diff --git a/bwi/FeatureBanner/FeatureBannerView.swift b/bwi/FeatureBanner/FeatureBannerView.swift index b2ebb0c20..0a259070e 100644 --- a/bwi/FeatureBanner/FeatureBannerView.swift +++ b/bwi/FeatureBanner/FeatureBannerView.swift @@ -91,7 +91,7 @@ protocol FeatureBannerDelegate { } func didPressShowDetails() { - let migrationInfoView = MigrationInfoView(username: username).interactiveDismissDisabled(true) + let migrationInfoView = MigrationInfoView(username: username).environmentObject(BWIThemeService.shared).interactiveDismissDisabled(true) let hostingViewController = UIHostingController(rootView: migrationInfoView) if hostingViewController.popoverPresentationController != nil { hostingViewController.modalPresentationStyle = .popover diff --git a/bwi/FeatureBanner/MigrationInfoView.swift b/bwi/FeatureBanner/MigrationInfoView.swift index 1d682207c..62e6e2b0b 100644 --- a/bwi/FeatureBanner/MigrationInfoView.swift +++ b/bwi/FeatureBanner/MigrationInfoView.swift @@ -21,6 +21,8 @@ import SwiftUI struct MigrationInfoView: View { @Environment(\.dismiss) var dismissView @State private var selectedTab = 1 + @EnvironmentObject var themeService: BWIThemeService + @State var redrawKey = UUID() let username: String @@ -31,8 +33,13 @@ struct MigrationInfoView: View { MigrationInfoViewTwo(username: username) .tag(2) } + .id(redrawKey) .tabViewStyle(.page) - .indexViewStyle(.page(backgroundDisplayMode: .always)) + .tabViewStyle(.page(indexDisplayMode: .always)) + .background { + Color(themeService.theme.backgroundColor) + .edgesIgnoringSafeArea(/*@START_MENU_TOKEN@*/.all/*@END_MENU_TOKEN@*/) + } .onAppear() { FeatureBannerVisibilityService().markAsRead() NotificationCenter.default.post(name: .bwiMarkTopBannerAsRead, object: self, userInfo: ["type" : "feature_banner"]) @@ -48,7 +55,7 @@ struct MigrationInfoView: View { .renderingMode(.template) .resizable() .frame(width: 36, height: 36) - .foregroundColor(Color(ThemeService.shared().theme.colors.tertiaryContent)) + .foregroundColor(Color(themeService.theme.colors.tertiaryContent)) .padding(20) } .accessibilityLabel(BWIL10n.bwiA11yCloseButton) @@ -63,7 +70,7 @@ struct MigrationInfoView: View { Image(systemName: "arrow.left") .resizable() .frame(width: 24, height: 24) - .foregroundStyle(Color(ThemeService.shared().theme.colors.tertiaryContent)) + .foregroundStyle(Color(themeService.theme.colors.tertiaryContent)) .padding(EdgeInsets(top: 20, leading: 30, bottom: 10, trailing: 30)) } .opacity(selectedTab == 1 ? 0 : 1) @@ -78,19 +85,37 @@ struct MigrationInfoView: View { Image(systemName: "arrow.right") .resizable() .frame(width: 24, height: 24) - .foregroundStyle(Color(ThemeService.shared().theme.colors.tertiaryContent)) + .foregroundStyle(Color(themeService.theme.colors.tertiaryContent)) .padding(EdgeInsets(top: 20, leading: 30, bottom: 10, trailing: 30)) } .opacity(selectedTab == 2 ? 0 : 1) } } } + .onAppear { + setupIndicatorColors() + } + .onChange(of: themeService.isCurrentThemeDark) { _ in + setupIndicatorColors() + redrawKey = UUID() + } + .onChange(of: themeService.isCurrentThemeDark) { _ in + setupIndicatorColors() + redrawKey = UUID() + } + } + + private func setupIndicatorColors() { + UIPageControl.appearance().currentPageIndicatorTintColor = themeService.theme.textPrimaryColor + UIPageControl.appearance().pageIndicatorTintColor = themeService.theme.textSecondaryColor } } // MARK: Migraion Info View one struct MigrationInfoViewOne: View { + @EnvironmentObject var themeService: BWIThemeService + var body: some View { GeometryReader { geo in ScrollView(.vertical) { @@ -170,6 +195,7 @@ struct MigrationInfoViewOne: View { struct MigrationInfoViewTwo: View { let username: String @State var showSuccessToast: Bool = false + @EnvironmentObject var themeService: BWIThemeService var body: some View { GeometryReader { geo in @@ -196,6 +222,9 @@ struct MigrationInfoViewTwo: View { Spacer() downloadNewAppButton + .frame(maxWidth: 350) + .frame(width: geo.size.width - 100) + .padding(.bottom, 100) } .frame(minHeight: geo.size.height) .frame(width: geo.size.width) @@ -230,10 +259,10 @@ struct MigrationInfoViewTwo: View { }, label: { Text(BWIL10n.bwiMobileDialogMMore2Text1) .underline() - .foregroundColor(Color(ThemeService.shared().theme.textPrimaryColor)) + .foregroundColor(Color(themeService.theme.textPrimaryColor)) Image(systemName: "square.on.square") .resizable() - .foregroundColor(Color(ThemeService.shared().theme.textPrimaryColor)) + .foregroundColor(Color(themeService.theme.textPrimaryColor)) .frame(width: 15, height: 15) }) } @@ -261,15 +290,9 @@ struct MigrationInfoViewTwo: View { UIApplication.shared.open(bumxAppStoreURL, options: [:], completionHandler: nil) }, label: { Text(BWIL10n.bwiMobileDialogMMoreButton) - .foregroundColor(.white) - .padding(.vertical, 10) - .padding(.horizontal, 50) - .background(Color(ThemeService.shared().theme.tintColor)) - .clipShape(RoundedRectangle(cornerRadius: 10)) - .lineLimit(nil) - .fixedSize(horizontal: false, vertical: true) + .foregroundColor(Color(ThemeService.shared().theme.backgroundColor)) }) - .padding(.bottom, 100) + .buttonStyle(PrimaryActionButtonStyle()) } var successToast: some View { @@ -280,9 +303,9 @@ struct MigrationInfoViewTwo: View { .accessibilityHidden(true) Text(BWIL10n.bwiMobileDialogMMoreSuccess) } - .foregroundColor(ThemeService.shared().isCurrentThemeDark() ? .black : .white) + .foregroundColor(themeService.isCurrentThemeDark ? .black : .white) .padding(10) - .background(ThemeService.shared().isCurrentThemeDark() ? .white : .black) + .background(themeService.isCurrentThemeDark ? .white : .black) .clipShape(RoundedRectangle(cornerRadius: 10)) .opacity(showSuccessToast ? 1 : 0) .transition(.opacity)