Swiftify code, ignore session state

Signed-off-by: ismailgulek <gulekismail@gmail.com>
This commit is contained in:
ismailgulek
2020-05-25 21:20:31 +03:00
parent 9331d9ecf1
commit e900a895b3

View File

@@ -161,25 +161,21 @@ class NotificationService: UNNotificationServiceExtension {
if userAccount.mxSession == nil {
userAccount.openSession(with: store)
}
let sessionState = userAccount.mxSession.state
if sessionState == MXSessionStateInitialised || sessionState == MXSessionStatePaused {
userAccount.initialBackgroundSync(20000, success: { [weak self] in
guard let self = self else {
NSLog("[NotificationService] Fallback case 12")
return
}
self.fetchEvent()
}) { [weak self] (error) in
guard let self = self else {
NSLog("[NotificationService] Fallback case 11")
return
}
NSLog("[NotificationService] Fallback case 6")
self.fallbackToOriginalContent()
// launch an initial background sync
userAccount.initialBackgroundSync(20000, success: { [weak self] in
guard let self = self else {
NSLog("[NotificationService] Fallback case 12")
return
}
} else {
NSLog("[NotificationService] Fallback case 8")
fallbackToOriginalContent()
self.fetchEvent()
}) { [weak self] (error) in
guard let self = self else {
NSLog("[NotificationService] Fallback case 11")
return
}
NSLog("[NotificationService] Fallback case 6")
self.fallbackToOriginalContent()
}
}