diff --git a/apps/ios/Shared/Views/ChatList/ChatListView.swift b/apps/ios/Shared/Views/ChatList/ChatListView.swift index 66dbc7348e..3ffb5ba6d2 100644 --- a/apps/ios/Shared/Views/ChatList/ChatListView.swift +++ b/apps/ios/Shared/Views/ChatList/ChatListView.swift @@ -216,6 +216,7 @@ struct ChatListView: View { Spacer() trailingToolbarItem.padding(.bottom, padding) } + .privacySensitive(protectScreen) .contentShape(Rectangle()) .onTapGesture { scrollToSearchBar = true } } @@ -251,11 +252,13 @@ struct ChatListView: View { } @ViewBuilder var trailingToolbarItem: some View { - switch chatModel.chatRunning { - case .some(true): NewChatMenuButton() - case .some(false): chatStoppedIcon() - case .none: EmptyView() - } + Group { + switch chatModel.chatRunning { + case .some(true): NewChatMenuButton() + case .some(false): chatStoppedIcon() + case .none: EmptyView() + } + }.privacySensitive(protectScreen) } @ViewBuilder private var chatList: some View { @@ -412,6 +415,7 @@ struct SubsStatusIndicator: View { @State private var showServersSummary = false @AppStorage(DEFAULT_SHOW_SUBSCRIPTION_PERCENTAGE) private var showSubscriptionPercentage = false + @AppStorage(DEFAULT_PRIVACY_PROTECT_SCREEN) private var protectScreen = false var body: some View { Button { @@ -426,6 +430,7 @@ struct SubsStatusIndicator: View { } } .disabled(ChatModel.shared.chatRunning != true) + .privacySensitive(protectScreen) .onAppear { startTask() } diff --git a/apps/ios/Shared/Views/Helpers/LocalAuthenticationUtils.swift b/apps/ios/Shared/Views/Helpers/LocalAuthenticationUtils.swift index 6fb39ce2cf..9950d62a32 100644 --- a/apps/ios/Shared/Views/Helpers/LocalAuthenticationUtils.swift +++ b/apps/ios/Shared/Views/Helpers/LocalAuthenticationUtils.swift @@ -65,14 +65,15 @@ func systemAuthenticate(_ reason: String, _ completed: @escaping (LAResult) -> V logger.debug("DEBUGGING: systemAuthenticate: canEvaluatePolicy callback") AppSheetState.shared.biometricAuth = true laContext.evaluatePolicy(.deviceOwnerAuthentication, localizedReason: reason) { success, authError in - AppSheetState.shared.biometricAuth = false logger.debug("DEBUGGING: systemAuthenticate evaluatePolicy callback") DispatchQueue.main.async { if success { completed(LAResult.success) + AppSheetState.shared.biometricAuth = false } else { logger.error("DEBUGGING: systemAuthenticate authentication error: \(authError.debugDescription)") completed(LAResult.failed(authError: authError?.localizedDescription)) + AppSheetState.shared.biometricAuth = false } } } diff --git a/apps/ios/Shared/Views/UserSettings/UserProfilesView.swift b/apps/ios/Shared/Views/UserSettings/UserProfilesView.swift index 8ac1b704db..e7c9661352 100644 --- a/apps/ios/Shared/Views/UserSettings/UserProfilesView.swift +++ b/apps/ios/Shared/Views/UserSettings/UserProfilesView.swift @@ -59,8 +59,10 @@ struct UserProfilesView: View { userProfilesView() } else { Button(action: runAuth) { Label("Unlock", systemImage: "lock") } - // TODO: Prevent Feedback loop -// .onAppear(perform: runAuth) + .onAppear { + // `scenePhase` check Prevents a feedback loop + if AppSheetState.shared.scenePhaseActive { runAuth() } + } } }