diff --git a/Kiwix-iOS/Assets.xcassets/Library/BookColor.imageset/Contents.json b/Kiwix-iOS/Assets.xcassets/Library/BookColor.imageset/Contents.json deleted file mode 100644 index 8c0ebca1..00000000 --- a/Kiwix-iOS/Assets.xcassets/Library/BookColor.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "open-book.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Kiwix-iOS/Assets.xcassets/Library/BookColor.imageset/open-book.png b/Kiwix-iOS/Assets.xcassets/Library/BookColor.imageset/open-book.png deleted file mode 100644 index 4e28e75f..00000000 Binary files a/Kiwix-iOS/Assets.xcassets/Library/BookColor.imageset/open-book.png and /dev/null differ diff --git a/Kiwix-iOS/Assets.xcassets/Library/Download/Download.imageset/Contents.json b/Kiwix-iOS/Assets.xcassets/Library/Cloud/Download.imageset/Contents.json similarity index 100% rename from Kiwix-iOS/Assets.xcassets/Library/Download/Download.imageset/Contents.json rename to Kiwix-iOS/Assets.xcassets/Library/Cloud/Download.imageset/Contents.json diff --git a/Kiwix-iOS/Assets.xcassets/Library/Download/Download.imageset/down-arrow.png b/Kiwix-iOS/Assets.xcassets/Library/Cloud/Download.imageset/down-arrow.png similarity index 100% rename from Kiwix-iOS/Assets.xcassets/Library/Download/Download.imageset/down-arrow.png rename to Kiwix-iOS/Assets.xcassets/Library/Cloud/Download.imageset/down-arrow.png diff --git a/Kiwix-iOS/Assets.xcassets/Library/Download/DownloadColor.imageset/Contents.json b/Kiwix-iOS/Assets.xcassets/Library/Cloud/DownloadColor.imageset/Contents.json similarity index 100% rename from Kiwix-iOS/Assets.xcassets/Library/Download/DownloadColor.imageset/Contents.json rename to Kiwix-iOS/Assets.xcassets/Library/Cloud/DownloadColor.imageset/Contents.json diff --git a/Kiwix-iOS/Assets.xcassets/Library/Download/DownloadColor.imageset/arrows.png b/Kiwix-iOS/Assets.xcassets/Library/Cloud/DownloadColor.imageset/arrows.png similarity index 100% rename from Kiwix-iOS/Assets.xcassets/Library/Download/DownloadColor.imageset/arrows.png rename to Kiwix-iOS/Assets.xcassets/Library/Cloud/DownloadColor.imageset/arrows.png diff --git a/Kiwix-iOS/Assets.xcassets/Library/Cloud/Refresh.imageset/Contents.json b/Kiwix-iOS/Assets.xcassets/Library/Cloud/Refresh.imageset/Contents.json deleted file mode 100644 index dfae5579..00000000 --- a/Kiwix-iOS/Assets.xcassets/Library/Cloud/Refresh.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "update23.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Kiwix-iOS/Assets.xcassets/Library/Cloud/Refresh.imageset/update23.png b/Kiwix-iOS/Assets.xcassets/Library/Cloud/Refresh.imageset/update23.png deleted file mode 100644 index dc7aaca8..00000000 Binary files a/Kiwix-iOS/Assets.xcassets/Library/Cloud/Refresh.imageset/update23.png and /dev/null differ diff --git a/Kiwix-iOS/Assets.xcassets/Library/Download/Contents.json b/Kiwix-iOS/Assets.xcassets/Library/Download/Contents.json deleted file mode 100644 index da4a164c..00000000 --- a/Kiwix-iOS/Assets.xcassets/Library/Download/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Kiwix-iOS/Assets.xcassets/Library/Download/DownloadFilled.imageset/Contents.json b/Kiwix-iOS/Assets.xcassets/Library/Download/DownloadFilled.imageset/Contents.json deleted file mode 100644 index 527e9ffd..00000000 --- a/Kiwix-iOS/Assets.xcassets/Library/Download/DownloadFilled.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "down-arrow-square-button2.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Kiwix-iOS/Assets.xcassets/Library/Download/DownloadFilled.imageset/down-arrow-square-button2.png b/Kiwix-iOS/Assets.xcassets/Library/Download/DownloadFilled.imageset/down-arrow-square-button2.png deleted file mode 100644 index ebc25c4c..00000000 Binary files a/Kiwix-iOS/Assets.xcassets/Library/Download/DownloadFilled.imageset/down-arrow-square-button2.png and /dev/null differ diff --git a/Kiwix-iOS/Controller/Library/LibraryBooksController.swift b/Kiwix-iOS/Controller/Library/LibraryBooksController.swift index a6f6d577..c395b4be 100644 --- a/Kiwix-iOS/Controller/Library/LibraryBooksController.swift +++ b/Kiwix-iOS/Controller/Library/LibraryBooksController.swift @@ -13,6 +13,13 @@ import DZNEmptyDataSet class LibraryBooksController: CoreDataCollectionBaseController, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout, LibraryCollectionCellDelegate { private(set) var itemWidth: CGFloat = 0.0 + var isCloudTab = true { + didSet { + title = isCloudTab ? Localized.Library.cloudTitle : Localized.Library.localTitle + tabBarItem.image = UIImage(named: isCloudTab ? "Cloud" : "Folder") + tabBarItem.selectedImage = UIImage(named: isCloudTab ? "CloudFilled" : "FolderFilled") + } + } @IBAction func dismissButtonTapped(_ sender: UIBarButtonItem) { dismiss(animated: true, completion: nil) @@ -25,9 +32,8 @@ class LibraryBooksController: CoreDataCollectionBaseController, UICollectionView override func viewDidLoad() { super.viewDidLoad() - title = Localized.Library.title - configureRefreshControl() + configureRefreshControl() if let layout = collectionView.collectionViewLayout as? UICollectionViewFlowLayout { layout.minimumInteritemSpacing = 1 layout.minimumLineSpacing = 1 @@ -182,7 +188,7 @@ class LibraryBooksController: CoreDataCollectionBaseController, UICollectionView var predicate: NSCompoundPredicate { let displayedLanguages = Language.fetch(displayed: true, context: managedObjectContext) return NSCompoundPredicate(andPredicateWithSubpredicates: [ - NSPredicate(format: "stateRaw == 0"), + NSPredicate(format: "stateRaw == 0 OR stateRaw == 1"), displayedLanguages.count > 0 ? NSPredicate(format: "language IN %@", displayedLanguages) : NSPredicate(format: "language.name != nil") ]) } @@ -197,7 +203,9 @@ class LibraryBooksController: CoreDataCollectionBaseController, UICollectionView extension Localized { class Library { - static let title = NSLocalizedString("Library", comment: "Library") + static let cloudTitle = NSLocalizedString("Cloud", comment: "Library, Cloud") + static let localTitle = NSLocalizedString("Local", comment: "Library, Local") + static let download = NSLocalizedString("Download", comment: "Library, more action sheet") static let copyURL = NSLocalizedString("Copy URL", comment: "Library, more action sheet") } diff --git a/Kiwix-iOS/Controller/Library/LibraryTabController.swift b/Kiwix-iOS/Controller/Library/LibraryTabController.swift new file mode 100644 index 00000000..1ba858d6 --- /dev/null +++ b/Kiwix-iOS/Controller/Library/LibraryTabController.swift @@ -0,0 +1,24 @@ +// +// LibraryTabController.swift +// Kiwix +// +// Created by Chris Li on 1/25/17. +// Copyright © 2017 Chris Li. All rights reserved. +// + +import UIKit + +class LibraryTabController: UITabBarController { + let cloud = UIStoryboard(name: "Library", bundle: nil).instantiateViewController(withIdentifier: "LibraryBookNavController") as! UINavigationController + let local = UIStoryboard(name: "Library", bundle: nil).instantiateViewController(withIdentifier: "LibraryBookNavController") as! UINavigationController + + override func viewDidLoad() { + super.viewDidLoad() + + (cloud.topViewController as! LibraryBooksController).isCloudTab = true + (local.topViewController as! LibraryBooksController).isCloudTab = false + + viewControllers = [cloud, local] + } + +} diff --git a/Kiwix-iOS/Storyboard/Library.storyboard b/Kiwix-iOS/Storyboard/Library.storyboard index d8fa86db..22893ad6 100644 --- a/Kiwix-iOS/Storyboard/Library.storyboard +++ b/Kiwix-iOS/Storyboard/Library.storyboard @@ -11,25 +11,6 @@ - - - - - - - - - - - - - - - - - - - @@ -200,28 +181,24 @@ - + - + - - - - - + - + @@ -237,25 +214,6 @@ - - - - - - - - - - - - - - - - - - - diff --git a/Kiwix.xcodeproj/project.pbxproj b/Kiwix.xcodeproj/project.pbxproj index 6730640f..69401177 100644 --- a/Kiwix.xcodeproj/project.pbxproj +++ b/Kiwix.xcodeproj/project.pbxproj @@ -97,6 +97,7 @@ 97BC0FC01DD90A65004BBAD1 /* MainController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97BC0FBE1DD90A65004BBAD1 /* MainController.swift */; }; 97BC0FC21DD92B62004BBAD1 /* Buttons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97BC0FC11DD92B62004BBAD1 /* Buttons.swift */; }; 97C2C26A1DDCC58500A9CC64 /* ArticleOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9764CBD21D8083AA00072D6A /* ArticleOperation.swift */; }; + 97C4A2E31E3926E50004CEB2 /* LibraryTabController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97C4A2E21E3926E50004CEB2 /* LibraryTabController.swift */; }; 97C601DC1D7F15C400362D4F /* Bookmark.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C601DB1D7F15C400362D4F /* Bookmark.storyboard */; }; 97C601DE1D7F342100362D4F /* HTMLHeading.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97C601DD1D7F342100362D4F /* HTMLHeading.swift */; }; 97D048AC1E32B7BE0028F9FD /* liblzma.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 9764F5921D830EF200E0B1C4 /* liblzma.tbd */; }; @@ -264,6 +265,7 @@ 97BC0FBD1DD90A65004BBAD1 /* JSInjection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JSInjection.swift; sourceTree = ""; }; 97BC0FBE1DD90A65004BBAD1 /* MainController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainController.swift; sourceTree = ""; }; 97BC0FC11DD92B62004BBAD1 /* Buttons.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Buttons.swift; sourceTree = ""; }; + 97C4A2E21E3926E50004CEB2 /* LibraryTabController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LibraryTabController.swift; sourceTree = ""; }; 97C601DB1D7F15C400362D4F /* Bookmark.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Bookmark.storyboard; sourceTree = ""; }; 97C601DD1D7F342100362D4F /* HTMLHeading.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HTMLHeading.swift; sourceTree = ""; }; 97D0E9921DDA487E0029530E /* SearchBaseController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchBaseController.swift; sourceTree = ""; }; @@ -723,6 +725,7 @@ 97C005D41D64B369004352E8 /* Library */ = { isa = PBXGroup; children = ( + 97C4A2E21E3926E50004CEB2 /* LibraryTabController.swift */, 9705D5951E368712005292AC /* LibraryBooksController.swift */, 9737F6201E379D0700961020 /* LibraryLanguageController.swift */, 97347BB91E39056A00F56EE6 /* LibraryDownloadController.swift */, @@ -1075,6 +1078,7 @@ 97A08C151DD263B90070D0E4 /* Book.swift in Sources */, 97D6813A1D6F711A00E5FA99 /* Language.swift in Sources */, 97BC0FBF1DD90A65004BBAD1 /* JSInjection.swift in Sources */, + 97C4A2E31E3926E50004CEB2 /* LibraryTabController.swift in Sources */, 97BC0FC01DD90A65004BBAD1 /* MainController.swift in Sources */, 97A1FD421D6F728200A80EE2 /* Extensions.swift in Sources */, 97A1FD3A1D6F724E00A80EE2 /* reader.cpp in Sources */,