Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS] - Add alert for mobile config download #27115

Merged
merged 4 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,26 @@ extension BrowserViewController: WKNavigationDelegate {
let mimeType = response.mimeType.flatMap({ UTType(mimeType: $0) }),
mimeTypesThatRequireSFSafariViewControllerHandling.contains(mimeType)
{
handleLinkWithSafariViewController(url, tab: tab)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This handles other mime types as well not just mobile configurations

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I think it should do it also for the calendar type.
So both the calendar and the mobile config since you can do the same issue on both.

I'll have to change the text I guess, to handle both.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Added calendar support.

// Do what Chromium does: https://source.chromium.org/chromium/chromium/src/+/main:ios/chrome/browser/download/ui_bundled/safari_download_coordinator.mm;l=100;bpv=1;bpt=1?q=presentMobileConfigAlertFromURL&ss=chromium%2Fchromium%2Fsrc
// and present an alert before showing the Safari View Controller

let alert = UIAlertController(
title: Strings.openMobileConfigurationAlertTitle,
message: String.init(
format: Strings.openMobileConfigurationAlertDescription,
url.absoluteString
),
preferredStyle: .alert
)
alert.addAction(
UIAlertAction(title: Strings.OBContinueButton, style: .default) { [weak self] _ in
self?.handleLinkWithSafariViewController(url, tab: tab)
}
)

alert.addAction(UIAlertAction(title: Strings.cancelButtonTitle, style: .cancel))
present(alert, animated: true)

return .cancel
}

Expand Down
14 changes: 14 additions & 0 deletions ios/brave-ios/Sources/BraveStrings/BraveStrings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3619,6 +3619,20 @@ extension Strings {
value: "Don't Allow",
comment: "Don't allow Brave to open the external app URL"
)
public static let openMobileConfigurationAlertTitle = NSLocalizedString(
"OpenMobileConfigurationAlertTitle",
tableName: "BraveShared",
bundle: .module,
value: "Configuration profile available",
comment: "Title of the alert when a mobile configuration profile is available for download"
)
public static let openMobileConfigurationAlertDescription = NSLocalizedString(
"OpenMobileConfigurationAlertTitle",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Key duped

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

tableName: "BraveShared",
bundle: .module,
value: "Continue download a configuration profile from %@",
comment: "Title of the alert when a mobile configuration profile is available for download. %@ is the URL placeholder of the website where the profile will be downloaded from"
)
public static let requestCameraPermissionPrompt = NSLocalizedString(
"requestCameraPermissionPrompt",
tableName: "BraveShared",
Expand Down
Loading