diff --git a/Kiwix-iOS/Controller/Setting/FontSizeController.swift b/Kiwix-iOS/Controller/Setting/FontSizeController.swift
new file mode 100644
index 00000000..62d110d4
--- /dev/null
+++ b/Kiwix-iOS/Controller/Setting/FontSizeController.swift
@@ -0,0 +1,74 @@
+//
+// FontSizeController.swift
+// Kiwix
+//
+// Created by Chris Li on 1/20/17.
+// Copyright © 2017 Chris Li. All rights reserved.
+//
+
+import UIKit
+
+class FontSizeController: UIViewController, UITableViewDelegate, UITableViewDataSource {
+
+ @IBOutlet weak var label: UILabel!
+ @IBOutlet weak var visiualView: UIVisualEffectView!
+ @IBOutlet weak var tableView: UITableView!
+
+ private(set) var selected = Preference.webViewZoomScale
+ let percentages = [0.75, 0.8, 0.85, 0.9, 0.95, 1.0, 1.05, 1.10, 1.15, 1.20, 1.30, 1.40, 1.50, 1.75, 2.0]
+ let percentageFormatter: NumberFormatter = {
+ let formatter = NumberFormatter()
+ formatter.numberStyle = .percent
+ formatter.maximumFractionDigits = 0
+ formatter.maximumIntegerDigits = 3
+ return formatter
+ }()
+
+ override func viewWillDisappear(_ animated: Bool) {
+ super.viewWillDisappear(animated)
+ Preference.webViewZoomScale = selected
+ }
+
+ override func viewDidLayoutSubviews() {
+ super.viewDidLayoutSubviews()
+ let topInset = (navigationController?.navigationBar.frame.height ?? 0) + visiualView.frame.height
+ tableView.contentInset = UIEdgeInsets(top: topInset, left: 0, bottom: 0, right: 0)
+ tableView.scrollIndicatorInsets = tableView.contentInset
+ tableView.scrollRectToVisible(CGRect(x: 0, y: 0, width: 1, height: 1), animated: false)
+ }
+
+ // MARK: - UITableViewDataSource
+
+ func numberOfSections(in tableView: UITableView) -> Int {
+ return 1
+ }
+
+ func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+ return percentages.count
+ }
+
+ func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
+ let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
+ cell.textLabel?.text = percentageFormatter.string(from: NSNumber(value: percentages[indexPath.row]))
+ cell.accessoryType = percentages[indexPath.row] == selected ? .checkmark : .none
+ return cell
+ }
+
+ // MARK: - UITableViewDelegate
+
+ func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
+ tableView.deselectRow(at: indexPath, animated: true)
+
+ var indexPaths = [indexPath]
+
+ if let previousIndex = percentages.index(of: selected) {
+ indexPaths.append(IndexPath(row: previousIndex, section: 0))
+ }
+
+ selected = percentages[indexPath.row]
+ tableView.reloadRows(at: indexPaths, with: .automatic)
+ label.font = UIFont.systemFont(ofSize: CGFloat(14.0 * percentages[indexPath.row]))
+ }
+
+
+}
diff --git a/Kiwix-iOS/Controller/Setting/NotificationSettingController.swift b/Kiwix-iOS/Controller/Setting/NotificationSettingController.swift
new file mode 100644
index 00000000..0b223f16
--- /dev/null
+++ b/Kiwix-iOS/Controller/Setting/NotificationSettingController.swift
@@ -0,0 +1,95 @@
+//
+// NotificationSettingController.swift
+// Kiwix
+//
+// Created by Chris Li on 1/20/17.
+// Copyright © 2017 Chris Li. All rights reserved.
+//
+
+import UIKit
+
+class NotificationSettingController: 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 numberOfSections(in 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
+ }
+
+ /*
+ override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
+ let cell = tableView.dequeueReusableCell(withIdentifier: "reuseIdentifier", for: indexPath)
+
+ // Configure the cell...
+
+ return cell
+ }
+ */
+
+ /*
+ // Override to support conditional editing of the table view.
+ override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
+ // Return false if you do not want the specified item to be editable.
+ return true
+ }
+ */
+
+ /*
+ // Override to support editing the table view.
+ override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
+ if editingStyle == .delete {
+ // Delete the row from the data source
+ tableView.deleteRows(at: [indexPath], with: .fade)
+ } else if editingStyle == .insert {
+ // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
+ }
+ }
+ */
+
+ /*
+ // Override to support rearranging the table view.
+ override func tableView(_ tableView: UITableView, moveRowAt fromIndexPath: IndexPath, to: IndexPath) {
+
+ }
+ */
+
+ /*
+ // Override to support conditional rearranging of the table view.
+ override func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool {
+ // Return false if you do not want the item to be re-orderable.
+ return true
+ }
+ */
+
+ /*
+ // MARK: - Navigation
+
+ // In a storyboard-based application, you will often want to do a little preparation before navigation
+ override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
+ // Get the new view controller using segue.destinationViewController.
+ // Pass the selected object to the new view controller.
+ }
+ */
+
+}
diff --git a/Kiwix-iOS/Controller/Setting/SettingController.swift b/Kiwix-iOS/Controller/Setting/SettingController.swift
index 301e7d42..f69e6d38 100644
--- a/Kiwix-iOS/Controller/Setting/SettingController.swift
+++ b/Kiwix-iOS/Controller/Setting/SettingController.swift
@@ -15,6 +15,14 @@ class SettingController: UITableViewController {
let rows = [[Localized.Setting.fontSize, Localized.Setting.notifications],
[Localized.Setting.feedback, Localized.Setting.rateApp],
[Localized.Setting.about]]
+
+ let percentageFormatter: NumberFormatter = {
+ let formatter = NumberFormatter()
+ formatter.numberStyle = .percent
+ formatter.maximumFractionDigits = 0
+ formatter.maximumIntegerDigits = 3
+ return formatter
+ }()
override func viewDidLoad() {
super.viewDidLoad()
@@ -37,7 +45,14 @@ class SettingController: UITableViewController {
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
- cell.textLabel?.text = rows[indexPath.section][indexPath.row]
+ let text = rows[indexPath.section][indexPath.row]
+ cell.textLabel?.text = text
+ switch text {
+ case Localized.Setting.fontSize:
+ cell.detailTextLabel?.text = percentageFormatter.string(from: NSNumber(value: Preference.webViewZoomScale))
+ default:
+ cell.detailTextLabel?.text = nil
+ }
return cell
}
@@ -47,6 +62,10 @@ class SettingController: UITableViewController {
tableView.deselectRow(at: indexPath, animated: true)
let text = rows[indexPath.section][indexPath.row]
switch text {
+ case Localized.Setting.fontSize:
+ let controller = UIStoryboard(name: "Setting", bundle: nil).instantiateViewController(withIdentifier: "FontSizeController") as! FontSizeController
+ controller.title = Localized.Setting.fontSize
+ navigationController?.pushViewController(controller, animated: true)
case Localized.Setting.feedback:
if MFMailComposeViewController.canSendMail() {
UIQueue.shared.add(operation: FeedbackMailOperation(context: self))
@@ -90,6 +109,11 @@ extension Localized {
static let about = NSLocalizedString("About", comment: "Setting table rows")
static let version = NSLocalizedString("Kiwix for iOS v%@", comment: "Setting table footer")
+ class Notification {
+ static let libraryRefresh = NSLocalizedString("Library Refresh", comment: "Notification Setting")
+ static let bookUpdatesAvailable = NSLocalizedString("Book Updates Available", comment: "Notification Setting")
+ }
+
class Feedback {
static let subject = NSLocalizedString(String(format: "Feedback: Kiwix for iOS %@", Bundle.appShortVersion),
comment: "Feedback email composer subject, %@ will be replaced by kiwix version string")
diff --git a/Kiwix-iOS/Storyboard/Setting.storyboard b/Kiwix-iOS/Storyboard/Setting.storyboard
index 964966d9..8bcc69f0 100644
--- a/Kiwix-iOS/Storyboard/Setting.storyboard
+++ b/Kiwix-iOS/Storyboard/Setting.storyboard
@@ -18,7 +18,7 @@
-
+
@@ -26,7 +26,14 @@
+