diff --git a/apps/ios/Shared/Views/Onboarding/ChooseServerOperators.swift b/apps/ios/Shared/Views/Onboarding/ChooseServerOperators.swift index 0c3106eaeb..565ce51413 100644 --- a/apps/ios/Shared/Views/Onboarding/ChooseServerOperators.swift +++ b/apps/ios/Shared/Views/Onboarding/ChooseServerOperators.swift @@ -10,12 +10,14 @@ import SwiftUI import SimpleXChat struct OnboardingButtonStyle: ButtonStyle { + @EnvironmentObject var theme: AppTheme + func makeBody(configuration: Configuration) -> some View { configuration.label .font(.system(size: 17, weight: .semibold)) .padding() .frame(maxWidth: .infinity) // Makes button stretch horizontally - .background(Color.blue) // Apple blue color + .background(theme.colors.primary) // Apple blue color .foregroundColor(.white) // White text color .cornerRadius(10) // Rounded corners .scaleEffect(configuration.isPressed ? 0.95 : 1.0) // Slight scale effect on press @@ -30,6 +32,7 @@ struct ChooseServerOperators: View { @State private var selectedOperators = Set() @State private var customServersNavLinkActive = false @State private var reviewConditionsNavLinkActive = false + @State private var justOpened = true var body: some View { NavigationView { @@ -62,8 +65,11 @@ struct ChooseServerOperators: View { .frame(maxHeight: .infinity) .padding() .onAppear { - serverOperators = ChatModel.shared.serverOperators - selectedOperators = Set(serverOperators.filter { $0.enabled }.map { $0.operatorId }) + if justOpened { + serverOperators = ChatModel.shared.serverOperators + selectedOperators = Set(serverOperators.filter { $0.enabled }.map { $0.operatorId }) + justOpened = false + } } .sheet(isPresented: $showInfoSheet) { ChooseServerOperatorsInfoView() diff --git a/apps/ios/Shared/Views/Onboarding/SetNotificationsMode.swift b/apps/ios/Shared/Views/Onboarding/SetNotificationsMode.swift index 7681a42a77..c498280ce7 100644 --- a/apps/ios/Shared/Views/Onboarding/SetNotificationsMode.swift +++ b/apps/ios/Shared/Views/Onboarding/SetNotificationsMode.swift @@ -15,41 +15,43 @@ struct SetNotificationsMode: View { @State private var showAlert: NotificationAlert? var body: some View { - ScrollView { - VStack(alignment: .leading, spacing: 16) { - Text("Push notifications") - .font(.largeTitle) - .bold() - .frame(maxWidth: .infinity) - - Text("Send notifications:") - ForEach(NotificationsMode.values) { mode in - NtfModeSelector(mode: mode, selection: $notificationMode) - } - - Spacer() - - Button { - if let token = m.deviceToken { - setNotificationsMode(token, notificationMode) - } else { - AlertManager.shared.showAlertMsg(title: "No device token!") + GeometryReader { g in + ScrollView { + VStack(alignment: .leading, spacing: 16) { + Text("Push notifications") + .font(.largeTitle) + .bold() + .frame(maxWidth: .infinity) + + Text("Send notifications:") + ForEach(NotificationsMode.values) { mode in + NtfModeSelector(mode: mode, selection: $notificationMode) } - onboardingStageDefault.set(.onboardingComplete) - m.onboardingStage = .onboardingComplete - } label: { - if case .off = notificationMode { - Text("Use chat") - } else { - Text("Enable notifications") + + Spacer() + + Button { + if let token = m.deviceToken { + setNotificationsMode(token, notificationMode) + } else { + AlertManager.shared.showAlertMsg(title: "No device token!") + } + onboardingStageDefault.set(.onboardingComplete) + m.onboardingStage = .onboardingComplete + } label: { + if case .off = notificationMode { + Text("Use chat") + } else { + Text("Enable notifications") + } } + .buttonStyle(OnboardingButtonStyle()) } - .font(.title) - .frame(maxWidth: .infinity) + .padding() + .frame(minHeight: g.size.height) } - .padding() - .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottom) } + .frame(maxHeight: .infinity) } private func setNotificationsMode(_ token: DeviceToken, _ mode: NotificationsMode) {