mirror of
https://github.com/TermiT/Flycut.git
synced 2025-10-06 03:46:31 +08:00
Detect iCloud sync errors due to not being signed in or not having iCloud Drive enabled and inform the user giving option to open Settings. If the user declines to open Settings do not ask again this until app is closed and opens again.
This commit is contained in:
parent
8f634d41a9
commit
82350d9fda
1 changed files with 26 additions and 1 deletions
|
@ -8,7 +8,7 @@
|
|||
|
||||
import UIKit
|
||||
|
||||
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, FlycutStoreDelegate, FlycutOperatorDelegate {
|
||||
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, FlycutStoreDelegate, FlycutOperatorDelegate, MJCloudKitUserDefaultsSyncDelegate {
|
||||
|
||||
let flycut:FlycutOperator = FlycutOperator()
|
||||
var activeUpdates:Int = 0
|
||||
|
@ -17,6 +17,7 @@ class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSour
|
|||
var pbCount:Int = -1
|
||||
var rememberedSyncSettings:Bool = false
|
||||
var rememberedSyncClippings:Bool = false
|
||||
var ignoreCKAccountStatusNoAccount = false
|
||||
|
||||
let pasteboardInteractionQueue = DispatchQueue(label: "com.Flycut.pasteboardInteractionQueue")
|
||||
let alertHandlingSemaphore = DispatchSemaphore(value: 0)
|
||||
|
@ -37,6 +38,8 @@ class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSour
|
|||
// Use this command to get screenshots:
|
||||
// while true; do xcrun simctl io booted screenshot;sleep 1;done
|
||||
|
||||
MJCloudKitUserDefaultsSync.setDelegate(self)
|
||||
|
||||
if ( UserDefaults.standard.bool(forKey: "demoForAppStoreScreenshots") )
|
||||
{
|
||||
// Ensure we will not load or save clippings in demo mode.
|
||||
|
@ -440,5 +443,27 @@ class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSour
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func notifyCKAccountStatusNoAccount() {
|
||||
if ( !ignoreCKAccountStatusNoAccount )
|
||||
{
|
||||
let alert = UIAlertController(title: "No iCloud Account", message: "An iCloud account with iCloud Drive enabled is required for iCloud sync.", preferredStyle: .alert)
|
||||
alert.addAction(UIAlertAction(title: "Preferences", style: .default, handler: { (_) in
|
||||
if #available(iOS 10.0, *)
|
||||
{
|
||||
// Opens iCloud Prefs < iOS 11.0, main Prefs >= iOS 11.0
|
||||
UIApplication.shared.openURL(URL(string: "App-Prefs:root=CASTLE")!)
|
||||
}
|
||||
else
|
||||
{
|
||||
UIApplication.shared.openURL(URL(string: "prefs:root=CASTLE")!)
|
||||
}
|
||||
}))
|
||||
alert.addAction(UIAlertAction(title: "Ignore", style: .cancel, handler: { (_) in
|
||||
self.ignoreCKAccountStatusNoAccount = true
|
||||
}))
|
||||
self.present(alert, animated: true, completion: nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue