From 265dcb9e66e02bdbc5639702b02a3839ffe62c00 Mon Sep 17 00:00:00 2001 From: Chris Li Date: Thu, 15 Sep 2016 15:43:21 -0400 Subject: [PATCH] NetworkRequiredAlert --- Kiwix-iOS/Controller/Alerts.swift | 12 ++++++++++-- .../Controller/Library/CloudBooksController.swift | 8 ++------ Kiwix-iOS/Info.plist | 2 +- Kiwix-iOSWidgets/Bookmarks/Info.plist | 2 +- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Kiwix-iOS/Controller/Alerts.swift b/Kiwix-iOS/Controller/Alerts.swift index a1f3509a..f00d3cee 100644 --- a/Kiwix-iOS/Controller/Alerts.swift +++ b/Kiwix-iOS/Controller/Alerts.swift @@ -12,7 +12,6 @@ import Operations class SpaceNotEnoughAlert: AlertOperation { init(context: UIViewController) { super.init(presentAlertFrom: context) - title = LocalizedStrings.Library.spaceNotEnough message = NSLocalizedString("Please free up some space and try again.", comment: "Library, Space Alert") addActionWithTitle(LocalizedStrings.cancel) @@ -44,7 +43,16 @@ class RemoveBookConfirmationAlert: AlertOperation { let operation = RemoveBookOperation(bookID: bookID) GlobalQueue.shared.addOperation(operation) } - addActionWithTitle(LocalizedStrings.cancel) + addActionWithTitle(LocalizedStrings.ok) preferredAction = actions[0] } } + +class NetworkRequiredAlert: AlertOperation { + init(context: UIViewController) { + super.init(presentAlertFrom: context) + title = NSLocalizedString("Network Required", comment: "Network Required Alert") + message = NSLocalizedString("Unable to connect to server. Please check your Internet connection.", comment: "Network Required Alert") + addActionWithTitle(LocalizedStrings.cancel) + } +} diff --git a/Kiwix-iOS/Controller/Library/CloudBooksController.swift b/Kiwix-iOS/Controller/Library/CloudBooksController.swift index c68e378b..e5794303 100644 --- a/Kiwix-iOS/Controller/Library/CloudBooksController.swift +++ b/Kiwix-iOS/Controller/Library/CloudBooksController.swift @@ -133,12 +133,8 @@ class CloudBooksController: UITableViewController, NSFetchedResultsControllerDel } func showReachibilityAlert() { - let cancel = UIAlertAction(title: LocalizedStrings.Common.ok, style: .Cancel, handler: nil) - let alertController = UIAlertController(title: NSLocalizedString("Network Required", comment: "Network Required Alert"), - message: NSLocalizedString("Unable to connect to server. Please check your Internet connection.", comment: "Network Required Alert"), - preferredStyle: .Alert) - alertController.addAction(cancel) - self.presentViewController(alertController, animated: true, completion: nil) + let operation = NetworkRequiredAlert(context: self) + GlobalQueue.shared.addOperation(operation) } func showLanguageFilterAlert() { diff --git a/Kiwix-iOS/Info.plist b/Kiwix-iOS/Info.plist index 63360c27..4e71dd87 100644 --- a/Kiwix-iOS/Info.plist +++ b/Kiwix-iOS/Info.plist @@ -49,7 +49,7 @@ CFBundleVersion - 1.8.649 + 1.8.652 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/Kiwix-iOSWidgets/Bookmarks/Info.plist b/Kiwix-iOSWidgets/Bookmarks/Info.plist index 2770278f..45e5b369 100644 --- a/Kiwix-iOSWidgets/Bookmarks/Info.plist +++ b/Kiwix-iOSWidgets/Bookmarks/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 1.8.652 + 1.8.655 NSExtension NSExtensionMainStoryboard