mirror of
https://github.com/kiwix/kiwix-apple.git
synced 2025-09-27 05:49:25 -04:00
commit
This commit is contained in:
parent
59f6ddf88c
commit
4f8c74c810
@ -49,7 +49,7 @@
|
|||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1.8.2196</string>
|
<string>1.8.2207</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.2196</string>
|
<string>1.8.2207</string>
|
||||||
<key>NSExtension</key>
|
<key>NSExtension</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>NSExtensionMainStoryboard</key>
|
<key>NSExtensionMainStoryboard</key>
|
||||||
|
@ -33,21 +33,5 @@
|
|||||||
endingLineNumber = "37">
|
endingLineNumber = "37">
|
||||||
</BreakpointContent>
|
</BreakpointContent>
|
||||||
</BreakpointProxy>
|
</BreakpointProxy>
|
||||||
<BreakpointProxy
|
|
||||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
|
||||||
<BreakpointContent
|
|
||||||
shouldBeEnabled = "Yes"
|
|
||||||
ignoreCount = "0"
|
|
||||||
continueAfterRunningActions = "No"
|
|
||||||
filePath = "Kiwix/CoreData/CoreDataContainer.swift"
|
|
||||||
timestampString = "500310814.395924"
|
|
||||||
startingColumnNumber = "9223372036854775807"
|
|
||||||
endingColumnNumber = "9223372036854775807"
|
|
||||||
startingLineNumber = "14"
|
|
||||||
endingLineNumber = "14"
|
|
||||||
landmarkName = "init()"
|
|
||||||
landmarkType = "7">
|
|
||||||
</BreakpointContent>
|
|
||||||
</BreakpointProxy>
|
|
||||||
</Breakpoints>
|
</Breakpoints>
|
||||||
</Bucket>
|
</Bucket>
|
||||||
|
@ -86,7 +86,7 @@ class Book: NSManagedObject {
|
|||||||
// MARK: - Fetch
|
// MARK: - Fetch
|
||||||
|
|
||||||
class func fetchAll(in context: NSManagedObjectContext) -> [Book] {
|
class func fetchAll(in context: NSManagedObjectContext) -> [Book] {
|
||||||
let request: NSFetchRequest<Book> = Book.fetchRequest() as! NSFetchRequest<Book>
|
let request: NSFetchRequest<Book> = NSFetchRequest<Book>(entityName: "Book")
|
||||||
return (try? context.fetch(request)) ?? [Book]()
|
return (try? context.fetch(request)) ?? [Book]()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="11756" systemVersion="16B2555" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="1.8">
|
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="11756" systemVersion="16B2555" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="1.8">
|
||||||
<entity name="Article" representedClassName="Article">
|
<entity name="Article" representedClassName=".Article">
|
||||||
<attribute name="bookmarkDate" optional="YES" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
|
<attribute name="bookmarkDate" optional="YES" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
|
||||||
<attribute name="isBookmarked" optional="YES" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/>
|
<attribute name="isBookmarked" optional="YES" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/>
|
||||||
<attribute name="isMainPage" optional="YES" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/>
|
<attribute name="isMainPage" optional="YES" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/>
|
||||||
@ -15,7 +15,7 @@
|
|||||||
<relationship name="tags" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Tag" inverseName="articles" inverseEntity="Tag" syncable="YES"/>
|
<relationship name="tags" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Tag" inverseName="articles" inverseEntity="Tag" syncable="YES"/>
|
||||||
<userInfo/>
|
<userInfo/>
|
||||||
</entity>
|
</entity>
|
||||||
<entity name="Book" representedClassName="Book">
|
<entity name="Book" representedClassName=".Book">
|
||||||
<attribute name="articleCount" optional="YES" attributeType="Integer 64" minValueString="0" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
|
<attribute name="articleCount" optional="YES" attributeType="Integer 64" minValueString="0" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
|
||||||
<attribute name="creator" optional="YES" attributeType="String" syncable="YES"/>
|
<attribute name="creator" optional="YES" attributeType="String" syncable="YES"/>
|
||||||
<attribute name="date" optional="YES" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
|
<attribute name="date" optional="YES" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
|
||||||
@ -50,7 +50,7 @@
|
|||||||
</uniquenessConstraints>
|
</uniquenessConstraints>
|
||||||
<userInfo/>
|
<userInfo/>
|
||||||
</entity>
|
</entity>
|
||||||
<entity name="DownloadTask" representedClassName="DownloadTask" syncable="YES">
|
<entity name="DownloadTask" representedClassName=".DownloadTask" syncable="YES">
|
||||||
<attribute name="creationTime" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
|
<attribute name="creationTime" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
|
||||||
<attribute name="stateRaw" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
|
<attribute name="stateRaw" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
|
||||||
<attribute name="totalBytesWritten" optional="YES" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
|
<attribute name="totalBytesWritten" optional="YES" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
|
||||||
@ -61,7 +61,7 @@
|
|||||||
</uniquenessConstraint>
|
</uniquenessConstraint>
|
||||||
</uniquenessConstraints>
|
</uniquenessConstraints>
|
||||||
</entity>
|
</entity>
|
||||||
<entity name="Language" representedClassName="Language" syncable="YES">
|
<entity name="Language" representedClassName=".Language" syncable="YES">
|
||||||
<attribute name="code" attributeType="String" syncable="YES"/>
|
<attribute name="code" attributeType="String" syncable="YES"/>
|
||||||
<attribute name="isDisplayed" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/>
|
<attribute name="isDisplayed" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/>
|
||||||
<attribute name="name" optional="YES" attributeType="String" syncable="YES"/>
|
<attribute name="name" optional="YES" attributeType="String" syncable="YES"/>
|
||||||
@ -77,7 +77,7 @@
|
|||||||
</uniquenessConstraint>
|
</uniquenessConstraint>
|
||||||
</uniquenessConstraints>
|
</uniquenessConstraints>
|
||||||
</entity>
|
</entity>
|
||||||
<entity name="Tag" representedClassName="Tag" syncable="YES">
|
<entity name="Tag" representedClassName=".Tag" syncable="YES">
|
||||||
<attribute name="name" optional="YES" attributeType="String" syncable="YES"/>
|
<attribute name="name" optional="YES" attributeType="String" syncable="YES"/>
|
||||||
<relationship name="articles" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Article" inverseName="tags" inverseEntity="Article" syncable="YES"/>
|
<relationship name="articles" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Article" inverseName="tags" inverseEntity="Article" syncable="YES"/>
|
||||||
</entity>
|
</entity>
|
||||||
|
@ -21,7 +21,6 @@ class RefreshLibraryOperation: GroupProcedure {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fileprivate class Retrieve: NetworkDataProcedure<URLSession> {
|
fileprivate class Retrieve: NetworkDataProcedure<URLSession> {
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
let session = URLSession.shared
|
let session = URLSession.shared
|
||||||
let url = URL(string: "https://download.kiwix.org/library/library.xml")!
|
let url = URL(string: "https://download.kiwix.org/library/library.xml")!
|
||||||
@ -59,6 +58,16 @@ fileprivate class Process: Procedure, ResultInjection, XMLParserDelegate {
|
|||||||
parser.delegate = self
|
parser.delegate = self
|
||||||
parser.parse()
|
parser.parse()
|
||||||
|
|
||||||
|
let toBeDeleted = storeBookIDs.subtracting(memoryBookIDs)
|
||||||
|
hasUpdate = toBeDeleted.count > 0
|
||||||
|
context.performAndWait {
|
||||||
|
toBeDeleted.forEach({ (id) in
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
print("\(memoryBookIDs.count)")
|
||||||
|
|
||||||
|
if context.hasChanges { try? context.save() }
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,13 +80,6 @@ fileprivate class Process: Procedure, ResultInjection, XMLParserDelegate {
|
|||||||
_ = Book.add(meta: attributeDict, in: self.context)
|
_ = Book.add(meta: attributeDict, in: self.context)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
memoryBookIDs.insert(id)
|
||||||
|
|
||||||
func parserDidEndDocument(_ parser: XMLParser) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func parser(_ parser: XMLParser, parseErrorOccurred parseError: Error) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user