Backup Contacts
TBD: (!) Нет описания как работать с пермишнами нужно вынести в отдельную страницу
Manual Backup
TBD: Описание что такое Manual backup
To backup user contacts, you need to call:
CloudikeContacts.shared.backupProcessor.backupNow { (success, error) in }
Monitoring
TBD: Описание прогресса бэкапа, стрктура нотификаций и значение
To monitor backup status, you need to call:
CloudikeContacts.shared.backupProcessor.registerObserver(observer)
To cancel monitoring, you need to call:
CloudikeContacts.shared.backupProcessor.unregisterObserver(observer)
The following example shows how to do that:
class BackupHomeViewController: UIViewController {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
CloudikeContacts.shared.backupProcessor.registerObserver(self)
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
CloudikeContacts.shared.backupProcessor.unregisterObserver(self)
}
}
extension BackupHomeViewController: BackupObserver {
func backupStateChanged(state: BackupProcessor.BackupState) {
// your implementation
}
}
Planned Backup
TBD: Описание что такое planned backup
For control the planned backup, you can change the BackupFrequency value:
CloudikeContacts.shared.plannedBackupProcessor.backupFrequency = .daily
TBD: Доступные опции backupFrequency или ссылка на References
TBD: Описание для чего нужно вызывать checkNeedBackup()
To check if a backup is required, you have to call the method after the application start (and after initialisation library):
CloudikeContacts.shared.plannedBackupProcessor.checkNeedBackup()
TBD: Разобраться что это за нотификация
To start the planned backup, you need to call: didReceiveNotificationResponse()
after notification is clicked.
The following example shows how to do that:
extension NotificationService : UNUserNotificationCenterDelegate {
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
if CloudikeContacts.shared.plannedBackupProcessor.willPresentNotification(notification, completionHandler: completionHandler) {
return
}
completionHandler([.sound, .alert])
}
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
if CloudikeContacts.shared.plannedBackupProcessor.didReceiveNotificationResponse(response, completionHandler: completionHandler) {
return
}
completionHandler()
}
}