From df58d8378edac30e09ab70d628d4dcca32d4f03c Mon Sep 17 00:00:00 2001 From: Alfonso Grillo Date: Wed, 19 Jul 2023 12:15:26 +0200 Subject: [PATCH] Delete Location Sharing feature flags (#1358) * Delete location sharing feature flags * Add changelog.d file * Update localizations * Amend changelog file --- .../en.lproj/Localizable.strings | 3 +- .../Sources/Application/AppSettings.swift | 8 ----- ElementX/Sources/Generated/Strings.swift | 4 ++- .../View/RoomAttachmentPicker.swift | 14 ++++----- .../DeveloperOptionsScreenModels.swift | 4 --- .../DeveloperOptionsScreenViewModel.swift | 6 ---- .../View/DeveloperOptionsScreen.swift | 30 +++++-------------- .../RoomTimelineItemFactory.swift | 3 -- changelog.d/pr-1358.feature | 1 + 9 files changed, 19 insertions(+), 54 deletions(-) create mode 100644 changelog.d/pr-1358.feature diff --git a/ElementX/Resources/Localizations/en.lproj/Localizable.strings b/ElementX/Resources/Localizations/en.lproj/Localizable.strings index d362ba014..1c71c610b 100644 --- a/ElementX/Resources/Localizations/en.lproj/Localizable.strings +++ b/ElementX/Resources/Localizations/en.lproj/Localizable.strings @@ -175,6 +175,7 @@ "rageshake_dialog_content" = "You seem to be shaking the phone in frustration. Would you like to open the bug report screen?"; "report_content_explanation" = "This message will be reported to your homeserver’s administrator. They will not be able to read any encrypted messages."; "report_content_hint" = "Reason for reporting this content"; +"rich_text_editor_a11y_add_attachment" = "Add attachment"; "rich_text_editor_bullet_list" = "Toggle bullet list"; "rich_text_editor_code_block" = "Toggle code block"; "rich_text_editor_composer_placeholder" = "Message…"; @@ -363,7 +364,7 @@ "screen_waitlist_message_success" = "Welcome to %1$@!"; "screen_waitlist_title" = "You’re almost there."; "screen_waitlist_title_success" = "You're in."; -"screen_welcome_bullet_1" = "Calls, location sharing, search and more will be added later this year."; +"screen_welcome_bullet_1" = "Calls, polls, search and more will be added later this year."; "screen_welcome_bullet_2" = "Message history for encrypted rooms won’t be available in this update."; "screen_welcome_bullet_3" = "We’d love to hear from you, let us know what you think via the settings page."; "screen_welcome_button" = "Let's go!"; diff --git a/ElementX/Sources/Application/AppSettings.swift b/ElementX/Sources/Application/AppSettings.swift index f4d0e75df..7e982030a 100644 --- a/ElementX/Sources/Application/AppSettings.swift +++ b/ElementX/Sources/Application/AppSettings.swift @@ -32,8 +32,6 @@ final class AppSettings { case shouldCollapseRoomStateEvents case userSuggestionsEnabled case readReceiptsEnabled - case locationEventsEnabled - case shareLocationEnabled case hasShownWelcomeScreen case notificationSettingsEnabled case timelineDiffableAnimationsEnabled @@ -218,12 +216,6 @@ final class AppSettings { @UserPreference(key: UserDefaultsKeys.readReceiptsEnabled, defaultValue: false, storageType: .userDefaults(store)) var readReceiptsEnabled - - @UserPreference(key: UserDefaultsKeys.locationEventsEnabled, defaultValue: false, storageType: .userDefaults(store)) - var locationEventsEnabled - - @UserPreference(key: UserDefaultsKeys.shareLocationEnabled, defaultValue: false, storageType: .userDefaults(store)) - var shareLocationEnabled @UserPreference(key: UserDefaultsKeys.notificationSettingsEnabled, defaultValue: false, storageType: .userDefaults(store)) var notificationSettingsEnabled diff --git a/ElementX/Sources/Generated/Strings.swift b/ElementX/Sources/Generated/Strings.swift index 377f98756..1d43519a0 100644 --- a/ElementX/Sources/Generated/Strings.swift +++ b/ElementX/Sources/Generated/Strings.swift @@ -436,6 +436,8 @@ public enum L10n { public static var reportContentExplanation: String { return L10n.tr("Localizable", "report_content_explanation") } /// Reason for reporting this content public static var reportContentHint: String { return L10n.tr("Localizable", "report_content_hint") } + /// Add attachment + public static var richTextEditorA11yAddAttachment: String { return L10n.tr("Localizable", "rich_text_editor_a11y_add_attachment") } /// Toggle bullet list public static var richTextEditorBulletList: String { return L10n.tr("Localizable", "rich_text_editor_bullet_list") } /// Toggle code block @@ -920,7 +922,7 @@ public enum L10n { public static var screenWaitlistTitle: String { return L10n.tr("Localizable", "screen_waitlist_title") } /// You're in. public static var screenWaitlistTitleSuccess: String { return L10n.tr("Localizable", "screen_waitlist_title_success") } - /// Calls, location sharing, search and more will be added later this year. + /// Calls, polls, search and more will be added later this year. public static var screenWelcomeBullet1: String { return L10n.tr("Localizable", "screen_welcome_bullet_1") } /// Message history for encrypted rooms won’t be available in this update. public static var screenWelcomeBullet2: String { return L10n.tr("Localizable", "screen_welcome_bullet_2") } diff --git a/ElementX/Sources/Screens/RoomScreen/View/RoomAttachmentPicker.swift b/ElementX/Sources/Screens/RoomScreen/View/RoomAttachmentPicker.swift index 4a16da378..b77125b25 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/RoomAttachmentPicker.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/RoomAttachmentPicker.swift @@ -53,14 +53,12 @@ struct RoomAttachmentPicker: View { } label: { PickerLabel(title: L10n.screenRoomAttachmentSourceCamera, icon: Image(systemName: "camera.fill")) } - - if ServiceLocator.shared.settings.shareLocationEnabled { - Button { - context.showAttachmentPopover = false - context.send(viewAction: .displayLocationPicker) - } label: { - PickerLabel(title: L10n.screenRoomAttachmentSourceLocation, icon: Image(asset: Asset.Images.locationPin)) - } + + Button { + context.showAttachmentPopover = false + context.send(viewAction: .displayLocationPicker) + } label: { + PickerLabel(title: L10n.screenRoomAttachmentSourceLocation, icon: Image(asset: Asset.Images.locationPin)) } } .padding(.top, isPresented ? 20 : 0) diff --git a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift index 68d8aa4c2..2dfd7daf3 100644 --- a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift +++ b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift @@ -29,8 +29,6 @@ struct DeveloperOptionsScreenViewStateBindings { var userSuggestionsEnabled: Bool var readReceiptsEnabled: Bool var isEncryptionSyncEnabled: Bool - var locationEventsEnabled: Bool - var shareLocationEnabled: Bool var notificationSettingsEnabled: Bool var timelineDiffableAnimationsEnabled: Bool } @@ -40,8 +38,6 @@ enum DeveloperOptionsScreenViewAction { case changedUserSuggestionsEnabled case changedReadReceiptsEnabled case changedIsEncryptionSyncEnabled - case changedLocationEventsEnabled - case changedShareLocationEnabled case changedNotificationSettingsEnabled case changedTimelineDiffableAnimationsEnabled case clearCache diff --git a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenViewModel.swift b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenViewModel.swift index 82e366009..c17c53c81 100644 --- a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenViewModel.swift +++ b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenViewModel.swift @@ -30,8 +30,6 @@ class DeveloperOptionsScreenViewModel: DeveloperOptionsScreenViewModelType, Deve userSuggestionsEnabled: appSettings.userSuggestionsEnabled, readReceiptsEnabled: appSettings.readReceiptsEnabled, isEncryptionSyncEnabled: appSettings.isEncryptionSyncEnabled, - locationEventsEnabled: appSettings.locationEventsEnabled, - shareLocationEnabled: appSettings.shareLocationEnabled, notificationSettingsEnabled: appSettings.notificationSettingsEnabled, timelineDiffableAnimationsEnabled: appSettings.timelineDiffableAnimationsEnabled) let state = DeveloperOptionsScreenViewState(bindings: bindings) @@ -53,10 +51,6 @@ class DeveloperOptionsScreenViewModel: DeveloperOptionsScreenViewModelType, Deve appSettings.readReceiptsEnabled = state.bindings.readReceiptsEnabled case .changedIsEncryptionSyncEnabled: appSettings.isEncryptionSyncEnabled = state.bindings.isEncryptionSyncEnabled - case .changedLocationEventsEnabled: - appSettings.locationEventsEnabled = state.bindings.locationEventsEnabled - case .changedShareLocationEnabled: - appSettings.shareLocationEnabled = state.bindings.shareLocationEnabled case .changedNotificationSettingsEnabled: appSettings.notificationSettingsEnabled = state.bindings.notificationSettingsEnabled case .changedTimelineDiffableAnimationsEnabled: diff --git a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift index b62fd321d..8aa652f7c 100644 --- a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift +++ b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift @@ -19,7 +19,7 @@ import SwiftUI struct DeveloperOptionsScreen: View { @ObservedObject var context: DeveloperOptionsScreenViewModel.Context @State private var showConfetti = false - + var body: some View { Form { Section("Timeline") { @@ -38,7 +38,7 @@ struct DeveloperOptionsScreen: View { context.send(viewAction: .changedReadReceiptsEnabled) } } - + Section("Notifications") { Toggle(isOn: $context.isEncryptionSyncEnabled) { Text("Use notification encryption sync") @@ -55,23 +55,7 @@ struct DeveloperOptionsScreen: View { context.send(viewAction: .changedNotificationSettingsEnabled) } } - - Section("Location sharing") { - Toggle(isOn: $context.locationEventsEnabled) { - Text("Location events in timeline") - } - .onChange(of: context.locationEventsEnabled) { _ in - context.send(viewAction: .changedLocationEventsEnabled) - } - - Toggle(isOn: $context.shareLocationEnabled) { - Text("Show share location action") - } - .onChange(of: context.shareLocationEnabled) { _ in - context.send(viewAction: .changedShareLocationEnabled) - } - } - + Section("Room creation") { Toggle(isOn: $context.userSuggestionsEnabled) { Text("User suggestions") @@ -87,7 +71,7 @@ struct DeveloperOptionsScreen: View { context.send(viewAction: .changedTimelineDiffableAnimationsEnabled) } } - + Section { Button { showConfetti = true @@ -104,7 +88,7 @@ struct DeveloperOptionsScreen: View { .frame(maxWidth: .infinity) } } - + Section { Button(role: .destructive) { context.send(viewAction: .clearCache) @@ -119,7 +103,7 @@ struct DeveloperOptionsScreen: View { .navigationTitle(L10n.commonDeveloperOptions) .navigationBarTitleDisplayMode(.inline) } - + @ViewBuilder private var effectsView: some View { if showConfetti { @@ -129,7 +113,7 @@ struct DeveloperOptionsScreen: View { .task { await removeConfettiAfterDelay() } } } - + private func removeConfettiAfterDelay() async { try? await Task.sleep(for: .seconds(4)) showConfetti = false diff --git a/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift b/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift index be3c0e333..c224a9864 100644 --- a/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift +++ b/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift @@ -75,9 +75,6 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol { case .audio(let content): return buildAudioTimelineItem(for: eventItemProxy, messageTimelineItem, content, isOutgoing) case .location(let content): - guard ServiceLocator.shared.settings.locationEventsEnabled else { - return nil - } return buildLocationTimelineItem(for: eventItemProxy, messageTimelineItem, content, isOutgoing) case .none: return nil diff --git a/changelog.d/pr-1358.feature b/changelog.d/pr-1358.feature new file mode 100644 index 000000000..177b1f3d9 --- /dev/null +++ b/changelog.d/pr-1358.feature @@ -0,0 +1 @@ +Location sharing: view and send static locations. \ No newline at end of file