From 159c8a315936f3bcd69b7a24fcf377a5887eba01 Mon Sep 17 00:00:00 2001 From: Chris Li Date: Wed, 16 Nov 2016 11:59:56 -0500 Subject: [PATCH] GlobalQueue --- Kiwix-iOS/Info.plist | 2 +- Kiwix-iOSWidgets/Bookmarks/Info.plist | 2 +- Kiwix/Operations/GlobalQueue.swift | 36 ++++++++++----------------- 3 files changed, 15 insertions(+), 25 deletions(-) diff --git a/Kiwix-iOS/Info.plist b/Kiwix-iOS/Info.plist index 9313f97a..b1c633c2 100644 --- a/Kiwix-iOS/Info.plist +++ b/Kiwix-iOS/Info.plist @@ -49,7 +49,7 @@ CFBundleVersion - 1.8.2902 + 1.8.2903 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/Kiwix-iOSWidgets/Bookmarks/Info.plist b/Kiwix-iOSWidgets/Bookmarks/Info.plist index d5bdc5c8..54e238f3 100644 --- a/Kiwix-iOSWidgets/Bookmarks/Info.plist +++ b/Kiwix-iOSWidgets/Bookmarks/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 1.8.2902 + 1.8.2903 NSExtension NSExtensionMainStoryboard diff --git a/Kiwix/Operations/GlobalQueue.swift b/Kiwix/Operations/GlobalQueue.swift index e559d48f..4dde71d8 100644 --- a/Kiwix/Operations/GlobalQueue.swift +++ b/Kiwix/Operations/GlobalQueue.swift @@ -29,28 +29,18 @@ class GlobalQueue: ProcedureQueue { add(operation: searchOperation) self.searchOperation = searchOperation } - - // Fix: use specific class type -// private weak var scanOperation: Procedure? -// private weak var searchOperation: Procedure? -// private weak var articleLoadOperation: ArticleLoadOperation? -// func add(scan operation: Procedure) { -// addOperation(operation) -// scanOperation = operation -// } -// -// -// func add(load operation: ArticleLoadOperation) { -// if let scanOperation = scanOperation { -// operation.addDependency(scanOperation) -// } -// -// if let articleLoadOperation = self.articleLoadOperation { -// operation.addDependency(articleLoadOperation) -// } -// -// addOperation(operation) -// articleLoadOperation = operation -// } + private weak var articleLoadOperation: ArticleLoadOperation? + func add(articleLoadOperation: ArticleLoadOperation) { + if let scanOperation = scanOperation { + articleLoadOperation.addDependency(scanOperation) + } + + if let articleLoadOperation = self.articleLoadOperation { + articleLoadOperation.addDependency(articleLoadOperation) + } + + add(operation: articleLoadOperation) + self.articleLoadOperation = articleLoadOperation + } }