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