From dc28efa0206d37d8d465e45ee25b766312437a5b Mon Sep 17 00:00:00 2001 From: udaybansal19 Date: Mon, 4 Nov 2024 07:42:14 +0530 Subject: [PATCH] ios internal url fixes --- .../App/ActionExtension/ActionToBraveViewController.swift | 2 +- .../App/ShareExtension/ShareToBraveViewController.swift | 2 +- ios/brave-ios/App/iOS/Entitlements/Debug.entitlements | 2 -- .../Browser/BrowserViewController/BVC+ToolbarDelegate.swift | 4 ++-- .../BrowserViewController/BVC+WKNavigationDelegate.swift | 2 +- .../Brave/Frontend/Sync/SyncSettingsTableViewController.swift | 2 +- .../Brave/Frontend/Sync/SyncWelcomeViewController.swift | 2 +- ios/brave-ios/Sources/BraveShared/BraveURLs.swift | 2 +- 8 files changed, 8 insertions(+), 10 deletions(-) diff --git a/ios/brave-ios/App/ActionExtension/ActionToBraveViewController.swift b/ios/brave-ios/App/ActionExtension/ActionToBraveViewController.swift index 6c71c2ebb258..cfaac412214f 100644 --- a/ios/brave-ios/App/ActionExtension/ActionToBraveViewController.swift +++ b/ios/brave-ios/App/ActionExtension/ActionToBraveViewController.swift @@ -86,7 +86,7 @@ class ActionToBraveViewController: UIViewController { private func createURL(for schemeType: SchemeType, with value: String) -> URL? { var queryItem: URLQueryItem var components = URLComponents() - components.scheme = Bundle.main.infoDictionary?["BRAVE_URL_SCHEME"] as? String ?? "brave" + components.scheme = Bundle.main.infoDictionary?["BRAVE_URL_SCHEME"] as? String ?? "ping" switch schemeType { case .query: diff --git a/ios/brave-ios/App/ShareExtension/ShareToBraveViewController.swift b/ios/brave-ios/App/ShareExtension/ShareToBraveViewController.swift index 0c19353c2443..a73dce414439 100644 --- a/ios/brave-ios/App/ShareExtension/ShareToBraveViewController.swift +++ b/ios/brave-ios/App/ShareExtension/ShareToBraveViewController.swift @@ -49,7 +49,7 @@ class ShareToBraveViewController: SLComposeServiceViewController { var components = URLComponents() let queryItem: URLQueryItem - components.scheme = Bundle.main.infoDictionary?["BRAVE_URL_SCHEME"] as? String ?? "brave" + components.scheme = Bundle.main.infoDictionary?["BRAVE_URL_SCHEME"] as? String ?? "ping" switch type { case .url: diff --git a/ios/brave-ios/App/iOS/Entitlements/Debug.entitlements b/ios/brave-ios/App/iOS/Entitlements/Debug.entitlements index ced55d319d73..eb546f6b35b2 100644 --- a/ios/brave-ios/App/iOS/Entitlements/Debug.entitlements +++ b/ios/brave-ios/App/iOS/Entitlements/Debug.entitlements @@ -28,7 +28,5 @@ group.com.ping.ios.browser - com.apple.developer.carplay-audio - diff --git a/ios/brave-ios/Sources/Brave/Frontend/Browser/BrowserViewController/BVC+ToolbarDelegate.swift b/ios/brave-ios/Sources/Brave/Frontend/Browser/BrowserViewController/BVC+ToolbarDelegate.swift index bcdfe8579991..df1b23092576 100644 --- a/ios/brave-ios/Sources/Brave/Frontend/Browser/BrowserViewController/BVC+ToolbarDelegate.swift +++ b/ios/brave-ios/Sources/Brave/Frontend/Browser/BrowserViewController/BVC+ToolbarDelegate.swift @@ -265,7 +265,7 @@ extension BrowserViewController: TopToolbarDelegate { isUserDefinedURLNavigation: Bool ) async -> Bool { - if let url = URL(string: text), url.scheme == "brave" || url.scheme == "chrome" { + if let url = URL(string: text), url.scheme == "ping" || url.scheme == "brave" || url.scheme == "chrome" { topToolbar.leaveOverlayMode() return handleChromiumWebUIURL(url) } @@ -274,7 +274,7 @@ extension BrowserViewController: TopToolbarDelegate { return false } - if fixupURL.scheme == "brave" || fixupURL.scheme == "chrome" { + if fixupURL.scheme == "ping" || fixupURL.scheme == "brave" || fixupURL.scheme == "chrome" { topToolbar.leaveOverlayMode() return handleChromiumWebUIURL(fixupURL) } diff --git a/ios/brave-ios/Sources/Brave/Frontend/Browser/BrowserViewController/BVC+WKNavigationDelegate.swift b/ios/brave-ios/Sources/Brave/Frontend/Browser/BrowserViewController/BVC+WKNavigationDelegate.swift index fcf84b546676..39bad21dd8e9 100644 --- a/ios/brave-ios/Sources/Brave/Frontend/Browser/BrowserViewController/BVC+WKNavigationDelegate.swift +++ b/ios/brave-ios/Sources/Brave/Frontend/Browser/BrowserViewController/BVC+WKNavigationDelegate.swift @@ -600,7 +600,7 @@ extension BrowserViewController: WKNavigationDelegate { // Standard schemes are handled in previous if-case. // This check handles custom app schemes to open external apps. // Our own 'brave' scheme does not require the switch-app prompt. - if requestURL.scheme?.contains("brave") == false { + if requestURL.scheme?.contains("ping") == false { // Do not allow opening external URLs from child tabs let shouldOpen = await handleExternalURL( requestURL, diff --git a/ios/brave-ios/Sources/Brave/Frontend/Sync/SyncSettingsTableViewController.swift b/ios/brave-ios/Sources/Brave/Frontend/Sync/SyncSettingsTableViewController.swift index dec178987e4e..ef303e5e2256 100644 --- a/ios/brave-ios/Sources/Brave/Frontend/Sync/SyncSettingsTableViewController.swift +++ b/ios/brave-ios/Sources/Brave/Frontend/Sync/SyncSettingsTableViewController.swift @@ -360,7 +360,7 @@ class SyncSettingsTableViewController: SyncViewController, UITableViewDelegate, let syncInternalsController = ChromeWebViewController(privateBrowsing: false).then { $0.title = Strings.Sync.internalsTitle - $0.loadURL("brave://sync-internals") + $0.loadURL("ping://sync-internals") } self.navigationController?.pushViewController(syncInternalsController, animated: true) diff --git a/ios/brave-ios/Sources/Brave/Frontend/Sync/SyncWelcomeViewController.swift b/ios/brave-ios/Sources/Brave/Frontend/Sync/SyncWelcomeViewController.swift index f5b93f41a075..f7f74ef99caa 100644 --- a/ios/brave-ios/Sources/Brave/Frontend/Sync/SyncWelcomeViewController.swift +++ b/ios/brave-ios/Sources/Brave/Frontend/Sync/SyncWelcomeViewController.swift @@ -312,7 +312,7 @@ class SyncWelcomeViewController: SyncViewController { let syncInternalsController = ChromeWebViewController(privateBrowsing: false).then { $0.title = Strings.Sync.internalsTitle - $0.loadURL("brave://sync-internals") + $0.loadURL("ping://sync-internals") } navigationController?.pushViewController(syncInternalsController, animated: true) diff --git a/ios/brave-ios/Sources/BraveShared/BraveURLs.swift b/ios/brave-ios/Sources/BraveShared/BraveURLs.swift index a9b016bf715b..d06de7158695 100644 --- a/ios/brave-ios/Sources/BraveShared/BraveURLs.swift +++ b/ios/brave-ios/Sources/BraveShared/BraveURLs.swift @@ -86,6 +86,6 @@ extension URL { public struct AppURLScheme { /// The apps URL scheme for the current build channel public static var appURLScheme: String { - Bundle.main.infoDictionary?["BRAVE_URL_SCHEME"] as? String ?? "brave" + Bundle.main.infoDictionary?["BRAVE_URL_SCHEME"] as? String ?? "ping" } }