Logout
When a user logs out from the app use below method to logout the user from Kommunicate.
Kommunicate.logoutUser { (result) in
switch result {
case .success(_):
print("Logout success")
case .failure( _):
print("Logout failure, now registering remote notifications(if not registered)")
if !UIApplication.shared.isRegisteredForRemoteNotifications {
UNUserNotificationCenter.current().requestAuthorization(options:[.badge, .alert, .sound]) { (granted, error) in
if granted {
DispatchQueue.main.async {
UIApplication.shared.registerForRemoteNotifications()
}
}
}
}
}
}