From 6dc2ae01c899c7016372cc3977ca953a88f74a80 Mon Sep 17 00:00:00 2001 From: Chris Li Date: Sat, 1 Oct 2016 14:06:05 -0400 Subject: [PATCH] Setting --- Kiwix-iOS/Controller/AdjustLayoutTBVC.swift | 62 --- .../Controller/LibraryAutoRefreshTBVC.swift | 138 ------ Kiwix-iOS/Controller/LibraryBackupTBVC.swift | 54 --- .../LibraryUseCellularDataTBVC.swift | 69 --- Kiwix-iOS/Controller/Main/JSInjection.swift | 5 +- .../Controller/Main/MainController.swift | 17 +- .../Main/MainControllerDelegates.swift | 1 + .../Controller/{ => Others}/Alerts.swift | 0 .../{ => Others}/ControllerRetainer.swift | 0 .../FontSizeController.swift} | 4 +- .../SettingController.swift} | 104 ++-- .../Setting/SettingDetailController.swift | 98 ++++ .../Setting/SettingSearchTuneController.swift | 129 ----- .../Setting/SettingSingleSwitchTBVC.swift | 42 -- .../Setting/SettingWidgetBookmarksTBVC.swift | 71 --- .../{ => Setting}/WebViewController.swift | 0 Kiwix-iOS/Info.plist | 2 +- Kiwix-iOS/Storyboard/Setting.storyboard | 452 +++--------------- Kiwix-iOSWidgets/Bookmarks/Info.plist | 2 +- Kiwix.xcodeproj/project.pbxproj | 136 ++---- Kiwix/Tools/StringTools.swift | 2 + Kiwix/ZimMultiReader/SearchResult.swift | 13 + 22 files changed, 248 insertions(+), 1153 deletions(-) delete mode 100644 Kiwix-iOS/Controller/AdjustLayoutTBVC.swift delete mode 100644 Kiwix-iOS/Controller/LibraryAutoRefreshTBVC.swift delete mode 100644 Kiwix-iOS/Controller/LibraryBackupTBVC.swift delete mode 100644 Kiwix-iOS/Controller/LibraryUseCellularDataTBVC.swift rename Kiwix-iOS/Controller/{ => Others}/Alerts.swift (100%) rename Kiwix-iOS/Controller/{ => Others}/ControllerRetainer.swift (100%) rename Kiwix-iOS/Controller/{FontSizeTBVC.swift => Setting/FontSizeController.swift} (94%) rename Kiwix-iOS/Controller/{SettingTBVC.swift => Setting/SettingController.swift} (55%) create mode 100644 Kiwix-iOS/Controller/Setting/SettingDetailController.swift delete mode 100644 Kiwix-iOS/Controller/Setting/SettingSearchTuneController.swift delete mode 100644 Kiwix-iOS/Controller/Setting/SettingSingleSwitchTBVC.swift delete mode 100644 Kiwix-iOS/Controller/Setting/SettingWidgetBookmarksTBVC.swift rename Kiwix-iOS/Controller/{ => Setting}/WebViewController.swift (100%) diff --git a/Kiwix-iOS/Controller/AdjustLayoutTBVC.swift b/Kiwix-iOS/Controller/AdjustLayoutTBVC.swift deleted file mode 100644 index c88350d2..00000000 --- a/Kiwix-iOS/Controller/AdjustLayoutTBVC.swift +++ /dev/null @@ -1,62 +0,0 @@ -// -// AdjustLayoutTBVC.swift -// Kiwix -// -// Created by Chris on 1/10/16. -// Copyright © 2016 Chris. All rights reserved. -// - -import UIKit - -class AdjustLayoutTBVC: UITableViewController { - - var adjustPageLayout = Preference.webViewInjectJavascriptToAdjustPageLayout - let adjustPageLayoutSwitch = UISwitch() - - override func viewDidLoad() { - super.viewDidLoad() - title = LocalizedStrings.adjustLayout - adjustPageLayoutSwitch.addTarget(self, action: #selector(AdjustLayoutTBVC.switcherValueChanged(_:)), forControlEvents: .ValueChanged) - adjustPageLayoutSwitch.on = adjustPageLayout - } - - override func viewWillDisappear(animated: Bool) { - super.viewWillDisappear(animated) - Preference.webViewInjectJavascriptToAdjustPageLayout = adjustPageLayout - } - - // MARK: - Table view data source - - override func numberOfSectionsInTableView(tableView: UITableView) -> Int { - return 1 - } - - override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return 1 - } - - override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { - let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) - cell.textLabel?.text = LocalizedStrings.adjustLayout - cell.accessoryView = adjustPageLayoutSwitch - return cell - } - - override func tableView(tableView: UITableView, titleForFooterInSection section: Int) -> String? { - return LocalizedStrings.adjustPageLayoutMessage - } - - // MARK: - Actions - - func switcherValueChanged(switcher: UISwitch) { - if switcher == adjustPageLayoutSwitch { - adjustPageLayout = switcher.on - } - } - -} - -extension LocalizedStrings { - class var adjustPageLayout: String {return NSLocalizedString("Adjust Page Layout (Beta)", comment: "Setting: Reading Optimization")} - class var adjustPageLayoutMessage: String {return NSLocalizedString("When turned on, Kiwix will try its best to adjust the page layout for your device.", comment: "Setting: Reading Optimization")} -} diff --git a/Kiwix-iOS/Controller/LibraryAutoRefreshTBVC.swift b/Kiwix-iOS/Controller/LibraryAutoRefreshTBVC.swift deleted file mode 100644 index c7c71cc0..00000000 --- a/Kiwix-iOS/Controller/LibraryAutoRefreshTBVC.swift +++ /dev/null @@ -1,138 +0,0 @@ -// -// LibraryAutoRefreshTBVC.swift -// Kiwix -// -// Created by Chris Li on 8/15/15. -// Copyright © 2015 Chris Li. All rights reserved. -// - -import UIKit - -class LibraryAutoRefreshTBVC: UITableViewController { - let sectionHeader = ["day", "week", "month"] - let sectionHeaderLocalized = [LocalizedStrings.day, LocalizedStrings.week, LocalizedStrings.month] - let enableAutoRefreshSwitch = UISwitch() - var checkedRowIndexPath: NSIndexPath? - var libraryAutoRefreshDisabled = Preference.libraryAutoRefreshDisabled - var libraryRefreshInterval = Preference.libraryRefreshInterval - let timeIntervals: [String: [Double]] = { - let hour = 3600.0 - let day = 24.0 * hour - let week = 7.0 * day - - let timeIntervals = ["day": [day, 3*day, 5*day], "week": [week, 2*week, 4*week]] - return timeIntervals - }() - - let dateComponentsFormatter: NSDateComponentsFormatter = { - let formatter = NSDateComponentsFormatter() - formatter.unitsStyle = NSDateComponentsFormatterUnitsStyle.Full - formatter.maximumUnitCount = 1 - return formatter - }() - - override func viewDidLoad() { - super.viewDidLoad() - title = LocalizedStrings.libraryAutoRefresh - enableAutoRefreshSwitch.addTarget(self, action: #selector(LibraryAutoRefreshTBVC.switcherValueChanged(_:)), forControlEvents: .ValueChanged) - enableAutoRefreshSwitch.on = !libraryAutoRefreshDisabled - } - - override func viewWillDisappear(animated: Bool) { - super.viewWillDisappear(animated) - Preference.libraryAutoRefreshDisabled = libraryAutoRefreshDisabled - Preference.libraryRefreshInterval = libraryRefreshInterval - } - - // MARK: - Table view data source - - override func numberOfSectionsInTableView(tableView: UITableView) -> Int { - if libraryAutoRefreshDisabled { - return 1 - } else { - return timeIntervals.keys.count + 1 - } - } - - override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - if section == 0 { - return 1 - } else { - let sectionHeader = self.sectionHeader[section-1] - return timeIntervals[sectionHeader]!.count - } - } - - override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { - let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) - if indexPath.section == 0 { - cell.textLabel?.text = LocalizedStrings.enableAutoRefresh - cell.accessoryView = enableAutoRefreshSwitch - } else { - let sectionHeader = self.sectionHeader[indexPath.section-1] - let interval = timeIntervals[sectionHeader]![indexPath.row] - cell.textLabel?.text = dateComponentsFormatter.stringFromTimeInterval(interval) - if interval == libraryRefreshInterval { - cell.accessoryType = .Checkmark - checkedRowIndexPath = indexPath - } else { - cell.accessoryType = .None - } - cell.accessoryView = nil - } - return cell - } - - override func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? { - if section == 0 { - return LocalizedStrings.autoRefreshHelpMessage - } else { - return sectionHeaderLocalized[section-1] - } - } - - // MARK: - Table view delegate - - override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { - if indexPath.section >= 1 { - if let checkedRowIndexPath = checkedRowIndexPath, let cell = tableView.cellForRowAtIndexPath(checkedRowIndexPath) { - cell.accessoryType = .None - } - - if let cell = tableView.cellForRowAtIndexPath(indexPath) { - cell.accessoryType = .Checkmark - } - - checkedRowIndexPath = indexPath - let sectionHeader = self.sectionHeader[indexPath.section-1] - libraryRefreshInterval = timeIntervals[sectionHeader]![indexPath.row] - } - } - - override func tableView(tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) { - if section == 0 { - if let view = view as? UITableViewHeaderFooterView { - view.textLabel?.text = LocalizedStrings.autoRefreshHelpMessage - } - } - } - - // MARK: - Action - - func switcherValueChanged(switcher: UISwitch) { - libraryAutoRefreshDisabled = !switcher.on - if libraryAutoRefreshDisabled { - tableView.deleteSections(NSIndexSet(indexesInRange: NSMakeRange(1, sectionHeader.count-1)), withRowAnimation: UITableViewRowAnimation.Fade) - } else { - tableView.insertSections(NSIndexSet(indexesInRange: NSMakeRange(1, sectionHeader.count-1)), withRowAnimation: .Fade) - } - } -} - -extension LocalizedStrings { - class var day: String {return NSLocalizedString("day", comment: "Setting: Library Auto Refresh Page section title")} - class var week: String {return NSLocalizedString("week", comment: "Setting: Library Auto Refresh Page section title")} - class var month: String {return NSLocalizedString("month", comment: "Setting: Library Auto Refresh Page section title")} - class var enableAutoRefresh: String {return NSLocalizedString("Enable Auto Refresh", comment: "Setting: Library Auto Refresh Page")} - class var autoRefreshHelpMessage: String {return NSLocalizedString("When enabled, your library will refresh automatically according to the selected interval when you open the app.", comment: "Setting: Library Auto Refresh Page")} -} \ No newline at end of file diff --git a/Kiwix-iOS/Controller/LibraryBackupTBVC.swift b/Kiwix-iOS/Controller/LibraryBackupTBVC.swift deleted file mode 100644 index a5cd5a46..00000000 --- a/Kiwix-iOS/Controller/LibraryBackupTBVC.swift +++ /dev/null @@ -1,54 +0,0 @@ -// -// LibraryBackupTBVC.swift -// Kiwix -// -// Created by Chris Li on 6/14/16. -// Copyright © 2016 Chris. All rights reserved. -// - -import UIKit - -class LibraryBackupTBVC: UITableViewController { - - let toggle = UISwitch() - - override func viewDidLoad() { - super.viewDidLoad() - title = NSLocalizedString("Backup", comment: "Setting: Backup local files title") - toggle.addTarget(self, action: #selector(LibraryBackupTBVC.switcherValueChanged(_:)), forControlEvents: .ValueChanged) - toggle.on = !(NSFileManager.getSkipBackupAttribute(item: NSFileManager.docDirURL) ?? false) - } - - // MARK: - Table view data source - - override func numberOfSectionsInTableView(tableView: UITableView) -> Int { - return 1 - } - - override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return 1 - } - - override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { - let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) - - cell.textLabel?.text = LocalizedStrings.libraryBackup - cell.accessoryView = toggle - - return cell - } - - override func tableView(tableView: UITableView, titleForFooterInSection section: Int) -> String? { - return NSLocalizedString("When turned off, iOS will not backup zim files and index folders to iCloud or iTunes.", - comment: "Setting: Backup local files comment") + "\n\n" + - NSLocalizedString("Note: Large zim file collection can take up a lot of space in backup. You may want to turn this off if you use iCloud for backup.", comment: "Setting: Backup local files comment") - } - - // MARK: - Actions - - func switcherValueChanged(switcher: UISwitch) { - guard switcher == toggle else {return} - NSFileManager.setSkipBackupAttribute(!switcher.on, url: NSFileManager.docDirURL) - } - -} diff --git a/Kiwix-iOS/Controller/LibraryUseCellularDataTBVC.swift b/Kiwix-iOS/Controller/LibraryUseCellularDataTBVC.swift deleted file mode 100644 index 67ca7196..00000000 --- a/Kiwix-iOS/Controller/LibraryUseCellularDataTBVC.swift +++ /dev/null @@ -1,69 +0,0 @@ -// -// LibraryUseCellularDataTBVC.swift -// Kiwix -// -// Created by Chris Li on 8/24/15. -// Copyright © 2015 Chris Li. All rights reserved. -// - -import UIKit - -class LibraryUseCellularDataTBVC: UITableViewController { - - var libraryRefreshAllowCellularData = Preference.libraryRefreshAllowCellularData - let libraryrefreshAllowCellularDataSwitch = UISwitch() - - override func viewDidLoad() { - super.viewDidLoad() - title = LocalizedStrings.libraryUseCellularData - libraryrefreshAllowCellularDataSwitch.addTarget(self, action: #selector(LibraryUseCellularDataTBVC.switcherValueChanged(_:)), forControlEvents: .ValueChanged) - libraryrefreshAllowCellularDataSwitch.on = libraryRefreshAllowCellularData - } - - override func viewWillDisappear(animated: Bool) { - super.viewWillDisappear(animated) - Preference.libraryRefreshAllowCellularData = libraryRefreshAllowCellularData - } - - // MARK: - Table view data source - - override func numberOfSectionsInTableView(tableView: UITableView) -> Int { - return 1 - } - - override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return 1 - } - - override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { - let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) - - cell.textLabel?.text = LocalizedStrings.libraryUseCellularData - cell.accessoryView = libraryrefreshAllowCellularDataSwitch - - return cell - } - - override func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? { - return "Refresh Library" - } - - override func tableView(tableView: UITableView, titleForFooterInSection section: Int) -> String? { - return LocalizedStrings.cellularLibraryRefreshMessage1 + "\n\n" + LocalizedStrings.cellularLibraryRefreshMessage2 - } - - // MARK: - Actions - - func switcherValueChanged(switcher: UISwitch) { - if switcher == libraryrefreshAllowCellularDataSwitch { - libraryRefreshAllowCellularData = switcher.on - } - } - -} - -extension LocalizedStrings { - class var refreshLibraryUsingCellularData: String {return NSLocalizedString("Refresh Library Using Cellular Data", comment: "Setting: Use Cellular Data")} - class var cellularLibraryRefreshMessage1: String {return NSLocalizedString("When enabled, library refresh will use cellular data.", comment: "Setting: Use Cellular Data")} - class var cellularLibraryRefreshMessage2: String {return NSLocalizedString("Note: a 5-6MB database is downloaded every time the library refreshes.", comment: "Setting: Use Cellular Data")} -} diff --git a/Kiwix-iOS/Controller/Main/JSInjection.swift b/Kiwix-iOS/Controller/Main/JSInjection.swift index f5eab7a3..849ba411 100644 --- a/Kiwix-iOS/Controller/Main/JSInjection.swift +++ b/Kiwix-iOS/Controller/Main/JSInjection.swift @@ -26,9 +26,8 @@ class JSInjection { } class func adjustFontSizeIfNeeded(webView: UIWebView) { - let zoomScale = Preference.webViewZoomScale - guard zoomScale != 100.0 else {return} - let jString = String(format: "document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust= '%.0f%%'", zoomScale) + guard Preference.webViewZoomScale != 100.0 else {return} + let jString = String(format: "document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust= '%.0f%%'", Preference.webViewZoomScale) webView.stringByEvaluatingJavaScriptFromString(jString) } diff --git a/Kiwix-iOS/Controller/Main/MainController.swift b/Kiwix-iOS/Controller/Main/MainController.swift index 89841f9b..e88382f1 100644 --- a/Kiwix-iOS/Controller/Main/MainController.swift +++ b/Kiwix-iOS/Controller/Main/MainController.swift @@ -52,7 +52,6 @@ class MainController: UIViewController { ZimMultiReader.shared.delegate = self navigationItem.titleView = searchBar - NSUserDefaults.standardUserDefaults().addObserver(self, forKeyPath: "webViewNotInjectJavascriptToAdjustPageLayout", options: .New, context: context) NSUserDefaults.standardUserDefaults().addObserver(self, forKeyPath: "webViewZoomScale", options: .New, context: context) configureButtonColor() @@ -62,14 +61,13 @@ class MainController: UIViewController { deinit { article?.removeObserver(self, forKeyPath: "isBookmarked") - NSUserDefaults.standardUserDefaults().removeObserver(self, forKeyPath: "webViewNotInjectJavascriptToAdjustPageLayout") NSUserDefaults.standardUserDefaults().removeObserver(self, forKeyPath: "webViewZoomScale") } override func observeValueForKeyPath(keyPath: String?, ofObject object: AnyObject?, change: [String : AnyObject]?, context: UnsafeMutablePointer) { guard context == self.context, let keyPath = keyPath else {return} switch keyPath { - case "webViewZoomScale", "webViewNotInjectJavascriptToAdjustPageLayout": + case "webViewZoomScale": webView.reload() case "isBookmarked": configureBookmarkButton() @@ -165,19 +163,6 @@ class MainController: UIViewController { bookmarkButton.customImageView?.highlighted = article?.isBookmarked ?? false } - func configureWebViewInsets() { - let topInset: CGFloat = { - guard let navigationBar = navigationController?.navigationBar else {return 44.0} - return navigationBar.hidden ? 0.0 : navigationBar.frame.origin.y + navigationBar.frame.height - }() - let bottomInset: CGFloat = { - guard let toolbar = navigationController?.toolbar else {return 0.0} - return traitCollection.horizontalSizeClass == .Compact ? view.frame.height - toolbar.frame.origin.y : 0.0 - }() - webView.scrollView.contentInset = UIEdgeInsetsMake(topInset, 0, bottomInset, 0) - webView.scrollView.scrollIndicatorInsets = UIEdgeInsetsMake(topInset, 0, bottomInset, 0) - } - func configureSearchBarPlaceHolder() { func truncatedPlaceHolderString(string: String?, searchBar: UISearchBar) -> String? { guard let string = string else {return nil} diff --git a/Kiwix-iOS/Controller/Main/MainControllerDelegates.swift b/Kiwix-iOS/Controller/Main/MainControllerDelegates.swift index 7869ec3d..f64a11f1 100644 --- a/Kiwix-iOS/Controller/Main/MainControllerDelegates.swift +++ b/Kiwix-iOS/Controller/Main/MainControllerDelegates.swift @@ -50,6 +50,7 @@ extension MainController: UIWebViewDelegate, SFSafariViewControllerDelegate, LPT // UI Updates configureNavigationButtonTint() + JSInjection.adjustFontSizeIfNeeded(webView) } func webView(webView: UIWebView, didFailLoadWithError error: NSError) { diff --git a/Kiwix-iOS/Controller/Alerts.swift b/Kiwix-iOS/Controller/Others/Alerts.swift similarity index 100% rename from Kiwix-iOS/Controller/Alerts.swift rename to Kiwix-iOS/Controller/Others/Alerts.swift diff --git a/Kiwix-iOS/Controller/ControllerRetainer.swift b/Kiwix-iOS/Controller/Others/ControllerRetainer.swift similarity index 100% rename from Kiwix-iOS/Controller/ControllerRetainer.swift rename to Kiwix-iOS/Controller/Others/ControllerRetainer.swift diff --git a/Kiwix-iOS/Controller/FontSizeTBVC.swift b/Kiwix-iOS/Controller/Setting/FontSizeController.swift similarity index 94% rename from Kiwix-iOS/Controller/FontSizeTBVC.swift rename to Kiwix-iOS/Controller/Setting/FontSizeController.swift index 520593c1..60493a4c 100644 --- a/Kiwix-iOS/Controller/FontSizeTBVC.swift +++ b/Kiwix-iOS/Controller/Setting/FontSizeController.swift @@ -1,5 +1,5 @@ // -// FontSizeTBVC.swift +// FontSizeController.swift // Kiwix // // Created by Chris Li on 8/15/15. @@ -8,7 +8,7 @@ import UIKit -class FontSizeTBVC: UITableViewController { +class FontSizeController: UITableViewController { @IBOutlet var slider: UISlider! diff --git a/Kiwix-iOS/Controller/SettingTBVC.swift b/Kiwix-iOS/Controller/Setting/SettingController.swift similarity index 55% rename from Kiwix-iOS/Controller/SettingTBVC.swift rename to Kiwix-iOS/Controller/Setting/SettingController.swift index 7e56a429..320ff438 100644 --- a/Kiwix-iOS/Controller/SettingTBVC.swift +++ b/Kiwix-iOS/Controller/Setting/SettingController.swift @@ -9,28 +9,15 @@ import UIKit class SettingTBVC: UITableViewController { - private(set) var sectionHeader = [LocalizedStrings.library, LocalizedStrings.reading, LocalizedStrings.search, LocalizedStrings.widget, LocalizedStrings.misc] - private(set) var cellTextlabels = [[LocalizedStrings.libraryAutoRefresh, LocalizedStrings.libraryUseCellularData, LocalizedStrings.libraryBackup], - [LocalizedStrings.fontSize, LocalizedStrings.adjustLayout], - [LocalizedStrings.history], - [LocalizedStrings.bookmarks], + private(set) var sectionHeader: [String?] = [nil, LocalizedStrings.misc] + private(set) var cellTitles = [[LocalizedStrings.backupLocalFiles, LocalizedStrings.fontSize, LocalizedStrings.searchHistory], [LocalizedStrings.rateKiwix, LocalizedStrings.about]] - let dateComponentsFormatter: NSDateComponentsFormatter = { - let formatter = NSDateComponentsFormatter() - formatter.unitsStyle = NSDateComponentsFormatterUnitsStyle.Full - return formatter - }() - override func viewDidLoad() { super.viewDidLoad() title = LocalizedStrings.settings clearsSelectionOnViewWillAppear = true showRateKiwixIfNeeded() - - if UIApplication.buildStatus == .Alpha { - cellTextlabels[2].append("Boost Factor 🚀") - } } override func viewWillAppear(animated: Bool) { @@ -38,41 +25,28 @@ class SettingTBVC: UITableViewController { tableView.reloadData() } - override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { - if segue.identifier == "MiscAbout" { - guard let controller = segue.destinationViewController as? WebViewController else {return} - controller.page = .About - } - } - // MARK: - Table view data source override func numberOfSectionsInTableView(tableView: UITableView) -> Int { - return sectionHeader.count + return cellTitles.count } override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return cellTextlabels[section].count + return cellTitles[section].count } override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) - cell.textLabel?.text = cellTextlabels[indexPath.section][indexPath.row] + let title = cellTitles[indexPath.section][indexPath.row] + cell.textLabel?.text = title cell.detailTextLabel?.text = { - switch indexPath { - case NSIndexPath(forRow: 0, inSection: 0): - return Preference.libraryAutoRefreshDisabled ? LocalizedStrings.disabled : - dateComponentsFormatter.stringFromTimeInterval(Preference.libraryRefreshInterval) - case NSIndexPath(forRow: 1, inSection: 0): - return Preference.libraryRefreshAllowCellularData ? LocalizedStrings.on : LocalizedStrings.off - case NSIndexPath(forRow: 2, inSection: 0): + switch title { + case LocalizedStrings.backupLocalFiles: guard let skipBackup = NSFileManager.getSkipBackupAttribute(item: NSFileManager.docDirURL) else {return ""} return skipBackup ? LocalizedStrings.off: LocalizedStrings.on - case NSIndexPath(forRow: 0, inSection: 1): + case LocalizedStrings.fontSize: return String.formattedPercentString(Preference.webViewZoomScale / 100) - case NSIndexPath(forRow: 1, inSection: 1): - return Preference.webViewInjectJavascriptToAdjustPageLayout ? LocalizedStrings.on : LocalizedStrings.off default: return nil } @@ -89,7 +63,7 @@ class SettingTBVC: UITableViewController { override func tableView(tableView: UITableView, titleForFooterInSection section: Int) -> String? { guard section == tableView.numberOfSections - 1 else {return nil} - var footnote = String(format: LocalizedStrings.versionString, NSBundle.appShortVersion) + var footnote = String(format: LocalizedStrings.settingFootnote, NSBundle.appShortVersion) switch UIApplication.buildStatus { case .Alpha, .Beta: footnote += (UIApplication.buildStatus == .Alpha ? " Alpha" : " Beta") @@ -113,26 +87,27 @@ class SettingTBVC: UITableViewController { let cell = tableView.cellForRowAtIndexPath(indexPath) guard let text = cell?.textLabel?.text else {return} switch text { - case LocalizedStrings.libraryAutoRefresh: - performSegueWithIdentifier("LibraryAutoRefresh", sender: self) - case LocalizedStrings.libraryUseCellularData: - performSegueWithIdentifier("LibraryUseCellularData", sender: self) - case LocalizedStrings.libraryBackup: - performSegueWithIdentifier("LibraryBackup", sender: self) + case LocalizedStrings.backupLocalFiles: + let controller = UIStoryboard(name: "Setting", bundle: nil) + .instantiateViewControllerWithIdentifier("SettingDetailController") as! SettingDetailController + controller.page = .BackupLocalFiles + navigationController?.pushViewController(controller, animated: true) + case LocalizedStrings.searchHistory: + let controller = UIStoryboard(name: "Setting", bundle: nil) + .instantiateViewControllerWithIdentifier("SettingDetailController") as! SettingDetailController + controller.page = .SearchHistory + navigationController?.pushViewController(controller, animated: true) case LocalizedStrings.fontSize: - performSegueWithIdentifier("ReadingFontSize", sender: self) - case LocalizedStrings.adjustLayout: - performSegueWithIdentifier("AdjustLayout", sender: self) - case LocalizedStrings.history: - performSegueWithIdentifier("SearchHistory", sender: self) - case LocalizedStrings.bookmarks: - performSegueWithIdentifier("SettingWidgetBookmarksTBVC", sender: self) - case "Boost Factor 🚀": - performSegueWithIdentifier("SearchTune", sender: self) + let controller = UIStoryboard(name: "Setting", bundle: nil) + .instantiateViewControllerWithIdentifier("FontSizeController") as! FontSizeController + navigationController?.pushViewController(controller, animated: true) case LocalizedStrings.rateKiwix: showRateKiwixAlert(showRemindLater: false) case LocalizedStrings.about: - performSegueWithIdentifier("MiscAbout", sender: self) + let controller = UIStoryboard(name: "Setting", bundle: nil) + .instantiateViewControllerWithIdentifier("WebViewController") as! WebViewController + controller.page = .About + navigationController?.pushViewController(controller, animated: true) default: break } @@ -190,25 +165,16 @@ class SettingTBVC: UITableViewController { } extension LocalizedStrings { - class var settings: String {return NSLocalizedString("Settings", comment: "Setting: Title")} - class var versionString: String {return NSLocalizedString("Kiwix for iOS v%@", comment: "Version footnote (please translate 'v' as version)")} + static let settings = NSLocalizedString("Settings", comment: "Settings") - //MARK: - Table Header Text - class var library: String {return NSLocalizedString("Library ", comment: "Setting: Section Header")} - class var reading: String {return NSLocalizedString("Reading", comment: "Setting: Section Header")} - class var search: String {return NSLocalizedString("Search", comment: "Setting: Section Header")} - class var widget: String {return NSLocalizedString("Widget", comment: "Setting: Section Header")} - class var misc: String {return NSLocalizedString("Misc", comment: "Setting: Section Header")} + static let backupLocalFiles = NSLocalizedString("Backup Local Files", comment: "Setting") + static let fontSize = NSLocalizedString("Font Size", comment: "Setting") + static let searchHistory = NSLocalizedString("Search History", comment: "Setting") - //MARK: - Table Cell Text - class var libraryAutoRefresh: String {return NSLocalizedString("Auto Refresh", comment: "Setting: Library Auto Refresh")} - class var libraryUseCellularData: String {return NSLocalizedString("Refresh Using Cellular Data", comment: "Setting: Library Use Cellular Data")} - class var libraryBackup: String {return NSLocalizedString("Backup Local Files", comment: "Setting: Backup Local Files")} - class var fontSize: String {return NSLocalizedString("Font Size", comment: "Setting: Font Size")} - class var adjustLayout: String {return NSLocalizedString("Adjust Layout", comment: "Setting: Adjust Layout")} - class var rateKiwix: String {return NSLocalizedString("Please Rate Kiwix", comment: "Setting: Others")} - class var emailFeedback: String {return NSLocalizedString("Send Email Feedback", comment: "Setting: Others")} - class var about: String {return NSLocalizedString("About", comment: "Setting: Others")} + static let misc = NSLocalizedString("Misc", comment: "Setting") + static let rateKiwix = NSLocalizedString("Give Kiwix a rate!", comment: "Setting") + static let about = NSLocalizedString("About", comment: "Setting") + static let settingFootnote = NSLocalizedString("Kiwix for iOS v%@", comment: "Version footnote (please translate 'v' as version)") //MARK: - Rate Kiwix class var rateKiwixTitle: String {return NSLocalizedString("Give Kiwix a rate!", comment: "Rate Kiwix in App Store Alert Title")} diff --git a/Kiwix-iOS/Controller/Setting/SettingDetailController.swift b/Kiwix-iOS/Controller/Setting/SettingDetailController.swift new file mode 100644 index 00000000..89b35a70 --- /dev/null +++ b/Kiwix-iOS/Controller/Setting/SettingDetailController.swift @@ -0,0 +1,98 @@ +// +// SettingDetailController.swift +// Kiwix +// +// Created by Chris Li on 7/13/16. +// Copyright © 2016 Chris. All rights reserved. +// + +import UIKit +import Operations + +class SettingDetailController: UITableViewController { + + let switchControl = UISwitch() + var page = SettingDetailControllerContentType.BackupLocalFiles + + override func viewDidLoad() { + super.viewDidLoad() + switch page { + case .BackupLocalFiles: + title = LocalizedStrings.backupLocalFiles + switchControl.on = !(NSFileManager.getSkipBackupAttribute(item: NSFileManager.docDirURL) ?? false) + case .SearchHistory: + title = LocalizedStrings.searchHistory + } + + switchControl.addTarget(self, action: #selector(SettingDetailController.switchValueChanged), forControlEvents: .ValueChanged) + } + + func switchValueChanged() { + if page == .BackupLocalFiles { + NSFileManager.setSkipBackupAttribute(!switchControl.on, url: NSFileManager.docDirURL) + } + } + + // MARK: - Table view data source + + override func numberOfSectionsInTableView(tableView: UITableView) -> Int { + return 1 + } + + override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return 1 + } + + override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { + switch page { + case .BackupLocalFiles: + let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) + cell.textLabel?.text = LocalizedStrings.backupLocalFiles + cell.accessoryView = switchControl + return cell + case .SearchHistory: + let cell = tableView.dequeueReusableCellWithIdentifier("CenterTextCell", forIndexPath: indexPath) + cell.textLabel?.text = LocalizedStrings.clearSearchHistory + return cell + } + } + + override func tableView(tableView: UITableView, titleForFooterInSection section: Int) -> String? { + switch page { + case .BackupLocalFiles: + return NSLocalizedString("When turned off, iOS will not backup zim files and index folders to iCloud or iTunes.", + comment: "Setting: Backup local files comment") + "\n\n" + + NSLocalizedString("Note: Large zim file collection can take up a lot of space in backup. You may want to turn this off if you use iCloud for backup.", comment: "Setting: Backup local files comment") + case .SearchHistory: + return nil + } + } + + // MARK: - Table view delegate + + override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { + tableView.deselectRowAtIndexPath(indexPath, animated: true) + guard let title = tableView.cellForRowAtIndexPath(indexPath)?.textLabel?.text else {return} + switch title { + case LocalizedStrings.clearSearchHistory: + Preference.recentSearchTerms = [String]() + let controller = UIAlertController(title: NSLocalizedString("Cleared", comment: "Setting, search history cleared"), + message: NSLocalizedString("Your search history has been cleared!", comment: "Setting, search history cleared"), + preferredStyle: .Alert) + let done = UIAlertAction(title: LocalizedStrings.done, style: .Default, handler: nil) + controller.addAction(done) + presentViewController(controller, animated: true, completion: nil) + default: + return + } + } + +} + +extension LocalizedStrings { + static let clearSearchHistory = NSLocalizedString("Clear Search History", comment: "") +} + +enum SettingDetailControllerContentType: String { + case BackupLocalFiles, SearchHistory +} diff --git a/Kiwix-iOS/Controller/Setting/SettingSearchTuneController.swift b/Kiwix-iOS/Controller/Setting/SettingSearchTuneController.swift deleted file mode 100644 index 7fc74497..00000000 --- a/Kiwix-iOS/Controller/Setting/SettingSearchTuneController.swift +++ /dev/null @@ -1,129 +0,0 @@ -// -// SearchTuneController.swift -// Kiwix -// -// Created by Chris Li on 6/23/16. -// Copyright © 2016 Chris. All rights reserved. -// - -import UIKit -import SwiftyUserDefaults - -class SettingSearchTuneController: UIViewController, UITableViewDataSource { - @IBOutlet weak var y1Value: UITextField! - @IBOutlet weak var y2Value: UITextField! - @IBOutlet weak var x1Value: UITextField! - @IBOutlet weak var x2Value: UITextField! - - @IBOutlet weak var mLabel: UILabel! - @IBOutlet weak var nLabel: UILabel! - - @IBOutlet weak var tableView: UITableView! - - let e = 2.718281828459 - - override func viewDidLoad() { - super.viewDidLoad() - title = "y=ln(n-mx) 🤓" - - let button = UIBarButtonItem(title: "Calculate", style: .Plain, target: self, action: #selector(SettingSearchTuneController.calculate)) - navigationItem.rightBarButtonItem = button - - tableView.dataSource = self - - if Defaults[.m] == nil { - Defaults[.x1] = 1 - Defaults[.x2] = 0.75 - Defaults[.y1] = 0.1 - Defaults[.y2] = 1 - } - - y1Value.text = String(Defaults[.y1]) - y2Value.text = String(Defaults[.y2]) - x1Value.text = String(Defaults[.x1]) - x2Value.text = String(Defaults[.x2]) - - calculate() - } - - override func viewWillDisappear(animated: Bool) { - Defaults[.x1] = Double(x1Value.text ?? "") ?? 0 - Defaults[.x2] = Double(x2Value.text ?? "") ?? 0 - Defaults[.y1] = Double(y1Value.text ?? "") ?? 0 - Defaults[.y2] = Double(y2Value.text ?? "") ?? 0 - } - - func calculate() { - guard let y1Text = y1Value.text, let y2Text = y2Value.text, let x1Text = x1Value.text, let x2Text = x2Value.text else {return} - guard let y1 = Double(y1Text), let y2 = Double(y2Text), let x1 = Double(x1Text), let x2 = Double(x2Text) else {return} - let ey1 = pow(e, y1) - let ey2 = pow(e, y2) - let m = (ey1 - ey2) / (x2 - x1) - let n = ey1 + m * x1 - - Defaults[.m] = m - Defaults[.n] = n - - mLabel.text = "m = " + String(format: "%.5f", m) - nLabel.text = "n = " + String(format: "%.5f", n) - - y1Value.resignFirstResponder() - y2Value.resignFirstResponder() - x1Value.resignFirstResponder() - x2Value.resignFirstResponder() - tableView.reloadData() - } - - // MARK: - UITableViewDataSource - - func numberOfSectionsInTableView(tableView: UITableView) -> Int { - return 2 - } - - func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return 10 - } - - func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { - let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) - let prob: Double = indexPath.section == 0 ? ((100 - Double(indexPath.row)) / 100.0) : ((10.0 - Double(indexPath.row)) / 10.0) - cell.textLabel?.text = "\(prob * 100)%" - cell.detailTextLabel?.text = String(format: "%.5f", WeightFactor.calculate(prob) ?? "NA") - return cell - } - - func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? { - return section == 0 ? "100% -- 90%" : "100% -- 10%" - } -} - -class WeightFactor { - class func calculate(prob: Double) -> Double { - if UIApplication.buildStatus == .Alpha { - if let m = Defaults[.m], let n = Defaults[.n] { - return caluclateLog(m: m, n: n, prob: prob) - } else { - return 1 - } - } else { - let m = 6.4524436415334163 - let n = 7.5576145596090623 - return caluclateLog(m: m, n: n, prob: prob) - } - } - - private class func caluclateLog(m m: Double, n: Double, prob: Double) -> Double { - let e = 2.718281828459 - return log(n - m * prob) / log(e) - } -} - -extension DefaultsKeys { - static let x1 = DefaultsKey("Debug-x1") - static let x2 = DefaultsKey("Debug-x2") - static let y1 = DefaultsKey("Debug-y1") - static let y2 = DefaultsKey("Debug-y2") - - static let m = DefaultsKey("Debug-m") - static let n = DefaultsKey("Debug-n") -} diff --git a/Kiwix-iOS/Controller/Setting/SettingSingleSwitchTBVC.swift b/Kiwix-iOS/Controller/Setting/SettingSingleSwitchTBVC.swift deleted file mode 100644 index 97929764..00000000 --- a/Kiwix-iOS/Controller/Setting/SettingSingleSwitchTBVC.swift +++ /dev/null @@ -1,42 +0,0 @@ -// -// SettingSingleSwitchTBVC.swift -// Kiwix -// -// Created by Chris Li on 7/13/16. -// Copyright © 2016 Chris. All rights reserved. -// - -import UIKit - -class SettingSingleSwitchTBVC: UITableViewController { - - override func viewDidLoad() { - super.viewDidLoad() - - // Uncomment the following line to preserve selection between presentations - // self.clearsSelectionOnViewWillAppear = false - - // Uncomment the following line to display an Edit button in the navigation bar for this view controller. - // self.navigationItem.rightBarButtonItem = self.editButtonItem() - } - - override func didReceiveMemoryWarning() { - super.didReceiveMemoryWarning() - // Dispose of any resources that can be recreated. - } - - // MARK: - Table view data source - - override func numberOfSectionsInTableView(tableView: UITableView) -> Int { - // #warning Incomplete implementation, return the number of sections - return 0 - } - - override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - // #warning Incomplete implementation, return the number of rows - return 0 - } - -} - - diff --git a/Kiwix-iOS/Controller/Setting/SettingWidgetBookmarksTBVC.swift b/Kiwix-iOS/Controller/Setting/SettingWidgetBookmarksTBVC.swift deleted file mode 100644 index 21da4eb5..00000000 --- a/Kiwix-iOS/Controller/Setting/SettingWidgetBookmarksTBVC.swift +++ /dev/null @@ -1,71 +0,0 @@ -// -// SettingWidgetBookmarksTBVC.swift -// Kiwix -// -// Created by Chris Li on 7/26/16. -// Copyright © 2016 Chris. All rights reserved. -// - -import UIKit - -class SettingWidgetBookmarksTBVC: UITableViewController { - // widget row count - private var rowCount = 1 { - didSet { - let defaults = NSUserDefaults(suiteName: "group.kiwix") - defaults?.setInteger(rowCount ?? 1, forKey: "BookmarkWidgetMaxRowCount") - } - } - - let options = [NSLocalizedString("One Row", comment: "Setting: Bookmark Widget"), - NSLocalizedString("Two Rows", comment: "Setting: Bookmark Widget"), - NSLocalizedString("Three Rows", comment: "Setting: Bookmark Widget")] - - override func viewWillAppear(animated: Bool) { - super.viewWillAppear(animated) - - title = LocalizedStrings.bookmarks - if let defaults = NSUserDefaults(suiteName: "group.kiwix") { - rowCount = max(1, min(defaults.integerForKey("BookmarkWidgetMaxRowCount"), 3)) - } - } - - // MARK: - Table view data source - - override func numberOfSectionsInTableView(tableView: UITableView) -> Int { - return 1 - } - - override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return options.count - } - - override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { - let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) - cell.textLabel?.text = options[indexPath.row] - cell.accessoryType = indexPath.row == (rowCount - 1) ? .Checkmark : .None - return cell - } - - override func tableView(tableView: UITableView, titleForFooterInSection section: Int) -> String? { - return NSLocalizedString("Set the maximum number of rows displayed in Bookmarks Today Widget.", comment: "Setting: Bookmark Widget") - } - - // MARK: - Table view delegate - - override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { - let oldIndexPath = NSIndexPath(forItem: rowCount - 1, inSection: 0) - guard let oldCell = tableView.cellForRowAtIndexPath(oldIndexPath), - let newCell = tableView.cellForRowAtIndexPath(indexPath) else {return} - oldCell.accessoryType = .None - newCell.accessoryType = .Checkmark - rowCount = indexPath.row + 1 - tableView.deselectRowAtIndexPath(indexPath, animated: true) - } - - override func tableView(tableView: UITableView, willDisplayFooterView view: UIView, forSection section: Int) { - guard section == 0 else {return} - guard let view = view as? UITableViewHeaderFooterView else {return} - view.textLabel?.textAlignment = .Center - } -} \ No newline at end of file diff --git a/Kiwix-iOS/Controller/WebViewController.swift b/Kiwix-iOS/Controller/Setting/WebViewController.swift similarity index 100% rename from Kiwix-iOS/Controller/WebViewController.swift rename to Kiwix-iOS/Controller/Setting/WebViewController.swift diff --git a/Kiwix-iOS/Info.plist b/Kiwix-iOS/Info.plist index 0cd4fd79..0c352299 100644 --- a/Kiwix-iOS/Info.plist +++ b/Kiwix-iOS/Info.plist @@ -49,7 +49,7 @@ CFBundleVersion - 1.8.1491 + 1.8.1549 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/Kiwix-iOS/Storyboard/Setting.storyboard b/Kiwix-iOS/Storyboard/Setting.storyboard index a334ccd4..9375bfec 100644 --- a/Kiwix-iOS/Storyboard/Setting.storyboard +++ b/Kiwix-iOS/Storyboard/Setting.storyboard @@ -1,8 +1,9 @@ - - + + - + + @@ -21,110 +22,34 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + - + @@ -137,49 +62,46 @@ - + - - - - - - - - - - - - - + + - - - + + + - + - - + + - - + + + + + + + + + + - @@ -187,129 +109,61 @@ - - + + + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + - + - + - + - @@ -363,204 +217,14 @@ + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -571,15 +235,14 @@ - + - - + - + @@ -587,16 +250,17 @@ + - + - + diff --git a/Kiwix-iOSWidgets/Bookmarks/Info.plist b/Kiwix-iOSWidgets/Bookmarks/Info.plist index 45e1a409..da05129b 100644 --- a/Kiwix-iOSWidgets/Bookmarks/Info.plist +++ b/Kiwix-iOSWidgets/Bookmarks/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 1.8.1495 + 1.8.1549 NSExtension NSExtensionMainStoryboard diff --git a/Kiwix.xcodeproj/project.pbxproj b/Kiwix.xcodeproj/project.pbxproj index 05d00337..8a0d7c4d 100644 --- a/Kiwix.xcodeproj/project.pbxproj +++ b/Kiwix.xcodeproj/project.pbxproj @@ -9,11 +9,16 @@ /* Begin PBXBuildFile section */ 7356F9FACBB84380CFC8F68F /* Pods_Kiwix_iOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EC884ACBBA260AF741C4C4FE /* Pods_Kiwix_iOS.framework */; }; 970722AA1D6B4D1700A45620 /* LanguageFilterController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 970722A91D6B4D1700A45620 /* LanguageFilterController.swift */; }; - 970E68B21D37E1DD001E8514 /* SettingSearchTuneController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 970E68B11D37E1DD001E8514 /* SettingSearchTuneController.swift */; }; - 970E68B61D37E224001E8514 /* SettingSearchHistoryTBVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 970E68B51D37E224001E8514 /* SettingSearchHistoryTBVC.swift */; }; 970E68BA1D3809A3001E8514 /* MainController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 970E68B71D3809A3001E8514 /* MainController.swift */; }; 970E68BB1D3809A3001E8514 /* MainControllerDelegates.swift in Sources */ = {isa = PBXBuildFile; fileRef = 970E68B81D3809A3001E8514 /* MainControllerDelegates.swift */; }; 970E7F741D9DB0FC00741290 /* 1.8.xcmappingmodel in Sources */ = {isa = PBXBuildFile; fileRef = 970E7F731D9DB0FC00741290 /* 1.8.xcmappingmodel */; }; + 970E7F771D9DBEA900741290 /* SettingController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 970E7F761D9DBEA900741290 /* SettingController.swift */; }; + 970E7F791DA003FA00741290 /* WebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 970E7F781DA003FA00741290 /* WebViewController.swift */; }; + 970E7F7B1DA0069600741290 /* FontSizeController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 970E7F7A1DA0069600741290 /* FontSizeController.swift */; }; + 970E7F801DA0305000741290 /* Alerts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 970E7F7C1DA0305000741290 /* Alerts.swift */; }; + 970E7F811DA0305000741290 /* ControllerRetainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 970E7F7D1DA0305000741290 /* ControllerRetainer.swift */; }; + 970E7F821DA0305000741290 /* TableOfContentsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 970E7F7E1DA0305000741290 /* TableOfContentsController.swift */; }; + 970E7F831DA0305000741290 /* WelcomeController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 970E7F7F1DA0305000741290 /* WelcomeController.swift */; }; 9711871C1CEB448400B9909D /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 9711871B1CEB448400B9909D /* libz.tbd */; }; 9711871E1CEB449A00B9909D /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 9711871D1CEB449A00B9909D /* libz.tbd */; }; 971187A91CEB694400B9909D /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 971187A81CEB694400B9909D /* WebKit.framework */; }; @@ -27,12 +32,6 @@ 971A10301D022AD5007FC62C /* LTBarButtonItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 971A10281D022AD5007FC62C /* LTBarButtonItem.swift */; }; 971A10311D022AD5007FC62C /* RefreshHUD.swift in Sources */ = {isa = PBXBuildFile; fileRef = 971A10291D022AD5007FC62C /* RefreshHUD.swift */; }; 971A10321D022AD5007FC62C /* SearchBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 971A102A1D022AD5007FC62C /* SearchBar.swift */; }; - 971A10381D022C15007FC62C /* WebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 971A10371D022C15007FC62C /* WebViewController.swift */; }; - 971A103B1D022C2C007FC62C /* AdjustLayoutTBVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 971A10391D022C2C007FC62C /* AdjustLayoutTBVC.swift */; }; - 971A103C1D022C2C007FC62C /* FontSizeTBVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 971A103A1D022C2C007FC62C /* FontSizeTBVC.swift */; }; - 971A103F1D022C42007FC62C /* LibraryAutoRefreshTBVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 971A103D1D022C42007FC62C /* LibraryAutoRefreshTBVC.swift */; }; - 971A10401D022C42007FC62C /* LibraryUseCellularDataTBVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 971A103E1D022C42007FC62C /* LibraryUseCellularDataTBVC.swift */; }; - 971A10431D022C54007FC62C /* SettingTBVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 971A10411D022C54007FC62C /* SettingTBVC.swift */; }; 971A10521D022D9D007FC62C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 971A10511D022D9D007FC62C /* AppDelegate.swift */; }; 971A10771D022F05007FC62C /* Localizable.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = 971A10791D022F05007FC62C /* Localizable.stringsdict */; }; 971A107E1D022F74007FC62C /* DownloaderLearnMore.html in Resources */ = {isa = PBXBuildFile; fileRef = 971A107A1D022F74007FC62C /* DownloaderLearnMore.html */; }; @@ -41,7 +40,6 @@ 971A10811D022F74007FC62C /* Pic_P.png in Resources */ = {isa = PBXBuildFile; fileRef = 971A107D1D022F74007FC62C /* Pic_P.png */; }; 97219DBD1D383A00009FDFF1 /* BookmarkHUD.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97219DBC1D383A00009FDFF1 /* BookmarkHUD.swift */; }; 9722122B1D3FCCE200C0DCF2 /* MainControllerShowHide.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9722122A1D3FCCE200C0DCF2 /* MainControllerShowHide.swift */; }; - 972659191D8AE4B400D1DFFB /* Alerts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 972659181D8AE4B400D1DFFB /* Alerts.swift */; }; 9726591B1D8DB91200D1DFFB /* DownloadProgress.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9726591A1D8DB91200D1DFFB /* DownloadProgress.swift */; }; 9726591D1D90A64600D1DFFB /* Notifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9726591C1D90A64500D1DFFB /* Notifications.swift */; }; 9734E54E1D289D060061C39B /* Welcome.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9734E54D1D289D060061C39B /* Welcome.storyboard */; }; @@ -60,9 +58,8 @@ 973DD4161D343F2F009D45DB /* libicuuc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 973DD40B1D343F2F009D45DB /* libicuuc.a */; }; 973DD4181D343F2F009D45DB /* libxapian.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 973DD40D1D343F2F009D45DB /* libxapian.a */; }; 973DD4191D343F2F009D45DB /* libzim.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 973DD40E1D343F2F009D45DB /* libzim.a */; }; - 973DD4281D36E3E4009D45DB /* SettingSingleSwitchTBVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 973DD4271D36E3E4009D45DB /* SettingSingleSwitchTBVC.swift */; }; + 973DD4281D36E3E4009D45DB /* SettingDetailController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 973DD4271D36E3E4009D45DB /* SettingDetailController.swift */; }; 974F33C61D99CAD700879D35 /* BookmarkOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 974F33C51D99CAD700879D35 /* BookmarkOperation.swift */; }; - 974F42821D47E19A00F8074C /* SettingWidgetBookmarksTBVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 974F42811D47E19A00F8074C /* SettingWidgetBookmarksTBVC.swift */; }; 975227821D020560001D1DDE /* Indexer.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 975227811D020560001D1DDE /* Indexer.storyboard */; }; 975227B01D021539001D1DDE /* IndexerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 975227AF1D021539001D1DDE /* IndexerController.swift */; }; 975227CD1D0227E8001D1DDE /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 975227CA1D0227E8001D1DDE /* Main.storyboard */; }; @@ -85,13 +82,10 @@ 9779C3171D4575AE0064CC8E /* TodayViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9779C3161D4575AE0064CC8E /* TodayViewController.swift */; }; 9779C31A1D4575AE0064CC8E /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9779C3181D4575AE0064CC8E /* MainInterface.storyboard */; }; 9779C31E1D4575AE0064CC8E /* Bookmarks.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 9779C3131D4575AD0064CC8E /* Bookmarks.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; - 9787BC211D9318300030D311 /* WelcomeController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9787BC201D9318300030D311 /* WelcomeController.swift */; }; - 9787BC231D9318570030D311 /* TableOfContentsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9787BC221D9318570030D311 /* TableOfContentsController.swift */; }; 979C518D1CECAE4C001707F2 /* PreferenceWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 979C518B1CECAE4C001707F2 /* PreferenceWindowController.swift */; }; 979CB60F1D04AD04005E1BA1 /* PreferenceTabController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 979CB60E1D04AD04005E1BA1 /* PreferenceTabController.swift */; }; 979CB6C81D05CF37005E1BA1 /* SearchResultController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 979CB6C71D05CF37005E1BA1 /* SearchResultController.swift */; }; 979CB6CA1D05D26E005E1BA1 /* WebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 979CB6C91D05D26E005E1BA1 /* WebViewController.swift */; }; - 97A127C41D774C9900FB204D /* ControllerRetainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97A127C31D774C9900FB204D /* ControllerRetainer.swift */; }; 97A127C91D777CF100FB204D /* RecentSearchController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97A127C51D777CF100FB204D /* RecentSearchController.swift */; }; 97A127CA1D777CF100FB204D /* SearchBooksController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97A127C61D777CF100FB204D /* SearchBooksController.swift */; }; 97A127CB1D777CF100FB204D /* SearchController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97A127C71D777CF100FB204D /* SearchController.swift */; }; @@ -142,7 +136,6 @@ 97DF259D1D6F9053001648A3 /* URLSessionDownloadTaskOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97D681221D6F70AC00E5FA99 /* URLSessionDownloadTaskOperation.swift */; }; 97DF25A01D6F996B001648A3 /* Network.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97DF259F1D6F996B001648A3 /* Network.swift */; }; 97E60A021D10423A00EBCB9D /* ShadowViews.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97E60A011D10423A00EBCB9D /* ShadowViews.swift */; }; - 97E60A061D10504000EBCB9D /* LibraryBackupTBVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97E60A051D10504000EBCB9D /* LibraryBackupTBVC.swift */; }; 97E850CB1D2DA5B300A9F688 /* About.html in Resources */ = {isa = PBXBuildFile; fileRef = 97E850CA1D2DA5B300A9F688 /* About.html */; }; 97F03CE21D2440470040D26E /* Search.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97F03CE11D2440470040D26E /* Search.storyboard */; }; 97FD5CE71D3D90B7001C74A2 /* getSnippet.js in Resources */ = {isa = PBXBuildFile; fileRef = 97FD5CE61D3D90B7001C74A2 /* getSnippet.js */; }; @@ -218,11 +211,16 @@ 6DCB0E958A1083CA248C5A12 /* Pods-Kiwix-OSX.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Kiwix-OSX.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Kiwix-OSX/Pods-Kiwix-OSX.debug.xcconfig"; sourceTree = ""; }; 970722A91D6B4D1700A45620 /* LanguageFilterController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LanguageFilterController.swift; sourceTree = ""; }; 970912551D7F452C00BBD5A1 /* 1.8.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = 1.8.xcdatamodel; sourceTree = ""; }; - 970E68B11D37E1DD001E8514 /* SettingSearchTuneController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SettingSearchTuneController.swift; path = "Kiwix-iOS/Controller/Setting/SettingSearchTuneController.swift"; sourceTree = SOURCE_ROOT; }; - 970E68B51D37E224001E8514 /* SettingSearchHistoryTBVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SettingSearchHistoryTBVC.swift; path = "Kiwix-iOS/Controller/Setting/SettingSearchHistoryTBVC.swift"; sourceTree = SOURCE_ROOT; }; 970E68B71D3809A3001E8514 /* MainController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MainController.swift; path = "Kiwix-iOS/Controller/Main/MainController.swift"; sourceTree = SOURCE_ROOT; }; 970E68B81D3809A3001E8514 /* MainControllerDelegates.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MainControllerDelegates.swift; path = "Kiwix-iOS/Controller/Main/MainControllerDelegates.swift"; sourceTree = SOURCE_ROOT; }; 970E7F731D9DB0FC00741290 /* 1.8.xcmappingmodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcmappingmodel; name = 1.8.xcmappingmodel; path = Kiwix/CoreData/Migration/1.8.xcmappingmodel; sourceTree = SOURCE_ROOT; }; + 970E7F761D9DBEA900741290 /* SettingController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingController.swift; sourceTree = ""; }; + 970E7F781DA003FA00741290 /* WebViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WebViewController.swift; sourceTree = ""; }; + 970E7F7A1DA0069600741290 /* FontSizeController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FontSizeController.swift; sourceTree = ""; }; + 970E7F7C1DA0305000741290 /* Alerts.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Alerts.swift; sourceTree = ""; }; + 970E7F7D1DA0305000741290 /* ControllerRetainer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ControllerRetainer.swift; sourceTree = ""; }; + 970E7F7E1DA0305000741290 /* TableOfContentsController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableOfContentsController.swift; sourceTree = ""; }; + 970E7F7F1DA0305000741290 /* WelcomeController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WelcomeController.swift; sourceTree = ""; }; 9711871B1CEB448400B9909D /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/lib/libz.tbd; sourceTree = DEVELOPER_DIR; }; 9711871D1CEB449A00B9909D /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; 971187A81CEB694400B9909D /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/WebKit.framework; sourceTree = DEVELOPER_DIR; }; @@ -237,12 +235,6 @@ 971A10281D022AD5007FC62C /* LTBarButtonItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LTBarButtonItem.swift; sourceTree = ""; }; 971A10291D022AD5007FC62C /* RefreshHUD.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RefreshHUD.swift; sourceTree = ""; }; 971A102A1D022AD5007FC62C /* SearchBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchBar.swift; sourceTree = ""; }; - 971A10371D022C15007FC62C /* WebViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = WebViewController.swift; path = "Kiwix-iOS/Controller/WebViewController.swift"; sourceTree = SOURCE_ROOT; }; - 971A10391D022C2C007FC62C /* AdjustLayoutTBVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AdjustLayoutTBVC.swift; path = "Kiwix-iOS/Controller/AdjustLayoutTBVC.swift"; sourceTree = SOURCE_ROOT; }; - 971A103A1D022C2C007FC62C /* FontSizeTBVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = FontSizeTBVC.swift; path = "Kiwix-iOS/Controller/FontSizeTBVC.swift"; sourceTree = SOURCE_ROOT; }; - 971A103D1D022C42007FC62C /* LibraryAutoRefreshTBVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LibraryAutoRefreshTBVC.swift; path = "Kiwix-iOS/Controller/LibraryAutoRefreshTBVC.swift"; sourceTree = SOURCE_ROOT; }; - 971A103E1D022C42007FC62C /* LibraryUseCellularDataTBVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LibraryUseCellularDataTBVC.swift; path = "Kiwix-iOS/Controller/LibraryUseCellularDataTBVC.swift"; sourceTree = SOURCE_ROOT; }; - 971A10411D022C54007FC62C /* SettingTBVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SettingTBVC.swift; path = "Kiwix-iOS/Controller/SettingTBVC.swift"; sourceTree = SOURCE_ROOT; }; 971A10511D022D9D007FC62C /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 971A10781D022F05007FC62C /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = en; path = en.lproj/Localizable.stringsdict; sourceTree = ""; }; 971A107A1D022F74007FC62C /* DownloaderLearnMore.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = DownloaderLearnMore.html; path = Kiwix/HelpDocuments/DownloaderLearnMore.html; sourceTree = SOURCE_ROOT; }; @@ -252,7 +244,6 @@ 971C4F0B1D3FFFA60027B7D2 /* Kiwix.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = Kiwix.entitlements; path = "Kiwix-iOS/Kiwix.entitlements"; sourceTree = SOURCE_ROOT; }; 97219DBC1D383A00009FDFF1 /* BookmarkHUD.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = BookmarkHUD.swift; path = "Kiwix-iOS/Controller/Bookmark/BookmarkHUD.swift"; sourceTree = SOURCE_ROOT; }; 9722122A1D3FCCE200C0DCF2 /* MainControllerShowHide.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MainControllerShowHide.swift; path = "Kiwix-iOS/Controller/Main/MainControllerShowHide.swift"; sourceTree = SOURCE_ROOT; }; - 972659181D8AE4B400D1DFFB /* Alerts.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Alerts.swift; sourceTree = ""; }; 9726591A1D8DB91200D1DFFB /* DownloadProgress.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DownloadProgress.swift; sourceTree = ""; }; 9726591C1D90A64500D1DFFB /* Notifications.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Notifications.swift; sourceTree = ""; }; 9734E54D1D289D060061C39B /* Welcome.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Welcome.storyboard; path = "Kiwix-iOS/Storyboard/Welcome.storyboard"; sourceTree = SOURCE_ROOT; }; @@ -280,9 +271,8 @@ 973DD40C1D343F2F009D45DB /* liblzma.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = liblzma.a; path = Kiwix/libkiwix/iOS/liblzma.a; sourceTree = ""; }; 973DD40D1D343F2F009D45DB /* libxapian.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libxapian.a; path = Kiwix/libkiwix/iOS/libxapian.a; sourceTree = ""; }; 973DD40E1D343F2F009D45DB /* libzim.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libzim.a; path = Kiwix/libkiwix/iOS/libzim.a; sourceTree = ""; }; - 973DD4271D36E3E4009D45DB /* SettingSingleSwitchTBVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SettingSingleSwitchTBVC.swift; path = "Kiwix-iOS/Controller/Setting/SettingSingleSwitchTBVC.swift"; sourceTree = SOURCE_ROOT; }; + 973DD4271D36E3E4009D45DB /* SettingDetailController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SettingDetailController.swift; path = "Kiwix-iOS/Controller/Setting/SettingDetailController.swift"; sourceTree = SOURCE_ROOT; }; 974F33C51D99CAD700879D35 /* BookmarkOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BookmarkOperation.swift; sourceTree = ""; }; - 974F42811D47E19A00F8074C /* SettingWidgetBookmarksTBVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SettingWidgetBookmarksTBVC.swift; path = "Kiwix-iOS/Controller/Setting/SettingWidgetBookmarksTBVC.swift"; sourceTree = SOURCE_ROOT; }; 975227811D020560001D1DDE /* Indexer.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Indexer.storyboard; path = "Kiwix-OSX/StoryBoards/Indexer.storyboard"; sourceTree = SOURCE_ROOT; }; 975227AF1D021539001D1DDE /* IndexerController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = IndexerController.swift; path = "Kiwix-OSX/Controllers/IndexerController.swift"; sourceTree = SOURCE_ROOT; }; 975227CA1D0227E8001D1DDE /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Main.storyboard; path = "Kiwix-iOS/Storyboard/Main.storyboard"; sourceTree = SOURCE_ROOT; }; @@ -306,13 +296,10 @@ 9779C3161D4575AE0064CC8E /* TodayViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TodayViewController.swift; sourceTree = ""; }; 9779C3191D4575AE0064CC8E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/MainInterface.storyboard; sourceTree = ""; }; 9779C31B1D4575AE0064CC8E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 9787BC201D9318300030D311 /* WelcomeController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = WelcomeController.swift; path = Others/WelcomeController.swift; sourceTree = ""; }; - 9787BC221D9318570030D311 /* TableOfContentsController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = TableOfContentsController.swift; path = Others/TableOfContentsController.swift; sourceTree = ""; }; 979C518B1CECAE4C001707F2 /* PreferenceWindowController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PreferenceWindowController.swift; path = "Kiwix-OSX/Controllers/PreferenceWindowController.swift"; sourceTree = SOURCE_ROOT; }; 979CB60E1D04AD04005E1BA1 /* PreferenceTabController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PreferenceTabController.swift; path = Controllers/PreferenceTabController.swift; sourceTree = ""; }; 979CB6C71D05CF37005E1BA1 /* SearchResultController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SearchResultController.swift; path = Controllers/SearchResultController.swift; sourceTree = ""; }; 979CB6C91D05D26E005E1BA1 /* WebViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = WebViewController.swift; path = Controllers/WebViewController.swift; sourceTree = ""; }; - 97A127C31D774C9900FB204D /* ControllerRetainer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ControllerRetainer.swift; sourceTree = ""; }; 97A127C51D777CF100FB204D /* RecentSearchController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecentSearchController.swift; sourceTree = ""; }; 97A127C61D777CF100FB204D /* SearchBooksController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchBooksController.swift; sourceTree = ""; }; 97A127C71D777CF100FB204D /* SearchController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchController.swift; sourceTree = ""; }; @@ -376,7 +363,6 @@ 97DF259F1D6F996B001648A3 /* Network.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Network.swift; sourceTree = ""; }; 97E609F01D103DED00EBCB9D /* NotificationCenter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = NotificationCenter.framework; path = System/Library/Frameworks/NotificationCenter.framework; sourceTree = SDKROOT; }; 97E60A011D10423A00EBCB9D /* ShadowViews.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShadowViews.swift; sourceTree = ""; }; - 97E60A051D10504000EBCB9D /* LibraryBackupTBVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LibraryBackupTBVC.swift; path = "Kiwix-iOS/Controller/LibraryBackupTBVC.swift"; sourceTree = SOURCE_ROOT; }; 97E850CA1D2DA5B300A9F688 /* About.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = About.html; path = Kiwix/HelpDocuments/About.html; sourceTree = SOURCE_ROOT; }; 97F03CE11D2440470040D26E /* Search.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Search.storyboard; path = "Kiwix-iOS/Storyboard/Search.storyboard"; sourceTree = SOURCE_ROOT; }; 97FD5CE61D3D90B7001C74A2 /* getSnippet.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = getSnippet.js; sourceTree = ""; }; @@ -477,24 +463,6 @@ name = Frameworks; sourceTree = ""; }; - 970E68B31D37E1E0001E8514 /* Search */ = { - isa = PBXGroup; - children = ( - 970E68B51D37E224001E8514 /* SettingSearchHistoryTBVC.swift */, - 970E68B11D37E1DD001E8514 /* SettingSearchTuneController.swift */, - ); - name = Search; - sourceTree = ""; - }; - 970E68B41D37E1EF001E8514 /* Generic */ = { - isa = PBXGroup; - children = ( - 973DD4271D36E3E4009D45DB /* SettingSingleSwitchTBVC.swift */, - 971A10371D022C15007FC62C /* WebViewController.swift */, - ); - name = Generic; - sourceTree = ""; - }; 971187051CEB426E00B9909D /* libkiwix */ = { isa = PBXGroup; children = ( @@ -694,14 +662,6 @@ path = Bookmark; sourceTree = ""; }; - 974F42801D47E15400F8074C /* Widget */ = { - isa = PBXGroup; - children = ( - 974F42811D47E19A00F8074C /* SettingWidgetBookmarksTBVC.swift */, - ); - name = Widget; - sourceTree = ""; - }; 975227A41D020C0F001D1DDE /* indexer */ = { isa = PBXGroup; children = ( @@ -759,14 +719,12 @@ 9771DC4B1C37278E009ECFF0 /* Setting */ = { isa = PBXGroup; children = ( - 971A10411D022C54007FC62C /* SettingTBVC.swift */, - 970E68B41D37E1EF001E8514 /* Generic */, - 97C01FCA1C39B7F100D010E5 /* Library */, - 97C01FD21C39BF4E00D010E5 /* Reading */, - 970E68B31D37E1E0001E8514 /* Search */, - 974F42801D47E15400F8074C /* Widget */, + 970E7F761D9DBEA900741290 /* SettingController.swift */, + 970E7F7A1DA0069600741290 /* FontSizeController.swift */, + 973DD4271D36E3E4009D45DB /* SettingDetailController.swift */, + 970E7F781DA003FA00741290 /* WebViewController.swift */, ); - name = Setting; + path = Setting; sourceTree = ""; }; 9779C3151D4575AD0064CC8E /* Bookmarks */ = { @@ -783,10 +741,12 @@ 9787BC1F1D9318080030D311 /* Others */ = { isa = PBXGroup; children = ( - 9787BC221D9318570030D311 /* TableOfContentsController.swift */, - 9787BC201D9318300030D311 /* WelcomeController.swift */, + 970E7F7C1DA0305000741290 /* Alerts.swift */, + 970E7F7D1DA0305000741290 /* ControllerRetainer.swift */, + 970E7F7E1DA0305000741290 /* TableOfContentsController.swift */, + 970E7F7F1DA0305000741290 /* WelcomeController.swift */, ); - name = Others; + path = Others; sourceTree = ""; }; 978C58791C1CCC920077AE47 /* Supporting */ = { @@ -820,14 +780,12 @@ 978C58821C1CCDAF0077AE47 /* Controllers */ = { isa = PBXGroup; children = ( - 972659181D8AE4B400D1DFFB /* Alerts.swift */, 9749A1B21C430653000F2D1E /* Bookmark */, 97C005D41D64B369004352E8 /* Library */, 972B007D1C35DBAB00B5FDC5 /* Main */, 97E108221C5D5A0D00E27FD3 /* Search */, 9771DC4B1C37278E009ECFF0 /* Setting */, 9787BC1F1D9318080030D311 /* Others */, - 97A127C31D774C9900FB204D /* ControllerRetainer.swift */, ); name = Controllers; path = Controller; @@ -937,25 +895,6 @@ path = Library; sourceTree = ""; }; - 97C01FCA1C39B7F100D010E5 /* Library */ = { - isa = PBXGroup; - children = ( - 971A103D1D022C42007FC62C /* LibraryAutoRefreshTBVC.swift */, - 971A103E1D022C42007FC62C /* LibraryUseCellularDataTBVC.swift */, - 97E60A051D10504000EBCB9D /* LibraryBackupTBVC.swift */, - ); - name = Library; - sourceTree = ""; - }; - 97C01FD21C39BF4E00D010E5 /* Reading */ = { - isa = PBXGroup; - children = ( - 971A10391D022C2C007FC62C /* AdjustLayoutTBVC.swift */, - 971A103A1D022C2C007FC62C /* FontSizeTBVC.swift */, - ); - name = Reading; - sourceTree = ""; - }; 97DF259E1D6F9942001648A3 /* Network */ = { isa = PBXGroup; children = ( @@ -1500,16 +1439,16 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 970E7F771D9DBEA900741290 /* SettingController.swift in Sources */, 971A10311D022AD5007FC62C /* RefreshHUD.swift in Sources */, 97A1FD161D6F71CE00A80EE2 /* DirectoryMonitor.swift in Sources */, 9726591D1D90A64600D1DFFB /* Notifications.swift in Sources */, 971A102C1D022AD5007FC62C /* BarButtonItems.swift in Sources */, 971A10301D022AD5007FC62C /* LTBarButtonItem.swift in Sources */, - 971A103F1D022C42007FC62C /* LibraryAutoRefreshTBVC.swift in Sources */, 97DF25A01D6F996B001648A3 /* Network.swift in Sources */, 97A1FD391D6F724E00A80EE2 /* pathTools.cpp in Sources */, - 970E68B61D37E224001E8514 /* SettingSearchHistoryTBVC.swift in Sources */, 97C005D81D64B99E004352E8 /* LibrarySplitViewController.swift in Sources */, + 970E7F811DA0305000741290 /* ControllerRetainer.swift in Sources */, 97FDACC41D85A3B300DEDACB /* Language+CoreDataProperties.swift in Sources */, 974F33C61D99CAD700879D35 /* BookmarkOperation.swift in Sources */, 97A8AD871D6CF38000584ED1 /* EmptyTableConfigExtension.swift in Sources */, @@ -1520,31 +1459,27 @@ 97E60A021D10423A00EBCB9D /* ShadowViews.swift in Sources */, 970E68BA1D3809A3001E8514 /* MainController.swift in Sources */, 97D6813A1D6F711A00E5FA99 /* Language.swift in Sources */, + 970E7F791DA003FA00741290 /* WebViewController.swift in Sources */, 97D681401D6F712800E5FA99 /* Book+CoreDataProperties.swift in Sources */, 9764CBD31D8083AA00072D6A /* ArticleOperation.swift in Sources */, 97A1FD421D6F728200A80EE2 /* Extensions.swift in Sources */, - 974F42821D47E19A00F8074C /* SettingWidgetBookmarksTBVC.swift in Sources */, 97A1FD3A1D6F724E00A80EE2 /* reader.cpp in Sources */, 97D681381D6F711A00E5FA99 /* Book.swift in Sources */, - 970E68B21D37E1DD001E8514 /* SettingSearchTuneController.swift in Sources */, 97C005DC1D64BEFE004352E8 /* CloudBooksController.swift in Sources */, 97D681371D6F711A00E5FA99 /* Article.swift in Sources */, 97D681231D6F70AC00E5FA99 /* GlobalQueue.swift in Sources */, + 970E7F831DA0305000741290 /* WelcomeController.swift in Sources */, 97A1FD3B1D6F724E00A80EE2 /* stringTools.cpp in Sources */, 970E7F741D9DB0FC00741290 /* 1.8.xcmappingmodel in Sources */, 97A1FD321D6F723D00A80EE2 /* resourceTools.cpp in Sources */, 971A10321D022AD5007FC62C /* SearchBar.swift in Sources */, - 97E60A061D10504000EBCB9D /* LibraryBackupTBVC.swift in Sources */, 97A1FD451D6F728200A80EE2 /* StringTools.swift in Sources */, - 971A10401D022C42007FC62C /* LibraryUseCellularDataTBVC.swift in Sources */, 97D681411D6F712800E5FA99 /* DownloadTask+CoreDataProperties.swift in Sources */, 97A127CA1D777CF100FB204D /* SearchBooksController.swift in Sources */, 97D681391D6F711A00E5FA99 /* DownloadTask.swift in Sources */, - 97A127C41D774C9900FB204D /* ControllerRetainer.swift in Sources */, 97D681321D6F70EC00E5FA99 /* MigrationPolicy.swift in Sources */, 97D6811B1D6E2A7100E5FA99 /* DownloadTasksController.swift in Sources */, 9764CBD11D806AD800072D6A /* RefreshLibControl.swift in Sources */, - 971A10381D022C15007FC62C /* WebViewController.swift in Sources */, 97C601DE1D7F342100362D4F /* HTMLHeading.swift in Sources */, 975B90FE1CEB909100D13906 /* iOSExtensions.swift in Sources */, 971A10521D022D9D007FC62C /* AppDelegate.swift in Sources */, @@ -1555,35 +1490,32 @@ 97D452BE1D1723FF0033666F /* CollectionViewCells.swift in Sources */, 971A102F1D022AD5007FC62C /* Logo.swift in Sources */, 9722122B1D3FCCE200C0DCF2 /* MainControllerShowHide.swift in Sources */, + 970E7F821DA0305000741290 /* TableOfContentsController.swift in Sources */, 970722AA1D6B4D1700A45620 /* LanguageFilterController.swift in Sources */, 97A1FD191D6F71CE00A80EE2 /* ZimMultiReader.swift in Sources */, 97A127CB1D777CF100FB204D /* SearchController.swift in Sources */, 97A1FD261D6F71E200A80EE2 /* ZimReader.mm in Sources */, 97A1FD1C1D6F71D800A80EE2 /* KiwixURLProtocol.swift in Sources */, - 972659191D8AE4B400D1DFFB /* Alerts.swift in Sources */, 97D6813F1D6F712800E5FA99 /* Article+CoreDataProperties.swift in Sources */, 97A1FD171D6F71CE00A80EE2 /* Extension.swift in Sources */, - 971A103C1D022C2C007FC62C /* FontSizeTBVC.swift in Sources */, - 971A103B1D022C2C007FC62C /* AdjustLayoutTBVC.swift in Sources */, + 970E7F801DA0305000741290 /* Alerts.swift in Sources */, 97219DBD1D383A00009FDFF1 /* BookmarkHUD.swift in Sources */, 97D6812E1D6F70DE00E5FA99 /* Kiwix.xcdatamodeld in Sources */, 97A1FD1D1D6F71D800A80EE2 /* URLResponseCache.swift in Sources */, 9764F5971D8339D500E0B1C4 /* JSInjection.swift in Sources */, - 9787BC211D9318300030D311 /* WelcomeController.swift in Sources */, 97A1FD441D6F728200A80EE2 /* Preference.swift in Sources */, 97D681311D6F70EC00E5FA99 /* 1.5.xcmappingmodel in Sources */, 97D681441D6F713200E5FA99 /* CoreDataExtension.swift in Sources */, 97DF259C1D6F7613001648A3 /* BookOperation.swift in Sources */, 97A1FD181D6F71CE00A80EE2 /* SearchResult.swift in Sources */, 9763275E1D64FE0F0034F120 /* BookDetailController.swift in Sources */, - 9787BC231D9318570030D311 /* TableOfContentsController.swift in Sources */, - 973DD4281D36E3E4009D45DB /* SettingSingleSwitchTBVC.swift in Sources */, - 971A10431D022C54007FC62C /* SettingTBVC.swift in Sources */, + 973DD4281D36E3E4009D45DB /* SettingDetailController.swift in Sources */, 97D681251D6F70AC00E5FA99 /* ScanLocalBookOperation.swift in Sources */, 970E68BB1D3809A3001E8514 /* MainControllerDelegates.swift in Sources */, 97D681281D6F70AC00E5FA99 /* UpdateWidgetDataSourceOperation.swift in Sources */, 97D681241D6F70AC00E5FA99 /* RefreshLibraryOperation.swift in Sources */, 97A127C91D777CF100FB204D /* RecentSearchController.swift in Sources */, + 970E7F7B1DA0069600741290 /* FontSizeController.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Kiwix/Tools/StringTools.swift b/Kiwix/Tools/StringTools.swift index 1ef42494..366e0ce3 100644 --- a/Kiwix/Tools/StringTools.swift +++ b/Kiwix/Tools/StringTools.swift @@ -52,6 +52,8 @@ class LocalizedStrings { static let download = NSLocalizedString("Download", comment: "Common") static let bookmarks = NSLocalizedString("Bookmarks", comment: "Common") + static let search = NSLocalizedString("Search", comment: "Common") + static let done = NSLocalizedString("Done", comment: "Common") class Library { static let spaceNotEnough = NSLocalizedString("Space Not Enough", comment: "Library") diff --git a/Kiwix/ZimMultiReader/SearchResult.swift b/Kiwix/ZimMultiReader/SearchResult.swift index d7b4cb4b..9b565ec2 100644 --- a/Kiwix/ZimMultiReader/SearchResult.swift +++ b/Kiwix/ZimMultiReader/SearchResult.swift @@ -64,3 +64,16 @@ class SearchResult: CustomStringConvertible { return "(\(distance), \(probability ?? -1), \(String(format: "%.4f", score)))" } } + +class WeightFactor { + class func calculate(prob: Double) -> Double { + let m = 6.4524436415334163 + let n = 7.5576145596090623 + return caluclateLog(m: m, n: n, prob: prob) + } + + private class func caluclateLog(m m: Double, n: Double, prob: Double) -> Double { + let e = 2.718281828459 + return log(n - m * prob) / log(e) + } +}