From b7e7ee073664d254a36785c2a353b37c164016aa Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Fri, 17 Feb 2023 13:30:45 +0100 Subject: [PATCH] Composer: Fix account switcher in share sheet --- IceCubesApp/App/AppRouter.swift | 1 + Packages/Status/Sources/Status/Editor/StatusEditorView.swift | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/IceCubesApp/App/AppRouter.swift b/IceCubesApp/App/AppRouter.swift index 44ba33ad..583de5a4 100644 --- a/IceCubesApp/App/AppRouter.swift +++ b/IceCubesApp/App/AppRouter.swift @@ -103,5 +103,6 @@ extension View { .environmentObject(Theme.shared) .environmentObject(AppAccountsManager.shared) .environmentObject(PushNotificationsService.shared) + .environmentObject(AppAccountsManager.shared.currentClient) } } diff --git a/Packages/Status/Sources/Status/Editor/StatusEditorView.swift b/Packages/Status/Sources/Status/Editor/StatusEditorView.swift index 99894c42..c1d5d6d8 100644 --- a/Packages/Status/Sources/Status/Editor/StatusEditorView.swift +++ b/Packages/Status/Sources/Status/Editor/StatusEditorView.swift @@ -12,7 +12,7 @@ import UIKit import StoreKit public struct StatusEditorView: View { - @EnvironmentObject private var appAccounnt: AppAccountsManager + @EnvironmentObject private var appAccounts: AppAccountsManager @EnvironmentObject private var preferences: UserPreferences @EnvironmentObject private var theme: Theme @EnvironmentObject private var client: Client @@ -161,9 +161,10 @@ public struct StatusEditorView: View { } } .interactiveDismissDisabled(!viewModel.shouldDisplayDismissWarning) - .onChange(of: appAccounnt.currentClient) { newClient in + .onChange(of: appAccounts.currentClient) { newClient in if viewModel.mode.isInShareExtension { currentAccount.setClient(client: newClient) + viewModel.client = newClient } } }