diff --git a/Config/BWIBuildSettings.swift b/Config/BWIBuildSettings.swift index 7a3db0868..f0702295f 100644 --- a/Config/BWIBuildSettings.swift +++ b/Config/BWIBuildSettings.swift @@ -257,6 +257,8 @@ class BWIBuildSettings: NSObject { // Default servers proposed on the authentication screen var serverConfigDefaultHomeserverUrlString = "https://bundesmessenger.isthebest.real" + // (#4549) this is needed because a real URL is expected by Element, for all of our systems this should be overwritten by well-known + var serverConfigDefaultMapstyleURLString = "https://default.mapstyle.url" var serverConfigDefaultIdentityServerUrlString = "" var serverConfigPreSelections = ["":""] var serverConfigSygnalAPIUrlString = "http://push-local/_matrix/push/v1/notify" diff --git a/Config/BuM-Beta/BWIBuildSettings+BuM-Beta.swift b/Config/BuM-Beta/BWIBuildSettings+BuM-Beta.swift index 933282ecc..f021518b8 100644 --- a/Config/BuM-Beta/BWIBuildSettings+BuM-Beta.swift +++ b/Config/BuM-Beta/BWIBuildSettings+BuM-Beta.swift @@ -29,7 +29,7 @@ extension BWIBuildSettings { bwiPersonalState = true bwiMatomoTrackingDefaultState = false showSessionManager = false - locationSharingEnabled = false + locationSharingEnabled = true bwiLocationShareButtonVisible = false bwiLoginFlowLayout = false useRustEncryption = true diff --git a/Config/BuM-Open/BWIBuildSettings+BuM-Open.swift b/Config/BuM-Open/BWIBuildSettings+BuM-Open.swift index 823147272..b24df4ad1 100644 --- a/Config/BuM-Open/BWIBuildSettings+BuM-Open.swift +++ b/Config/BuM-Open/BWIBuildSettings+BuM-Open.swift @@ -21,7 +21,7 @@ extension BWIBuildSettings { func overrideTargetSpecificSettings() { secondaryAppName = "BundesMessenger" - locationSharingEnabled = false + locationSharingEnabled = true bwiLocationShareButtonVisible = false bwiLoginFlowLayout = false authScreenShowTestServerOptions = false diff --git a/Config/BuM/BWIBuildSettings+BuM.swift b/Config/BuM/BWIBuildSettings+BuM.swift index f74b3882c..b3442057c 100644 --- a/Config/BuM/BWIBuildSettings+BuM.swift +++ b/Config/BuM/BWIBuildSettings+BuM.swift @@ -21,7 +21,7 @@ extension BWIBuildSettings { func overrideTargetSpecificSettings() { secondaryAppName = "BundesMessenger" - locationSharingEnabled = false + locationSharingEnabled = true bwiLocationShareButtonVisible = false bwiLoginFlowLayout = false authScreenShowTestServerOptions = false diff --git a/Riot/Model/HomeserverConfiguration/HomeserverConfigurationBuilder.swift b/Riot/Model/HomeserverConfiguration/HomeserverConfigurationBuilder.swift index 41514fdb0..8ef9107f3 100644 --- a/Riot/Model/HomeserverConfiguration/HomeserverConfigurationBuilder.swift +++ b/Riot/Model/HomeserverConfiguration/HomeserverConfigurationBuilder.swift @@ -77,10 +77,8 @@ final class HomeserverConfigurationBuilder: NSObject { if let mapStyleURLString = wellKnown?.tileServer?.mapStyleURLString, let mapStyleURL = URL(string: mapStyleURLString) { tileServerMapStyleURL = mapStyleURL - } else if let mapStyleURL = URL( string: AppConfigService.shared.serverUrl()) { - tileServerMapStyleURL = mapStyleURL } else { - tileServerMapStyleURL = BuildSettings.defaultTileServerMapStyleURL + tileServerMapStyleURL = URL(string: BWIBuildSettings.shared.serverConfigDefaultMapstyleURLString)! } diff --git a/Riot/Modules/LocationSharing/UserLocationService.swift b/Riot/Modules/LocationSharing/UserLocationService.swift index 12daf1a80..e0a5d688c 100644 --- a/Riot/Modules/LocationSharing/UserLocationService.swift +++ b/Riot/Modules/LocationSharing/UserLocationService.swift @@ -52,6 +52,7 @@ class UserLocationService: UserLocationServiceProtocol { // MARK: - Setup init(session: MXSession) { + // (bwi #4549): its ok to only test the buildsetting here. Wellknown check is handled in UI self.locationManager = LocationManager(accuracy: .full, allowsBackgroundLocationUpdates: BWIBuildSettings.shared.locationSharingEnabled) self.session = session } diff --git a/Riot/Modules/Room/RoomViewController.m b/Riot/Modules/Room/RoomViewController.m index aa66e8eba..9e33cee1d 100644 --- a/Riot/Modules/Room/RoomViewController.m +++ b/Riot/Modules/Room/RoomViewController.m @@ -2445,7 +2445,7 @@ static CGSize kThreadListBarButtonItemImageSize; [self.delegate roomViewControllerDidRequestPollCreationFormPresentation:self]; }]]; } - if (BWIBuildSettings.shared.locationSharingEnabled && !self.isNewDirectChat) + if ( [self bwiShowLocationSharingUI:self.roomDataSource.mxSession] && !self.isNewDirectChat) { [actionItems addObject:[[RoomActionItem alloc] initWithImage:AssetImages.actionLocation.image andAction:^{ MXStrongifyAndReturnIfNil(self); @@ -5299,7 +5299,7 @@ static CGSize kThreadListBarButtonItemImageSize; { [actionItems addObject:@(ComposerCreateActionPolls)]; } - if (BWIBuildSettings.shared.locationSharingEnabled && !self.isNewDirectChat) + if ([self bwiShowLocationSharingUI:self.roomDataSource.mxSession] && !self.isNewDirectChat) { [actionItems addObject:@(ComposerCreateActionLocation)]; } @@ -8234,6 +8234,17 @@ static CGSize kThreadListBarButtonItemImageSize; [service addReactionWithReaction:emoji]; } +#pragma mark - BWI Helper + +// (bwi #4549): Showing Location Sharing in UI depends on BuildSetting and url from well-known. If there is only the default url that was not overwritten by well-known, the UI will not be shown +- (BOOL) bwiShowLocationSharingUI:(MXSession*)session { + if (session) { + return BWIBuildSettings.shared.locationSharingEnabled && ![session.vc_homeserverConfiguration.tileServer.mapStyleURL.absoluteString isEqualToString:BWIBuildSettings.shared.serverConfigDefaultMapstyleURLString]; + } else { + return NO; + } +} + #pragma mark - UserSuggestionCoordinatorBridgeDelegate - (void)completionSuggestionCoordinatorBridge:(CompletionSuggestionCoordinatorBridge *)coordinator