From f89631b719f716eeb36f953e7d9687bc773aa494 Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Tue, 21 Jun 2022 09:43:45 +0200 Subject: [PATCH 1/4] Expose live-location sharing labs flag (default: false) Signed-off-by: Johannes Marbach --- Config/BuildSettings.swift | 5 ++--- Riot/Managers/Settings/RiotSettings.swift | 2 +- Riot/Modules/Settings/SettingsViewController.m | 1 - .../Modules/Room/LocationSharing/LocationSharingModels.swift | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Config/BuildSettings.swift b/Config/BuildSettings.swift index b246aac59b..71ceb90fe8 100644 --- a/Config/BuildSettings.swift +++ b/Config/BuildSettings.swift @@ -426,8 +426,7 @@ final class BuildSettings: NSObject { guard self.locationSharingEnabled else { return false } - - // Do not enable live location sharing atm - return false + + return true } } diff --git a/Riot/Managers/Settings/RiotSettings.swift b/Riot/Managers/Settings/RiotSettings.swift index d2cabfcfab..6349198142 100644 --- a/Riot/Managers/Settings/RiotSettings.swift +++ b/Riot/Managers/Settings/RiotSettings.swift @@ -153,7 +153,7 @@ final class RiotSettings: NSObject { var enableUISIAutoReporting /// Indicates if live location sharing is enabled - @UserDefault(key: UserDefaultsKeys.enableLiveLocationSharing, defaultValue: BuildSettings.liveLocationSharingEnabled, storage: defaults) + @UserDefault(key: UserDefaultsKeys.enableLiveLocationSharing, defaultValue: false, storage: defaults) var enableLiveLocationSharing // MARK: Calls diff --git a/Riot/Modules/Settings/SettingsViewController.m b/Riot/Modules/Settings/SettingsViewController.m index 722d6ac771..6cd76c94ad 100644 --- a/Riot/Modules/Settings/SettingsViewController.m +++ b/Riot/Modules/Settings/SettingsViewController.m @@ -597,7 +597,6 @@ - (void)updateSections [sectionLabs addRowWithTag:LABS_ENABLE_AUTO_REPORT_DECRYPTION_ERRORS]; if (BuildSettings.liveLocationSharingEnabled) { - // Hide live location lab setting until it's ready to be release [sectionLabs addRowWithTag:LABS_ENABLE_LIVE_LOCATION_SHARING]; } sectionLabs.headerTitle = [VectorL10n settingsLabs]; diff --git a/RiotSwiftUI/Modules/Room/LocationSharing/LocationSharingModels.swift b/RiotSwiftUI/Modules/Room/LocationSharing/LocationSharingModels.swift index ec9eb58bd3..b819e303ef 100644 --- a/RiotSwiftUI/Modules/Room/LocationSharing/LocationSharingModels.swift +++ b/RiotSwiftUI/Modules/Room/LocationSharing/LocationSharingModels.swift @@ -78,7 +78,7 @@ struct LocationSharingViewState: BindableState { /// True to indicate to show and follow current user location var showsUserLocation: Bool = false - /// Used to hide live location sharing features until is finished + /// Used to hide live location sharing features var isLiveLocationSharingEnabled: Bool = false var shareButtonEnabled: Bool { From b255bcd595489d19088e585633f7e76fca93daba Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Tue, 21 Jun 2022 09:45:30 +0200 Subject: [PATCH 2/4] Revert "Merge pull request #6299 from vector-im/johannes/back-out-background-location-access" This reverts commit c50f23fd8938b8845c0121016f97a15d8a6b8c35, reversing changes made to ff06c68f8ff8b497240e042a9330252771d93982. --- Riot/Modules/LocationSharing/UserLocationService.swift | 2 +- Riot/SupportingFiles/Info.plist | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Riot/Modules/LocationSharing/UserLocationService.swift b/Riot/Modules/LocationSharing/UserLocationService.swift index f9c04aaef4..d6e6ae92ec 100644 --- a/Riot/Modules/LocationSharing/UserLocationService.swift +++ b/Riot/Modules/LocationSharing/UserLocationService.swift @@ -52,7 +52,7 @@ class UserLocationService: UserLocationServiceProtocol { // MARK: - Setup init(session: MXSession) { - self.locationManager = LocationManager(accuracy: .full, allowsBackgroundLocationUpdates: false) + self.locationManager = LocationManager(accuracy: .full, allowsBackgroundLocationUpdates: true) self.session = session } diff --git a/Riot/SupportingFiles/Info.plist b/Riot/SupportingFiles/Info.plist index 537f72d95c..668798a9ac 100644 --- a/Riot/SupportingFiles/Info.plist +++ b/Riot/SupportingFiles/Info.plist @@ -89,6 +89,7 @@ UIBackgroundModes audio + location remote-notification voip From 2fa4cf0c2389a4c467dcbe4304e9d0d97348dd2f Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Tue, 21 Jun 2022 09:52:00 +0200 Subject: [PATCH 3/4] Add changelog --- changelog.d/pr-6324.change | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/pr-6324.change diff --git a/changelog.d/pr-6324.change b/changelog.d/pr-6324.change new file mode 100644 index 0000000000..3e9df96662 --- /dev/null +++ b/changelog.d/pr-6324.change @@ -0,0 +1 @@ +Expose live location sharing labs flag (default: false) and re-enable background location access From b7d9cf02782f3595a0624c095a1822e773d2b19b Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Tue, 21 Jun 2022 13:03:09 +0200 Subject: [PATCH 4/4] Unify location sharing build settings and drop iOS 14 checks --- Config/BuildSettings.swift | 20 +------------------ .../LocationSharing/UserLocationService.swift | 2 +- .../Modules/Settings/SettingsViewController.m | 2 +- 3 files changed, 3 insertions(+), 21 deletions(-) diff --git a/Config/BuildSettings.swift b/Config/BuildSettings.swift index 71ceb90fe8..e9ee04a456 100644 --- a/Config/BuildSettings.swift +++ b/Config/BuildSettings.swift @@ -410,23 +410,5 @@ final class BuildSettings: NSObject { static let tileServerMapStyleURL = URL(string: "https://api.maptiler.com/maps/streets/style.json?key=fU3vlMsMn4Jb6dnEIFsx")! - static var locationSharingEnabled: Bool { - guard #available(iOS 14, *) else { - return false - } - - return true - } - - static var liveLocationSharingEnabled: Bool { - guard #available(iOS 14, *) else { - return false - } - - guard self.locationSharingEnabled else { - return false - } - - return true - } + static let locationSharingEnabled = true } diff --git a/Riot/Modules/LocationSharing/UserLocationService.swift b/Riot/Modules/LocationSharing/UserLocationService.swift index d6e6ae92ec..1a2abc0a57 100644 --- a/Riot/Modules/LocationSharing/UserLocationService.swift +++ b/Riot/Modules/LocationSharing/UserLocationService.swift @@ -52,7 +52,7 @@ class UserLocationService: UserLocationServiceProtocol { // MARK: - Setup init(session: MXSession) { - self.locationManager = LocationManager(accuracy: .full, allowsBackgroundLocationUpdates: true) + self.locationManager = LocationManager(accuracy: .full, allowsBackgroundLocationUpdates: BuildSettings.locationSharingEnabled) self.session = session } diff --git a/Riot/Modules/Settings/SettingsViewController.m b/Riot/Modules/Settings/SettingsViewController.m index 6cd76c94ad..c60d435de7 100644 --- a/Riot/Modules/Settings/SettingsViewController.m +++ b/Riot/Modules/Settings/SettingsViewController.m @@ -595,7 +595,7 @@ - (void)updateSections [sectionLabs addRowWithTag:LABS_ENABLE_RINGING_FOR_GROUP_CALLS_INDEX]; [sectionLabs addRowWithTag:LABS_ENABLE_THREADS_INDEX]; [sectionLabs addRowWithTag:LABS_ENABLE_AUTO_REPORT_DECRYPTION_ERRORS]; - if (BuildSettings.liveLocationSharingEnabled) + if (BuildSettings.locationSharingEnabled) { [sectionLabs addRowWithTag:LABS_ENABLE_LIVE_LOCATION_SHARING]; }