/
AppConstants.swift
120 lines (102 loc) · 3.58 KB
/
AppConstants.swift
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
/* 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 UIKit
public enum AppBuildChannel: String {
case release = "release"
case beta = "beta"
case developer = "developer"
}
public enum KVOConstants: String {
case loading = "loading"
case estimatedProgress = "estimatedProgress"
case URL = "URL"
case title = "title"
case canGoBack = "canGoBack"
case canGoForward = "canGoForward"
case contentSize = "contentSize"
}
public struct KeychainKey {
public static let fxaPushRegistration = "account.push-registration"
public static let apnsToken = "apnsToken"
}
public struct AppConstants {
public static let IsRunningTest = NSClassFromString("XCTestCase") != nil || ProcessInfo.processInfo.arguments.contains(LaunchArguments.Test)
public static let FxAiOSClientId = "1b1a3e44c54fbb58"
/// Build Channel.
public static let BuildChannel: AppBuildChannel = {
#if MOZ_CHANNEL_RELEASE
return AppBuildChannel.release
#elseif MOZ_CHANNEL_BETA
return AppBuildChannel.beta
#elseif MOZ_CHANNEL_FENNEC
return AppBuildChannel.developer
#endif
}()
public static let scheme: String = {
guard let identifier = Bundle.main.bundleIdentifier else {
return "unknown"
}
let scheme = identifier.replacingOccurrences(of: "org.mozilla.ios.", with: "")
if scheme == "FirefoxNightly.enterprise" {
return "FirefoxNightly"
}
return scheme
}()
public static let PrefSendUsageData = "settings.sendUsageData"
/// Enables support for International Domain Names (IDN)
/// Disabled because of https://bugzilla.mozilla.org/show_bug.cgi?id=1312294
public static let MOZ_PUNYCODE: Bool = {
#if MOZ_CHANNEL_RELEASE
return false
#elseif MOZ_CHANNEL_BETA
return false
#elseif MOZ_CHANNEL_FENNEC
return true
#else
return true
#endif
}()
/// Toggle the use of Leanplum.
public static let MOZ_ENABLE_LEANPLUM: Bool = {
#if MOZ_CHANNEL_RELEASE
return true
#elseif MOZ_CHANNEL_BETA
return true
#elseif MOZ_CHANNEL_FENNEC
return true
#else
return false
#endif
}()
/// The maximum length of a URL stored by Firefox. Shared with Places on desktop.
public static let DB_URL_LENGTH_MAX = 65536
/// The maximum length of a page title stored by Firefox. Shared with Places on desktop.
public static let DB_TITLE_LENGTH_MAX = 4096
/// The maximum length of a bookmark description stored by Firefox. Shared with Places on desktop.
public static let DB_DESCRIPTION_LENGTH_MAX = 1024
/// Toggle FxA Leanplum A/B test for prompting push permissions
public static let MOZ_FXA_LEANPLUM_AB_PUSH_TEST: Bool = {
#if MOZ_CHANNEL_RELEASE
return true
#elseif MOZ_CHANNEL_BETA
return true
#elseif MOZ_CHANNEL_FENNEC
return true
#else
return false
#endif
}()
/// Put it behind a feature flag as the strings didn't land in time
public static let MOZ_SHAKE_TO_RESTORE: Bool = {
#if MOZ_CHANNEL_RELEASE
return false
#elseif MOZ_CHANNEL_BETA
return true
#elseif MOZ_CHANNEL_FENNEC
return true
#else
return true
#endif
}()
}