mirror of
https://github.com/kiwix/kiwix-apple.git
synced 2025-09-25 21:05:09 -04:00
ScanLocalBookOperation thread fix
This commit is contained in:
parent
7775515fde
commit
9181d34c0f
@ -49,7 +49,7 @@
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.8.342</string>
|
||||
<string>1.8.361</string>
|
||||
<key>ITSAppUsesNonExemptEncryption</key>
|
||||
<false/>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
|
@ -21,7 +21,7 @@
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.8.345</string>
|
||||
<string>1.8.364</string>
|
||||
<key>NSExtension</key>
|
||||
<dict>
|
||||
<key>NSExtensionMainStoryboard</key>
|
||||
|
@ -81,6 +81,13 @@
|
||||
ReferencedContainer = "container:Kiwix.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<EnvironmentVariables>
|
||||
<EnvironmentVariable
|
||||
key = "OS_ACTIVITY_MODE"
|
||||
value = "disable"
|
||||
isEnabled = "YES">
|
||||
</EnvironmentVariable>
|
||||
</EnvironmentVariables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
|
@ -46,7 +46,10 @@ class ScanLocalBookOperation: Operation {
|
||||
}
|
||||
|
||||
updateReaders()
|
||||
updateCoreData()
|
||||
context.performBlockAndWait {self.updateCoreData()}
|
||||
|
||||
context.performBlockAndWait {self.context.saveIfNeeded()}
|
||||
NSManagedObjectContext.mainQueueContext.performBlockAndWait {NSManagedObjectContext.mainQueueContext.saveIfNeeded()}
|
||||
}
|
||||
|
||||
override func operationDidFinish(errors: [ErrorType]) {
|
||||
@ -71,6 +74,7 @@ class ScanLocalBookOperation: Operation {
|
||||
for id in removedZimFileIDs {
|
||||
guard let book = localBooks[id] else {continue}
|
||||
if let _ = book.meta4URL {
|
||||
print(book.isLocal)
|
||||
book.isLocal = false
|
||||
} else {
|
||||
context.deleteObject(book)
|
||||
@ -94,12 +98,9 @@ class ScanLocalBookOperation: Operation {
|
||||
book.hasIndex = reader.hasIndex()
|
||||
}
|
||||
|
||||
if localBooks.count == 0 && addedZimFileIDs.count == 1 {
|
||||
if localBooks.count == 0 && addedZimFileIDs.count >= 1 {
|
||||
firstBookAdded = true
|
||||
}
|
||||
|
||||
context.performBlockAndWait {self.context.saveIfNeeded()}
|
||||
NSManagedObjectContext.mainQueueContext.performBlockAndWait {NSManagedObjectContext.mainQueueContext.saveIfNeeded()}
|
||||
}
|
||||
|
||||
// MARK: - Helper
|
||||
|
Loading…
x
Reference in New Issue
Block a user