MESSENGER-4549 Enable locationsharing per default when there is an url in well-known

This commit is contained in:
Frank Rotermund
2023-08-16 08:37:15 +02:00
parent b2f78a2ced
commit 7568f86a95
7 changed files with 20 additions and 8 deletions

View File

@@ -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"

View File

@@ -29,7 +29,7 @@ extension BWIBuildSettings {
bwiPersonalState = true
bwiMatomoTrackingDefaultState = false
showSessionManager = false
locationSharingEnabled = false
locationSharingEnabled = true
bwiLocationShareButtonVisible = false
bwiLoginFlowLayout = false
useRustEncryption = true

View File

@@ -21,7 +21,7 @@ extension BWIBuildSettings {
func overrideTargetSpecificSettings() {
secondaryAppName = "BundesMessenger"
locationSharingEnabled = false
locationSharingEnabled = true
bwiLocationShareButtonVisible = false
bwiLoginFlowLayout = false
authScreenShowTestServerOptions = false

View File

@@ -21,7 +21,7 @@ extension BWIBuildSettings {
func overrideTargetSpecificSettings() {
secondaryAppName = "BundesMessenger"
locationSharingEnabled = false
locationSharingEnabled = true
bwiLocationShareButtonVisible = false
bwiLoginFlowLayout = false
authScreenShowTestServerOptions = false

View File

@@ -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)!
}

View File

@@ -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
}

View File

@@ -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