diff --git a/Ring/Ring/AppDelegate.swift b/Ring/Ring/AppDelegate.swift index d9c2d47054944ed89a376961227b8ea1ec785a48..9a529c39b84a449813f2aade24f1e21fdbf9ad4c 100644 --- a/Ring/Ring/AppDelegate.swift +++ b/Ring/Ring/AppDelegate.swift @@ -168,9 +168,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD .subscribe(onCompleted: { //set selected account if exists self.appCoordinator.start() - for account in self.accountService.accounts { - self.accountService.setDetails(forAccountId: account.id) - } if self.accountService.hasAccountWithProxyEnabled() { self.registerVoipNotifications() } else { @@ -239,7 +236,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD func prepareVideoAcceleration() { // we want enable hardware acceleration by default so if key does not exists, - // means it was not disabled by user + // means it was not disabled by user let keyExists = UserDefaults.standard.object(forKey: hardareAccelerationKey) != nil let enable = keyExists ? UserDefaults.standard.bool(forKey: hardareAccelerationKey) : true self.videoService.setHardwareAccelerated(withState: enable) @@ -296,7 +293,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD private func unregisterVoipNotifications() { self.voipRegistry.desiredPushTypes = nil - self.accountService.savePushToken(token: "") self.accountService.setPushNotificationToken(token: "") } @@ -436,7 +432,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD extension AppDelegate: PKPushRegistryDelegate { func pushRegistry(_ registry: PKPushRegistry, didInvalidatePushTokenFor type: PKPushType) { - self.accountService.savePushToken(token: "") self.accountService.setPushNotificationToken(token: "") } @@ -455,7 +450,6 @@ extension AppDelegate: PKPushRegistryDelegate { func pushRegistry(_ registry: PKPushRegistry, didUpdate pushCredentials: PKPushCredentials, for type: PKPushType) { if type == PKPushType.voIP { let deviceTokenString = pushCredentials.token.map { String(format: "%02.2hhx", $0) }.joined() - self.accountService.savePushToken(token: deviceTokenString) self.accountService.setPushNotificationToken(token: deviceTokenString) } } diff --git a/Ring/Ring/Services/AccountsService.swift b/Ring/Ring/Services/AccountsService.swift index e5169c916f7ab7d6dab687dcfd45ae254631308f..5769f4aa4c2b2ce4439551efc76ced038ddbd591 100644 --- a/Ring/Ring/Services/AccountsService.swift +++ b/Ring/Ring/Services/AccountsService.swift @@ -522,24 +522,6 @@ class AccountsService: AccountAdapterDelegate { return result } - func setDetails(forAccountId accountId: String) { - let details = self.getAccountDetails(fromAccountId: accountId) - let filename = "" - if details - .get(withConfigKeyModel: ConfigKeyModel(withKey: ConfigKey.ringtonePath)) == filename && - details - .get(withConfigKeyModel: ConfigKeyModel(withKey: ConfigKey.ringtoneEnabled)) == "false" { - return - } - details - .set(withConfigKeyModel: ConfigKeyModel(withKey: ConfigKey.ringtonePath), - withValue: filename) - details - .set(withConfigKeyModel: ConfigKeyModel(withKey: ConfigKey.ringtoneEnabled), - withValue: "false") - setAccountDetails(forAccountId: accountId, withDetails: details) - } - /** Gets an account from the list of accounts handled by the application. @@ -696,6 +678,7 @@ class AccountsService: AccountAdapterDelegate { accountDetails!.updateValue("true", forKey: ConfigKey.videoEnabled.rawValue) accountDetails!.updateValue(accountType, forKey: ConfigKey.accountType.rawValue) accountDetails!.updateValue("true", forKey: ConfigKey.accountUpnpEnabled.rawValue) + accountDetails!.updateValue("false", forKey: ConfigKey.ringtoneEnabled.rawValue) return accountDetails! } @@ -892,14 +875,6 @@ class AccountsService: AccountAdapterDelegate { return proxyEnabled } - func savePushToken(token: String) { - for account in accounts { - let accountDetails = self.getAccountDetails(fromAccountId: account.id) - accountDetails.set(withConfigKeyModel: ConfigKeyModel(withKey: ConfigKey.devicePushToken), withValue: token) - self.setAccountDetails(forAccountId: account.id, withDetails: accountDetails) - } - } - func proxyEnabled(accountID: String) -> Variable<Bool> { let variable = Variable<Bool>(getCurrentProxyState(accountID: accountID)) self.sharedResponseStream