diff --git a/ElementX/Sources/Application/Application.swift b/ElementX/Sources/Application/Application.swift index 6961bcc84..fe9bd1c5a 100644 --- a/ElementX/Sources/Application/Application.swift +++ b/ElementX/Sources/Application/Application.swift @@ -22,6 +22,10 @@ struct Application: App { private let applicationCoordinator: AppCoordinatorProtocol init() { + // Set the tint colour app-wide. Using UIView ensures that alerts, confirmation dialogs + // and Xcode previews all take on the tint colour, similar to defining it in an asset catalog. + UIView.appearance().tintColor = .element.accent + if Tests.isRunningUITests { applicationCoordinator = UITestsAppCoordinator() } else { @@ -35,7 +39,6 @@ struct Application: App { EmptyView() } else { applicationCoordinator.toPresentable() - .accentColor(.element.accent) .task { applicationCoordinator.start() } diff --git a/ElementX/Sources/Application/Navigation/NavigationCoordinators.swift b/ElementX/Sources/Application/Navigation/NavigationCoordinators.swift index 52cec3f64..08de762ba 100644 --- a/ElementX/Sources/Application/Navigation/NavigationCoordinators.swift +++ b/ElementX/Sources/Application/Navigation/NavigationCoordinators.swift @@ -371,11 +371,9 @@ private struct NavigationSplitCoordinatorView: View { // through the NavigationSplitCoordinator as well. .sheet(item: $navigationSplitCoordinator.sheetModule) { module in module.coordinator?.toPresentable() - .tint(.element.accent) } .fullScreenCover(item: $navigationSplitCoordinator.fullScreenCoverModule) { module in module.coordinator?.toPresentable() - .tint(.element.accent) } } @@ -666,11 +664,9 @@ private struct NavigationStackCoordinatorView: View { } .sheet(item: $navigationStackCoordinator.sheetModule) { module in module.coordinator?.toPresentable() - .tint(.element.accent) } .fullScreenCover(item: $navigationStackCoordinator.fullScreenCoverModule) { module in module.coordinator?.toPresentable() - .tint(.element.accent) } } } diff --git a/ElementX/Sources/Screens/AnalyticsPrompt/View/AnalyticsPrompt.swift b/ElementX/Sources/Screens/AnalyticsPrompt/View/AnalyticsPrompt.swift index 301779a68..c7028b8f8 100644 --- a/ElementX/Sources/Screens/AnalyticsPrompt/View/AnalyticsPrompt.swift +++ b/ElementX/Sources/Screens/AnalyticsPrompt/View/AnalyticsPrompt.swift @@ -69,6 +69,7 @@ struct AnalyticsPrompt: View { .font(.element.body) .multilineTextAlignment(.center) .foregroundColor(.element.secondaryContent) + .tint(.element.links) Divider() .background(Color.element.quinaryContent) @@ -115,6 +116,5 @@ struct AnalyticsPrompt_Previews: PreviewProvider { static let viewModel = AnalyticsPromptViewModel(termsURL: ServiceLocator.shared.settings.analyticsConfiguration.termsURL) static var previews: some View { AnalyticsPrompt(context: viewModel.context) - .tint(.element.accent) } } diff --git a/ElementX/Sources/Screens/Authentication/LoginScreen/View/LoginScreen.swift b/ElementX/Sources/Screens/Authentication/LoginScreen/View/LoginScreen.swift index 7635e8634..bf91a6d3d 100644 --- a/ElementX/Sources/Screens/Authentication/LoginScreen/View/LoginScreen.swift +++ b/ElementX/Sources/Screens/Authentication/LoginScreen/View/LoginScreen.swift @@ -165,7 +165,6 @@ struct Login_Previews: PreviewProvider { NavigationStack { LoginScreen(context: viewModel.context) .navigationBarTitleDisplayMode(.inline) - .tint(.element.accent) .toolbar { ToolbarItem(placement: .cancellationAction) { Button { } label: { @@ -174,6 +173,5 @@ struct Login_Previews: PreviewProvider { } } } - .tint(.element.accent) } } diff --git a/ElementX/Sources/Screens/Authentication/ServerSelection/View/ServerSelectionScreen.swift b/ElementX/Sources/Screens/Authentication/ServerSelection/View/ServerSelectionScreen.swift index f7badf61c..971e6067e 100644 --- a/ElementX/Sources/Screens/Authentication/ServerSelection/View/ServerSelectionScreen.swift +++ b/ElementX/Sources/Screens/Authentication/ServerSelection/View/ServerSelectionScreen.swift @@ -106,7 +106,6 @@ struct ServerSelection_Previews: PreviewProvider { ForEach(MockServerSelectionScreenState.allCases, id: \.self) { state in NavigationStack { ServerSelectionScreen(context: state.viewModel.context) - .tint(.element.accent) } } } diff --git a/ElementX/Sources/Screens/Authentication/SoftLogout/View/SoftLogoutScreen.swift b/ElementX/Sources/Screens/Authentication/SoftLogout/View/SoftLogoutScreen.swift index fae0f48d5..6e1219306 100644 --- a/ElementX/Sources/Screens/Authentication/SoftLogout/View/SoftLogoutScreen.swift +++ b/ElementX/Sources/Screens/Authentication/SoftLogout/View/SoftLogoutScreen.swift @@ -182,7 +182,6 @@ struct SoftLogout_Previews: PreviewProvider { NavigationStack { SoftLogoutScreen(context: viewModel.context) .navigationBarTitleDisplayMode(.inline) - .tint(.element.accent) .toolbar { ToolbarItem(placement: .cancellationAction) { Button { } label: { @@ -191,6 +190,5 @@ struct SoftLogout_Previews: PreviewProvider { } } } - .tint(.element.accent) } } diff --git a/ElementX/Sources/Screens/DeveloperOptionsScreen/View/DeveloperOptionsScreenScreen.swift b/ElementX/Sources/Screens/DeveloperOptionsScreen/View/DeveloperOptionsScreenScreen.swift index c3a9ee595..fef9b46a6 100644 --- a/ElementX/Sources/Screens/DeveloperOptionsScreen/View/DeveloperOptionsScreenScreen.swift +++ b/ElementX/Sources/Screens/DeveloperOptionsScreen/View/DeveloperOptionsScreenScreen.swift @@ -26,6 +26,8 @@ struct DeveloperOptionsScreenScreen: View { Toggle(isOn: $context.shouldCollapseRoomStateEvents) { Text("Collapse room state events") } + .tint(.element.brand) + .labelStyle(FormRowLabelStyle()) .onChange(of: context.shouldCollapseRoomStateEvents) { _ in context.send(viewAction: .changedShouldCollapseRoomStateEvents) } @@ -77,6 +79,5 @@ struct DeveloperOptionsScreen_Previews: PreviewProvider { static var previews: some View { let viewModel = DeveloperOptionsScreenViewModel() DeveloperOptionsScreenScreen(context: viewModel.context) - .tint(.element.accent) } } diff --git a/ElementX/Sources/Screens/EmojiPickerScreen/View/EmojiPickerScreen.swift b/ElementX/Sources/Screens/EmojiPickerScreen/View/EmojiPickerScreen.swift index 6436a346d..434a232f5 100644 --- a/ElementX/Sources/Screens/EmojiPickerScreen/View/EmojiPickerScreen.swift +++ b/ElementX/Sources/Screens/EmojiPickerScreen/View/EmojiPickerScreen.swift @@ -67,6 +67,5 @@ struct EmojiPickerScreen_Previews: PreviewProvider { NavigationStack { EmojiPickerScreen(context: EmojiPickerScreenViewModel(emojiProvider: EmojiProvider()).context) } - .tint(.element.accent) } } diff --git a/ElementX/Sources/Screens/FilePreview/View/FilePreviewScreen.swift b/ElementX/Sources/Screens/FilePreview/View/FilePreviewScreen.swift index 28e443b5b..a4e36fbc0 100644 --- a/ElementX/Sources/Screens/FilePreview/View/FilePreviewScreen.swift +++ b/ElementX/Sources/Screens/FilePreview/View/FilePreviewScreen.swift @@ -98,6 +98,5 @@ struct FilePreview_Previews: PreviewProvider { let upgradeViewModel = FilePreviewViewModel(fileURL: URL(staticString: "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf")) FilePreviewScreen(context: upgradeViewModel.context) } - .tint(.element.accent) } } diff --git a/ElementX/Sources/Screens/HomeScreen/View/HomeScreen.swift b/ElementX/Sources/Screens/HomeScreen/View/HomeScreen.swift index 2b33309ec..4d85136ae 100644 --- a/ElementX/Sources/Screens/HomeScreen/View/HomeScreen.swift +++ b/ElementX/Sources/Screens/HomeScreen/View/HomeScreen.swift @@ -240,9 +240,7 @@ struct HomeScreen: View { struct HomeScreen_Previews: PreviewProvider { static var previews: some View { body(.loading) - .tint(.element.accent) body(.loaded) - .tint(.element.accent) } static func body(_ state: MockRoomSummaryProviderState) -> some View { diff --git a/ElementX/Sources/Screens/HomeScreen/View/HomeScreenRoomCell.swift b/ElementX/Sources/Screens/HomeScreen/View/HomeScreenRoomCell.swift index b3f7c439e..9a15ad17e 100644 --- a/ElementX/Sources/Screens/HomeScreen/View/HomeScreenRoomCell.swift +++ b/ElementX/Sources/Screens/HomeScreen/View/HomeScreenRoomCell.swift @@ -161,10 +161,6 @@ private extension View { struct HomeScreenRoomCell_Previews: PreviewProvider { static var previews: some View { - body.tint(.element.accent) - } - - static var body: some View { let summaryProvider = MockRoomSummaryProvider(state: .loaded) let userSession = MockUserSession(clientProxy: MockClientProxy(userID: "John Doe", roomSummaryProvider: summaryProvider), diff --git a/ElementX/Sources/Screens/OnboardingScreen/View/OnboardingScreen.swift b/ElementX/Sources/Screens/OnboardingScreen/View/OnboardingScreen.swift index 53c0c54d6..d49e0c9f9 100644 --- a/ElementX/Sources/Screens/OnboardingScreen/View/OnboardingScreen.swift +++ b/ElementX/Sources/Screens/OnboardingScreen/View/OnboardingScreen.swift @@ -205,6 +205,5 @@ struct OnboardingScreen_Previews: PreviewProvider { static var previews: some View { OnboardingScreen(context: viewModel.context) - .tint(.element.accent) } } diff --git a/ElementX/Sources/Screens/RoomDetails/View/RoomDetailsScreen.swift b/ElementX/Sources/Screens/RoomDetails/View/RoomDetailsScreen.swift index bd4354a86..d75249bc8 100644 --- a/ElementX/Sources/Screens/RoomDetails/View/RoomDetailsScreen.swift +++ b/ElementX/Sources/Screens/RoomDetails/View/RoomDetailsScreen.swift @@ -171,6 +171,5 @@ struct RoomDetails_Previews: PreviewProvider { static var previews: some View { RoomDetailsScreen(context: viewModel.context) - .tint(.element.accent) } } diff --git a/ElementX/Sources/Screens/RoomMembers/View/RoomMemberDetailsMemberCell.swift b/ElementX/Sources/Screens/RoomMembers/View/RoomMemberDetailsMemberCell.swift index 508ee9f48..00d7004d5 100644 --- a/ElementX/Sources/Screens/RoomMembers/View/RoomMemberDetailsMemberCell.swift +++ b/ElementX/Sources/Screens/RoomMembers/View/RoomMemberDetailsMemberCell.swift @@ -48,13 +48,6 @@ struct RoomMemberDetailsMemberCell: View { struct RoomMemberDetailsMemberCell_Previews: PreviewProvider { static var previews: some View { - body.preferredColorScheme(.light) - .tint(.element.accent) - body.preferredColorScheme(.dark) - .tint(.element.accent) - } - - static var body: some View { let members: [RoomMemberProxy] = [ .mockAlice, .mockBob, diff --git a/ElementX/Sources/Screens/RoomMembers/View/RoomMemberDetailsScreen.swift b/ElementX/Sources/Screens/RoomMembers/View/RoomMemberDetailsScreen.swift index ff7645372..3e900321b 100644 --- a/ElementX/Sources/Screens/RoomMembers/View/RoomMemberDetailsScreen.swift +++ b/ElementX/Sources/Screens/RoomMembers/View/RoomMemberDetailsScreen.swift @@ -59,6 +59,5 @@ struct RoomMemberDetails_Previews: PreviewProvider { members: members) RoomMemberDetailsScreen(context: viewModel.context) } - .tint(.element.accent) } } diff --git a/ElementX/Sources/Screens/RoomScreen/View/MessageComposer.swift b/ElementX/Sources/Screens/RoomScreen/View/MessageComposer.swift index a0d579518..64b0e2ac1 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/MessageComposer.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/MessageComposer.swift @@ -217,7 +217,6 @@ struct MessageComposer_Previews: PreviewProvider { replyCancellationAction: { }, editCancellationAction: { }) } - .tint(.element.accent) .padding(.horizontal) } } diff --git a/ElementX/Sources/Screens/RoomScreen/View/TimelineItemDebugView.swift b/ElementX/Sources/Screens/RoomScreen/View/TimelineItemDebugView.swift index 5878b5ad3..28d6f7c8f 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/TimelineItemDebugView.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/TimelineItemDebugView.swift @@ -51,7 +51,6 @@ struct TimelineItemDebugView: View { } } } - .tint(.element.accent) } } diff --git a/ElementX/Sources/Screens/SessionVerification/View/SessionVerificationScreen.swift b/ElementX/Sources/Screens/SessionVerification/View/SessionVerificationScreen.swift index 2e33ab687..40438ff4d 100644 --- a/ElementX/Sources/Screens/SessionVerification/View/SessionVerificationScreen.swift +++ b/ElementX/Sources/Screens/SessionVerification/View/SessionVerificationScreen.swift @@ -226,15 +226,12 @@ struct SessionVerificationScreen: View { struct SessionVerification_Previews: PreviewProvider { static var previews: some View { - Group { - sessionVerificationScreen(state: .initial) - sessionVerificationScreen(state: .requestingVerification) - sessionVerificationScreen(state: .cancelled) - - sessionVerificationScreen(state: .showingChallenge(emojis: SessionVerificationControllerProxyMock.emojis)) - sessionVerificationScreen(state: .verified) - } - .tint(Color.element.accent) + sessionVerificationScreen(state: .initial) + sessionVerificationScreen(state: .requestingVerification) + sessionVerificationScreen(state: .cancelled) + + sessionVerificationScreen(state: .showingChallenge(emojis: SessionVerificationControllerProxyMock.emojis)) + sessionVerificationScreen(state: .verified) } static func sessionVerificationScreen(state: SessionVerificationStateMachine.State) -> some View { diff --git a/ElementX/Sources/Screens/Settings/View/SettingsScreen.swift b/ElementX/Sources/Screens/Settings/View/SettingsScreen.swift index 762904056..b0a592fc4 100644 --- a/ElementX/Sources/Screens/Settings/View/SettingsScreen.swift +++ b/ElementX/Sources/Screens/Settings/View/SettingsScreen.swift @@ -192,7 +192,6 @@ struct SettingsScreen_Previews: PreviewProvider { static var previews: some View { NavigationStack { SettingsScreen(context: viewModel.context) - .tint(.element.accent) } } } diff --git a/Tools/Scripts/Templates/SimpleScreenExample/ElementX/View/TemplateScreen.swift b/Tools/Scripts/Templates/SimpleScreenExample/ElementX/View/TemplateScreen.swift index bb3718e63..b05795a5f 100644 --- a/Tools/Scripts/Templates/SimpleScreenExample/ElementX/View/TemplateScreen.swift +++ b/Tools/Scripts/Templates/SimpleScreenExample/ElementX/View/TemplateScreen.swift @@ -93,14 +93,12 @@ struct TemplateScreen: View { // MARK: - Previews struct Template_Previews: PreviewProvider { + static let regularViewModel = TemplateViewModel(promptType: .regular) + static let upgradeViewModel = TemplateViewModel(promptType: .upgrade) static var previews: some View { - Group { - let regularViewModel = TemplateViewModel(promptType: .regular) - TemplateScreen(context: regularViewModel.context) - - let upgradeViewModel = TemplateViewModel(promptType: .upgrade) - TemplateScreen(context: upgradeViewModel.context) - } - .tint(.element.accent) + TemplateScreen(context: regularViewModel.context) + .previewDisplayName("Regular") + TemplateScreen(context: upgradeViewModel.context) + .previewDisplayName("Upgrade") } } diff --git a/changelog.d/43.bugfix b/changelog.d/43.bugfix new file mode 100644 index 000000000..405c4d47c --- /dev/null +++ b/changelog.d/43.bugfix @@ -0,0 +1 @@ +Fix accent colour not being applied to Alerts etc.