mirror of
https://github.com/kiwix/kiwix-apple.git
synced 2025-10-02 16:46:30 -04:00
Coredata def modenerization
This commit is contained in:
parent
b53ab0363a
commit
0d4632913f
@ -156,8 +156,7 @@ class CloudBooksController: UITableViewController, NSFetchedResultsControllerDel
|
|||||||
self.managedObjectContext.performBlock({
|
self.managedObjectContext.performBlock({
|
||||||
let codes = NSLocale.preferredLangCodes
|
let codes = NSLocale.preferredLangCodes
|
||||||
Language.fetchAll(self.managedObjectContext).forEach({ (language) in
|
Language.fetchAll(self.managedObjectContext).forEach({ (language) in
|
||||||
guard let code = language.code else {return}
|
language.isDisplayed = codes.contains(language.code)
|
||||||
language.isDisplayed = codes.contains(code)
|
|
||||||
})
|
})
|
||||||
self.refreshFetchedResultController()
|
self.refreshFetchedResultController()
|
||||||
})
|
})
|
||||||
|
@ -112,8 +112,8 @@ class LanguageFilterController: UITableViewController, NSFetchedResultsControlle
|
|||||||
|
|
||||||
func sortByCountDesc(languages: [Language]) -> [Language] {
|
func sortByCountDesc(languages: [Language]) -> [Language] {
|
||||||
return languages.sort { (language0, language1) -> Bool in
|
return languages.sort { (language0, language1) -> Bool in
|
||||||
guard let count0 = language0.books?.count,
|
let count0 = language0.books.count
|
||||||
let count1 = language1.books?.count else {return false}
|
let count1 = language1.books.count
|
||||||
guard count0 != count1 else {
|
guard count0 != count1 else {
|
||||||
return alphabeticalAscCompare(language0: language0, language1: language1, byOriginalLocale: Preference.LangFilter.displayInOriginalLocale)
|
return alphabeticalAscCompare(language0: language0, language1: language1, byOriginalLocale: Preference.LangFilter.displayInOriginalLocale)
|
||||||
}
|
}
|
||||||
@ -159,7 +159,7 @@ class LanguageFilterController: UITableViewController, NSFetchedResultsControlle
|
|||||||
|
|
||||||
func configureCell(cell: UITableViewCell, atIndexPath indexPath: NSIndexPath, language: Language) {
|
func configureCell(cell: UITableViewCell, atIndexPath indexPath: NSIndexPath, language: Language) {
|
||||||
cell.textLabel?.text = Preference.LangFilter.displayInOriginalLocale ? language.nameInOriginalLocale : language.nameInCurrentLocale
|
cell.textLabel?.text = Preference.LangFilter.displayInOriginalLocale ? language.nameInOriginalLocale : language.nameInCurrentLocale
|
||||||
cell.detailTextLabel?.text = language.books?.count.description
|
cell.detailTextLabel?.text = language.books.count.description
|
||||||
}
|
}
|
||||||
|
|
||||||
override func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
|
override func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1.8.42</string>
|
<string>1.8.60</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.1</string>
|
<string>1.8.62</string>
|
||||||
<key>NSExtension</key>
|
<key>NSExtension</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>NSExtensionMainStoryboard</key>
|
<key>NSExtensionMainStoryboard</key>
|
||||||
|
@ -136,7 +136,6 @@
|
|||||||
97D6813F1D6F712800E5FA99 /* Article+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97D6813B1D6F712800E5FA99 /* Article+CoreDataProperties.swift */; };
|
97D6813F1D6F712800E5FA99 /* Article+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97D6813B1D6F712800E5FA99 /* Article+CoreDataProperties.swift */; };
|
||||||
97D681401D6F712800E5FA99 /* Book+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97D6813C1D6F712800E5FA99 /* Book+CoreDataProperties.swift */; };
|
97D681401D6F712800E5FA99 /* Book+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97D6813C1D6F712800E5FA99 /* Book+CoreDataProperties.swift */; };
|
||||||
97D681411D6F712800E5FA99 /* DownloadTask+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97D6813D1D6F712800E5FA99 /* DownloadTask+CoreDataProperties.swift */; };
|
97D681411D6F712800E5FA99 /* DownloadTask+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97D6813D1D6F712800E5FA99 /* DownloadTask+CoreDataProperties.swift */; };
|
||||||
97D681421D6F712800E5FA99 /* Language+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97D6813E1D6F712800E5FA99 /* Language+CoreDataProperties.swift */; };
|
|
||||||
97D681441D6F713200E5FA99 /* CoreDataExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97D681431D6F713200E5FA99 /* CoreDataExtension.swift */; };
|
97D681441D6F713200E5FA99 /* CoreDataExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97D681431D6F713200E5FA99 /* CoreDataExtension.swift */; };
|
||||||
97DB65DA1D4576B600A2CC42 /* BookmarkWidgetCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97DB65D91D4576B600A2CC42 /* BookmarkWidgetCell.swift */; };
|
97DB65DA1D4576B600A2CC42 /* BookmarkWidgetCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97DB65D91D4576B600A2CC42 /* BookmarkWidgetCell.swift */; };
|
||||||
97DF259C1D6F7613001648A3 /* BookOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97DF259B1D6F7612001648A3 /* BookOperation.swift */; };
|
97DF259C1D6F7613001648A3 /* BookOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97DF259B1D6F7612001648A3 /* BookOperation.swift */; };
|
||||||
@ -147,6 +146,7 @@
|
|||||||
97E850CB1D2DA5B300A9F688 /* About.html in Resources */ = {isa = PBXBuildFile; fileRef = 97E850CA1D2DA5B300A9F688 /* About.html */; };
|
97E850CB1D2DA5B300A9F688 /* About.html in Resources */ = {isa = PBXBuildFile; fileRef = 97E850CA1D2DA5B300A9F688 /* About.html */; };
|
||||||
97F03CE21D2440470040D26E /* Search.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97F03CE11D2440470040D26E /* Search.storyboard */; };
|
97F03CE21D2440470040D26E /* Search.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97F03CE11D2440470040D26E /* Search.storyboard */; };
|
||||||
97FD5CE71D3D90B7001C74A2 /* getSnippet.js in Resources */ = {isa = PBXBuildFile; fileRef = 97FD5CE61D3D90B7001C74A2 /* getSnippet.js */; };
|
97FD5CE71D3D90B7001C74A2 /* getSnippet.js in Resources */ = {isa = PBXBuildFile; fileRef = 97FD5CE61D3D90B7001C74A2 /* getSnippet.js */; };
|
||||||
|
97FDACC41D85A3B300DEDACB /* Language+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97D6813E1D6F712800E5FA99 /* Language+CoreDataProperties.swift */; };
|
||||||
EB1C0984A03359CD5CDC011C /* Pods_Kiwix_OSX.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 198ECFA618CDD6B29CD462A0 /* Pods_Kiwix_OSX.framework */; };
|
EB1C0984A03359CD5CDC011C /* Pods_Kiwix_OSX.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 198ECFA618CDD6B29CD462A0 /* Pods_Kiwix_OSX.framework */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
@ -1092,6 +1092,7 @@
|
|||||||
isa = PBXNativeTarget;
|
isa = PBXNativeTarget;
|
||||||
buildConfigurationList = 9779C31F1D4575AE0064CC8E /* Build configuration list for PBXNativeTarget "Bookmarks" */;
|
buildConfigurationList = 9779C31F1D4575AE0064CC8E /* Build configuration list for PBXNativeTarget "Bookmarks" */;
|
||||||
buildPhases = (
|
buildPhases = (
|
||||||
|
97FDACC31D859C3500DEDACB /* ShellScript */,
|
||||||
9779C30F1D4575AD0064CC8E /* Sources */,
|
9779C30F1D4575AD0064CC8E /* Sources */,
|
||||||
9779C3101D4575AD0064CC8E /* Frameworks */,
|
9779C3101D4575AD0064CC8E /* Frameworks */,
|
||||||
9779C3111D4575AD0064CC8E /* Resources */,
|
9779C3111D4575AD0064CC8E /* Resources */,
|
||||||
@ -1110,10 +1111,10 @@
|
|||||||
buildConfigurationList = 97A2ABB31C1B810000052E74 /* Build configuration list for PBXNativeTarget "Kiwix-iOS" */;
|
buildConfigurationList = 97A2ABB31C1B810000052E74 /* Build configuration list for PBXNativeTarget "Kiwix-iOS" */;
|
||||||
buildPhases = (
|
buildPhases = (
|
||||||
CDD21917A84F651D4CEFF569 /* [CP] Check Pods Manifest.lock */,
|
CDD21917A84F651D4CEFF569 /* [CP] Check Pods Manifest.lock */,
|
||||||
|
97A4D7E21CF8C318006C731E /* ShellScript */,
|
||||||
97A2AB841C1B80FF00052E74 /* Sources */,
|
97A2AB841C1B80FF00052E74 /* Sources */,
|
||||||
97A2AB851C1B80FF00052E74 /* Frameworks */,
|
97A2AB851C1B80FF00052E74 /* Frameworks */,
|
||||||
97A2AB861C1B80FF00052E74 /* Resources */,
|
97A2AB861C1B80FF00052E74 /* Resources */,
|
||||||
97A4D7E21CF8C318006C731E /* ShellScript */,
|
|
||||||
97E609FF1D103DED00EBCB9D /* Embed App Extensions */,
|
97E609FF1D103DED00EBCB9D /* Embed App Extensions */,
|
||||||
7D32C417880EE3A4FFF4017C /* [CP] Embed Pods Frameworks */,
|
7D32C417880EE3A4FFF4017C /* [CP] Embed Pods Frameworks */,
|
||||||
20E4CC4E024923B9E858CC06 /* [CP] Copy Pods Resources */,
|
20E4CC4E024923B9E858CC06 /* [CP] Copy Pods Resources */,
|
||||||
@ -1394,6 +1395,19 @@
|
|||||||
shellPath = /bin/sh;
|
shellPath = /bin/sh;
|
||||||
shellScript = "#!/bin/bash\nbuildNumber=$(/usr/libexec/PlistBuddy -c \"Print CFBundleVersion\" \"$INFOPLIST_FILE\")\nbuildNumber=$(($buildNumber + 1))\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"$INFOPLIST_FILE\"";
|
shellScript = "#!/bin/bash\nbuildNumber=$(/usr/libexec/PlistBuddy -c \"Print CFBundleVersion\" \"$INFOPLIST_FILE\")\nbuildNumber=$(($buildNumber + 1))\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"$INFOPLIST_FILE\"";
|
||||||
};
|
};
|
||||||
|
97FDACC31D859C3500DEDACB /* ShellScript */ = {
|
||||||
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
inputPaths = (
|
||||||
|
);
|
||||||
|
outputPaths = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
shellPath = /bin/sh;
|
||||||
|
shellScript = "#!/bin/bash\nbuildNumString=$(/usr/libexec/PlistBuddy -c \"Print CFBundleVersion\" \"$INFOPLIST_FILE\")\nversionNumber=$(/usr/libexec/PlistBuddy -c \"Print CFBundleShortVersionString\" \"$INFOPLIST_FILE\")\nIFS='.'; arr=($buildNumString)\nlastIndex=$((${#arr[@]} - 1))\nbuildNumber=$((${arr[lastIndex]} + 1))\nbuildNumString=\"${arr[0]}.${arr[1]}.$buildNumber\"\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumString\" \"$INFOPLIST_FILE\"";
|
||||||
|
};
|
||||||
99B6C5B82907BC9766F6107C /* [CP] Check Pods Manifest.lock */ = {
|
99B6C5B82907BC9766F6107C /* [CP] Check Pods Manifest.lock */ = {
|
||||||
isa = PBXShellScriptBuildPhase;
|
isa = PBXShellScriptBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
@ -1498,6 +1512,7 @@
|
|||||||
97A1FD391D6F724E00A80EE2 /* pathTools.cpp in Sources */,
|
97A1FD391D6F724E00A80EE2 /* pathTools.cpp in Sources */,
|
||||||
970E68B61D37E224001E8514 /* SettingSearchHistoryTBVC.swift in Sources */,
|
970E68B61D37E224001E8514 /* SettingSearchHistoryTBVC.swift in Sources */,
|
||||||
97C005D81D64B99E004352E8 /* LibrarySplitViewController.swift in Sources */,
|
97C005D81D64B99E004352E8 /* LibrarySplitViewController.swift in Sources */,
|
||||||
|
97FDACC41D85A3B300DEDACB /* Language+CoreDataProperties.swift in Sources */,
|
||||||
97A7017F1D2C59CA00AAE2D8 /* GetStartedController.swift in Sources */,
|
97A7017F1D2C59CA00AAE2D8 /* GetStartedController.swift in Sources */,
|
||||||
97A8AD871D6CF38000584ED1 /* EmptyTableConfigExtension.swift in Sources */,
|
97A8AD871D6CF38000584ED1 /* EmptyTableConfigExtension.swift in Sources */,
|
||||||
971A102E1D022AD5007FC62C /* TableViewCells.swift in Sources */,
|
971A102E1D022AD5007FC62C /* TableViewCells.swift in Sources */,
|
||||||
@ -1515,7 +1530,6 @@
|
|||||||
97D681381D6F711A00E5FA99 /* Book.swift in Sources */,
|
97D681381D6F711A00E5FA99 /* Book.swift in Sources */,
|
||||||
970E68B21D37E1DD001E8514 /* SettingSearchTuneController.swift in Sources */,
|
970E68B21D37E1DD001E8514 /* SettingSearchTuneController.swift in Sources */,
|
||||||
97C005DC1D64BEFE004352E8 /* CloudBooksController.swift in Sources */,
|
97C005DC1D64BEFE004352E8 /* CloudBooksController.swift in Sources */,
|
||||||
97D681421D6F712800E5FA99 /* Language+CoreDataProperties.swift in Sources */,
|
|
||||||
97D681371D6F711A00E5FA99 /* Article.swift in Sources */,
|
97D681371D6F711A00E5FA99 /* Article.swift in Sources */,
|
||||||
97D681231D6F70AC00E5FA99 /* GlobalQueue.swift in Sources */,
|
97D681231D6F70AC00E5FA99 /* GlobalQueue.swift in Sources */,
|
||||||
97A1FD3B1D6F724E00A80EE2 /* stringTools.cpp in Sources */,
|
97A1FD3B1D6F724E00A80EE2 /* stringTools.cpp in Sources */,
|
||||||
|
@ -14,9 +14,9 @@ import CoreData
|
|||||||
|
|
||||||
extension Language {
|
extension Language {
|
||||||
|
|
||||||
@NSManaged var code: String?
|
@NSManaged var code: String
|
||||||
@NSManaged var isDisplayed: NSNumber?
|
@NSManaged var isDisplayed: Bool
|
||||||
@NSManaged var name: String?
|
@NSManaged var name: String?
|
||||||
@NSManaged var books: NSSet?
|
@NSManaged var books: Set<Book>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -45,12 +45,10 @@ class Language: NSManagedObject {
|
|||||||
// MARK: - Computed Properties
|
// MARK: - Computed Properties
|
||||||
|
|
||||||
var nameInCurrentLocale: String? {
|
var nameInCurrentLocale: String? {
|
||||||
guard let code = code else {return nil}
|
|
||||||
return NSLocale.currentLocale().displayNameForKey(NSLocaleIdentifier, value: code)
|
return NSLocale.currentLocale().displayNameForKey(NSLocaleIdentifier, value: code)
|
||||||
}
|
}
|
||||||
|
|
||||||
var nameInOriginalLocale: String? {
|
var nameInOriginalLocale: String? {
|
||||||
guard let code = code else {return nil}
|
|
||||||
return NSLocale(localeIdentifier: code).displayNameForKey(NSLocaleIdentifier, value: code)
|
return NSLocale(localeIdentifier: code).displayNameForKey(NSLocaleIdentifier, value: code)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?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="11232" systemVersion="16A319" minimumToolsVersion="Xcode 7.3" sourceLanguage="Objective-C" userDefinedModelVersionIdentifier="1.8">
|
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="11232" systemVersion="16A319" minimumToolsVersion="Xcode 7.3" sourceLanguage="Swift" userDefinedModelVersionIdentifier="1.8">
|
||||||
<entity name="Article" representedClassName=".Article" syncable="YES">
|
<entity name="Article" representedClassName=".Article" syncable="YES">
|
||||||
<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"/>
|
||||||
@ -112,7 +112,7 @@
|
|||||||
<element name="Book" positionX="-947" positionY="-142" width="128" height="358"/>
|
<element name="Book" positionX="-947" positionY="-142" width="128" height="358"/>
|
||||||
<element name="DownloadTask" positionX="-657" positionY="273" width="128" height="105"/>
|
<element name="DownloadTask" positionX="-657" positionY="273" width="128" height="105"/>
|
||||||
<element name="Language" positionX="-938" positionY="288" width="128" height="103"/>
|
<element name="Language" positionX="-938" positionY="288" width="128" height="103"/>
|
||||||
<element name="Tag" positionX="-425" positionY="-18" width="128" height="73"/>
|
|
||||||
<element name="Response" positionX="-657" positionY="72" width="128" height="118"/>
|
<element name="Response" positionX="-657" positionY="72" width="128" height="118"/>
|
||||||
|
<element name="Tag" positionX="-425" positionY="-18" width="128" height="73"/>
|
||||||
</elements>
|
</elements>
|
||||||
</model>
|
</model>
|
Loading…
x
Reference in New Issue
Block a user