From fa6e0e74f68fc61d4cf6f64f6a199590dc98d6c0 Mon Sep 17 00:00:00 2001 From: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com> Date: Wed, 12 Aug 2020 15:22:38 -0400 Subject: [PATCH] jams: fix save profile When profile updated signal received, client may not have account yet. This patch fetch account details from daemon to save profile. Change-Id: Ie41054f7c2c114dddf04aceea8dc0467ec4c244f --- Ring/Ring/Services/AccountsService.swift | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Ring/Ring/Services/AccountsService.swift b/Ring/Ring/Services/AccountsService.swift index dc3f27de1..ed03f85e3 100644 --- a/Ring/Ring/Services/AccountsService.swift +++ b/Ring/Ring/Services/AccountsService.swift @@ -850,10 +850,14 @@ class AccountsService: AccountAdapterDelegate { name = accountDetails.get(withConfigKeyModel: ConfigKeyModel(withKey: ConfigKey.displayName)) } - guard let accountToUpdate = self.getAccount(fromAccountId: account), - let accountURI = AccountModelHelper - .init(withAccount: accountToUpdate).uri else {return} - _ = self.dbManager.saveAccountProfile(alias: name, photo: photo, accountId: account, accountURI: accountURI) + self.getAccountFromDaemon(fromAccountId: account) + .subscribe(onSuccess: { [weak self] accountToUpdate in + guard let self = self, let accountURI = AccountModelHelper + .init(withAccount: accountToUpdate).uri else { + return + } + _ = self.dbManager.saveAccountProfile(alias: name, photo: photo, accountId: account, accountURI: accountURI) + }).disposed(by: self.disposeBag) } // MARK: Push Notifications -- GitLab