Merge branch 'feature/4751_use_privacy_url_of_well_known' into 'develop'

MESSENGER-4751 use privacy url of well known

See merge request bwmessenger/bundesmessenger/bundesmessenger-ios!217
This commit is contained in:
JanNiklas Grabowski
2023-09-19 09:34:16 +00:00
8 changed files with 67 additions and 23 deletions
+3
View File
@@ -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]] = [:]
@@ -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"
}
+1
View File
@@ -27,6 +27,7 @@ extension BWIBuildSettings {
authScreenShowTestServerOptions = false
bwiNotificationTimes = true
enableNewSessionManagerByDefault = true
bwiUseWellKnownPrivacyPolicyLink = true
itunesAppLink = "itms://itunes.apple.com/app/bundesmessenger/id1616866351?mt=8"
}
@@ -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
}))
+13 -2
View File
@@ -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)
{
+7 -1
View File
@@ -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;
@@ -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
}
}
@@ -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 {