diff options
author | jan Iversen <jani@libreoffice.org> | 2017-10-27 19:37:53 +0200 |
---|---|---|
committer | jan Iversen <jani@libreoffice.org> | 2017-10-27 20:08:46 +0200 |
commit | 77663321f096d60dc6ff34b2e2ab209db99cda72 (patch) | |
tree | 1e782a6f18852782752e4940df673b63477da8c4 /ios | |
parent | 794120f5c62c80eba810a08d089ed5321b993579 (diff) |
iOS online check for iCloud
Added check for active iCloud during startup
as well as when returning from background.
Change-Id: I4481a4cc7814540da98c4c432fe04543316fa7aa
Diffstat (limited to 'ios')
3 files changed, 13 insertions, 10 deletions
diff --git a/ios/LibreOfficeLight/LibreOfficeLight/AppDelegate.swift b/ios/LibreOfficeLight/LibreOfficeLight/AppDelegate.swift index b77f53ece586..bb44f98d1ec3 100644 --- a/ios/LibreOfficeLight/LibreOfficeLight/AppDelegate.swift +++ b/ios/LibreOfficeLight/LibreOfficeLight/AppDelegate.swift @@ -9,6 +9,8 @@ import UIKit import Foundation +var isCloudEnabled : Bool = false + @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate @@ -72,16 +74,16 @@ class AppDelegate: UIResponder, UIApplicationDelegate func applicationWillEnterForeground(_ application: UIApplication) { - // Called as part of the transition from the background to the active state; - // here you can undo many of the changes made on entering the background. - - //JIX add code to check iCloud again + // test if iCloud is still enabled + isCloudEnabled = (FileManager.default.ubiquityIdentityToken != nil) } func applicationDidBecomeActive(_ application: UIApplication) { + // test if iCloud is still enabled + isCloudEnabled = (FileManager.default.ubiquityIdentityToken != nil) } diff --git a/ios/LibreOfficeLight/LibreOfficeLight/DocumentController.swift b/ios/LibreOfficeLight/LibreOfficeLight/DocumentController.swift index 1d02c01bb364..82b3613cc789 100755 --- a/ios/LibreOfficeLight/LibreOfficeLight/DocumentController.swift +++ b/ios/LibreOfficeLight/LibreOfficeLight/DocumentController.swift @@ -13,7 +13,7 @@ class DocumentController: UIViewController, MenuDelegate, UIDocumentPickerDelega { var currentDocumentName : String? var currentCloudUrl : URL? - var currentStorageLocal : Bool = false + var currentStorageLocal : Bool = true public func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentAt url: URL) @@ -75,8 +75,10 @@ class DocumentController: UIViewController, MenuDelegate, UIDocumentPickerDelega @IBAction func doSelectStorage(_ sender: UIBarButtonItem) { - currentStorageLocal = !currentStorageLocal - sender.image = currentStorageLocal ? #imageLiteral(resourceName: "iCloudDrive") : #imageLiteral(resourceName: "iPhone") + if isCloudEnabled { + currentStorageLocal = !currentStorageLocal + sender.image = currentStorageLocal ? #imageLiteral(resourceName: "iCloudDrive") : #imageLiteral(resourceName: "iPhone") + } self.presentedViewController?.dismiss(animated: true, completion: nil) } @@ -95,7 +97,6 @@ class DocumentController: UIViewController, MenuDelegate, UIDocumentPickerDelega - func actionName(_ name : String) { currentDocumentName = name diff --git a/ios/LibreOfficeLight/LibreOfficeLight/en.lproj/Main.storyboard b/ios/LibreOfficeLight/LibreOfficeLight/en.lproj/Main.storyboard index 299547157e8c..aa0295e021c5 100755 --- a/ios/LibreOfficeLight/LibreOfficeLight/en.lproj/Main.storyboard +++ b/ios/LibreOfficeLight/LibreOfficeLight/en.lproj/Main.storyboard @@ -41,7 +41,7 @@ <action selector="doMenu:" destination="vXZ-lx-hvc" id="mHw-Uf-vh2"/> </connections> </barButtonItem> - <barButtonItem image="iCloudDrive" id="BNN-MQ-25d" userLabel="Button Select Storage"> + <barButtonItem image="iPhone" id="BNN-MQ-25d" userLabel="Button Select Storage"> <connections> <action selector="doSelectStorage:" destination="vXZ-lx-hvc" id="77L-yW-vcR"/> </connections> @@ -583,7 +583,7 @@ </scenes> <resources> <image name="document" width="20" height="20"/> - <image name="iCloudDrive" width="22" height="22"/> + <image name="iPhone" width="18" height="37"/> <image name="menu" width="22" height="22"/> </resources> </document> |