From a6cdfdabed4065a70c9a1689d49ba95c7d7ba3f3 Mon Sep 17 00:00:00 2001 From: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com> Date: Tue, 18 Feb 2025 10:59:13 -0500 Subject: [PATCH] setting: fix display of account state This patch ensures the account state is displayed properly: online, offline, or connecting. Change-Id: I9db1b394062edd9dfa9eb2a3c94b2e8d93ada6e6 --- .../Features/Settings/Me/AccountSummaryVM.swift | 3 +-- .../Settings/Me/AccountSummaryView.swift | 16 +++++++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Ring/Ring/Features/Settings/Me/AccountSummaryVM.swift b/Ring/Ring/Features/Settings/Me/AccountSummaryVM.swift index c7a7bb1bb..fcc2d30ed 100644 --- a/Ring/Ring/Features/Settings/Me/AccountSummaryVM.swift +++ b/Ring/Ring/Features/Settings/Me/AccountSummaryVM.swift @@ -180,8 +180,7 @@ extension AccountSummaryVM { self.accountService.sharedResponseStream .filter({ [weak self] serviceEvent in guard let self = self else { return false } - guard serviceEvent - .getEventInput(ServiceEventInput.registrationState) != nil else { return false } + guard serviceEvent.getEventInput(ServiceEventInput.registrationState) as String? != nil else { return false } guard let accountId: String = serviceEvent .getEventInput(ServiceEventInput.accountId), accountId == self.account.id else { return false } diff --git a/Ring/Ring/Features/Settings/Me/AccountSummaryView.swift b/Ring/Ring/Features/Settings/Me/AccountSummaryView.swift index 1ed72d02b..cd4ff1c72 100644 --- a/Ring/Ring/Features/Settings/Me/AccountSummaryView.swift +++ b/Ring/Ring/Features/Settings/Me/AccountSummaryView.swift @@ -47,11 +47,17 @@ struct AccountSummaryView: View { profileSection() Section(header: Text(L10n.AccountPage.accountHeader)) { - ToggleCell( - toggleText: L10n.Account.statusOnline, - getAction: { model.accountEnabled }, - setAction: { newValue in model.enableAccount(enable: newValue) } - ) + HStack { + Text(model.accountStatus) + Spacer() + Toggle("", isOn: Binding( + get: { model.accountEnabled }, + set: { newValue in model.enableAccount(enable: newValue) } + )) + .labelsHidden() + .toggleStyle(SwitchToggleStyle(tint: Color.jamiColor)) + } + .accessibilityElement(children: .combine) } if model.account.type == .sip { -- GitLab