element-ios/Config/BuildSettings.swift

338 lines
13 KiB
Swift
Raw Normal View History

//
// 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
import MatrixKit
/// BuildSettings provides settings computed at build time.
/// In future, it may be automatically generated from xcconfig files
@objcMembers
final class BuildSettings: NSObject {
2020-07-31 07:15:57 +00:00
// MARK: - Bundle Settings
static var bundleDisplayName: String {
guard let bundleDisplayName = Bundle.app.object(forInfoDictionaryKey: "CFBundleDisplayName") as? String else {
fatalError("CFBundleDisplayName should be defined")
}
return bundleDisplayName
}
static var applicationGroupIdentifier: String {
guard let applicationGroupIdentifier = Bundle.app.object(forInfoDictionaryKey: "applicationGroupIdentifier") as? String else {
fatalError("applicationGroupIdentifier should be defined")
}
return applicationGroupIdentifier
}
2020-08-05 14:11:06 +00:00
static var baseBundleIdentifier: String {
guard let baseBundleIdentifier = Bundle.app.object(forInfoDictionaryKey: "baseBundleIdentifier") as? String else {
fatalError("baseBundleIdentifier should be defined")
}
return baseBundleIdentifier
2020-08-05 14:11:06 +00:00
}
static var keychainAccessGroup: String {
guard let keychainAccessGroup = Bundle.app.object(forInfoDictionaryKey: "keychainAccessGroup") as? String else {
fatalError("keychainAccessGroup should be defined")
}
return keychainAccessGroup
2020-08-05 14:11:06 +00:00
}
2020-12-18 17:22:46 +00:00
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
}
2020-08-05 14:11:06 +00:00
static var pushKitAppIdProd: String {
return baseBundleIdentifier + ".ios.voip.prod"
2020-08-05 14:11:06 +00:00
}
static var pushKitAppIdDev: String {
return baseBundleIdentifier + ".ios.voip.dev"
2020-08-05 14:11:06 +00:00
}
static var pusherAppIdProd: String {
return baseBundleIdentifier + ".ios.prod"
2020-08-05 14:11:06 +00:00
}
static var pusherAppIdDev: String {
return baseBundleIdentifier + ".ios.dev"
2020-08-05 14:11:06 +00:00
}
2020-08-10 15:16:07 +00:00
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"
2020-07-31 06:29:22 +00:00
2020-07-31 10:12:05 +00:00
// MARK: - Server configuration
// Default servers proposed on the authentication screen
2020-08-03 13:07:39 +00:00
static let serverConfigDefaultHomeserverUrlString = "https://matrix.org"
static let serverConfigDefaultIdentityServerUrlString = "https://vector.im"
2020-08-03 13:07:39 +00:00
static let serverConfigSygnalAPIUrlString = "https://matrix.org/_matrix/push/v1/notify"
2020-07-31 10:12:05 +00:00
2020-07-31 07:15:57 +00:00
// MARK: - Legal URLs
// Note: Set empty strings to hide the related entry in application settings
2020-07-31 06:29:22 +00:00
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"
2020-07-31 06:37:27 +00:00
// MARk: - Matrix permalinks
// Paths for URLs that will considered as Matrix permalinks. Those permalinks are opened within the app
static let matrixPermalinkPaths: [String: [String]] = [
"app.element.io": [],
"staging.element.io": [],
"develop.element.io": [],
2020-08-06 08:05:15 +00:00
"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": ["/"],
]
2020-07-31 07:15:57 +00:00
// MARK: - VoIP
static var allowVoIPUsage: Bool {
2021-02-09 09:34:45 +00:00
#if canImport(JitsiMeetSDK)
return true
#else
return false
#endif
}
static let stunServerFallbackUrlString: String? = "stun:turn.matrix.org"
// MARK: - Public rooms Directory
#warning("Unused build setting: should this be implemented in ShowDirectory?")
2020-08-03 13:07:39 +00:00
static let publicRoomsAllowServerChange: Bool = true
// List of homeservers for the public rooms directory
2020-08-03 13:07:39 +00:00
static let publicRoomsDirectoryServers = [
"matrix.org",
"gitter.im"
]
2021-04-13 17:21:07 +00:00
// MARK: - Rooms Screen
static let roomsAllowToJoinPublicRooms: Bool = true
2020-07-31 09:28:57 +00:00
// MARK: - Analytics
2020-07-31 07:15:57 +00:00
static let analyticsServerUrl = URL(string: "https://piwik.riot.im/piwik.php")
static let analyticsAppId = "14"
// MARK: - Bug report
2020-07-31 06:37:27 +00:00
static let bugReportEndpointUrlString = "https://riot.im/bugreports"
// Use the name allocated by the bug report server
static let bugReportApplicationId = "riot-ios"
2020-07-31 09:28:57 +00:00
// 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",
]
2020-07-31 09:28:57 +00:00
// Jitsi server used outside integrations to create conference calls from the call button in the timeline
static let jitsiServerUrl: URL = URL(string: "https://jitsi.riot.im")!
2020-07-31 06:29:22 +00:00
2020-07-31 07:15:57 +00:00
// MARK: - Features
/// Setting to force protection by pin code
static let forcePinProtection: Bool = false
2020-09-07 10:41:52 +00:00
/// 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
2020-08-03 13:07:39 +00:00
static let allowSendingStickers: Bool = true
2020-07-31 06:29:22 +00:00
static let allowLocalContactsAccess: Bool = true
static let allowInviteExernalUsers: Bool = true
static let enableSideMenu: 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.
2021-08-06 09:42:18 +00:00
static let supportFunctionalMembers: Bool = true
2020-09-17 11:01:29 +00:00
// MARK: - Feature Specifics
2020-09-17 12:55:41 +00:00
/// Not allowed pin codes. User won't be able to select one of the pin in the list.
static let notAllowedPINs: [String] = []
2020-07-31 06:29:22 +00:00
2020-09-28 15:12:56 +00:00
/// 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`
2020-09-28 15:12:56 +00:00
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
2021-04-19 16:53:32 +00:00
// MARK: - Main Tabs
static let homeScreenShowFavouritesTab: Bool = true
static let homeScreenShowPeopleTab: Bool = true
static let homeScreenShowRoomsTab: Bool = true
static let homeScreenShowCommunitiesTab: Bool = true
2020-08-18 10:05:56 +00:00
// MARK: - General Settings Screen
2020-08-03 13:07:39 +00:00
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
2020-08-03 13:07:39 +00:00
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 settingsScreenShowInviteFriends: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
// MARK: - Timeline settings
static let roomInputToolbarCompressionMode = MXKRoomInputToolbarCompressionModePrompt
// MARK: - Room Creation Screen
static let roomCreationScreenAllowEncryptionConfiguration: Bool = true
static let roomCreationScreenRoomIsEncrypted: Bool = true
static let roomCreationScreenAllowRoomTypeConfiguration: Bool = true
static let roomCreationScreenRoomIsPublic: Bool = false
2021-04-19 18:39:07 +00:00
// 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
// 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
2020-08-18 10:05:56 +00:00
// 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
2020-07-31 07:15:57 +00:00
// MARK: - Message
2020-08-03 13:07:39 +00:00
static let messageDetailsAllowShare: Bool = true
static let messageDetailsAllowPermalink: Bool = true
static let messageDetailsAllowViewSource: Bool = true
2020-08-14 11:55:06 +00:00
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] = [:]
2020-07-31 06:29:22 +00:00
2020-07-31 07:15:57 +00:00
// MARK: - Authentication Screen
static let authScreenShowRegister = true
static let authScreenShowPhoneNumber = true
static let authScreenShowForgotPassword = true
static let authScreenShowCustomServerOptions = true
// MARK: - Unified Search
static let unifiedSearchScreenShowPublicDirectory = true
// MARK: - Secrets Recovery
static let secretsRecoveryAllowReset = true
}