@@ -29,11 +29,16 @@ enum SettingsPage: String {
29
29
case fxa = " fxa "
30
30
}
31
31
32
+ enum DefaultBrowserPath : String {
33
+ case systemSettings = " system-settings "
34
+ }
35
+
32
36
// Used by the App to navigate to different views.
33
37
// To open a URL use /open-url or to open a blank tab use /open-url with no params
34
38
enum DeepLink {
35
39
case settings( SettingsPage )
36
40
case homePanel( HomePanelPath )
41
+ case defaultBrowser( DefaultBrowserPath )
37
42
init ? ( urlString: String ) {
38
43
let paths = urlString. split ( separator: " / " )
39
44
guard let component = paths [ safe: 0 ] , let componentPath = paths [ safe: 1 ] else {
@@ -43,6 +48,8 @@ enum DeepLink {
43
48
self = . settings( link)
44
49
} else if component == " homepanel " , let link = HomePanelPath ( rawValue: String ( componentPath) ) {
45
50
self = . homePanel( link)
51
+ } else if component == " default-browser " , let link = DefaultBrowserPath ( rawValue: String ( componentPath) ) {
52
+ self = . defaultBrowser( link)
46
53
} else {
47
54
return nil
48
55
}
@@ -126,6 +133,8 @@ enum NavigationPath {
126
133
break
127
134
case . settings( let settingsPath) :
128
135
NavigationPath . handleSettings ( settings: settingsPath, and: bvc)
136
+ case . defaultBrowser( let path) :
137
+ NavigationPath . handleDefaultBrowser ( path: path)
129
138
}
130
139
}
131
140
@@ -180,6 +189,13 @@ enum NavigationPath {
180
189
break
181
190
}
182
191
}
192
+
193
+ private static func handleDefaultBrowser( path: DefaultBrowserPath ) {
194
+ switch path {
195
+ case . systemSettings:
196
+ UIApplication . shared. open ( URL ( string: UIApplication . openSettingsURLString) !, options: [ : ] )
197
+ }
198
+ }
183
199
}
184
200
185
201
extension NavigationPath : Equatable { }
@@ -203,6 +219,8 @@ func == (lhs: DeepLink, rhs: DeepLink) -> Bool {
203
219
return lhs == rhs
204
220
case let ( . homePanel( lhs) , . homePanel( rhs) ) :
205
221
return lhs == rhs
222
+ case let ( . defaultBrowser( lhs) , . defaultBrowser( rhs) ) :
223
+ return lhs == rhs
206
224
default :
207
225
return false
208
226
}
0 commit comments