forked from qodo-benchmark/firefox-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRoute.swift
More file actions
137 lines (120 loc) · 5.65 KB
/
Route.swift
File metadata and controls
137 lines (120 loc) · 5.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/
import Foundation
/// An enumeration representing different navigational routes in an application.
enum Route {
/// Represents a search route that takes a URL, a boolean value indicating whether the search
/// is private or not and an optional set of search options.
///
/// - Parameters:
/// - url: A `URL` object representing the URL to be searched. Pass `nil` if the search does not require a URL.
/// - isPrivate: A boolean value indicating whether the search is private or not.
/// - options: An optional set of `SearchOptions` values that can be used to customize the search behavior.
case search(url: URL?, isPrivate: Bool, options: Set<SearchOptions>? = nil)
/// Represents a search route that takes a URL and a tab identifier.
///
/// - Parameters:
/// - url: A `URL` object representing the URL to be searched. Can be `nil`.
/// - tabId: A string representing the identifier of the tab where the search should be performed.
case searchURL(url: URL?, tabId: String)
/// Represents a search route that takes a query string a boolean value indicating whether the search
/// is private or not.
///
/// - Parameters:
/// - query: A string representing the query to be searched and.
/// - isPrivate: A boolean value indicating whether the search is private or not.
case searchQuery(query: String, isPrivate: Bool)
/// Represents a route for sending Glean data.
///
/// - Parameter url: A `URL` object representing the URL to send Glean data to.
case glean(url: URL)
/// Represents a home panel route that takes a `HomepanelSection` value indicating the section to be displayed.
///
/// - Parameter section: An instance of `HomepanelSection` indicating the section of the home
/// panel to be displayed.
case homepanel(section: HomepanelSection)
/// Represents a settings route that takes a `SettingsSection` value indicating the settings
/// section to be displayed.
///
/// - Parameter section: An instance of `SettingsSection` indicating the section of the settings
/// menu to be displayed.
case settings(section: SettingsSection)
/// Represents an application action route that takes an `AppAction` value indicating the action to be performed.
///
/// - Parameter action: An instance of `AppAction` indicating the application action to be performed.
case action(action: AppAction)
/// Represents a Firefox account sign-in route that takes an `FxALaunchParams` object indicating
/// the parameters for the sign-in.
///
/// - Parameter params: An instance of `FxALaunchParams` containing the parameters for the sign-in.
case fxaSignIn(params: FxALaunchParams)
/// Represents a default browser route that takes a `DefaultBrowserSection` value indicating
/// the section to be displayed.
///
/// - Parameter section: An instance of `DefaultBrowserSection` indicating the section of the default browser
/// settings to be displayed.
case defaultBrowser(section: DefaultBrowserSection)
/// A route for opening a share sheet with share content and an optional accompanying message.
///
/// - Parameters:
/// - shareType: The content to be shared.
/// - shareMessage: An optional plain text share message to be shared.
case sharesheet(shareType: ShareType, shareMessage: ShareMessage?)
/// An enumeration representing different sections of the home panel.
enum HomepanelSection: String, CaseIterable, Equatable {
case bookmarks
case topSites = "top-sites"
case history
case readingList = "reading-list"
case downloads
case newPrivateTab = "new-private-tab"
case newTab = "new-tab"
var libraryPanel: LibraryPanelType {
switch self {
case .bookmarks: return .bookmarks
case .history: return .history
case .readingList: return .readingList
case .downloads: return .downloads
default: return . bookmarks
}
}
}
/// An enumeration representing different sections of the settings menu.
enum SettingsSection: String, CaseIterable, Equatable {
case addresses
case appIcon = "app-icon"
case contentBlocker
case clearPrivateData = "clear-private-data"
case creditCard
case password
case fxa
case general
case homePage = "homepage"
case mailto
case newTab = "newtab"
case search
case relayMask
case browser
case theme
case toolbar
case topSites
case wallpaper
case rateApp
}
/// An enumeration representing different actions that can be performed within the application.
enum AppAction: String, CaseIterable, Equatable {
case closePrivateTabs = "close-private-tabs"
case showIntroOnboarding = "show-intro-onboarding"
}
/// An enumeration representing different sections of the default browser settings.
enum DefaultBrowserSection: String, CaseIterable, Equatable {
case tutorial
case systemSettings = "system-settings"
}
/// An enumeration representing options that can be used in a search feature.
enum SearchOptions: Equatable {
/// An option to focus the user's attention on the location field of the search interface.
case focusLocationField
}
}