-
Notifications
You must be signed in to change notification settings - Fork 499
/
BuildSettings.swift
432 lines (338 loc) · 17.4 KB
/
BuildSettings.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
//
// Copyright 2020 Vector Creations Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
/// BuildSettings provides settings computed at build time.
/// In future, it may be automatically generated from xcconfig files
@objcMembers
final class BuildSettings: NSObject {
// MARK: - Bundle Settings
static var applicationGroupIdentifier: String {
guard let applicationGroupIdentifier = Bundle.app.object(forInfoDictionaryKey: "applicationGroupIdentifier") as? String else {
fatalError("applicationGroupIdentifier should be defined")
}
return applicationGroupIdentifier
}
static var baseBundleIdentifier: String {
guard let baseBundleIdentifier = Bundle.app.object(forInfoDictionaryKey: "baseBundleIdentifier") as? String else {
fatalError("baseBundleIdentifier should be defined")
}
return baseBundleIdentifier
}
static var keychainAccessGroup: String {
guard let keychainAccessGroup = Bundle.app.object(forInfoDictionaryKey: "keychainAccessGroup") as? String else {
fatalError("keychainAccessGroup should be defined")
}
return keychainAccessGroup
}
static var applicationURLScheme: String? {
guard let urlTypes = Bundle.app.object(forInfoDictionaryKey: "CFBundleURLTypes") as? [AnyObject],
let urlTypeDictionary = urlTypes.first as? [String: AnyObject],
let urlSchemes = urlTypeDictionary["CFBundleURLSchemes"] as? [AnyObject],
let externalURLScheme = urlSchemes.first as? String else {
return nil
}
return externalURLScheme
}
static var pushKitAppIdProd: String {
return baseBundleIdentifier + ".ios.voip.prod"
}
static var pushKitAppIdDev: String {
return baseBundleIdentifier + ".ios.voip.dev"
}
static var pusherAppIdProd: String {
return baseBundleIdentifier + ".ios.prod"
}
static var pusherAppIdDev: String {
return baseBundleIdentifier + ".ios.dev"
}
static var pushKitAppId: String {
#if DEBUG
return pushKitAppIdDev
#else
return pushKitAppIdProd
#endif
}
static var pusherAppId: String {
#if DEBUG
return pusherAppIdDev
#else
return pusherAppIdProd
#endif
}
// Element-Web instance for the app
static let applicationWebAppUrlString = "https://app.element.io"
// MARK: - Localization
/// Whether to allow the app to use a right to left layout or force left to right for all languages
static let disableRightToLeftLayout = true
// MARK: - Server configuration
// Default servers proposed on the authentication screen
static let serverConfigDefaultHomeserverUrlString = "https://matrix.org"
static let serverConfigDefaultIdentityServerUrlString = "https://vector.im"
static let serverConfigSygnalAPIUrlString = "https://matrix.org/_matrix/push/v1/notify"
// MARK: - Legal URLs
// Note: Set empty strings to hide the related entry in application settings
static let applicationCopyrightUrlString = "https://element.io/copyright"
static let applicationPrivacyPolicyUrlString = "https://element.io/privacy"
static let applicationTermsConditionsUrlString = "https://element.io/terms-of-service"
static let applicationHelpUrlString =
"https://element.io/help"
// MARK: - Permalinks
// Hosts/Paths for URLs that will considered as valid permalinks. Those permalinks are opened within the app.
static let permalinkSupportedHosts: [String: [String]] = [
"app.element.io": [],
"staging.element.io": [],
"develop.element.io": [],
"mobile.element.io": [""],
// Historical ones
"riot.im": ["/app", "/staging", "/develop"],
"www.riot.im": ["/app", "/staging", "/develop"],
"vector.im": ["/app", "/staging", "/develop"],
"www.vector.im": ["/app", "/staging", "/develop"],
// Official Matrix ones
"matrix.to": ["/"],
"www.matrix.to": ["/"],
// Client Permalinks (for use with `BuildSettings.clientPermalinkBaseUrl`)
// "example.com": ["/"],
// "www.example.com": ["/"],
]
// For use in clients that use a custom base url for permalinks rather than matrix.to.
// This baseURL is used to generate permalinks within the app (E.g. timeline message permalinks).
// Optional String that when set is used as permalink base, when nil matrix.to format is used.
// Example value would be "https://www.example.com", note there is no trailing '/'.
static let clientPermalinkBaseUrl: String? = nil
// MARK: - VoIP
static var allowVoIPUsage: Bool {
#if canImport(JitsiMeetSDK)
return true
#else
return false
#endif
}
static let stunServerFallbackUrlString: String? = "stun:turn.matrix.org"
// MARK: - Public rooms Directory
// List of homeservers for the public rooms directory
static let publicRoomsDirectoryServers = [
"matrix.org",
"gitter.im"
]
// MARK: - Rooms Screen
static let roomsAllowToJoinPublicRooms: Bool = true
// MARK: - Analytics
/// A type that represents how to set up the analytics module in the app.
///
/// **Note:** Analytics are disabled by default for forks.
/// If you are maintaining a fork, set custom configurations.
struct AnalyticsConfiguration {
/// Whether or not analytics should be enabled.
let isEnabled: Bool
/// The host to use for PostHog analytics.
let host: String
/// The public key for submitting analytics.
let apiKey: String
/// The URL to open with more information about analytics terms.
let termsURL: URL
}
#if DEBUG
/// The configuration to use for analytics during development. Set `isEnabled` to false to disable analytics in debug builds.
static let analyticsConfiguration = AnalyticsConfiguration(isEnabled: BuildSettings.baseBundleIdentifier.starts(with: "im.vector.app"),
host: "https://posthog.element.dev",
apiKey: "phc_VtA1L35nw3aeAtHIx1ayrGdzGkss7k1xINeXcoIQzXN",
termsURL: URL(string: "https://element.io/cookie-policy")!)
#else
/// The configuration to use for analytics. Set `isEnabled` to false to disable analytics.
static let analyticsConfiguration = AnalyticsConfiguration(isEnabled: BuildSettings.baseBundleIdentifier.starts(with: "im.vector.app"),
host: "https://posthog.hss.element.io",
apiKey: "phc_Jzsm6DTm6V2705zeU5dcNvQDlonOR68XvX2sh1sEOHO",
termsURL: URL(string: "https://element.io/cookie-policy")!)
#endif
// MARK: - Bug report
static let bugReportEndpointUrlString = "https://riot.im/bugreports"
// Use the name allocated by the bug report server
static let bugReportApplicationId = "riot-ios"
static let bugReportUISIId = "element-auto-uisi"
// MARK: - Integrations
static let integrationsUiUrlString = "https://scalar.vector.im/"
static let integrationsRestApiUrlString = "https://scalar.vector.im/api"
// Widgets in those paths require a scalar token
static let integrationsScalarWidgetsPaths = [
"https://scalar.vector.im/_matrix/integrations/v1",
"https://scalar.vector.im/api",
"https://scalar-staging.vector.im/_matrix/integrations/v1",
"https://scalar-staging.vector.im/api",
"https://scalar-staging.riot.im/scalar/api",
]
// Jitsi server used outside integrations to create conference calls from the call button in the timeline.
// Setting this to nil effectively disables Jitsi conference calls (given that there is no wellknown override).
// Note: this will not remove the conference call button, use roomScreenAllowVoIPForNonDirectRoom setting.
static let jitsiServerUrl: URL? = URL(string: "https://jitsi.riot.im")
// MARK: - Features
/// Setting to force protection by pin code
static let forcePinProtection: Bool = false
/// Max allowed time to continue using the app without prompting PIN
static let pinCodeGraceTimeInSeconds: TimeInterval = 0
/// Force non-jailbroken app usage
static let forceNonJailbrokenUsage: Bool = true
static let allowSendingStickers: Bool = true
static let allowLocalContactsAccess: Bool = true
static let allowInviteExernalUsers: Bool = true
// MARK: - Side Menu
static let enableSideMenu: Bool = true
static let sideMenuShowInviteFriends: Bool = true
/// Whether to read the `io.element.functional_members` state event and exclude any service members when computing a room's name and avatar.
static let supportFunctionalMembers: Bool = true
// MARK: - Feature Specifics
/// Not allowed pin codes. User won't be able to select one of the pin in the list.
static let notAllowedPINs: [String] = []
/// Maximum number of allowed pin failures when unlocking, before force logging out the user. Defaults to `3`
static let maxAllowedNumberOfPinFailures: Int = 3
/// Maximum number of allowed biometrics failures when unlocking, before fallbacking the user to the pin if set or logging out the user. Defaults to `5`
static let maxAllowedNumberOfBiometricsFailures: Int = 5
/// Indicates should the app log out the user when number of PIN failures reaches `maxAllowedNumberOfPinFailures`. Defaults to `false`
static let logOutUserWhenPINFailuresExceeded: Bool = false
/// Indicates should the app log out the user when number of biometrics failures reaches `maxAllowedNumberOfBiometricsFailures`. Defaults to `false`
static let logOutUserWhenBiometricsFailuresExceeded: Bool = false
static let showNotificationsV2: Bool = true
// MARK: - Main Tabs
static let homeScreenShowFavouritesTab: Bool = true
static let homeScreenShowPeopleTab: Bool = true
static let homeScreenShowRoomsTab: Bool = true
static let homeScreenShowCommunitiesTab: Bool = true
// MARK: - General Settings Screen
static let settingsScreenShowUserFirstName: Bool = false
static let settingsScreenShowUserSurname: Bool = false
static let settingsScreenAllowAddingEmailThreepids: Bool = true
static let settingsScreenAllowAddingPhoneThreepids: Bool = true
static let settingsScreenShowThreepidExplanatory: Bool = true
static let settingsScreenShowDiscoverySettings: Bool = true
static let settingsScreenAllowIdentityServerConfig: Bool = true
static let settingsScreenShowConfirmMediaSize: Bool = true
static let settingsScreenShowAdvancedSettings: Bool = true
static let settingsScreenShowLabSettings: Bool = true
static let settingsScreenAllowChangingRageshakeSettings: Bool = true
static let settingsScreenAllowChangingCrashUsageDataSettings: Bool = true
static let settingsScreenAllowBugReportingManually: Bool = true
static let settingsScreenAllowDeactivatingAccount: Bool = true
static let settingsScreenShowChangePassword:Bool = true
static let settingsScreenShowEnableStunServerFallback: Bool = true
static let settingsScreenShowNotificationDecodedContentOption: Bool = true
static let settingsScreenShowNsfwRoomsOption: Bool = true
static let settingsSecurityScreenShowSessions:Bool = true
static let settingsSecurityScreenShowSetupBackup:Bool = true
static let settingsSecurityScreenShowRestoreBackup:Bool = true
static let settingsSecurityScreenShowDeleteBackup:Bool = true
static let settingsSecurityScreenShowCryptographyInfo:Bool = true
static let settingsSecurityScreenShowCryptographyExport:Bool = true
static let settingsSecurityScreenShowAdvancedUnverifiedDevices:Bool = true
/// A setting to enable the presence configuration settings section.
static let settingsScreenPresenceAllowConfiguration: Bool = false
// MARK: - Timeline settings
static let roomInputToolbarCompressionMode: MediaCompressionMode = .prompt
enum MediaCompressionMode {
case prompt, small, medium, large, none
}
// MARK: - Room Creation Screen
static let roomCreationScreenAllowEncryptionConfiguration: Bool = true
static let roomCreationScreenRoomIsEncrypted: Bool = true
static let roomCreationScreenAllowRoomTypeConfiguration: Bool = true
static let roomCreationScreenRoomIsPublic: Bool = false
// MARK: - Room Screen
static let roomScreenAllowVoIPForDirectRoom: Bool = true
static let roomScreenAllowVoIPForNonDirectRoom: Bool = true
static let roomScreenAllowCameraAction: Bool = true
static let roomScreenAllowMediaLibraryAction: Bool = true
static let roomScreenAllowStickerAction: Bool = true
static let roomScreenAllowFilesAction: Bool = true
// Timeline style
static let roomScreenAllowTimelineStyleConfiguration: Bool = true
static let roomScreenTimelineDefaultStyleIdentifier: RoomTimelineStyleIdentifier = .plain
static var isRoomScreenEnableMessageBubblesByDefault: Bool {
return self.roomScreenTimelineDefaultStyleIdentifier == .bubble
}
static let roomScreenUseOnlyLatestUserAvatarAndName: Bool = false
/// Allow split view detail view stacking
static let allowSplitViewDetailsScreenStacking: Bool = true
// MARK: - Room Contextual Menu
static let roomContextualMenuShowMoreOptionForMessages: Bool = true
static let roomContextualMenuShowMoreOptionForStates: Bool = true
static let roomContextualMenuShowReportContentOption: Bool = true
// MARK: - Room Info Screen
static let roomInfoScreenShowIntegrations: Bool = true
// MARK: - Room Settings Screen
static let roomSettingsScreenShowLowPriorityOption: Bool = true
static let roomSettingsScreenShowDirectChatOption: Bool = true
static let roomSettingsScreenAllowChangingAccessSettings: Bool = true
static let roomSettingsScreenAllowChangingHistorySettings: Bool = true
static let roomSettingsScreenShowAddressSettings: Bool = true
static let roomSettingsScreenShowFlairSettings: Bool = true
static let roomSettingsScreenShowAdvancedSettings: Bool = true
static let roomSettingsScreenAdvancedShowEncryptToVerifiedOption: Bool = true
// MARK: - Room Member Screen
static let roomMemberScreenShowIgnore: Bool = true
// MARK: - Message
static let messageDetailsAllowShare: Bool = true
static let messageDetailsAllowPermalink: Bool = true
static let messageDetailsAllowViewSource: Bool = true
static let messageDetailsAllowSave: Bool = true
static let messageDetailsAllowCopyMedia: Bool = true
static let messageDetailsAllowPasteMedia: Bool = true
// MARK: - Notifications
static let decryptNotificationsByDefault: Bool = true
// MARK: - HTTP
/// Additional HTTP headers will be sent by all requests. Not recommended to use request-specific headers, like `Authorization`.
/// Empty dictionary by default.
static let httpAdditionalHeaders: [String: String] = [:]
// MARK: - Authentication Screen
static let authScreenShowRegister = true
static let authScreenShowPhoneNumber = true
static let authScreenShowForgotPassword = true
static let authScreenShowCustomServerOptions = true
static let authScreenShowSocialLoginSection = true
// MARK: - Authentication Options
static let authEnableRefreshTokens = false
// MARK: - Onboarding
static let onboardingShowAccountPersonalization = false
// MARK: - Unified Search
static let unifiedSearchScreenShowPublicDirectory = true
// MARK: - Secrets Recovery
static let secretsRecoveryAllowReset = true
// MARK: - UISI Autoreporting
static let cryptoUISIAutoReportingEnabled = false
// MARK: - Polls
static var pollsEnabled: Bool {
guard #available(iOS 14, *) else {
return false
}
return true
}
// MARK: - Location Sharing
static let tileServerMapStyleURL = URL(string: "https://api.maptiler.com/maps/streets/style.json?key=fU3vlMsMn4Jb6dnEIFsx")!
static var locationSharingEnabled: Bool {
guard #available(iOS 14, *) else {
return false
}
return true
}
static var liveLocationSharingEnabled: Bool {
guard #available(iOS 14, *) else {
return false
}
guard self.locationSharingEnabled else {
return false
}
// Do not enable live location sharing atm
return false
}
}