diff --git a/Config/BWIBuildSettings.swift b/Config/BWIBuildSettings.swift index cf7afe206..13fcd2a60 100644 --- a/Config/BWIBuildSettings.swift +++ b/Config/BWIBuildSettings.swift @@ -270,6 +270,9 @@ class BWIBuildSettings: NSObject { var applicationTermsConditionsUrlString = "" var applicationPrivacyPolicyWithMatomoSectionUrlString = "https://messenger.bwi.de/datenschutz#c6637" + // (#4751) use privacy policy link of well known + var bwiUseWellKnownPrivacyPolicyLink: Bool = false + // MARk: - Matrix permalinks // Paths for URLs that will considered as Matrix permalinks. Those permalinks are opened within the app var permalinkSupportedHosts: [String: [String]] = [:] diff --git a/Config/BuM-Beta/BWIBuildSettings+BuM-Beta.swift b/Config/BuM-Beta/BWIBuildSettings+BuM-Beta.swift index 24791e993..6cc9f294a 100644 --- a/Config/BuM-Beta/BWIBuildSettings+BuM-Beta.swift +++ b/Config/BuM-Beta/BWIBuildSettings+BuM-Beta.swift @@ -38,6 +38,7 @@ extension BWIBuildSettings { showMaintenanceInfoMessageType = true ignoreBlockingMaintenance = true enableAllChatsToolbar = false + bwiUseWellKnownPrivacyPolicyLink = true itunesAppLink = "itms://itunes.apple.com/app/bundesmessenger-beta/id1617068656?mt=8" } diff --git a/Config/BuM/BWIBuildSettings+BuM.swift b/Config/BuM/BWIBuildSettings+BuM.swift index 1605a0865..90a587b43 100644 --- a/Config/BuM/BWIBuildSettings+BuM.swift +++ b/Config/BuM/BWIBuildSettings+BuM.swift @@ -27,6 +27,7 @@ extension BWIBuildSettings { authScreenShowTestServerOptions = false bwiNotificationTimes = true enableNewSessionManagerByDefault = true + bwiUseWellKnownPrivacyPolicyLink = true itunesAppLink = "itms://itunes.apple.com/app/bundesmessenger/id1616866351?mt=8" } diff --git a/Riot/Modules/Home/AllChats/AllChatsViewController.swift b/Riot/Modules/Home/AllChats/AllChatsViewController.swift index e74cd8e65..94476c631 100644 --- a/Riot/Modules/Home/AllChats/AllChatsViewController.swift +++ b/Riot/Modules/Home/AllChats/AllChatsViewController.swift @@ -455,8 +455,20 @@ class AllChatsViewController: HomeViewController { alert.addAction(UIAlertAction(title: BWIL10n.bwiAnalyticsAlertInfoButton, style: .default, handler: { [self] action in - if let url = URL(string: BWIBuildSettings.shared.applicationPrivacyPolicyWithMatomoSectionUrlString) { - UIApplication.shared.open(url) + if let defaultURL = URL(string: BWIBuildSettings.shared.applicationPrivacyPolicyWithMatomoSectionUrlString) { + if BWIBuildSettings.shared.bwiUseWellKnownPrivacyPolicyLink { + guard let wellKnownDataPrivacyURL = URL(string: self.mainSession.homeserverWellknown.dataPrivacyURL() ?? ""), let defaultHost = defaultURL.host else { + UIApplication.shared.open(defaultURL) + return + } + if !wellKnownDataPrivacyURL.absoluteString.contains(defaultHost) { + UIApplication.shared.open(wellKnownDataPrivacyURL) + } else { + UIApplication.shared.open(defaultURL) + } + } else { + UIApplication.shared.open(defaultURL) + } } showMatomoConsentAlertOnCloseModal = true })) diff --git a/Riot/Modules/Settings/SettingsViewController.m b/Riot/Modules/Settings/SettingsViewController.m index e16daa0a5..66f8afe94 100644 --- a/Riot/Modules/Settings/SettingsViewController.m +++ b/Riot/Modules/Settings/SettingsViewController.m @@ -759,7 +759,11 @@ ChangePasswordCoordinatorBridgePresenterDelegate> { [sectionAbout addRowWithTag:ABOUT_ACCEPTABLE_USE_INDEX]; } - if (BWIBuildSettings.shared.applicationPrivacyPolicyUrlString.length) + if (self.mainSession.homeserverWellknown.dataPrivacyURL != nil && BWIBuildSettings.shared.bwiUseWellKnownPrivacyPolicyLink) + { + [sectionAbout addRowWithTag:ABOUT_PRIVACY_INDEX]; + } + else if (BWIBuildSettings.shared.applicationPrivacyPolicyUrlString.length && !BWIBuildSettings.shared.bwiUseWellKnownPrivacyPolicyLink) { [sectionAbout addRowWithTag:ABOUT_PRIVACY_INDEX]; } @@ -3415,7 +3419,14 @@ ChangePasswordCoordinatorBridgePresenterDelegate> } else if (row == ABOUT_PRIVACY_INDEX) { - [[UIApplication sharedApplication] openURL:[NSURL URLWithString:BWIBuildSettings.shared.applicationPrivacyPolicyUrlString] options:@{} completionHandler:nil]; + if (BWIBuildSettings.shared.bwiUseWellKnownPrivacyPolicyLink) + { + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:self.mainSession.homeserverWellknown.dataPrivacyURL] options:@{} completionHandler:nil]; + } + else + { + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:BWIBuildSettings.shared.applicationPrivacyPolicyUrlString] options:@{} completionHandler:nil]; + } } else if (row == ABOUT_ACCESSIBILITY_DECLARATION_INDEX) { diff --git a/Riot/Modules/TabBar/MasterTabBarController.m b/Riot/Modules/TabBar/MasterTabBarController.m index 22614bf80..72cb22927 100644 --- a/Riot/Modules/TabBar/MasterTabBarController.m +++ b/Riot/Modules/TabBar/MasterTabBarController.m @@ -1089,8 +1089,14 @@ message:[BWIL10n bwiAnalyticsAlertBody:AppInfo.current.displayName] preferredStyle:UIAlertControllerStyleAlert]; - [alert addAction:[UIAlertAction actionWithTitle:BWIL10n.bwiAnalyticsAlertInfoButton style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { + [alert addAction:[UIAlertAction actionWithTitle:BWIL10n.bwiAnalyticsAlertInfoButton style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { + if (BWIBuildSettings.shared.bwiUseWellKnownPrivacyPolicyLink) { + if (self->mxSessionArray.firstObject.homeserverWellknown.dataPrivacyURL != nil) { + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:self->mxSessionArray.firstObject.homeserverWellknown.dataPrivacyURL] options:@{} completionHandler:nil]; + } + } else { [[UIApplication sharedApplication] openURL:[NSURL URLWithString:BWIBuildSettings.shared.applicationPrivacyPolicyUrlString] options:@{} completionHandler:nil]; + } }]]; [alert addAction:[UIAlertAction actionWithTitle:BWIL10n.bwiAnalyticsAlertCancelButton style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { BWIAnalytics.sharedTracker.running = NO; diff --git a/RiotSwiftUI/Modules/Authentication/Login/AuthenticationLoginModels.swift b/RiotSwiftUI/Modules/Authentication/Login/AuthenticationLoginModels.swift index 356bd5fd3..2c3699a97 100644 --- a/RiotSwiftUI/Modules/Authentication/Login/AuthenticationLoginModels.swift +++ b/RiotSwiftUI/Modules/Authentication/Login/AuthenticationLoginModels.swift @@ -88,11 +88,12 @@ struct AuthenticationLoginViewState: BindableState { hasValidCredentials && !isLoading } - var dataPrivacyString: String { - guard let urlString = AuthenticationService.shared.wellknown?.dataPrivacyURL() else { + var dataPrivacyString: String? { + if BWIBuildSettings.shared.bwiUseWellKnownPrivacyPolicyLink { + return AuthenticationService.shared.wellknown?.dataPrivacyURL() + } else { return BWIBuildSettings.shared.applicationPrivacyPolicyUrlString } - return urlString } } diff --git a/RiotSwiftUI/Modules/Authentication/Login/View/AuthenticationLoginScreen.swift b/RiotSwiftUI/Modules/Authentication/Login/View/AuthenticationLoginScreen.swift index 60e1b2d35..fead5cd83 100644 --- a/RiotSwiftUI/Modules/Authentication/Login/View/AuthenticationLoginScreen.swift +++ b/RiotSwiftUI/Modules/Authentication/Login/View/AuthenticationLoginScreen.swift @@ -209,22 +209,31 @@ struct AuthenticationLoginScreen: View { } var dataPrivacyForm: some View { - Button(action: { - let tosURL = URL.init(string: viewModel.viewState.dataPrivacyString)! // add your link here - if UIApplication.shared.canOpenURL(tosURL) { - UIApplication.shared.open(tosURL) + VStack() { + if viewModel.viewState.dataPrivacyString != nil { + Button(action: { + guard let urlString = viewModel.viewState.dataPrivacyString else { + return + } + let tosURL = URL.init(string: urlString)! // add your link here + if UIApplication.shared.canOpenURL(tosURL) { + UIApplication.shared.open(tosURL) + } + }, label: { + Text(BWIL10n.authenticationDataprivacyText) + .font(theme.fonts.footnote) + .foregroundColor(theme.colors.primaryContent) + + + Text(BWIL10n.authenticationDataprivacyLink) + .font(theme.fonts.footnote) + .foregroundColor(.blue) + .underline() + }) + .padding([.horizontal], 20) + } else { + EmptyView() } - }, label: { - Text(BWIL10n.authenticationDataprivacyText) - .font(theme.fonts.footnote) - .foregroundColor(theme.colors.primaryContent) - + - Text(BWIL10n.authenticationDataprivacyLink) - .font(theme.fonts.footnote) - .foregroundColor(.blue) - .underline() - }) - .padding([.horizontal], 20) + } } var loginDescription: some View {