diff --git a/Config/AppConfiguration.swift b/Config/AppConfiguration.swift index 365848190..fa0d8b533 100644 --- a/Config/AppConfiguration.swift +++ b/Config/AppConfiguration.swift @@ -35,7 +35,7 @@ class AppConfiguration: CommonConfiguration { // bwi: add additional event for nicknames MXKAppSettings.standard()?.addSupportedEventTypes([kWidgetMatrixEventTypeString, kWidgetModularEventTypeString, - BwiBuildSettings.bwiUserLabelEventTypeString]) + BWIBuildSettings.shared.bwiUserLabelEventTypeString]) // Hide undecryptable messages that were sent while the user was not in the room MXKAppSettings.standard()?.hidePreJoinedUndecryptableEvents = true @@ -53,7 +53,7 @@ class AppConfiguration: CommonConfiguration { MXSDKOptions.sharedInstance().enableKeyBackupWhenStartingMXCrypto = true // bwi: explicitly set option for key sharing - MXSDKOptions.sharedInstance().enableRoomSharedHistoryOnInvite = BwiBuildSettings.allowKeySharingOnRoomInvite + MXSDKOptions.sharedInstance().enableRoomSharedHistoryOnInvite = BWIBuildSettings.shared.allowKeySharingOnRoomInvite } @@ -63,7 +63,7 @@ class AppConfiguration: CommonConfiguration { super.setupSettings(for: matrixSession) setupWidgetReadReceipts(for: matrixSession) - if BuildSettings.enableAntivirusScan, let homeServerStringURL = matrixSession.credentials?.homeServer { + if BWIBuildSettings.shared.enableAntivirusScan, let homeServerStringURL = matrixSession.credentials?.homeServer { matrixSession.antivirusServerURL = homeServerStringURL } } diff --git a/Config/BWIBuildSettings.swift b/Config/BWIBuildSettings.swift new file mode 100644 index 000000000..53841e081 --- /dev/null +++ b/Config/BWIBuildSettings.swift @@ -0,0 +1,494 @@ +// +/* + * Copyright (c) 2022 BWI GmbH + * + * 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 KeychainAccess + +@objcMembers +class BWIBuildSettings: NSObject { + static let shared = BWIBuildSettings() + + private let vault: KeyValueVault + + override init() { + vault = KeychainVault(Keychain(service: BwiSettingsConstants.bwiSettingsKeychainService, + accessGroup: BuildSettings.keychainAccessGroup)) + + super.init() + overrideTargetSpecificSettings() + } + + // MARK: - + + private enum UserDefaultsKeys { + static let additionalBwiHeaderKey = "bwiHeader" + } + + private struct BwiSettingsConstants { + static let bwiSettingsKeychainService: String = BuildSettings.baseBundleIdentifier + ".bwi-settings-service" + } + + func reset() { + additionalBwiHeader = UserAgentService().bwiUserAgentDict + let sdkOptions = MXSDKOptions.sharedInstance() + sdkOptions.httpAdditionalHeaders = UserAgentService().bwiUserAgentDict + } + + // MARK: Servers + + var additionalBwiHeader: Dictionary { + get { + do { + guard let data = try vault.data(forKey: UserDefaultsKeys.additionalBwiHeaderKey) else { + return UserAgentService().bwiUserAgentDict + } + var dict = try JSONDecoder().decode(Dictionary.self, from: data) + dict["User-Agent"] = UserAgentService().bwiUserAgent + return dict + } catch { + return UserAgentService().bwiUserAgentDict + } + } set { + do { + let data = try JSONEncoder().encode(newValue) + try vault.set(data, forKey: UserDefaultsKeys.additionalBwiHeaderKey) + } catch let error { + NSLog("[PinCodePreferences] Error when storing addional header to the vault: \(error)") + } + } + } + + // MARK: - + + // Integration check + var forcedPinProtection = true + + // Jailbreak check + var forcedNoneJailbroken = true + + /// Default number of iterations for secure storage. Do not change this value after going live. + var iterationsForSecureStorage: UInt = 100000 + + /// Allow split view detail view stacking + var allowSplitViewDetailsScreenStacking = true + + // direct rooms are for two persons only in bwi context + var allowInviteOnDirectRooms = false + + // test setup for downtime: should be false for all builds + var useTestDataForDowntime = false + + var flavor = "" + + var showBwiSplashScreen = false + + var bwiShowRoomSearch = false + + var bwiAllowRoomPermalink = false + + var bwiAllowUserPermalink = false + + var bwiCheckAppVersion = true + + var bwiNotificationTimes = true + + var bwiUserLabelsAdminSettingsVisible = true + var bwiUserLabelsMemberDetailsVisible = true + var bwiUserLabelsParticipantsVisible = true + var bwiUserLabelsTimelineDisplayNameVisible = true + var bwiUserLabelsTimelineEventVisible = true + + var bwiUserLabelEventTypeString = "de.bwi.room.user_function_labels" + + var bwiUserLabelParticipantSorting = true + + var bwiShowClosedPolls = true + var bwiShowThreads = false + + var bwiShowRoomCreationSectionFooter = false + + var bwiAutoCreateAliasOnRoomCreation = true + + var bwiLocationShareButtonVisible = true + var bwiUseCustomPersonalNotesAvatar = true + var bwiBetterIgnoredUsers = true + var bwiSettingsShowInAppNotifications = false + var bwiFilteredContextMenu = true + + var bwiShowPinnedNotificationSettings = false + var bwiShowSessionSettingsFooter = false + + var bwiEnablePersonalState = false + + // In onboarding splash screen dis/enable register button + var bwiOnboardingSplashScreenEnableRegister = false + + // make sure that the NSE extention always resets message body and title + var bwiHideNotificationMessageBody = true + + // in Auth screen dis/enable register button even with onboarding splash screen enabled + var bwiAuthentificationScreenEnableRegister = false + + // enable BuM style authentication UI (more Info text and a logo) + var bwiEnableBuMAuthentificationUI = true + + // voicemessages should resignplaying when the app enters the background + var bwiResignPlayingVoiceMessageInBackground = true + + // enable BUM style UI in pincode and maybe other places + var bwiEnableBuMUI = true + + // clear media cache every time when leaving a room vc: no media should be saved on device for security purposes + var bwiClearMediaCacheOnRoomExit = true + + var bwiEnableLoginProtection = true + + var bwiHashes = [ "a3f65e35a7476799afe8d80282fb3c45b39dab06d0d8c70dc98e45ab7d8e93a9", + "2fda1a831655c22a5e6096d7cfbff4429fbf27881141e191b46adbf168142a11", + "4f8cbb3fef885f7284d0477d797d7007f0e1ba76221834132652f4d645796e28", + "24c2ec541e61e8e68941b96dc45ed5df12f6bdbda283cb0b3a322742aa970256", + "1be0b314a6c915d4475290522baef5b642db1b6d68937992b8e0eb5b7b0d6666" ] + + // use a different badge color if the user was mentioned in a room + var showMentionsInRoom = true + + // replace feature history link variable with the appropiate build setting + var bwiFeatureHistoryLink = "https://messenger.bwi.de/#c4783" + var bwiReplaceFeatureLink = true + + // login with matrix id should only be enabled in some configurations + var bwiEnableLoginWithMatrixID = true + + // show app specific loading icons instead of the rotating element logo + var showBUMLottieAnimation = true + + // DMs don't need all roomsettings (like changing avatar, name, topic) + var showUnrelatedRoomSettingsForDirectMessages = false + + // create rooms without shared history + var enableSharedHistoryOnRoomCreation = false + + // explicitly set sdk option for key sharing => We don't want to share even if the room setting allows it + var allowKeySharingOnRoomInvite = true + + // DMs don't need all roomsettings (like changing avatar, name, topic) + var allowDoubleTapOnImageAttachmentsForZoom = true + + // ------ End of BwiBuildSettings --------- + + // Element-Web instance for the app + var applicationWebAppUrlString = "" + + // Default servers proposed on the authentication screen + var serverConfigDefaultHomeserverUrlString = "" + var serverConfigDefaultIdentityServerUrlString = "" + var serverConfigPreSelections = ["":""] + var serverConfigSygnalAPIUrlString = "" + + // Note: Set empty strings to hide the related entry in application settings + var applicationCopyrightUrlString = "https://messenger.bwi.de/copyright" + var applicationPrivacyPolicyUrlString = "" + + // MARk: - Matrix permalinks + // Paths for URLs that will considered as Matrix permalinks. Those permalinks are opened within the app + var permalinkSupportedHosts: [String: [String]] = [:] + + // MARK: - VoIP + var allowVoIPUsage = false + var stunServerFallbackUrlString: String? = "" + + // MARK: - Public rooms Directory + // List of homeservers for the public rooms directory + var publicRoomsDirectoryServers = ["matrix.org"] + + // MARK: - Analytics + + /// BWI: set host and key to nil to disable PostHog tracking + var analyticsHost: String? = nil + var analyticsKey: String? = nil + var bwiAnalyticsServerUrlString = "" + var bwiAnalyticsAppId = "1" + + /// The configuration to use for analytics during development. Set `isEnabled` to false to disable analytics in debug builds. + var analyticsConfiguration = BuildSettings.AnalyticsConfiguration(isEnabled: false, + host: "", + apiKey: "", + termsURL: URL(string: "https://element.io/cookie-policy")!) + + // MARK: - Bug report + var bugReportEndpointUrlString = "" + + // MARK: - Integrations + // Widgets in those paths require a scalar token + var integrationsScalarWidgetsPaths = [""] + // Jitsi server used outside integrations to create conference calls from the call button in the timeline + var jitsiServerUrl = URL(string: "https://enter.jitsi.url")! + var enableJSInWebView = false + + // MARK: - Features + + /// Setting to force protection by pin code + var forcePinProtection = true + + /// Max allowed time to continue using the app without prompting PIN + var pinCodeGraceTimeInSeconds: TimeInterval = 180 + + var allowLocalContactsAccess = false + var allowInviteExernalUsers = false + var enableSideMenu = false + var sideMenuShowInviteFriends = false + + // MARK: - Feature Specifics + + /// Not allowed pin codes. User won't be able to select one of the pin in the list. + var notAllowedPINs: [String] = [ + "1234", + "1111", + "0000", + "1212", + "7777", + "1004", + "2000", + "4444", + "2222", + "6969", + "9999", + "3333", + "5555", + "6666", + "1122", + "1313", + "8888", + "4321", + "2001", + "1010", + "2580", + "4711", + "0815", + "0852" + ] + + var allowLocalContactPresence = false + + /// Indicates should the app log out the user when number of PIN failures reaches `maxAllowedNumberOfPinFailures`. Defaults to `false` + var logOutUserWhenPINFailuresExceeded = true + + /// Indicates should the app log out the user when number of biometrics failures reaches `maxAllowedNumberOfBiometricsFailures`. Defaults to `false` + var logOutUserWhenBiometricsFailuresExceeded = true + + /// If force is enabled the dialog for asking if reseting the key backup is not shown.. already asked before in mandatory verfication + var forceResetBackupIfLost = true + + /// if skip is enabled the key backup dialogs are passed through + var skipKeyBackupStep = true + + // MARK: - Main Tabs + + var homeScreenShowHomeTab = false + + // MARK: - General Settings Screen + + var settingsScreenAllowAddingLinkedEmails = false + var settingsScreenAllowAddingPhoneNumbers = false + var settingsScreenAllowAddingEmailThreepids = false + var settingsScreenAllowAddingPhoneThreepids = false + var settingsScreenShowThreepidExplanatory = false + var settingsScreenShowDiscoverySettings = false + var settingsScreenAllowIdentityServerConfig = false + var settingsScreenShowConfirmMediaSize = false + var settingsScreenShowAdvancedSettings = false + var settingsScreenShowLabSettings = false + var settingsScreenAllowChangingRageshakeSettings = false + var settingsScreenAllowChangingCrashUsageDataSettings = false + var settingsScreenAllowBugReportingManually = false + var settingsScreenAllowDeactivatingAccount = false + + var settingsScreenShowLinkPreviews = false + var settingsScreenShowInviteFriends = false + var settingsScreenShowSettings = true + var settingsScreenShowFeedback = false + var settingsScreenShowHelp = false + + var settingsScreenShowNotificationDecodedContentOption = false + var settingsScreenShowSystemSettingsOption = false + var settingsScreenShowNsfwRoomsOption = false + var settingsScreenShowSupportSetting = true + + var settingsSecurityScreenShowCryptographyInfo:Bool = false + var settingsSecurityScreenShowCryptographyExport:Bool = false + var settingsSecurityScreenShowAdvancedUnverifiedDevices:Bool = false + + // MARK: - Notification Settings + var settingsNotificationsBWIDefaultSet = true + var settingsNotificationsShowDefault = true + var settingsNotificationsShowMentions = false + var settingsNotificationsShowAdvanced = false + + // MARK: - Timeline settings + var roomInputToolbarCompressionMode: BuildSettings.MediaCompressionMode = .none + + // MARK: - Room Creation Screen + + var roomCreationScreenAllowEncryptionConfiguration = false + + // MARK: - Room Screen + + var roomScreenAllowStickerAction = false + + // MARK: - Room Info Screen + + var roomInfoScreenShowIntegrations = false + + // MARK: - Room Settings Screen + + var roomSettingsScreenShowLowPriorityOption = false + var roomSettingsScreenShowDirectChatOption = false + var roomSettingsScreenAllowChangingAccessSettings = false + var roomSettingsScreenAllowChangingHistorySettings = false + var roomSettingsScreenShowAddressSettings = false + var roomSettingsScreenShowAdvancedSettings = false + var roomSettingsScreenShowAccessSettingsBW = true + var roomSettingsScreenRemoveLeave = true + var roomSettingsScreenShowNotificationsV2 = false + + // MARK: - Message + + var messageDetailsAllowShare = false + var messageDetailsAllowPermalink = false + var messageDetailsAllowViewSource = false + var messageDetailsAllowSave = false + var messageDetailsAllowCopyMedia = false + var messageDetailsAllowPasteMedia = false + + // MARK: - Authentication Screen + + var authScreenShowRegister = false + var authScreenShowPhoneNumber = false + var authScreenShowForgotPassword = false + var authScreenShowCustomServerOptions = true + var authScreenShowTestServerOptions = true + var authScreenShowSocialLoginSection = false + + // MARK: - Cross-signing (bwi=true) + var disableSelfUserVerification = true + + // MARK: - Antivirus scan (bwi=true) + + var enableAntivirusScan = false + + // MARK: Verification screen (bwi=false) + + var showRecoverWithKey = false + + // MARK: Unified search screen (bwi=false) + + var showUnifiedSearchViewMessagesTab = false + var showUnifiedSearchViewFilesTab = false + + // MARK: - Onboarding + + var onboardingShowAccountPersonalization = false + var onboardingEnableNewAuthenticationFlow = false + + // --- + + // MARK: Last message timestamp support (bwi=false) + var enableLastMessageTimestamp = false + + // MARK: Invite friends in Direct Chat (bwi=false) + var directChatShowInviteFriends = false + + // MARK: Last admin is not allowed to leave the room (bwi=true) + var lastAdminIsNotAllowedToLeaveRoom = true + + // MARK: Room Member Details Screen (bwi=true) + var roomMemberDetailsHideLeaveButton = true + + // MARK: Room create options (bwi=false) + var enableShowInRoomDirectory = false + + // Mark: Unified Search (bwi=true) + var unifiedSearchScreenShowPublicDirectory = true + + // MARK: Allows removal of uploaded avatar photos (bwi=true) + var enableRemoveAvatarImage = true + + // MARK: Add a toggle button to the login screen to make the password visible + var passwordIndicatorOnLogin = true + + // MARK: Displays the element base version on the settings screen + var elementBaseVersion = "1.9.8" + + var showElementBaseVersion = true + + // MARK: Bypasses the normal forgot password process by presenting the user an information alert + // (requires authScreenShowForgotPassword set to true) + var forgotPasswordInformationAlert = true + + // MARK: Promote new feature within a banner below the navigation view + var showTopBanner = true + + var showCustomServerDisplayName = true + var customServerDisplayName = "" + + // MARK BWI show/hide developer menu + var bwiShowDeveloperSettings = false + + // MARK BWI personal notes room + var bwiPersonalNotesRoom = false + var bwiPersonalNotesRoomLeavable = false + var bwiResetPersonalNotesAccountData = false + var bwiShowTimelineSettings = false + + // MARK BWI personal state + var bwiPersonalState = false + + // MARK BWI personal notes room + var bwiRollsAndRights = true + + // MARK: Timeline + var settingsScreenShowSimpleTimeLineOptions = false + var settingsScreenShowTimeStampOption = true + var settingsScreenShowDeletedMessagesOption = false + var settingsScreenShowNameChangeOption = false + var settingsScreenShowChatEffectsOption = false + var settingsScreenShowRoomAvatarChangeOption = false + var settingsScreenShowUserAvatarChangeOption = true + var settingsScreenShowEnterRoomOption = true + + var bwiLastAdminCanDowngradeHimself = false + + var bwiEnableErrorTracking = false + + var bwiEnableRegisterInfo = false + + var bwiShowHappyBirthdayCampaign = false + var bwiHappyBirthdayCampaignIdentifier: String = "one_year_anniversary" + var bwiDisableSecuritySettingsUntrustedDevices = true + var bwiMatomoTrackingDefaultState = false + var bwiShowNewFeatures = true + + // MARK: - Location Sharing + + /// Overwritten by the home server's .well-known configuration (if any exists) + var defaultTileServerMapStyleURL = URL(string: "https://msgpriv.example.com/")! + + // MARK: - Message Bubbles bwi show in our menu and only for beta builds + + var bwiShowMessageBubbles = false + +} diff --git a/Config/BuM-Beta/BWIBuildSettings+BuM-Beta.swift b/Config/BuM-Beta/BWIBuildSettings+BuM-Beta.swift new file mode 100644 index 000000000..0a0e0dae1 --- /dev/null +++ b/Config/BuM-Beta/BWIBuildSettings+BuM-Beta.swift @@ -0,0 +1,32 @@ +// +/* + * Copyright (c) 2022 BWI GmbH + * + * 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 + +extension BWIBuildSettings { + + func overrideTargetSpecificSettings() { + authScreenShowRegister = true + showTopBanner = false + bwiShowDeveloperSettings = true + bwiPersonalState = true + bwiEnableErrorTracking = true + bwiMatomoTrackingDefaultState = true + bwiShowMessageBubbles = true + } + +} diff --git a/Config/BuM-Beta/BuildSettings.swift b/Config/BuM-Beta/BuildSettings.swift deleted file mode 100644 index d1600a93d..000000000 --- a/Config/BuM-Beta/BuildSettings.swift +++ /dev/null @@ -1,572 +0,0 @@ -// -// Copyright 2020 Vector Creations Ltd -// Copyright (c) 2021 BWI GmbH -// -// 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 = "" - - // 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 = "" - static let serverConfigDefaultIdentityServerUrlString = "" - - static let serverConfigPreSelections = ["":""] - - static let serverConfigSygnalAPIUrlString = "" - - // MARK: - Legal URLs - - // Note: Set empty strings to hide the related entry in application settings - static let applicationCopyrightUrlString = "https://messenger.bwi.de/copyright" - static let applicationPrivacyPolicyUrlString = "" - static let applicationTermsConditionsUrlString = "https://element.io/terms-of-service" - static let applicationHelpUrlString = "https://element.io/help" - - // MARk: - Matrix permalinks - // Paths for URLs that will considered as Matrix permalinks. Those permalinks are opened within the app - static let permalinkSupportedHosts: [String: [String]] = [:] - - // 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? = "" - - // MARK: - VoIP - static var allowVoIPUsage: Bool { - #if canImport(JitsiMeetSDK) - return false - #else - return false - #endif - } - - static let stunServerFallbackUrlString: String? = "" - - // 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 - - // $$$ - static let analyticsServerUrl = URL(string: "") - static let analyticsAppId = "0" - - /// BWI: set host and key to nil to disable PostHog tracking - static let analyticsHost: String? = nil - static let analyticsKey: String? = nil - static let analyticsTermsURL = URL(string: "https://element.io/cookie-policy")! - static let bwiPresentAnalyticsPrompt = false - - static let bwiAnalyticsServerUrlString = "" - static let bwiAnalyticsAppId = "1" - - /// 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 - } - - /// The configuration to use for analytics during development. Set `isEnabled` to false to disable analytics in debug builds. - static let analyticsConfiguration = AnalyticsConfiguration(isEnabled: false, - host: "", - apiKey: "", - termsURL: URL(string: "https://element.io/cookie-policy")!) - - // MARK: - Bug report - static let bugReportEndpointUrlString = "" - // 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 = [""] - // Jitsi server used outside integrations to create conference calls from the call button in the timeline - static let jitsiServerUrl: URL = URL(string: "https://enter.jitsi.url")! - - // MARK: - Features - - /// Setting to force protection by pin code - static let forcePinProtection: Bool = true - - /// Max allowed time to continue using the app without prompting PIN - static let pinCodeGraceTimeInSeconds: TimeInterval = 180 - - /// Force non-jailbroken app usage - static let forceNonJailbrokenUsage: Bool = true - - static let allowSendingStickers: Bool = false - - static let allowLocalContactsAccess: Bool = false - - static let allowInviteExernalUsers: Bool = false - - static let enableSideMenu: Bool = false - static let sideMenuShowInviteFriends: Bool = false - - /// 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] = [ - "1234", - "1111", - "0000", - "1212", - "7777", - "1004", - "2000", - "4444", - "2222", - "6969", - "9999", - "3333", - "5555", - "6666", - "1122", - "1313", - "8888", - "4321", - "2001", - "1010", - "2580", - "4711", - "0815", - "0852" - ] - - /// 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 - - static let allowLocalContactPresence: Bool = false - - /// Indicates should the app log out the user when number of PIN failures reaches `maxAllowedNumberOfPinFailures`. Defaults to `false` - static let logOutUserWhenPINFailuresExceeded: Bool = true - - /// Indicates should the app log out the user when number of biometrics failures reaches `maxAllowedNumberOfBiometricsFailures`. Defaults to `false` - static let logOutUserWhenBiometricsFailuresExceeded: Bool = true - - - /// If force is enabled the dialog for asking if reseting the key backup is not shown.. already asked before in mandatory verfication - static let forceResetBackupIfLost: Bool = true - - /// if skip is enabled the key backup dialogs are passed through - static let skipKeyBackupStep: Bool = true - - static let showNotificationsV2: Bool = true - - // MARK: - Main Tabs - - static let homeScreenShowHomeTab: Bool = false - static let homeScreenShowFavouritesTab: Bool = true - static let homeScreenShowPeopleTab: Bool = true - static let homeScreenShowRoomsTab: Bool = true - - // MARK: - General Settings Screen - - static let settingsScreenShowUserFirstName: Bool = false - static let settingsScreenShowUserSurname: Bool = false - static let settingsScreenAllowAddingLinkedEmails: Bool = false - static let settingsScreenAllowAddingPhoneNumbers: Bool = false - static let settingsScreenAllowAddingEmailThreepids: Bool = false - static let settingsScreenAllowAddingPhoneThreepids: Bool = false - static let settingsScreenShowThreepidExplanatory: Bool = false - static let settingsScreenShowDiscoverySettings: Bool = false - static let settingsScreenAllowIdentityServerConfig: Bool = false - static let settingsScreenShowConfirmMediaSize: Bool = false - static let settingsScreenShowAdvancedSettings: Bool = false - static let settingsScreenShowLabSettings: Bool = false - static let settingsScreenAllowChangingRageshakeSettings: Bool = false - static let settingsScreenAllowChangingCrashUsageDataSettings: Bool = false - static let settingsScreenAllowBugReportingManually: Bool = false - static let settingsScreenAllowDeactivatingAccount: Bool = false - static let settingsScreenEnableDecodedContentAndGlobalSettings: Bool = false - static let settingsScreenShowChangePassword:Bool = true - - static let settingsScreenShowLinkPreviews:Bool = false - static let settingsScreenShowInviteFriends:Bool = false - static let settingsScreenShowSettings:Bool = true - static let settingsScreenShowFeedback:Bool = false - static let settingsScreenShowHelp:Bool = false - - static let settingsScreenShowEnableStunServerFallback: Bool = true - static let settingsScreenShowNotificationDecodedContentOption: Bool = false - static let settingsScreenShowSystemSettingsOption: Bool = false - static let settingsScreenShowNsfwRoomsOption: Bool = false - static let settingsScreenShowTACSetting: Bool = false - static let settingsScreenShowSupportSetting: Bool = true - static let settingsSecurityScreenShowSessions:Bool = true - static let settingsSecurityScreenShowSetupBackup:Bool = true - static let settingsSecurityScreenShowRestoreBackup:Bool = true - static let settingsSecurityScreenShowDeleteBackup:Bool = true - /// A setting to enable the presence configuration settings section. - static let settingsScreenPresenceAllowConfiguration: Bool = false - - static let settingsSecurityScreenShowCryptographyInfo:Bool = false - static let settingsSecurityScreenShowCryptographyExport:Bool = false - static let settingsSecurityScreenShowAdvancedUnverifiedDevices:Bool = false - - // MARK: - Notification Settings - static let settingsNotificationsBWIDefaultSet:Bool = true - static let settingsNotificationsShowDefault:Bool = true - static let settingsNotificationsShowMentions:Bool = false - static let settingsNotificationsShowAdvanced:Bool = false - - // MARK: - Timeline settings - static let roomInputToolbarCompressionMode: MediaCompressionMode = .none - - enum MediaCompressionMode { - case prompt, small, medium, large, none - } - - // MARK: - Room Creation Screen - - static let roomCreationScreenAllowEncryptionConfiguration: Bool = false - 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 = false - 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 - static let roomContextualMenuShowEncryptionOption: Bool = false - - // MARK: - Room Info Screen - - static let roomInfoScreenShowIntegrations: Bool = false - - // MARK: - Room Settings Screen - - static let roomSettingsScreenShowLowPriorityOption: Bool = false - static let roomSettingsScreenShowDirectChatOption: Bool = false - static let roomSettingsScreenAllowChangingAccessSettings: Bool = false - static let roomSettingsScreenAllowChangingHistorySettings: Bool = false - static let roomSettingsScreenShowAddressSettings: Bool = false - static let roomSettingsScreenShowAdvancedSettings: Bool = false - - static let roomSettingsScreenShowAccessSettingsBW: Bool = true - static let roomSettingsScreenRemoveLeave: Bool = true - static let roomSettingsScreenAdvancedShowEncryptToVerifiedOption: Bool = true - - static let roomSettingsScreenShowNotificationsV2: Bool = false - - // MARK: - Room Member Screen - static let roomMemberScreenShowIgnore: Bool = true - - // MARK: - Message - static let messageDetailsAllowShare: Bool = false - static let messageDetailsAllowPermalink: Bool = false - static let messageDetailsAllowViewSource: Bool = false - static let messageDetailsAllowSave: Bool = false - static let messageDetailsAllowCopyMedia: Bool = false - static let messageDetailsAllowPasteMedia: Bool = false - - // MARK: - Notifications - static let decryptNotificationsByDefault: Bool = true - - // MARK: - Authentication Screen - static let authScreenShowRegister = true - static let authScreenShowPhoneNumber = false - static let authScreenShowForgotPassword = false - static let authScreenShowCustomServerOptions = true - static let authScreenShowTestServerOptions = true - static let authScreenShowSocialLoginSection = false - - // MARK: - Authentication Options - static let authEnableRefreshTokens = false - - // MARK: - Cross-signing (bwi=true) - static let disableSelfUserVerification = true - - // MARK: - Antivirus scan (bwi=true) - static let enableAntivirusScan = false - - // MARK: - Room Screen - static let enableRoomSearchItem = false - - // MARK: - Matomo Analytics (bwi=false) - static let enableMatomoAnalytics = true - - // MARK: Verification screen (bwi=false) - static let showDetailedVerificationElements : Bool = false - static let showRecoverWithKey : Bool = false - - // MARK: Unified search screen (bwi=false) - static let showUnifiedSearchViewMessagesTab : Bool = false - static let showUnifiedSearchViewFilesTab : Bool = false - - // MARK: - Onboarding - static let onboardingShowAccountPersonalization = false - static let onboardingEnableNewAuthenticationFlow = false - - // MARK: - Secrets Recovery - static let secretsRecoveryAllowReset = true - - // MARK: VoIP support (bwi=false) - static let enableVoIPSupport : Bool = false - // MARK: - UISI Autoreporting - static let cryptoUISIAutoReportingEnabled = false - - // MARK: - Polls - - // MARK: Last message timestamp support (bwi=false) - static let enableLastMessageTimestamp : Bool = false - - // MARK: Room chat alert screen (bwi=false) - static let enableViewEncryptionAction : Bool = false - - // MARK: JavaScript support in WKWebView (bwi=false) - static let enableJSInWebView : Bool = false - - // MARK: Secure pin code description (bwi=false) - static let settingsSettingsSecureShowPinCodeDescription : Bool = false - - // MARK: Invite friends in Direct Chat (bwi=false) - static let directChatShowInviteFriends : Bool = false - - // MARK: Last admin is not allowed to leave the room (bwi=true) - static let lastAdminIsNotAllowedToLeaveRoom : Bool = true - - // MARK: Room Member Details Screen (bwi=true) - static let roomMemberDetailsHideLeaveButton : Bool = true - - // MARK: Room create options (bwi=false) - static let enableShowInRoomDirectory : Bool = false - - // MARK: sticker in composer (bwi=false) - static let enableRoomComposerSticker : Bool = false - - // Mark: Unified Search (bwi=true) - static let unifiedSearchScreenShowPublicDirectory = true - - // MARK: Allows removal of uploaded avatar photos (bwi=true) - static let enableRemoveAvatarImage = true - - // MARK: Add a toggle button to the login screen to make the password visible - static let passwordIndicatorOnLogin : Bool = true - - // MARK: Displays the element base version on the settings screen - static let elementBaseVersion : String = "1.9.8" - - static let showElementBaseVersion : Bool = true - - // MARK: Bypasses the normal forgot password process by presenting the user an information alert - // (requires authScreenShowForgotPassword set to true) - static let forgotPasswordInformationAlert : Bool = true - - // MARK: Promote new feature within a banner below the navigation view - static let showTopBanner : Bool = false - - static let showCustomServerDisplayName : Bool = true - static let customServerDisplayName : String = "" - - // MARK BWI show/hide developer menu - static let bwiShowDeveloperSettings : Bool = true - - // MARK BWI personal notes room - static let bwiPersonalNotesRoom : Bool = false - static let bwiPersonalNotesRoomLeavable : Bool = false - static let bwiResetPersonalNotesAccountData : Bool = false - static let bwiShowTimelineSettings : Bool = false - - // MARK BWI personal state - static let bwiPersonalState : Bool = true - - // MARK BWI personal notes room - static let bwiRollsAndRights : Bool = true - - // MARK: Timeline - static let settingsScreenShowSimpleTimeLineOptions : Bool = false - static let settingsScreenShowTimeStampOption : Bool = true - static let settingsScreenShowDeletedMessagesOption : Bool = false - static let settingsScreenShowNameChangeOption : Bool = false - static let settingsScreenShowChatEffectsOption : Bool = false - static let settingsScreenShowRoomAvatarChangeOption : Bool = false - static let settingsScreenShowUserAvatarChangeOption : Bool = true - static let settingsScreenShowEnterRoomOption : Bool = true - - static let bwiLastAdminCanDowngradeHimself : Bool = false - - static let bwiEnableErrorTracking : Bool = true - - static let bwiEnableRegisterInfo : Bool = false - - static let bwiShowHappyBirthdayCampaign: Bool = false - static let bwiHappyBirthdayCampaignIdentifier: String = "one_year_anniversary" - static let bwiDisableSecuritySettingsUntrustedDevices: Bool = true - static let bwiShowMatomoInfoScreen = true - static let bwiShowMatomoSettings = true - static let bwiMatomoTrackingDefaultState = true - static let bwiShowNewFeatures = true - static let bwiSendMessageThreshold = 10.0 - - static let pollsEnabled = true - - // MARK: - Location Sharing - - /// Overwritten by the home server's .well-known configuration (if any exists) - static let defaultTileServerMapStyleURL = URL(string: "https://msgpriv.example.com/")! - - static let locationSharingEnabled = true - - // MARK: - MXKAppSettings - static let enableBotCreation: Bool = false - static let maxAllowedMediaCacheSize: Int = 1073741824 - static let presenceColorForOfflineUser: Int = 15020851 - static let presenceColorForOnlineUser: Int = 3401011 - static let presenceColorForUnavailableUser: Int = 15066368 - static let showAllEventsInRoomHistory: Bool = false - static let showLeftMembersInRoomMemberList: Bool = false - static let showRedactionsInRoomHistory: Bool = true - static let showUnsupportedEventsInRoomHistory: Bool = false - static let sortRoomMembersUsingLastSeenTime: Bool = true - static let syncLocalContacts: Bool = false - - // MARK: - New App Layout - static let newAppLayoutEnabled = false - - // MARK: - Device manager - - static let deviceManagerEnabled = false - - // MARK: - Message Bubbles bwi show in our menu and only for beta builds - static let bwiShowMessageBubbles = true -} diff --git a/Config/BuM/BWIBuildSettings+BuM.swift b/Config/BuM/BWIBuildSettings+BuM.swift new file mode 100644 index 000000000..2052ea4c7 --- /dev/null +++ b/Config/BuM/BWIBuildSettings+BuM.swift @@ -0,0 +1,25 @@ +// +/* + * Copyright (c) 2022 BWI GmbH + * + * 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 + +extension BWIBuildSettings { + + func overrideTargetSpecificSettings() { + } + +} diff --git a/Config/BuildSettings.swift b/Config/BuildSettings.swift index c15848c09..aa0de1873 100644 --- a/Config/BuildSettings.swift +++ b/Config/BuildSettings.swift @@ -1,6 +1,5 @@ // // Copyright 2020 Vector Creations Ltd -// Copyright (c) 2021 BWI GmbH // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -88,7 +87,8 @@ final class BuildSettings: NSObject { } // Element-Web instance for the app - static let applicationWebAppUrlString = "" + static let applicationWebAppUrlString = "https://app.element.io" + // MARK: - Localization @@ -99,25 +99,42 @@ final class BuildSettings: NSObject { // MARK: - Server configuration // Default servers proposed on the authentication screen - static let serverConfigDefaultHomeserverUrlString = "" - static let serverConfigDefaultIdentityServerUrlString = "" + static let serverConfigDefaultHomeserverUrlString = "https://matrix.org" + static let serverConfigDefaultIdentityServerUrlString = "https://vector.im" - static let serverConfigPreSelections = ["":""] + static let serverConfigSygnalAPIUrlString = "https://matrix.org/_matrix/push/v1/notify" - static let serverConfigSygnalAPIUrlString = "" // MARK: - Legal URLs // Note: Set empty strings to hide the related entry in application settings - static let applicationCopyrightUrlString = "https://messenger.bwi.de/copyright" - static let applicationPrivacyPolicyUrlString = "" + 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: - Matrix permalinks - // Paths for URLs that will considered as Matrix permalinks. Those permalinks are opened within the app - static let permalinkSupportedHosts: [String: [String]] = [:] - + 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. @@ -127,37 +144,24 @@ final class BuildSettings: NSObject { // MARK: - VoIP static var allowVoIPUsage: Bool { #if canImport(JitsiMeetSDK) - return false + return true #else return false #endif } - - static let stunServerFallbackUrlString: String? = "" + 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" + "matrix.org", + "gitter.im" ] // MARK: - Rooms Screen static let roomsAllowToJoinPublicRooms: Bool = true // MARK: - Analytics - - // $$$ - static let analyticsServerUrl = URL(string: "") - static let analyticsAppId = "0" - - /// BWI: set host and key to nil to disable PostHog tracking - static let analyticsHost: String? = nil - static let analyticsKey: String? = nil - static let analyticsTermsURL = URL(string: "https://element.io/cookie-policy")! - static let bwiPresentAnalyticsPrompt = false - - static let bwiAnalyticsServerUrlString = "" - static let bwiAnalyticsAppId = "1" /// A type that represents how to set up the analytics module in the app. /// @@ -174,45 +178,67 @@ final class BuildSettings: NSObject { 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: false, - host: "", - apiKey: "", + 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 = "" + 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 = [""] - // Jitsi server used outside integrations to create conference calls from the call button in the timeline - static let jitsiServerUrl: URL = URL(string: "https://enter.jitsi.url")! + 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 = true - + static let forcePinProtection: Bool = false + /// Max allowed time to continue using the app without prompting PIN - static let pinCodeGraceTimeInSeconds: TimeInterval = 180 + static let pinCodeGraceTimeInSeconds: TimeInterval = 0 /// Force non-jailbroken app usage static let forceNonJailbrokenUsage: Bool = true - static let allowSendingStickers: Bool = false + static let allowSendingStickers: Bool = true - static let allowLocalContactsAccess: Bool = false - - static let allowInviteExernalUsers: Bool = false + static let allowLocalContactsAccess: Bool = true - static let enableSideMenu: Bool = false - static let sideMenuShowInviteFriends: Bool = false + static let allowInviteExernalUsers: Bool = true + + static let allowBackgroundAudioMessagePlayback: Bool = true + + // MARK: - Side Menu + static let enableSideMenu: Bool = true && !newAppLayoutEnabled + 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 @@ -220,32 +246,7 @@ final class BuildSettings: NSObject { // 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] = [ - "1234", - "1111", - "0000", - "1212", - "7777", - "1004", - "2000", - "4444", - "2222", - "6969", - "9999", - "3333", - "5555", - "6666", - "1122", - "1313", - "8888", - "4321", - "2001", - "1010", - "2580", - "4711", - "0815", - "0852" - ] + 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 @@ -253,26 +254,16 @@ final class BuildSettings: NSObject { /// 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 - static let allowLocalContactPresence: Bool = false - /// Indicates should the app log out the user when number of PIN failures reaches `maxAllowedNumberOfPinFailures`. Defaults to `false` - static let logOutUserWhenPINFailuresExceeded: Bool = true + 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 = true + static let logOutUserWhenBiometricsFailuresExceeded: Bool = false - - /// If force is enabled the dialog for asking if reseting the key backup is not shown.. already asked before in mandatory verfication - static let forceResetBackupIfLost: Bool = true - - /// if skip is enabled the key backup dialogs are passed through - static let skipKeyBackupStep: Bool = true - static let showNotificationsV2: Bool = true // MARK: - Main Tabs - static let homeScreenShowHomeTab: Bool = false static let homeScreenShowFavouritesTab: Bool = true static let homeScreenShowPeopleTab: Bool = true static let homeScreenShowRoomsTab: Bool = true @@ -281,54 +272,34 @@ final class BuildSettings: NSObject { static let settingsScreenShowUserFirstName: Bool = false static let settingsScreenShowUserSurname: Bool = false - static let settingsScreenAllowAddingLinkedEmails: Bool = false - static let settingsScreenAllowAddingPhoneNumbers: Bool = false - static let settingsScreenAllowAddingEmailThreepids: Bool = false - static let settingsScreenAllowAddingPhoneThreepids: Bool = false - static let settingsScreenShowThreepidExplanatory: Bool = false - static let settingsScreenShowDiscoverySettings: Bool = false - static let settingsScreenAllowIdentityServerConfig: Bool = false - static let settingsScreenShowConfirmMediaSize: Bool = false - static let settingsScreenShowAdvancedSettings: Bool = false - static let settingsScreenShowLabSettings: Bool = false - static let settingsScreenAllowChangingRageshakeSettings: Bool = false - static let settingsScreenAllowChangingCrashUsageDataSettings: Bool = false - static let settingsScreenAllowBugReportingManually: Bool = false - static let settingsScreenAllowDeactivatingAccount: Bool = false - static let settingsScreenEnableDecodedContentAndGlobalSettings: 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 settingsScreenShowLinkPreviews:Bool = false - static let settingsScreenShowInviteFriends:Bool = false - static let settingsScreenShowSettings:Bool = true - static let settingsScreenShowFeedback:Bool = false - static let settingsScreenShowHelp:Bool = false - static let settingsScreenShowEnableStunServerFallback: Bool = true - static let settingsScreenShowNotificationDecodedContentOption: Bool = false - static let settingsScreenShowSystemSettingsOption: Bool = false - static let settingsScreenShowNsfwRoomsOption: Bool = false - static let settingsScreenShowTACSetting: Bool = false - static let settingsScreenShowSupportSetting: 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 - static let settingsSecurityScreenShowCryptographyInfo:Bool = false - static let settingsSecurityScreenShowCryptographyExport:Bool = false - static let settingsSecurityScreenShowAdvancedUnverifiedDevices:Bool = false - - // MARK: - Notification Settings - static let settingsNotificationsBWIDefaultSet:Bool = true - static let settingsNotificationsShowDefault:Bool = true - static let settingsNotificationsShowMentions:Bool = false - static let settingsNotificationsShowAdvanced:Bool = false - // MARK: - Timeline settings - static let roomInputToolbarCompressionMode: MediaCompressionMode = .none + static let roomInputToolbarCompressionMode: MediaCompressionMode = .prompt enum MediaCompressionMode { case prompt, small, medium, large, none @@ -336,7 +307,7 @@ final class BuildSettings: NSObject { // MARK: - Room Creation Screen - static let roomCreationScreenAllowEncryptionConfiguration: Bool = false + static let roomCreationScreenAllowEncryptionConfiguration: Bool = true static let roomCreationScreenRoomIsEncrypted: Bool = true static let roomCreationScreenAllowRoomTypeConfiguration: Bool = true static let roomCreationScreenRoomIsPublic: Bool = false @@ -347,7 +318,7 @@ final class BuildSettings: NSObject { static let roomScreenAllowVoIPForNonDirectRoom: Bool = true static let roomScreenAllowCameraAction: Bool = true static let roomScreenAllowMediaLibraryAction: Bool = true - static let roomScreenAllowStickerAction: Bool = false + static let roomScreenAllowStickerAction: Bool = true static let roomScreenAllowFilesAction: Bool = true // Timeline style @@ -366,186 +337,79 @@ final class BuildSettings: NSObject { static let roomContextualMenuShowMoreOptionForMessages: Bool = true static let roomContextualMenuShowMoreOptionForStates: Bool = true static let roomContextualMenuShowReportContentOption: Bool = true - static let roomContextualMenuShowEncryptionOption: Bool = false - + // MARK: - Room Info Screen - static let roomInfoScreenShowIntegrations: Bool = false + static let roomInfoScreenShowIntegrations: Bool = true // MARK: - Room Settings Screen - static let roomSettingsScreenShowLowPriorityOption: Bool = false - static let roomSettingsScreenShowDirectChatOption: Bool = false - static let roomSettingsScreenAllowChangingAccessSettings: Bool = false - static let roomSettingsScreenAllowChangingHistorySettings: Bool = false - static let roomSettingsScreenShowAddressSettings: Bool = false - static let roomSettingsScreenShowAdvancedSettings: Bool = false - - static let roomSettingsScreenShowAccessSettingsBW: Bool = true - static let roomSettingsScreenRemoveLeave: Bool = true - + 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 roomSettingsScreenShowAdvancedSettings: Bool = true static let roomSettingsScreenAdvancedShowEncryptToVerifiedOption: Bool = true - static let roomSettingsScreenShowNotificationsV2: Bool = false - // MARK: - Room Member Screen + static let roomMemberScreenShowIgnore: Bool = true // MARK: - Message - static let messageDetailsAllowShare: Bool = false - static let messageDetailsAllowPermalink: Bool = false - static let messageDetailsAllowViewSource: Bool = false - static let messageDetailsAllowSave: Bool = false - static let messageDetailsAllowCopyMedia: Bool = false - static let messageDetailsAllowPasteMedia: Bool = false + 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 = false - static let authScreenShowPhoneNumber = false - static let authScreenShowForgotPassword = false + static let authScreenShowRegister = true + static let authScreenShowPhoneNumber = true + static let authScreenShowForgotPassword = true static let authScreenShowCustomServerOptions = true - static let authScreenShowTestServerOptions = true - static let authScreenShowSocialLoginSection = false + static let authScreenShowSocialLoginSection = true // MARK: - Authentication Options static let authEnableRefreshTokens = false - // MARK: - Cross-signing (bwi=true) - static let disableSelfUserVerification = true - - // MARK: - Antivirus scan (bwi=true) - static let enableAntivirusScan = false - - // MARK: - Room Screen - static let enableRoomSearchItem = false - - // MARK: - Matomo Analytics (bwi=false) - static let enableMatomoAnalytics = false - - // MARK: Verification screen (bwi=false) - static let showDetailedVerificationElements : Bool = false - static let showRecoverWithKey : Bool = false - - // MARK: Unified search screen (bwi=false) - static let showUnifiedSearchViewMessagesTab : Bool = false - static let showUnifiedSearchViewFilesTab : Bool = false - // MARK: - Onboarding - static let onboardingShowAccountPersonalization = false - static let onboardingEnableNewAuthenticationFlow = false + static let onboardingShowAccountPersonalization = true + static let onboardingEnableNewAuthenticationFlow = true + + // MARK: - Unified Search + static let unifiedSearchScreenShowPublicDirectory = true // MARK: - Secrets Recovery static let secretsRecoveryAllowReset = true - // MARK: VoIP support (bwi=false) - static let enableVoIPSupport : Bool = false // MARK: - UISI Autoreporting static let cryptoUISIAutoReportingEnabled = false // MARK: - Polls - // MARK: Last message timestamp support (bwi=false) - static let enableLastMessageTimestamp : Bool = false - - // MARK: Room chat alert screen (bwi=false) - static let enableViewEncryptionAction : Bool = false - - // MARK: JavaScript support in WKWebView (bwi=false) - static let enableJSInWebView : Bool = false - - // MARK: Secure pin code description (bwi=false) - static let settingsSettingsSecureShowPinCodeDescription : Bool = false - - // MARK: Invite friends in Direct Chat (bwi=false) - static let directChatShowInviteFriends : Bool = false - - // MARK: Last admin is not allowed to leave the room (bwi=true) - static let lastAdminIsNotAllowedToLeaveRoom : Bool = true - - // MARK: Room Member Details Screen (bwi=true) - static let roomMemberDetailsHideLeaveButton : Bool = true - - // MARK: Room create options (bwi=false) - static let enableShowInRoomDirectory : Bool = false - - // MARK: sticker in composer (bwi=false) - static let enableRoomComposerSticker : Bool = false - - // Mark: Unified Search (bwi=true) - static let unifiedSearchScreenShowPublicDirectory = true - - // MARK: Allows removal of uploaded avatar photos (bwi=true) - static let enableRemoveAvatarImage = true - - // MARK: Add a toggle button to the login screen to make the password visible - static let passwordIndicatorOnLogin : Bool = true - - // MARK: Displays the element base version on the settings screen - static let elementBaseVersion : String = "1.9.8" - - static let showElementBaseVersion : Bool = true - - // MARK: Bypasses the normal forgot password process by presenting the user an information alert - // (requires authScreenShowForgotPassword set to true) - static let forgotPasswordInformationAlert : Bool = true - - // MARK: Promote new feature within a banner below the navigation view - static let showTopBanner : Bool = true - - static let showCustomServerDisplayName : Bool = true - static let customServerDisplayName : String = "" - - // MARK BWI show/hide developer menu - static let bwiShowDeveloperSettings : Bool = false - - // MARK BWI personal notes room - static let bwiPersonalNotesRoom : Bool = false - static let bwiPersonalNotesRoomLeavable : Bool = false - static let bwiResetPersonalNotesAccountData : Bool = false - static let bwiShowTimelineSettings : Bool = false - - // MARK BWI personal state - static let bwiPersonalState : Bool = false - - // MARK BWI personal notes room - static let bwiRollsAndRights : Bool = true - - // MARK: Timeline - static let settingsScreenShowSimpleTimeLineOptions : Bool = false - static let settingsScreenShowTimeStampOption : Bool = true - static let settingsScreenShowDeletedMessagesOption : Bool = false - static let settingsScreenShowNameChangeOption : Bool = false - static let settingsScreenShowChatEffectsOption : Bool = false - static let settingsScreenShowRoomAvatarChangeOption : Bool = false - static let settingsScreenShowUserAvatarChangeOption : Bool = true - static let settingsScreenShowEnterRoomOption : Bool = true - - static let bwiLastAdminCanDowngradeHimself : Bool = false - - static let bwiEnableErrorTracking : Bool = false - - static let bwiEnableRegisterInfo : Bool = false - - static let bwiShowHappyBirthdayCampaign: Bool = false - static let bwiHappyBirthdayCampaignIdentifier: String = "one_year_anniversary" - static let bwiDisableSecuritySettingsUntrustedDevices: Bool = true - static let bwiShowMatomoInfoScreen = false - static let bwiShowMatomoSettings = false - static let bwiMatomoTrackingDefaultState = false - static let bwiShowNewFeatures = true - static let bwiSendMessageThreshold = 10.0 - static let pollsEnabled = true // MARK: - Location Sharing /// Overwritten by the home server's .well-known configuration (if any exists) - static let defaultTileServerMapStyleURL = URL(string: "https://msgpriv.example.com/")! + static let defaultTileServerMapStyleURL = URL(string: "https://api.maptiler.com/maps/streets/style.json?key=fU3vlMsMn4Jb6dnEIFsx")! static let locationSharingEnabled = true + + // MARK: - Voice Broadcast + static let voiceBroadcastChunkLength: Int = 120 + static let voiceBroadcastMaxLength: UInt64 = 144000 // MARK: - MXKAppSettings static let enableBotCreation: Bool = false @@ -561,12 +425,16 @@ final class BuildSettings: NSObject { static let syncLocalContacts: Bool = false // MARK: - New App Layout - static let newAppLayoutEnabled = false - - // MARK: - Device manager + static let newAppLayoutEnabled = true + + // MARK: - QR Login - static let deviceManagerEnabled = false + /// Flag indicating whether the QR login enabled from login screen + static let qrLoginEnabledFromNotAuthenticated = true + /// Flag indicating whether the QR login enabled from Device Manager screen + static let qrLoginEnabledFromAuthenticated = false + /// Flag indicating whether displaying QRs enabled for the QR login screens + static let qrLoginEnableDisplayingQRs = false - // MARK: - Message Bubbles bwi show in our menu and only for beta builds - static let bwiShowMessageBubbles = false + static let rendezvousServerBaseURL = URL(string: "https://rendezvous.lab.element.dev/")! } diff --git a/Config/BwiSettings.swift b/Config/BwiSettings.swift deleted file mode 100644 index f488e0037..000000000 --- a/Config/BwiSettings.swift +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2021 BWI GmbH - * - * 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 MatrixSDK -import KeychainAccess - -@objcMembers -final class BwiSettings : NSObject { - static let shared = BwiSettings() - - private enum UserDefaultsKeys { - static let additionalBwiHeaderKey = "bwiHeader" - } - - private struct BwiSettingsConstants { - static let bwiSettingsKeychainService: String = BuildSettings.baseBundleIdentifier + ".bwi-settings-service" - } - - private let vault: KeyValueVault - - override init() { - vault = KeychainVault(Keychain(service: BwiSettingsConstants.bwiSettingsKeychainService, - accessGroup: BuildSettings.keychainAccessGroup)) - super.init() - } - - func reset() { - additionalBwiHeader = UserAgentService().bwiUserAgentDict - let sdkOptions = MXSDKOptions.sharedInstance() - sdkOptions.httpAdditionalHeaders = UserAgentService().bwiUserAgentDict - } - - // MARK: Servers - - var additionalBwiHeader: Dictionary { - get { - do { - guard let data = try vault.data(forKey: UserDefaultsKeys.additionalBwiHeaderKey) else { - return UserAgentService().bwiUserAgentDict - } - var dict = try JSONDecoder().decode(Dictionary.self, from: data) - dict["User-Agent"] = UserAgentService().bwiUserAgent - return dict - } catch { - return UserAgentService().bwiUserAgentDict - } - } set { - do { - let data = try JSONEncoder().encode(newValue) - try vault.set(data, forKey: UserDefaultsKeys.additionalBwiHeaderKey) - } catch let error { - NSLog("[PinCodePreferences] Error when storing addional header to the vault: \(error)") - } - } - } -} diff --git a/Config/CommonConfiguration.swift b/Config/CommonConfiguration.swift index 3a24c657e..6b9e5a4c5 100644 --- a/Config/CommonConfiguration.swift +++ b/Config/CommonConfiguration.swift @@ -46,15 +46,15 @@ class CommonConfiguration: NSObject, Configurable { // Customize the default notification content settings.notificationBodyLocalizationKey = "Notification" - settings.messageDetailsAllowSharing = BuildSettings.messageDetailsAllowShare - settings.messageDetailsAllowSaving = BuildSettings.messageDetailsAllowSave - settings.messageDetailsAllowCopyingMedia = BuildSettings.messageDetailsAllowCopyMedia - settings.messageDetailsAllowPastingMedia = BuildSettings.messageDetailsAllowPasteMedia + settings.messageDetailsAllowSharing = BWIBuildSettings.shared.messageDetailsAllowShare + settings.messageDetailsAllowSaving = BWIBuildSettings.shared.messageDetailsAllowSave + settings.messageDetailsAllowCopyingMedia = BWIBuildSettings.shared.messageDetailsAllowCopyMedia + settings.messageDetailsAllowPastingMedia = BWIBuildSettings.shared.messageDetailsAllowPasteMedia // Enable link detection if url preview are enabled settings.enableBubbleComponentLinkDetection = true - MXKContactManager.shared().allowLocalContactsAccess = BuildSettings.allowLocalContactsAccess + MXKContactManager.shared().allowLocalContactsAccess = BWIBuildSettings.shared.allowLocalContactsAccess } private func setupMatrixSDKSettings() { @@ -162,7 +162,7 @@ class CommonConfiguration: NSObject, Configurable { // Let's call invite be valid for 1 minute callManager.inviteLifetime = 60000 - if RiotSettings.shared.allowStunServerFallback, let stunServerFallback = BuildSettings.stunServerFallbackUrlString { + if RiotSettings.shared.allowStunServerFallback, let stunServerFallback = BWIBuildSettings.shared.stunServerFallbackUrlString { callManager.fallbackSTUNServer = stunServerFallback } } diff --git a/Riot.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Riot.xcworkspace/xcshareddata/swiftpm/Package.resolved index 7b45c9e98..719e0d9de 100644 --- a/Riot.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Riot.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -9,6 +9,15 @@ "version" : "4.7.0" } }, + { + "identity" : "lottie-ios", + "kind" : "remoteSourceControl", + "location" : "https://github.com/airbnb/lottie-ios.git", + "state" : { + "revision" : "b4bd0604ded9574807f41b4004b57dd1226a30a4", + "version" : "3.5.0" + } + }, { "identity" : "maplibre-gl-native-distribution", "kind" : "remoteSourceControl", diff --git a/Riot/Categories/MXBugReportRestClient+Riot.swift b/Riot/Categories/MXBugReportRestClient+Riot.swift index 93eff76aa..17c42cd71 100644 --- a/Riot/Categories/MXBugReportRestClient+Riot.swift +++ b/Riot/Categories/MXBugReportRestClient+Riot.swift @@ -21,7 +21,7 @@ import GBDeviceInfo extension MXBugReportRestClient { @objc static func vc_bugReportRestClient(appName: String) -> MXBugReportRestClient { - let client = MXBugReportRestClient(bugReportEndpoint: BuildSettings.bugReportEndpointUrlString) + let client = MXBugReportRestClient(bugReportEndpoint: BWIBuildSettings.shared.bugReportEndpointUrlString) // App info client.appName = appName client.version = AppDelegate.theDelegate().appVersion diff --git a/Riot/Managers/EncryptionKeyManager/EncryptionKeyManager.swift b/Riot/Managers/EncryptionKeyManager/EncryptionKeyManager.swift index 803d6eadb..c8e3a95b5 100644 --- a/Riot/Managers/EncryptionKeyManager/EncryptionKeyManager.swift +++ b/Riot/Managers/EncryptionKeyManager/EncryptionKeyManager.swift @@ -40,7 +40,7 @@ class EncryptionKeyManager: NSObject, MXKeyProviderDelegate { private let vault: KeyValueVault private override init() { - vault = BwiBuildSettings.forcedPinProtection ? securedFileStore : keychainVault + vault = BWIBuildSettings.shared.forcedPinProtection ? securedFileStore : keychainVault } func initKeys() { @@ -58,7 +58,7 @@ class EncryptionKeyManager: NSObject, MXKeyProviderDelegate { assert(keychainVault.objectExists(withKey: EncryptionKeyManager.roomLastMessageIv), "[EncryptionKeyManager] initKeys: Failed to generate IV for room last message") assert(keychainVault.objectExists(withKey: EncryptionKeyManager.roomLastMessageAesKey), "[EncryptionKeyManager] initKeys: Failed to generate AES Key for room last message encryption") - guard !BwiBuildSettings.forcedPinProtection || !SecureFileStorage.shared.locked else { + guard !BWIBuildSettings.shared.forcedPinProtection || !SecureFileStorage.shared.locked else { MXLog.debug("[EncryptionKeyManager] initKeys: cannot init keys as store is not ready") return } diff --git a/Riot/Managers/LocalAuthentication/LocalAuthenticationService.swift b/Riot/Managers/LocalAuthentication/LocalAuthenticationService.swift index cd18f49f6..6ac05a910 100644 --- a/Riot/Managers/LocalAuthentication/LocalAuthenticationService.swift +++ b/Riot/Managers/LocalAuthentication/LocalAuthenticationService.swift @@ -72,10 +72,10 @@ class LocalAuthenticationService: NSObject { } func shouldLogOutUser() -> Bool { - if BuildSettings.logOutUserWhenPINFailuresExceeded && pinCodePreferences.numberOfPinFailures >= pinCodePreferences.maxAllowedNumberOfPinFailures { + if BWIBuildSettings.shared.logOutUserWhenPINFailuresExceeded && pinCodePreferences.numberOfPinFailures >= pinCodePreferences.maxAllowedNumberOfPinFailures { return true } - if BuildSettings.logOutUserWhenBiometricsFailuresExceeded && pinCodePreferences.numberOfBiometricsFailures >= pinCodePreferences.maxAllowedNumberOfBiometricsFailures { + if BWIBuildSettings.shared.logOutUserWhenBiometricsFailuresExceeded && pinCodePreferences.numberOfBiometricsFailures >= pinCodePreferences.maxAllowedNumberOfBiometricsFailures { return true } return false diff --git a/Riot/Managers/PushNotification/PushNotificationService.m b/Riot/Managers/PushNotification/PushNotificationService.m index 9661497e6..7a8d9a7db 100644 --- a/Riot/Managers/PushNotification/PushNotificationService.m +++ b/Riot/Managers/PushNotification/PushNotificationService.m @@ -43,7 +43,7 @@ Matrix session observer used to detect new opened sessions. if (self = [super init]) { self.pushNotificationStore = pushNotificationStore; - if (BuildSettings.allowVoIPUsage) + if (BWIBuildSettings.shared.allowVoIPUsage) { _pushRegistry = [[PKPushRegistry alloc] initWithQueue:dispatch_get_main_queue()]; } diff --git a/Riot/Managers/Settings/RiotSettings+TimeLine.swift b/Riot/Managers/Settings/RiotSettings+TimeLine.swift index 1f0f8bbd7..6dfc8d16c 100644 --- a/Riot/Managers/Settings/RiotSettings+TimeLine.swift +++ b/Riot/Managers/Settings/RiotSettings+TimeLine.swift @@ -40,7 +40,7 @@ extension RiotSettings { var settingsScreenShowSimpleTimeLineOptions: Bool { get { guard RiotSettings.defaults.object(forKey: UserDefaultsTimelineKeys.settingsScreenShowSimpleTimeLineOptions) != nil else { - return BuildSettings.settingsScreenShowSimpleTimeLineOptions + return BWIBuildSettings.shared.settingsScreenShowSimpleTimeLineOptions } return RiotSettings.defaults.bool(forKey: UserDefaultsTimelineKeys.settingsScreenShowSimpleTimeLineOptions) } set { @@ -51,7 +51,7 @@ extension RiotSettings { var settingsScreenShowTimeStampOption: Bool { get { guard RiotSettings.defaults.object(forKey: UserDefaultsTimelineKeys.settingsScreenShowTimeStampOption) != nil else { - return BuildSettings.settingsScreenShowTimeStampOption + return BWIBuildSettings.shared.settingsScreenShowTimeStampOption } return RiotSettings.defaults.bool(forKey: UserDefaultsTimelineKeys.settingsScreenShowTimeStampOption) } set { @@ -62,7 +62,7 @@ extension RiotSettings { var settingsScreenShowDeletedMessagesOption: Bool { get { guard RiotSettings.defaults.object(forKey: UserDefaultsTimelineKeys.settingsScreenShowDeletedMessagesOption) != nil else { - return BuildSettings.settingsScreenShowDeletedMessagesOption + return BWIBuildSettings.shared.settingsScreenShowDeletedMessagesOption } return RiotSettings.defaults.bool(forKey: UserDefaultsTimelineKeys.settingsScreenShowDeletedMessagesOption) } set { @@ -73,7 +73,7 @@ extension RiotSettings { var settingsScreenShowNameChangeOption: Bool { get { guard RiotSettings.defaults.object(forKey: UserDefaultsTimelineKeys.settingsScreenShowNameChangeOption) != nil else { - return BuildSettings.settingsScreenShowNameChangeOption + return BWIBuildSettings.shared.settingsScreenShowNameChangeOption } return RiotSettings.defaults.bool(forKey: UserDefaultsTimelineKeys.settingsScreenShowNameChangeOption) } set { @@ -84,7 +84,7 @@ extension RiotSettings { var settingsScreenShowChatEffectsOption: Bool { get { guard RiotSettings.defaults.object(forKey: UserDefaultsTimelineKeys.settingsScreenShowChatEffectsOption) != nil else { - return BuildSettings.settingsScreenShowChatEffectsOption + return BWIBuildSettings.shared.settingsScreenShowChatEffectsOption } return RiotSettings.defaults.bool(forKey: UserDefaultsTimelineKeys.settingsScreenShowChatEffectsOption) } set { @@ -95,7 +95,7 @@ extension RiotSettings { var settingsScreenShowRoomAvatarChangeOption: Bool { get { guard RiotSettings.defaults.object(forKey: UserDefaultsTimelineKeys.settingsScreenShowRoomAvatarChangeOption) != nil else { - return BuildSettings.settingsScreenShowRoomAvatarChangeOption + return BWIBuildSettings.shared.settingsScreenShowRoomAvatarChangeOption } return RiotSettings.defaults.bool(forKey: UserDefaultsTimelineKeys.settingsScreenShowRoomAvatarChangeOption) } set { @@ -106,7 +106,7 @@ extension RiotSettings { var settingsScreenShowUserAvatarChangeOption: Bool { get { guard RiotSettings.defaults.object(forKey: UserDefaultsTimelineKeys.settingsScreenShowUserAvatarChangeOption) != nil else { - return BuildSettings.settingsScreenShowUserAvatarChangeOption + return BWIBuildSettings.shared.settingsScreenShowUserAvatarChangeOption } return RiotSettings.defaults.bool(forKey: UserDefaultsTimelineKeys.settingsScreenShowUserAvatarChangeOption) } set { @@ -117,7 +117,7 @@ extension RiotSettings { var settingsScreenShowEnterRoomOption: Bool { get { guard RiotSettings.defaults.object(forKey: UserDefaultsTimelineKeys.settingsScreenShowEnterRoomOption) != nil else { - return BuildSettings.settingsScreenShowEnterRoomOption + return BWIBuildSettings.shared.settingsScreenShowEnterRoomOption } return RiotSettings.defaults.bool(forKey: UserDefaultsTimelineKeys.settingsScreenShowEnterRoomOption) } set { diff --git a/Riot/Managers/Settings/RiotSettings.swift b/Riot/Managers/Settings/RiotSettings.swift index f5b91c71b..fe27fddd2 100644 --- a/Riot/Managers/Settings/RiotSettings.swift +++ b/Riot/Managers/Settings/RiotSettings.swift @@ -78,10 +78,10 @@ final class RiotSettings: NSObject { // MARK: Servers - @UserDefault(key: "homeserverurl", defaultValue: BuildSettings.serverConfigDefaultHomeserverUrlString, storage: defaults) + @UserDefault(key: "homeserverurl", defaultValue: BWIBuildSettings.shared.serverConfigDefaultHomeserverUrlString, storage: defaults) var homeserverUrlString - @UserDefault(key: "identityserverurl", defaultValue: BuildSettings.serverConfigDefaultIdentityServerUrlString, storage: defaults) + @UserDefault(key: "identityserverurl", defaultValue: BWIBuildSettings.shared.serverConfigDefaultIdentityServerUrlString, storage: defaults) var identityServerUrlString // MARK: Notifications @@ -243,7 +243,7 @@ final class RiotSettings: NSObject { @UserDefault(key: "roomScreenAllowMediaLibraryAction", defaultValue: BuildSettings.roomScreenAllowMediaLibraryAction, storage: defaults) var roomScreenAllowMediaLibraryAction - @UserDefault(key: "roomScreenAllowStickerAction", defaultValue: BuildSettings.roomScreenAllowStickerAction, storage: defaults) + @UserDefault(key: "roomScreenAllowStickerAction", defaultValue: BWIBuildSettings.shared.roomScreenAllowStickerAction, storage: defaults) var roomScreenAllowStickerAction @UserDefault(key: "roomScreenAllowFilesAction", defaultValue: BuildSettings.roomScreenAllowFilesAction, storage: defaults) @@ -287,7 +287,7 @@ final class RiotSettings: NSObject { // MARK: - Room Info Screen - @UserDefault(key: "roomInfoScreenShowIntegrations", defaultValue: BuildSettings.roomInfoScreenShowIntegrations, storage: defaults) + @UserDefault(key: "roomInfoScreenShowIntegrations", defaultValue: BWIBuildSettings.shared.roomInfoScreenShowIntegrations, storage: defaults) var roomInfoScreenShowIntegrations // MARK: - Room Member Screen @@ -297,7 +297,7 @@ final class RiotSettings: NSObject { // MARK: - Room Creation Screen - @UserDefault(key: "roomCreationScreenAllowEncryptionConfiguration", defaultValue: BuildSettings.roomCreationScreenAllowEncryptionConfiguration, storage: defaults) + @UserDefault(key: "roomCreationScreenAllowEncryptionConfiguration", defaultValue: BWIBuildSettings.shared.roomCreationScreenAllowEncryptionConfiguration, storage: defaults) var roomCreationScreenAllowEncryptionConfiguration @UserDefault(key: "roomCreationScreenRoomIsEncrypted", defaultValue: BuildSettings.roomCreationScreenRoomIsEncrypted, storage: defaults) @@ -311,7 +311,7 @@ final class RiotSettings: NSObject { // MARK: Features - @UserDefault(key: "allowInviteExernalUsers", defaultValue: BuildSettings.allowInviteExernalUsers, storage: defaults) + @UserDefault(key: "allowInviteExernalUsers", defaultValue: BWIBuildSettings.shared.allowInviteExernalUsers, storage: defaults) var allowInviteExernalUsers /// When set to false the original image is sent and a 1080p preset is used for videos. @@ -322,7 +322,7 @@ final class RiotSettings: NSObject { // MARK: - Main Tabs // bwi: hide home tab - @UserDefault(key: "homeScreenShowHomeTab", defaultValue: BuildSettings.homeScreenShowHomeTab, storage: defaults) + @UserDefault(key: "homeScreenShowHomeTab", defaultValue: BWIBuildSettings.shared.homeScreenShowHomeTab, storage: defaults) var homeScreenShowHomeTab @UserDefault(key: "homeScreenShowFavouritesTab", defaultValue: BuildSettings.homeScreenShowFavouritesTab, storage: defaults) @@ -336,22 +336,22 @@ final class RiotSettings: NSObject { // MARK bwi Left Settings - @UserDefault(key: "settingsScreenShowInviteFriends", defaultValue: BuildSettings.settingsScreenShowInviteFriends, storage: defaults) + @UserDefault(key: "settingsScreenShowInviteFriends", defaultValue: BWIBuildSettings.shared.settingsScreenShowInviteFriends, storage: defaults) var settingsScreenShowInviteFriends - @UserDefault(key: "settingsScreenShowSettings", defaultValue: BuildSettings.settingsScreenShowSettings, storage: defaults) + @UserDefault(key: "settingsScreenShowSettings", defaultValue: BWIBuildSettings.shared.settingsScreenShowSettings, storage: defaults) var settingsScreenShowSettings - @UserDefault(key: "settingsScreenShowFeedback", defaultValue: BuildSettings.settingsScreenShowFeedback, storage: defaults) + @UserDefault(key: "settingsScreenShowFeedback", defaultValue: BWIBuildSettings.shared.settingsScreenShowFeedback, storage: defaults) var settingsScreenShowFeedback - @UserDefault(key: "settingsScreenShowHelp", defaultValue: BuildSettings.settingsScreenShowHelp, storage: defaults) + @UserDefault(key: "settingsScreenShowHelp", defaultValue: BWIBuildSettings.shared.settingsScreenShowHelp, storage: defaults) var settingsScreenShowHelp - @UserDefault(key: "settingsScreenShowSystemSettingsOption", defaultValue: BuildSettings.settingsScreenShowSystemSettingsOption, storage: defaults) + @UserDefault(key: "settingsScreenShowSystemSettingsOption", defaultValue: BWIBuildSettings.shared.settingsScreenShowSystemSettingsOption, storage: defaults) var settingsScreenShowSystemSettingsOption - @UserDefault(key: "homeScreenShowHomeTab", defaultValue: BuildSettings.bwiMatomoTrackingDefaultState, storage: defaults) + @UserDefault(key: "homeScreenShowHomeTab", defaultValue: BWIBuildSettings.shared.bwiMatomoTrackingDefaultState, storage: defaults) var bwiEnableMatomoTracking // MARK: General Settings @@ -362,10 +362,10 @@ final class RiotSettings: NSObject { @UserDefault(key: "settingsScreenShowEnableStunServerFallback", defaultValue: BuildSettings.settingsScreenShowEnableStunServerFallback, storage: defaults) var settingsScreenShowEnableStunServerFallback - @UserDefault(key: "settingsScreenShowNotificationDecodedContentOption", defaultValue: BuildSettings.settingsScreenShowNotificationDecodedContentOption, storage: defaults) + @UserDefault(key: "settingsScreenShowNotificationDecodedContentOption", defaultValue: BWIBuildSettings.shared.settingsScreenShowNotificationDecodedContentOption, storage: defaults) var settingsScreenShowNotificationDecodedContentOption - @UserDefault(key: "settingsScreenShowNsfwRoomsOption", defaultValue: BuildSettings.settingsScreenShowNsfwRoomsOption, storage: defaults) + @UserDefault(key: "settingsScreenShowNsfwRoomsOption", defaultValue: BWIBuildSettings.shared.settingsScreenShowNsfwRoomsOption, storage: defaults) var settingsScreenShowNsfwRoomsOption @UserDefault(key: "settingsSecurityScreenShowSessions", defaultValue: BuildSettings.settingsSecurityScreenShowSessions, storage: defaults) @@ -380,42 +380,42 @@ final class RiotSettings: NSObject { @UserDefault(key: "settingsSecurityScreenShowDeleteBackup", defaultValue: BuildSettings.settingsSecurityScreenShowDeleteBackup, storage: defaults) var settingsSecurityScreenShowDeleteBackup - @UserDefault(key: "settingsSecurityScreenShowCryptographyInfo", defaultValue: BuildSettings.settingsSecurityScreenShowCryptographyInfo, storage: defaults) + @UserDefault(key: "settingsSecurityScreenShowCryptographyInfo", defaultValue: BWIBuildSettings.shared.settingsSecurityScreenShowCryptographyInfo, storage: defaults) var settingsSecurityScreenShowCryptographyInfo - @UserDefault(key: "settingsSecurityScreenShowCryptographyExport", defaultValue: BuildSettings.settingsSecurityScreenShowCryptographyExport, storage: defaults) + @UserDefault(key: "settingsSecurityScreenShowCryptographyExport", defaultValue: BWIBuildSettings.shared.settingsSecurityScreenShowCryptographyExport, storage: defaults) var settingsSecurityScreenShowCryptographyExport - @UserDefault(key: "settingsSecurityScreenShowAdvancedBlacklistUnverifiedDevices", defaultValue: BuildSettings.settingsSecurityScreenShowAdvancedUnverifiedDevices, storage: defaults) + @UserDefault(key: "settingsSecurityScreenShowAdvancedBlacklistUnverifiedDevices", defaultValue: BWIBuildSettings.shared.settingsSecurityScreenShowAdvancedUnverifiedDevices, storage: defaults) var settingsSecurityScreenShowAdvancedUnverifiedDevices - @UserDefault(key: "settingsNotificationsShowDefault", defaultValue: BuildSettings.settingsNotificationsShowDefault, storage: defaults) + @UserDefault(key: "settingsNotificationsShowDefault", defaultValue: BWIBuildSettings.shared.settingsNotificationsShowDefault, storage: defaults) var settingsNotificationsShowDefault - @UserDefault(key: "settingsNotificationsShowMentions", defaultValue: BuildSettings.settingsNotificationsShowMentions, storage: defaults) + @UserDefault(key: "settingsNotificationsShowMentions", defaultValue: BWIBuildSettings.shared.settingsNotificationsShowMentions, storage: defaults) var settingsNotificationsShowMentions - @UserDefault(key: "settingsNotificationsShowAdvanced", defaultValue: BuildSettings.settingsNotificationsShowAdvanced, storage: defaults) + @UserDefault(key: "settingsNotificationsShowAdvanced", defaultValue: BWIBuildSettings.shared.settingsNotificationsShowAdvanced, storage: defaults) var settingsNotificationsShowAdvanced // MARK: - Room Settings Screen - @UserDefault(key: "roomSettingsScreenShowLowPriorityOption", defaultValue: BuildSettings.roomSettingsScreenShowLowPriorityOption, storage: defaults) + @UserDefault(key: "roomSettingsScreenShowLowPriorityOption", defaultValue: BWIBuildSettings.shared.roomSettingsScreenShowLowPriorityOption, storage: defaults) var roomSettingsScreenShowLowPriorityOption - @UserDefault(key: "roomSettingsScreenShowDirectChatOption", defaultValue: BuildSettings.roomSettingsScreenShowDirectChatOption, storage: defaults) + @UserDefault(key: "roomSettingsScreenShowDirectChatOption", defaultValue: BWIBuildSettings.shared.roomSettingsScreenShowDirectChatOption, storage: defaults) var roomSettingsScreenShowDirectChatOption - @UserDefault(key: "roomSettingsScreenAllowChangingAccessSettings", defaultValue: BuildSettings.roomSettingsScreenAllowChangingAccessSettings, storage: defaults) + @UserDefault(key: "roomSettingsScreenAllowChangingAccessSettings", defaultValue: BWIBuildSettings.shared.roomSettingsScreenAllowChangingAccessSettings, storage: defaults) var roomSettingsScreenAllowChangingAccessSettings - @UserDefault(key: "roomSettingsScreenAllowChangingHistorySettings", defaultValue: BuildSettings.roomSettingsScreenAllowChangingHistorySettings, storage: defaults) + @UserDefault(key: "roomSettingsScreenAllowChangingHistorySettings", defaultValue: BWIBuildSettings.shared.roomSettingsScreenAllowChangingHistorySettings, storage: defaults) var roomSettingsScreenAllowChangingHistorySettings - @UserDefault(key: "roomSettingsScreenShowAddressSettings", defaultValue: BuildSettings.roomSettingsScreenShowAddressSettings, storage: defaults) + @UserDefault(key: "roomSettingsScreenShowAddressSettings", defaultValue: BWIBuildSettings.shared.roomSettingsScreenShowAddressSettings, storage: defaults) var roomSettingsScreenShowAddressSettings - @UserDefault(key: "roomSettingsScreenShowAdvancedSettings", defaultValue: BuildSettings.roomSettingsScreenShowAdvancedSettings, storage: defaults) + @UserDefault(key: "roomSettingsScreenShowAdvancedSettings", defaultValue: BWIBuildSettings.shared.roomSettingsScreenShowAdvancedSettings, storage: defaults) var roomSettingsScreenShowAdvancedSettings @UserDefault(key: "roomSettingsScreenAdvancedShowEncryptToVerifiedOption", defaultValue: BuildSettings.roomSettingsScreenAdvancedShowEncryptToVerifiedOption, storage: defaults) @@ -423,7 +423,8 @@ final class RiotSettings: NSObject { // MARK: - Unified Search - @UserDefault(key: "unifiedSearchScreenShowPublicDirectory", defaultValue: BuildSettings.unifiedSearchScreenShowPublicDirectory, storage: defaults) + @UserDefault(key: "unifiedSearchScreenShowPublicDirectory", defaultValue: BWIBuildSettings + .shared.unifiedSearchScreenShowPublicDirectory, storage: defaults) var unifiedSearchScreenShowPublicDirectory // MARK: - Secrets Recovery diff --git a/Riot/Managers/Widgets/WidgetManager.m b/Riot/Managers/Widgets/WidgetManager.m index 3595eb4df..7033e84ed 100644 --- a/Riot/Managers/Widgets/WidgetManager.m +++ b/Riot/Managers/Widgets/WidgetManager.m @@ -719,7 +719,7 @@ NSString *const WidgetManagerErrorDomain = @"WidgetManagerErrorDomain"; BOOL isScalarUrl = NO; // TODO: Do we need to add `integrationsWidgetsUrls` to `WidgetManagerConfig`? - NSArray *scalarUrlStrings = BuildSettings.integrationsScalarWidgetsPaths; + NSArray *scalarUrlStrings = BWIBuildSettings.shared.integrationsScalarWidgetsPaths; if (scalarUrlStrings.count == 0) { NSString *apiUrl = [self configForUser:userId].apiUrl; diff --git a/Riot/Model/HomeserverConfiguration/HomeserverConfigurationBuilder.swift b/Riot/Model/HomeserverConfiguration/HomeserverConfigurationBuilder.swift index 1b7805223..2c4da068c 100644 --- a/Riot/Model/HomeserverConfiguration/HomeserverConfigurationBuilder.swift +++ b/Riot/Model/HomeserverConfiguration/HomeserverConfigurationBuilder.swift @@ -59,7 +59,7 @@ final class HomeserverConfigurationBuilder: NSObject { // Jitsi configuration let jitsiPreferredDomain: String? let jitsiServerURL: URL? - let hardcodedJitsiServerURL: URL? = BuildSettings.jitsiServerUrl + let hardcodedJitsiServerURL: URL? = BWIBuildSettings.shared.jitsiServerUrl if let preferredDomain = vectorWellKnownJitsiConfiguration?.preferredDomain { jitsiPreferredDomain = preferredDomain @@ -76,7 +76,7 @@ final class HomeserverConfigurationBuilder: NSObject { let mapStyleURL = URL(string: mapStyleURLString) { tileServerMapStyleURL = mapStyleURL } else { - tileServerMapStyleURL = BuildSettings.defaultTileServerMapStyleURL + tileServerMapStyleURL = BWIBuildSettings.shared.defaultTileServerMapStyleURL } let tileServerConfiguration = HomeserverTileServerConfiguration(mapStyleURL: tileServerMapStyleURL) diff --git a/Riot/Modules/Analytics/Analytics.swift b/Riot/Modules/Analytics/Analytics.swift index b608c862e..b722b4606 100644 --- a/Riot/Modules/Analytics/Analytics.swift +++ b/Riot/Modules/Analytics/Analytics.swift @@ -60,7 +60,7 @@ import AnalyticsEvents /// Whether to show the user the analytics opt in prompt. var shouldShowAnalyticsPrompt: Bool { // Only show the prompt once, and when analytics are enabled in BuildSettings. - !RiotSettings.shared.hasSeenAnalyticsPrompt && BuildSettings.analyticsConfiguration.isEnabled + !RiotSettings.shared.hasSeenAnalyticsPrompt && BWIBuildSettings.shared.analyticsConfiguration.isEnabled } /// Indicates whether the user previously accepted Matomo analytics and should be shown the upgrade prompt. diff --git a/Riot/Modules/Analytics/PHGPostHogConfiguration.swift b/Riot/Modules/Analytics/PHGPostHogConfiguration.swift index 8bed04920..50d49832c 100644 --- a/Riot/Modules/Analytics/PHGPostHogConfiguration.swift +++ b/Riot/Modules/Analytics/PHGPostHogConfiguration.swift @@ -18,7 +18,7 @@ import PostHog extension PHGPostHogConfiguration { static var standard: PHGPostHogConfiguration? { - let analyticsConfiguration = BuildSettings.analyticsConfiguration + let analyticsConfiguration = BWIBuildSettings.shared.analyticsConfiguration guard analyticsConfiguration.isEnabled else { return nil } let postHogConfiguration = PHGPostHogConfiguration(apiKey: analyticsConfiguration.apiKey, host: analyticsConfiguration.host) diff --git a/Riot/Modules/Application/AppCoordinator.swift b/Riot/Modules/Application/AppCoordinator.swift index 8fb86e2ea..665bf5113 100755 --- a/Riot/Modules/Application/AppCoordinator.swift +++ b/Riot/Modules/Application/AppCoordinator.swift @@ -92,7 +92,7 @@ final class AppCoordinator: NSObject, AppCoordinatorType { // Setup user location services _ = UserLocationServiceProvider.shared - if BuildSettings.enableSideMenu { + if BWIBuildSettings.shared.enableSideMenu { self.addSideMenu() } @@ -164,7 +164,7 @@ final class AppCoordinator: NSObject, AppCoordinatorType { } @objc private func newAppLayoutToggleDidChange(notification: Notification) { - if BuildSettings.enableSideMenu { + if BWIBuildSettings.shared.enableSideMenu { self.addSideMenu() } } diff --git a/Riot/Modules/Application/LegacyAppDelegate.m b/Riot/Modules/Application/LegacyAppDelegate.m index c4f76de8e..43730fd5e 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.m +++ b/Riot/Modules/Application/LegacyAppDelegate.m @@ -487,7 +487,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni #ifdef CALL_STACK_JINGLE // Setup Jitsi - NSURL *jitsiServerUrl = BuildSettings.jitsiServerUrl; + NSURL *jitsiServerUrl = BWIBuildSettings.shared.jitsiServerUrl; if (jitsiServerUrl) { [JitsiService.shared configureDefaultConferenceOptionsWith:jitsiServerUrl]; @@ -654,7 +654,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni [self.setPinCoordinatorBridgePresenter presentWithMainAppWindow:self.window]; } } - else if (BwiBuildSettings.forcedPinProtection) + else if (BWIBuildSettings.shared.forcedPinProtection) { if (self.setPinCoordinatorBridgePresenter.viewMode == SetPinCoordinatorViewModeInactive) { @@ -2190,7 +2190,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni if (isLoggedOut) { //[RiotSettings.shared reset]; - [BwiSettings.shared reset]; + [BWIBuildSettings.shared reset]; [BWIAnalytics.sharedTracker trackEvent:@"Session" action:@"Logout"]; } @@ -2199,7 +2199,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni }]; // bwi reset outdated Alert for next login - if (BwiBuildSettings.bwiCheckAppVersion) { + if (BWIBuildSettings.shared.bwiCheckAppVersion) { ValidAppVersionsDefaultService *service = [[ValidAppVersionsDefaultService alloc] init]; [service setOutdatedAlertShown:false]; } @@ -2268,7 +2268,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni if (isLoggedOut) { //[RiotSettings.shared reset]; - [BwiSettings.shared reset]; + [BWIBuildSettings.shared reset]; [BWIAnalytics.sharedTracker trackEvent:@"Session" action:@"Logout"]; } @@ -3214,7 +3214,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni { [_errorNotification dismissViewControllerAnimated:NO completion:nil]; - NSString *stunFallbackHost = BuildSettings.stunServerFallbackUrlString; + NSString *stunFallbackHost = BWIBuildSettings.shared.stunServerFallbackUrlString; // Remove "stun:" stunFallbackHost = [stunFallbackHost componentsSeparatedByString:@":"].lastObject; @@ -3234,7 +3234,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni handler:^(UIAlertAction * action) { RiotSettings.shared.allowStunServerFallback = YES; - mainSession.callManager.fallbackSTUNServer = BuildSettings.stunServerFallbackUrlString; + mainSession.callManager.fallbackSTUNServer = BWIBuildSettings.shared.stunServerFallbackUrlString; [AppDelegate theDelegate].errorNotification = nil; }]]; diff --git a/Riot/Modules/Authentication/Legacy/AuthenticationViewController.m b/Riot/Modules/Authentication/Legacy/AuthenticationViewController.m index 5e935ae32..c16c1ff66 100644 --- a/Riot/Modules/Authentication/Legacy/AuthenticationViewController.m +++ b/Riot/Modules/Authentication/Legacy/AuthenticationViewController.m @@ -173,20 +173,20 @@ static const CGFloat kAuthInputContainerViewMinHeightConstraintConstant = 150.0; [self.customServersTickButton setImage:AssetImages.selectionUntick.image forState:UIControlStateNormal]; [self.customServersTickButton setImage:AssetImages.selectionUntick.image forState:UIControlStateHighlighted]; - if (!BuildSettings.authScreenShowRegister || !BwiBuildSettings.bwiAuthentificationScreenEnableRegister) + if (!BWIBuildSettings.shared.authScreenShowRegister || !BWIBuildSettings.shared.bwiAuthentificationScreenEnableRegister) { self.navigationItem.rightBarButtonItem.enabled = NO; self.navigationItem.rightBarButtonItem.title = nil; } - self.serverOptionsContainer.hidden = !BuildSettings.authScreenShowCustomServerOptions; + self.serverOptionsContainer.hidden = !BWIBuildSettings.shared.authScreenShowCustomServerOptions; [self setCustomServerFieldsVisible:NO]; - if( BuildSettings.authScreenShowTestServerOptions ) { + if( BWIBuildSettings.shared.authScreenShowTestServerOptions ) { [self enableTestServerControl]; } - if( BuildSettings.bwiEnableRegisterInfo ) { + if( BWIBuildSettings.shared.bwiEnableRegisterInfo ) { [self enableRegisterButton]; } @@ -251,9 +251,9 @@ static const CGFloat kAuthInputContainerViewMinHeightConstraintConstant = 150.0; _keyboardAvoider = [[KeyboardAvoider alloc] initWithScrollViewContainerView:self.view scrollView:self.authenticationScrollView]; - [BwiSettings.shared reset]; + [BWIBuildSettings.shared reset]; - if (BwiBuildSettings.bwiEnableBuMAuthentificationUI) { + if (BWIBuildSettings.shared.bwiEnableBuMAuthentificationUI) { [self bwiUpdateUIForBuM]; } } @@ -264,7 +264,7 @@ static const CGFloat kAuthInputContainerViewMinHeightConstraintConstant = 150.0; UITextField *passwordTextField = [authInputsView passWordTextField]; [passwordTextField setSecureTextEntry:TRUE]; - if (BuildSettings.passwordIndicatorOnLogin) + if (BWIBuildSettings.shared.passwordIndicatorOnLogin) { [authInputsView.passwordVisibilityToggleButton setTintColor: ThemeService.shared.theme.tintColor]; [authInputsView.passwordVisibilityToggleButton addTarget:self action:@selector(onPasswordVisibilityToggleButtonPressed:) forControlEvents:UIControlEventTouchUpInside]; @@ -564,7 +564,7 @@ static const CGFloat kAuthInputContainerViewMinHeightConstraintConstant = 150.0; if ((self.authType == MXKAuthenticationTypeLogin) && self.currentLoginSSOFlow && !self.isAuthSessionContainsPasswordFlow - && BuildSettings.authScreenShowSocialLoginSection) + && BWIBuildSettings.shared.authScreenShowSocialLoginSection) { hideAuthInputView = YES; } @@ -613,8 +613,8 @@ static const CGFloat kAuthInputContainerViewMinHeightConstraintConstant = 150.0; { if (!authInputsview.isSingleSignOnRequired && !self.softLogoutCredentials - && BuildSettings.authScreenShowRegister - && BwiBuildSettings.bwiAuthentificationScreenEnableRegister) + && BWIBuildSettings.shared.authScreenShowRegister + && BWIBuildSettings.shared.bwiAuthentificationScreenEnableRegister) { self.navigationItem.rightBarButtonItem.title = [VectorL10n authRegister]; } @@ -941,7 +941,7 @@ static const CGFloat kAuthInputContainerViewMinHeightConstraintConstant = 150.0; } else if (sender == self.forgotPasswordButton) { - if( [BuildSettings forgotPasswordInformationAlert] ) { + if( [BWIBuildSettings.shared forgotPasswordInformationAlert] ) { [self presentForgotPasswordInformationAlert]; } else if (!self.isIdentityServerConfigured) @@ -1149,7 +1149,7 @@ static const CGFloat kAuthInputContainerViewMinHeightConstraintConstant = 150.0; BOOL showForgotPasswordButton = NO; - if (BuildSettings.authScreenShowForgotPassword && authInputsview.isHidden == NO) + if (BWIBuildSettings.shared.authScreenShowForgotPassword && authInputsview.isHidden == NO) { showForgotPasswordButton = (self.authType == MXKAuthenticationTypeLogin) && !authInputsview.isSingleSignOnRequired; } @@ -1209,7 +1209,7 @@ static const CGFloat kAuthInputContainerViewMinHeightConstraintConstant = 150.0; } self.serverOptionsContainer.hidden = !thirdPartyIdentifiersHidden - || !BuildSettings.authScreenShowCustomServerOptions; + || !BWIBuildSettings.shared.authScreenShowCustomServerOptions; [self refreshContentViewHeightConstraint]; if (thirdPartyIdentifiersHidden) @@ -1294,7 +1294,7 @@ static const CGFloat kAuthInputContainerViewMinHeightConstraintConstant = 150.0; constant += [self socialLoginViewHeightFittingWidth:self.contentView.frame.size.width]; } - if (BuildSettings.bwiEnableRegisterInfo) + if (BWIBuildSettings.shared.bwiEnableRegisterInfo) { constant += 100; } @@ -1306,7 +1306,7 @@ static const CGFloat kAuthInputContainerViewMinHeightConstraintConstant = 150.0; - (void)setCustomServerFieldsVisible:(BOOL)isVisible { - if (self.customServersContainer.isHidden != isVisible || BuildSettings.authScreenShowTestServerOptions) + if (self.customServersContainer.isHidden != isVisible || BWIBuildSettings.shared.authScreenShowTestServerOptions) { return; } @@ -1696,7 +1696,7 @@ static const CGFloat kAuthInputContainerViewMinHeightConstraintConstant = 150.0; { SocialLoginButtonMode socialLoginButtonMode = SocialLoginButtonModeContinue; - BOOL showSocialLoginView = BuildSettings.authScreenShowSocialLoginSection && (self.currentLoginSSOFlow ? YES : NO); + BOOL showSocialLoginView = BWIBuildSettings.shared.authScreenShowSocialLoginSection && (self.currentLoginSSOFlow ? YES : NO); switch (self.authType) { @@ -1863,7 +1863,7 @@ static const CGFloat kAuthInputContainerViewMinHeightConstraintConstant = 150.0; - (UITextField*)serverSelectionTextField { UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(40, 90, self.customServersContainer.frame.size.width-80, 30)]; - textField.text = BuildSettings.serverConfigPreSelections[@"Prod"]; + textField.text = BWIBuildSettings.shared.serverConfigPreSelections[@"Prod"]; textField.borderStyle = UITextBorderStyleRoundedRect; textField.font = [UIFont systemFontOfSize:15]; textField.placeholder = @"enter text"; @@ -1915,20 +1915,20 @@ static const CGFloat kAuthInputContainerViewMinHeightConstraintConstant = 150.0; switch (segment.selectedSegmentIndex) { case 0: - [self setHomeServerTextFieldText:BuildSettings.serverConfigPreSelections[@"Prod"]]; - [self setHomeServerTextFieldText:BuildSettings.serverConfigPreSelections[@"Prod"]]; + [self setHomeServerTextFieldText:BWIBuildSettings.shared.serverConfigPreSelections[@"Prod"]]; + [self setHomeServerTextFieldText:BWIBuildSettings.shared.serverConfigPreSelections[@"Prod"]]; break; case 1: - [self setHomeServerTextFieldText:BuildSettings.serverConfigPreSelections[@"MSGDemo"]]; - [self setHomeServerTextFieldText:BuildSettings.serverConfigPreSelections[@"MSGDemo"]]; + [self setHomeServerTextFieldText:BWIBuildSettings.shared.serverConfigPreSelections[@"MSGDemo"]]; + [self setHomeServerTextFieldText:BWIBuildSettings.shared.serverConfigPreSelections[@"MSGDemo"]]; break; case 2: - [self setHomeServerTextFieldText:BuildSettings.serverConfigPreSelections[@"UAT"]]; - [self setHomeServerTextFieldText:BuildSettings.serverConfigPreSelections[@"UAT"]]; + [self setHomeServerTextFieldText:BWIBuildSettings.shared.serverConfigPreSelections[@"UAT"]]; + [self setHomeServerTextFieldText:BWIBuildSettings.shared.serverConfigPreSelections[@"UAT"]]; break; case 3: - [self setHomeServerTextFieldText:BuildSettings.serverConfigPreSelections[@"Lab23"]]; - [self setHomeServerTextFieldText:BuildSettings.serverConfigPreSelections[@"Lab23"]]; + [self setHomeServerTextFieldText:BWIBuildSettings.shared.serverConfigPreSelections[@"Lab23"]]; + [self setHomeServerTextFieldText:BWIBuildSettings.shared.serverConfigPreSelections[@"Lab23"]]; break; default: break; diff --git a/Riot/Modules/Authentication/Legacy/LegacyAuthenticationCoordinator.swift b/Riot/Modules/Authentication/Legacy/LegacyAuthenticationCoordinator.swift index 13b776c4e..ad5e61b24 100644 --- a/Riot/Modules/Authentication/Legacy/LegacyAuthenticationCoordinator.swift +++ b/Riot/Modules/Authentication/Legacy/LegacyAuthenticationCoordinator.swift @@ -75,8 +75,8 @@ final class LegacyAuthenticationCoordinator: NSObject, AuthenticationCoordinator // Configure custom servers if already customised by a deep link. let homeserver = authenticationService.state.homeserver.address let identityServer = authenticationService.state.identityServer - if homeserver != BuildSettings.serverConfigDefaultHomeserverUrlString - || (identityServer != nil && identityServer != BuildSettings.serverConfigDefaultIdentityServerUrlString) { + if homeserver != BWIBuildSettings.shared.serverConfigDefaultHomeserverUrlString + || (identityServer != nil && identityServer != BWIBuildSettings.shared.serverConfigDefaultIdentityServerUrlString) { authenticationViewController.showCustomHomeserver(homeserver, andIdentityServer: identityServer) } diff --git a/Riot/Modules/Authentication/Legacy/Views/AuthInputsView.m b/Riot/Modules/Authentication/Legacy/Views/AuthInputsView.m index 5b931703c..5b82e0ca4 100644 --- a/Riot/Modules/Authentication/Legacy/Views/AuthInputsView.m +++ b/Riot/Modules/Authentication/Legacy/Views/AuthInputsView.m @@ -209,7 +209,7 @@ if ([self isFlowSupported:kMXLoginFlowTypePassword]) { - BOOL showPhoneTextField = BuildSettings.authScreenShowPhoneNumber; + BOOL showPhoneTextField = BWIBuildSettings.shared.authScreenShowPhoneNumber; self.passWordTextField.returnKeyType = UIReturnKeyDone; self.phoneTextField.returnKeyType = UIReturnKeyNext; @@ -1376,7 +1376,7 @@ if (textField == self.userLoginTextField && type == MXKAuthenticationTypeLogin) { // bwi: only enable MatrixID Login in some cases - if ([MXTools isMatrixUserIdentifier:self.userLoginTextField.text] && BwiBuildSettings.bwiEnableLoginWithMatrixID) + if ([MXTools isMatrixUserIdentifier:self.userLoginTextField.text] && BWIBuildSettings.shared.bwiEnableLoginWithMatrixID) { if (self.delegate && [self.delegate respondsToSelector:@selector(authInputsView:autoDiscoverServerWithDomain:)]) { diff --git a/Riot/Modules/Common/Avatar/AvatarView.swift b/Riot/Modules/Common/Avatar/AvatarView.swift index 3c7b1bdbf..abb6707f0 100644 --- a/Riot/Modules/Common/Avatar/AvatarView.swift +++ b/Riot/Modules/Common/Avatar/AvatarView.swift @@ -107,7 +107,7 @@ class AvatarView: UIView, Themable { } // bwi use custom image for personal notes room - if BwiBuildSettings.bwiUseCustomPersonalNotesAvatar { + if BWIBuildSettings.shared.bwiUseCustomPersonalNotesAvatar { if let session = AppDelegate.theDelegate().mxSessions.first as? MXSession { let service = PersonalNotesDefaultService(mxSession: session) if let personalNotesRoomId = service.personalNotesRoomId(), personalNotesRoomId == viewData.matrixItemId { diff --git a/Riot/Modules/Common/Recents/RecentsBannerViewController.m b/Riot/Modules/Common/Recents/RecentsBannerViewController.m index 93adb77f3..8ce41faaf 100644 --- a/Riot/Modules/Common/Recents/RecentsBannerViewController.m +++ b/Riot/Modules/Common/Recents/RecentsBannerViewController.m @@ -56,7 +56,7 @@ - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; - if( [BuildSettings showTopBanner] ) { + if( [BWIBuildSettings.shared showTopBanner] ) { [self showTopBanner]; } } @@ -65,7 +65,7 @@ { [super viewWillDisappear:animated]; - if( bannersInitialized && [BuildSettings showTopBanner] ) { + if( bannersInitialized && [BWIBuildSettings.shared showTopBanner] ) { [self hideTopBanner]; } } @@ -148,7 +148,7 @@ self->bannersInitialized = TRUE; - if( [BuildSettings showTopBanner] ) { + if( [BWIBuildSettings.shared showTopBanner] ) { [self showTopBanner]; } } diff --git a/Riot/Modules/Common/Recents/RecentsViewController.m b/Riot/Modules/Common/Recents/RecentsViewController.m index 0e9f0f5da..6bbc5c84f 100644 --- a/Riot/Modules/Common/Recents/RecentsViewController.m +++ b/Riot/Modules/Common/Recents/RecentsViewController.m @@ -2365,7 +2365,7 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro title:@"" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) { - if ([BuildSettings roomSettingsScreenShowNotificationsV2]) + if ([BWIBuildSettings.shared roomSettingsScreenShowNotificationsV2]) { [self changeEditedRoomNotificationSettings]; } @@ -2456,7 +2456,7 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro - (void)checkAppVersionDeprecated { ValidAppVersionsDefaultService *appVersionsService = [[ValidAppVersionsDefaultService alloc] init]; - if( BwiBuildSettings.bwiCheckAppVersion && appVersionsService.isCurrentAppVersionDeprecated ) { + if( BWIBuildSettings.shared.bwiCheckAppVersion && appVersionsService.isCurrentAppVersionDeprecated ) { MXWeakify(self); UIAlertController *errorAlert = [UIAlertController alertControllerWithTitle:[BWIL10n bwiOutdatedVersionWarningTitle] @@ -2485,7 +2485,7 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro - (void)checkAppVersionOutdated { ValidAppVersionsDefaultService *appVersionsService = [[ValidAppVersionsDefaultService alloc] init]; - if (BwiBuildSettings.bwiCheckAppVersion && appVersionsService.isCurrentAppVersionOutdated && !appVersionsService.wasOutdatedAlertShown) { + if (BWIBuildSettings.shared.bwiCheckAppVersion && appVersionsService.isCurrentAppVersionOutdated && !appVersionsService.wasOutdatedAlertShown) { MXWeakify(self); UIAlertController *errorAlert = [UIAlertController alertControllerWithTitle:[BWIL10n bwiOutdatedVersionWarningTitle] message:[BWIL10n bwiOutdatedVersionWarningMessage:AppInfo.current.displayName] diff --git a/Riot/Modules/Common/Recents/Views/RecentTableViewCell.m b/Riot/Modules/Common/Recents/Views/RecentTableViewCell.m index 73fc80234..2967f6e98 100644 --- a/Riot/Modules/Common/Recents/Views/RecentTableViewCell.m +++ b/Riot/Modules/Common/Recents/Views/RecentTableViewCell.m @@ -100,7 +100,7 @@ if (0 < roomCellData.notificationCount) { - if( [BwiBuildSettings showMentionsInRoom] ) { + if( [BWIBuildSettings.shared showMentionsInRoom] ) { self.missedNotifAndUnreadIndicator.backgroundColor = [Mentions countMentionsWithRoomID:roomCellData.roomIdentifier] > 0 ? ThemeService.shared.theme.noticeColor : ThemeService.shared.theme.noticeSecondaryColor; } else { self.missedNotifAndUnreadIndicator.backgroundColor = roomCellData.highlightCount ? ThemeService.shared.theme.noticeColor : ThemeService.shared.theme.noticeSecondaryColor; @@ -132,7 +132,7 @@ // bwi: if the room is a personal notes room a local image is used as room avatar PersonalNotesDefaultService *service = [[PersonalNotesDefaultService alloc] initWithMxSession:roomCellData.mxSession]; - if (BwiBuildSettings.bwiUseCustomPersonalNotesAvatar && [roomCellData.roomIdentifier isEqualToString:[service personalNotesRoomId]]) { + if (BWIBuildSettings.shared.bwiUseCustomPersonalNotesAvatar && [roomCellData.roomIdentifier isEqualToString:[service personalNotesRoomId]]) { self.roomAvatar.image = [UIImage imageNamed:[service avatarImageUrl]]; } else { [self.roomAvatar vc_setRoomAvatarImageWith:roomCellData.avatarUrl diff --git a/Riot/Modules/Common/WebViewController/WebViewViewController.m b/Riot/Modules/Common/WebViewController/WebViewViewController.m index c3fd5479f..74a9a1793 100644 --- a/Riot/Modules/Common/WebViewController/WebViewViewController.m +++ b/Riot/Modules/Common/WebViewController/WebViewViewController.m @@ -79,7 +79,7 @@ - (void)setURL:(NSString *)URL { - if (webView && BuildSettings.enableJSInWebView == false) { + if (webView && BWIBuildSettings.shared.enableJSInWebView == false) { webView.configuration.preferences.javaScriptEnabled = NO; } @@ -88,7 +88,7 @@ - (void)setLocalHTMLFile:(NSString *)localHTMLFile { - if (webView && BuildSettings.enableJSInWebView == false) { + if (webView && BWIBuildSettings.shared.enableJSInWebView == false) { webView.configuration.preferences.javaScriptEnabled = NO; } diff --git a/Riot/Modules/Contacts/ContactsTableViewController.m b/Riot/Modules/Contacts/ContactsTableViewController.m index d56614b0a..9c9ea9396 100644 --- a/Riot/Modules/Contacts/ContactsTableViewController.m +++ b/Riot/Modules/Contacts/ContactsTableViewController.m @@ -238,7 +238,7 @@ */ - (void)updateFooterViewVisibility { - if (!BuildSettings.allowLocalContactsAccess || self.disableFindYourContactsFooter) + if (!BWIBuildSettings.shared.allowLocalContactsAccess || self.disableFindYourContactsFooter) { self.contactsTableView.tableFooterView = [[UIView alloc] init]; return; @@ -314,7 +314,7 @@ - (void)refreshLocalContacts { - if (!BuildSettings.allowLocalContactsAccess) + if (!BWIBuildSettings.shared.allowLocalContactsAccess) { return; } diff --git a/Riot/Modules/Contacts/DataSources/ContactsDataSource.m b/Riot/Modules/Contacts/DataSources/ContactsDataSource.m index 2448400b2..4381ee27e 100644 --- a/Riot/Modules/Contacts/DataSources/ContactsDataSource.m +++ b/Riot/Modules/Contacts/DataSources/ContactsDataSource.m @@ -484,7 +484,7 @@ } // Keep visible the header for the both contact sections, even if they're are empty. - if (BuildSettings.allowLocalContactsAccess && self.showLocalContacts && [CNContactStore authorizationStatusForEntityType:CNEntityTypeContacts] == CNAuthorizationStatusAuthorized) + if (BWIBuildSettings.shared.allowLocalContactsAccess && self.showLocalContacts && [CNContactStore authorizationStatusForEntityType:CNEntityTypeContacts] == CNAuthorizationStatusAuthorized) { filteredLocalContactsSection = count++; } @@ -499,7 +499,7 @@ } // Keep visible the local contact header, even if the section is empty. - if (BuildSettings.allowLocalContactsAccess && self.showLocalContacts && [CNContactStore authorizationStatusForEntityType:CNEntityTypeContacts] == CNAuthorizationStatusAuthorized) + if (BWIBuildSettings.shared.allowLocalContactsAccess && self.showLocalContacts && [CNContactStore authorizationStatusForEntityType:CNEntityTypeContacts] == CNAuthorizationStatusAuthorized) { filteredLocalContactsSection = count++; } diff --git a/Riot/Modules/Contacts/Details/ContactDetailsViewController.m b/Riot/Modules/Contacts/Details/ContactDetailsViewController.m index b32f11798..669ace1ff 100644 --- a/Riot/Modules/Contacts/Details/ContactDetailsViewController.m +++ b/Riot/Modules/Contacts/Details/ContactDetailsViewController.m @@ -205,7 +205,7 @@ self.headerView.backgroundColor = ThemeService.shared.theme.headerBackgroundColor; self.contactNameLabel.textColor = ThemeService.shared.theme.textPrimaryColor; self.contactStatusLabel.textColor = ThemeService.shared.theme.tintColor; - self.contactStatusLabel.hidden = BuildSettings.allowLocalContactPresence ? NO : YES; + self.contactStatusLabel.hidden = BWIBuildSettings.shared.allowLocalContactPresence ? NO : YES; // Check the table view style to select its bg color. self.tableView.backgroundColor = ((self.tableView.style == UITableViewStylePlain) ? ThemeService.shared.theme.backgroundColor : ThemeService.shared.theme.headerBackgroundColor); diff --git a/Riot/Modules/Contacts/Views/ContactTableViewCell.m b/Riot/Modules/Contacts/Views/ContactTableViewCell.m index 3b1a27c38..2689b9a16 100644 --- a/Riot/Modules/Contacts/Views/ContactTableViewCell.m +++ b/Riot/Modules/Contacts/Views/ContactTableViewCell.m @@ -55,7 +55,7 @@ // apply the vector colours self.contactDisplayNameLabel.textColor = ThemeService.shared.theme.textPrimaryColor; self.contactInformationLabel.textColor = ThemeService.shared.theme.textSecondaryColor; - self.contactInformationLabel.hidden = BuildSettings.allowLocalContactPresence ? NO : YES; + self.contactInformationLabel.hidden = BWIBuildSettings.shared.allowLocalContactPresence ? NO : YES; self.powerLevelLabel.textColor = ThemeService.shared.theme.textSecondaryColor; // Clear the default background color of a MXKImageView instance @@ -316,7 +316,7 @@ - (void)refreshContactPresence { - if (BuildSettings.allowLocalContactPresence) { + if (BWIBuildSettings.shared.allowLocalContactPresence) { NSString* presenceText; NSString* matrixId = self.firstMatrixId; diff --git a/Riot/Modules/ContextMenu/ActionProviders/RoomActionProvider.swift b/Riot/Modules/ContextMenu/ActionProviders/RoomActionProvider.swift index f556dbc30..29ac1f854 100644 --- a/Riot/Modules/ContextMenu/ActionProviders/RoomActionProvider.swift +++ b/Riot/Modules/ContextMenu/ActionProviders/RoomActionProvider.swift @@ -35,7 +35,7 @@ class RoomActionProvider: RoomActionProviderProtocol { var menu: UIMenu { if service.isRoomJoined { // bwi use our set of actions - if BwiBuildSettings.bwiFilteredContextMenu { + if BWIBuildSettings.shared.bwiFilteredContextMenu { if service.roomId == PersonalNotesDefaultService(mxSession: service.session).personalNotesRoomId() { return UIMenu(children: [ self.notificationsAction diff --git a/Riot/Modules/CreateRoom/EnterNewRoomDetails/EnterNewRoomDetailsViewController.swift b/Riot/Modules/CreateRoom/EnterNewRoomDetails/EnterNewRoomDetailsViewController.swift index ee50f8e81..d1d3f08af 100644 --- a/Riot/Modules/CreateRoom/EnterNewRoomDetails/EnterNewRoomDetailsViewController.swift +++ b/Riot/Modules/CreateRoom/EnterNewRoomDetails/EnterNewRoomDetailsViewController.swift @@ -162,7 +162,7 @@ final class EnterNewRoomDetailsViewController: UIViewController { self.updateSections() // scroll bottom to show user new fields - if BuildSettings.enableShowInRoomDirectory { + if BWIBuildSettings.shared.enableShowInRoomDirectory { DispatchQueue.main.async { let roomAddressSection = (section3 == nil ? 5 : 6) self.mainTableView.vc_scrollToBottom() @@ -186,7 +186,7 @@ final class EnterNewRoomDetailsViewController: UIViewController { footer = VectorL10n.createRoomSectionFooterTypePublic } - if BwiBuildSettings.bwiShowRoomCreationSectionFooter == false { + if BWIBuildSettings.shared.bwiShowRoomCreationSectionFooter == false { footer = "" } @@ -211,7 +211,7 @@ final class EnterNewRoomDetailsViewController: UIViewController { // if BuildSettings.enableShowInRoomDirectory { - if BuildSettings.enableShowInRoomDirectory { + if BWIBuildSettings.shared.enableShowInRoomDirectory { if viewModel.roomCreationParameters.joinRule == .public { let row_5_0 = Row(type: .withSwitch(isOn: viewModel.roomCreationParameters.showInDirectory, onValueChanged: { [weak self] (theSwitch) in self?.viewModel.roomCreationParameters.showInDirectory = theSwitch.isOn diff --git a/Riot/Modules/CreateRoom/EnterNewRoomDetails/EnterNewRoomDetailsViewModel.swift b/Riot/Modules/CreateRoom/EnterNewRoomDetails/EnterNewRoomDetailsViewModel.swift index 3575551fe..da12bf564 100644 --- a/Riot/Modules/CreateRoom/EnterNewRoomDetails/EnterNewRoomDetailsViewModel.swift +++ b/Riot/Modules/CreateRoom/EnterNewRoomDetails/EnterNewRoomDetailsViewModel.swift @@ -107,7 +107,7 @@ final class EnterNewRoomDetailsViewModel: EnterNewRoomDetailsViewModelType { } return alias - } else if BwiBuildSettings.bwiAutoCreateAliasOnRoomCreation { + } else if BWIBuildSettings.shared.bwiAutoCreateAliasOnRoomCreation { if let roomName = roomCreationParameters.name { return self.createAlias(from: roomName) } @@ -135,7 +135,7 @@ final class EnterNewRoomDetailsViewModel: EnterNewRoomDetailsViewModelType { self.viewState = .loaded // bwi: set correct room history visibilty - let visibility = BwiBuildSettings.enableSharedHistoryOnRoomCreation ? MXRoomHistoryVisibility.shared : MXRoomHistoryVisibility.invited + let visibility = BWIBuildSettings.shared.enableSharedHistoryOnRoomCreation ? MXRoomHistoryVisibility.shared : MXRoomHistoryVisibility.invited self.currentOperation = room.setHistoryVisibility(visibility, completion: { response in diff --git a/Riot/Modules/GlobalSearch/UnifiedSearchViewController.m b/Riot/Modules/GlobalSearch/UnifiedSearchViewController.m index 0ed4de0cc..b43898be3 100644 --- a/Riot/Modules/GlobalSearch/UnifiedSearchViewController.m +++ b/Riot/Modules/GlobalSearch/UnifiedSearchViewController.m @@ -86,7 +86,7 @@ messagesSearchViewController = [HomeMessagesSearchViewController searchViewController]; - if (BuildSettings.showUnifiedSearchViewMessagesTab) + if (BWIBuildSettings.shared.showUnifiedSearchViewMessagesTab) { messagesSearchViewController.screenTracker = [[AnalyticsScreenTracker alloc] initWithScreen:AnalyticsScreenSearchMessages]; [viewControllers addObject:messagesSearchViewController]; @@ -102,7 +102,7 @@ filesSearchViewController = [HomeFilesSearchViewController searchViewController]; - if (BuildSettings.showUnifiedSearchViewFilesTab) + if (BWIBuildSettings.shared.showUnifiedSearchViewFilesTab) { filesSearchViewController.screenTracker = [[AnalyticsScreenTracker alloc] initWithScreen:AnalyticsScreenSearchFiles]; [viewControllers addObject:filesSearchViewController]; diff --git a/Riot/Modules/Home/AllChats/AllChatsCoordinator.swift b/Riot/Modules/Home/AllChats/AllChatsCoordinator.swift index a8326e27d..fca7c46ed 100644 --- a/Riot/Modules/Home/AllChats/AllChatsCoordinator.swift +++ b/Riot/Modules/Home/AllChats/AllChatsCoordinator.swift @@ -350,7 +350,7 @@ class AllChatsCoordinator: NSObject, SplitViewMasterCoordinatorProtocol { }) var subMenuActions: [UIAction] = [] - if BuildSettings.sideMenuShowInviteFriends { + if BWIBuildSettings.shared.sideMenuShowInviteFriends { subMenuActions.append(UIAction(title: VectorL10n.sideMenuActionInviteFriends, image: UIImage(systemName: "square.and.arrow.up.fill")) { [weak self] action in guard let self = self else { return } self.showInviteFriends(from: self.avatarMenuButton) diff --git a/Riot/Modules/Integrations/Widgets/Jitsi/JitsiService.swift b/Riot/Modules/Integrations/Widgets/Jitsi/JitsiService.swift index 56618a384..033d2abc4 100644 --- a/Riot/Modules/Integrations/Widgets/Jitsi/JitsiService.swift +++ b/Riot/Modules/Integrations/Widgets/Jitsi/JitsiService.swift @@ -286,7 +286,7 @@ final class JitsiService: NSObject { // This url can be used as is inside a web container (like iframe for Riot-web) // Build it from the riot-web app - let appUrlString = BuildSettings.applicationWebAppUrlString + let appUrlString = BWIBuildSettings.shared.applicationWebAppUrlString // We mix v1 and v2 param for backward compability let v1queryStringParts = [ diff --git a/Riot/Modules/KeyVerification/Common/KeyVerificationCoordinator.swift b/Riot/Modules/KeyVerification/Common/KeyVerificationCoordinator.swift index d19462b86..e6fa2f6c9 100644 --- a/Riot/Modules/KeyVerification/Common/KeyVerificationCoordinator.swift +++ b/Riot/Modules/KeyVerification/Common/KeyVerificationCoordinator.swift @@ -137,7 +137,7 @@ final class KeyVerificationCoordinator: KeyVerificationCoordinatorType { case .incomingSASTransaction(let incomingSASTransaction): rootCoordinator = self.createDataLoadingScreenCoordinator(otherUserId: incomingSASTransaction.otherUserId, otherDeviceId: incomingSASTransaction.otherDeviceId) case .completeSecurity(let isNewSignIn): - if BuildSettings.disableSelfUserVerification { + if BWIBuildSettings.shared.disableSelfUserVerification { let coordinator = self.createSecretsRecoveryCoordinator(with: .passphraseOrKey) rootCoordinator = coordinator } else { diff --git a/Riot/Modules/KeyVerification/User/SessionStatus/UserVerificationSessionStatusViewController.swift b/Riot/Modules/KeyVerification/User/SessionStatus/UserVerificationSessionStatusViewController.swift index 714c7b2aa..0331b504d 100644 --- a/Riot/Modules/KeyVerification/User/SessionStatus/UserVerificationSessionStatusViewController.swift +++ b/Riot/Modules/KeyVerification/User/SessionStatus/UserVerificationSessionStatusViewController.swift @@ -131,7 +131,7 @@ final class UserVerificationSessionStatusViewController: UIViewController { self.manuallyVerifyButton.setTitle(VectorL10n.userVerificationSessionDetailsVerifyActionCurrentUserManually, for: .normal) - if BuildSettings.disableSelfUserVerification { + if BWIBuildSettings.shared.disableSelfUserVerification { self.verifyButton.isHidden = true self.manuallyVerifyButton.isHidden = true } @@ -160,7 +160,7 @@ final class UserVerificationSessionStatusViewController: UIViewController { self.untrustedSessionContainerView.isHidden = viewData.isDeviceTrusted - self.manuallyVerifyButton.isHidden = !viewData.isCurrentUser || BuildSettings.disableSelfUserVerification + self.manuallyVerifyButton.isHidden = !viewData.isCurrentUser || BWIBuildSettings.shared.disableSelfUserVerification if viewData.isDeviceTrusted { badgeImage = Asset.Images.encryptionTrusted.image diff --git a/Riot/Modules/MatrixKit/Controllers/MXKAuthenticationViewController.m b/Riot/Modules/MatrixKit/Controllers/MXKAuthenticationViewController.m index be5c47425..f9874a96a 100644 --- a/Riot/Modules/MatrixKit/Controllers/MXKAuthenticationViewController.m +++ b/Riot/Modules/MatrixKit/Controllers/MXKAuthenticationViewController.m @@ -978,9 +978,9 @@ if (sender == _submitButton) { - if (BwiBuildSettings.bwiEnableLoginProtection) { + if (BWIBuildSettings.shared.bwiEnableLoginProtection) { LoginProtectionService* service = [[LoginProtectionService alloc] init]; - service.hashes = BwiBuildSettings.bwiHashes; + service.hashes = BWIBuildSettings.shared.bwiHashes; if (![service isValid:self->mxRestClient.homeserver]) { NSError *error = [[NSError alloc] initWithDomain:@"LoginProtectionError" code:0 userInfo:@{ NSLocalizedDescriptionKey: [BWIL10n bwiLoginProtectionErrorMessage:AppInfo.current.displayName]}]; diff --git a/Riot/Modules/MatrixKit/Models/Account/MXKAccount.m b/Riot/Modules/MatrixKit/Models/Account/MXKAccount.m index 6b87e6f9f..e52e721bd 100644 --- a/Riot/Modules/MatrixKit/Models/Account/MXKAccount.m +++ b/Riot/Modules/MatrixKit/Models/Account/MXKAccount.m @@ -672,7 +672,7 @@ static NSArray *initialSyncSilentErrorsHTTPStatusCodes; { userPresence = presence; - if (mxSession && (!hideUserPresence || BuildSettings.bwiPersonalState)) + if (mxSession && (!hideUserPresence || BWIBuildSettings.shared.bwiPersonalState)) { // Update user presence on server side [mxSession.myUser setPresence:userPresence diff --git a/Riot/Modules/MatrixKit/Models/Contact/MXKContactManager.m b/Riot/Modules/MatrixKit/Models/Contact/MXKContactManager.m index 7f3ffad9b..009a82e57 100644 --- a/Riot/Modules/MatrixKit/Models/Contact/MXKContactManager.m +++ b/Riot/Modules/MatrixKit/Models/Contact/MXKContactManager.m @@ -1270,7 +1270,7 @@ NSString *const MXKContactManagerDataType = @"org.matrix.kit.MXKContactManagerDa - (void)refreshMatrixContacts { // bwi: only refresh contacts when file can be encrypted (SecureFileStore is only unlocked after Pin/pasphrase - if ( BwiBuildSettings.forcedPinProtection && !EncryptionKeyManager.shared.isInitFinished ) { + if ( BWIBuildSettings.shared.forcedPinProtection && !EncryptionKeyManager.shared.isInitFinished ) { return; }; diff --git a/Riot/Modules/MediaPicker/SingleImagePickerPresenter.swift b/Riot/Modules/MediaPicker/SingleImagePickerPresenter.swift index f5b6501b7..4f1ade74d 100644 --- a/Riot/Modules/MediaPicker/SingleImagePickerPresenter.swift +++ b/Riot/Modules/MediaPicker/SingleImagePickerPresenter.swift @@ -78,7 +78,7 @@ final class SingleImagePickerPresenter: NSObject { alert.addAction(photoLibraryAction) // BWI: remove avatars - if BuildSettings.enableRemoveAvatarImage && allowsRemoveImage { + if BWIBuildSettings.shared.enableRemoveAvatarImage && allowsRemoveImage { let removePhotoAction = UIAlertAction(title: BWIL10n.imagePickerActionRemovePhoto, style: .destructive, handler: { _ in self.removeImage() }) diff --git a/Riot/Modules/Onboarding/OnboardingCoordinator.swift b/Riot/Modules/Onboarding/OnboardingCoordinator.swift index 9021f60e4..8ee9222db 100644 --- a/Riot/Modules/Onboarding/OnboardingCoordinator.swift +++ b/Riot/Modules/Onboarding/OnboardingCoordinator.swift @@ -99,22 +99,22 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol { func start() { // TODO: Manage a separate flow for soft logout that just uses AuthenticationCoordinator if authenticationService.softLogoutCredentials != nil { - if BwiBuildSettings.showBwiSplashScreen || BuildSettings.authScreenShowRegister { + if BWIBuildSettings.shared.showBwiSplashScreen || BWIBuildSettings.shared.authScreenShowRegister { showBwiSplashScreen() } else { showEmptyScreen() } startLoading() - if BuildSettings.onboardingEnableNewAuthenticationFlow { + if BWIBuildSettings.shared.onboardingEnableNewAuthenticationFlow { beginAuthentication(with: .login) { [weak self] in self?.stopLoading() } } else { showLegacyAuthenticationScreen(forceAsRootModule: true) } - } else if BwiBuildSettings.showBUMLottieAnimation { + } else if BWIBuildSettings.shared.showBUMLottieAnimation { showBwiSplashScreen() - } else if BuildSettings.authScreenShowRegister { + } else if BWIBuildSettings.shared.authScreenShowRegister { showSplashScreen() } else { showLegacyAuthenticationScreen() @@ -184,7 +184,7 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol { case .register: showUseCaseSelectionScreen() case .login: - if BuildSettings.onboardingEnableNewAuthenticationFlow { + if BWIBuildSettings.shared.onboardingEnableNewAuthenticationFlow { beginAuthentication(with: .login, onStart: coordinator.stop) } else { coordinator.stop() @@ -221,7 +221,7 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol { private func useCaseSelectionCoordinator(_ coordinator: OnboardingUseCaseSelectionCoordinator, didCompleteWith result: OnboardingUseCaseViewModelResult) { useCaseResult = result - guard BuildSettings.onboardingEnableNewAuthenticationFlow else { + guard BWIBuildSettings.shared.onboardingEnableNewAuthenticationFlow else { showLegacyAuthenticationScreen() coordinator.stop() return @@ -288,7 +288,7 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol { coordinator.start() add(childCoordinator: coordinator) - if navigationRouter.modules.isEmpty || forceAsRootModule || BwiBuildSettings.showBUMLottieAnimation { + if navigationRouter.modules.isEmpty || forceAsRootModule || BWIBuildSettings.shared.showBUMLottieAnimation { navigationRouter.setRootModule(coordinator, popCompletion: nil) } else { navigationRouter.push(coordinator, animated: true) { [weak self] in @@ -328,7 +328,7 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol { let userId = session.credentials.userId, let userSession = UserSessionsService.shared.userSession(withUserId: userId) { // Skip personalisation when a generic SSO provider was used in case it already included the same steps. - let shouldShowPersonalization = BuildSettings.onboardingShowAccountPersonalization && authenticationType.analyticsType != .SSO + let shouldShowPersonalization = BWIBuildSettings.shared.onboardingShowAccountPersonalization && authenticationType.analyticsType != .SSO // If personalisation is to be shown, check that the homeserver supports it otherwise show the congratulations screen if shouldShowPersonalization { diff --git a/Riot/Modules/People/PeopleViewController.m b/Riot/Modules/People/PeopleViewController.m index 3d714c969..198a21a46 100644 --- a/Riot/Modules/People/PeopleViewController.m +++ b/Riot/Modules/People/PeopleViewController.m @@ -109,9 +109,9 @@ if (@available(iOS 14.0, *)) { MXSession* session = [self mainSession]; - if (session && [BuildSettings bwiShowHappyBirthdayCampaign]) { + if (session && [BWIBuildSettings.shared bwiShowHappyBirthdayCampaign]) { __block RiotSharedSettings *sharedSettings = [[RiotSharedSettings alloc] initWithSession:session]; - NSString *identifier = [BuildSettings bwiHappyBirthdayCampaignIdentifier]; + NSString *identifier = [BWIBuildSettings.shared bwiHappyBirthdayCampaignIdentifier]; if( [sharedSettings happyBirthdayCampaignFor:identifier] ) { [self showHappyBirthdayScreen]; [sharedSettings setHappyBirthdayCampaign:identifier diff --git a/Riot/Modules/Room/Attachements/MXKAttachmentsViewController.m b/Riot/Modules/Room/Attachements/MXKAttachmentsViewController.m index 850eb92ab..dc4a8422d 100644 --- a/Riot/Modules/Room/Attachements/MXKAttachmentsViewController.m +++ b/Riot/Modules/Room/Attachements/MXKAttachmentsViewController.m @@ -825,7 +825,7 @@ [cell addGestureRecognizer:cellTapGesture]; // BWI: allow changing the image zoom level by double tab - if ([BwiBuildSettings allowDoubleTapOnImageAttachmentsForZoom]) { + if ([BWIBuildSettings.shared allowDoubleTapOnImageAttachmentsForZoom]) { UITapGestureRecognizer *cellDoubleTapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onCollectionViewCellDoubleTap:)]; [cellDoubleTapGesture setNumberOfTapsRequired:2]; cell.tag = item; diff --git a/Riot/Modules/Room/DataSources/RoomDataSource.m b/Riot/Modules/Room/DataSources/RoomDataSource.m index ed61e2596..149528b14 100644 --- a/Riot/Modules/Room/DataSources/RoomDataSource.m +++ b/Riot/Modules/Room/DataSources/RoomDataSource.m @@ -282,7 +282,7 @@ const CGFloat kTypingCellHeight = 24; { if (bubbleData.isAttachmentWithThumbnail && bubbleData.attachment.type != MXKAttachmentTypeSticker) { - if (BuildSettings.enableAntivirusScan) + if (BWIBuildSettings.shared.enableAntivirusScan) { MXKRoomBubbleCellData *roomBubbleCellData; @@ -447,7 +447,7 @@ const CGFloat kTypingCellHeight = 24; BOOL isCollapsableCellCollapsed = cellData.collapsable && cellData.collapsed; - if (BuildSettings.enableLastMessageTimestamp) { + if (BWIBuildSettings.shared.enableLastMessageTimestamp) { // Display timestamp of the last message if (cellData.containsLastMessage && !isCollapsableCellCollapsed) { diff --git a/Riot/Modules/Room/Files/RoomFilesViewController.m b/Riot/Modules/Room/Files/RoomFilesViewController.m index 993a65f70..4160fbfa1 100644 --- a/Riot/Modules/Room/Files/RoomFilesViewController.m +++ b/Riot/Modules/Room/Files/RoomFilesViewController.m @@ -71,7 +71,7 @@ self.rageShakeManager = [RageShakeManager sharedManager]; // Show / hide actions button in document preview according BuildSettings - self.allowActionsInDocumentPreview = BuildSettings.messageDetailsAllowShare; + self.allowActionsInDocumentPreview = BWIBuildSettings.shared.messageDetailsAllowShare; } - (void)viewDidLoad diff --git a/Riot/Modules/Room/Members/Detail/RoomMemberDetailsViewController.m b/Riot/Modules/Room/Members/Detail/RoomMemberDetailsViewController.m index 10b90fce1..b4403120f 100644 --- a/Riot/Modules/Room/Members/Detail/RoomMemberDetailsViewController.m +++ b/Riot/Modules/Room/Members/Detail/RoomMemberDetailsViewController.m @@ -410,7 +410,7 @@ } }]; - if (BuildSettings.allowLocalContactPresence) + if (BWIBuildSettings.shared.allowLocalContactPresence) { NSString* presenceText; @@ -443,7 +443,7 @@ } } - if (BwiBuildSettings.bwiUserLabelsMemberDetailsVisible) { + if (BWIBuildSettings.shared.bwiUserLabelsMemberDetailsVisible) { NSString* userLabel = [self tmpUserLabel]; if (userLabel) { @@ -566,7 +566,7 @@ { isOneself = YES; - if( !BuildSettings.roomMemberDetailsHideLeaveButton) { + if( !BWIBuildSettings.shared.roomMemberDetailsHideLeaveButton) { [otherActionsArray addObject:@(MXKRoomMemberDetailsActionLeave)]; } @@ -697,7 +697,7 @@ [otherActionsArray addObject:@(MXKRoomMemberDetailsActionMention)]; } - if (BwiBuildSettings.bwiAllowUserPermalink) + if (BWIBuildSettings.shared.bwiAllowUserPermalink) { [otherActionsArray addObject:@(MXKRoomMemberDetailsActionPermalink)]; } @@ -714,7 +714,7 @@ securityActionsArray = @[@(MXKRoomMemberDetailsActionSecurity)]; } - if ( BwiBuildSettings.bwiUserLabelsAdminSettingsVisible && oneSelfPowerLevel >= RoomPowerLevelAdmin) { + if ( BWIBuildSettings.shared.bwiUserLabelsAdminSettingsVisible && oneSelfPowerLevel >= RoomPowerLevelAdmin) { [bwiUserLabelsArray addObject:@(MXKRoomMemberDetailsActionBwiUserLabelDescription)]; [bwiUserLabelsArray addObject:@(MXKRoomMemberDetailsActionBwiUserLabel)]; } @@ -1194,7 +1194,7 @@ UIButton *button = (UIButton*)sender; - BOOL isUpgradable = BuildSettings.bwiLastAdminCanDowngradeHimself || + BOOL isUpgradable = BWIBuildSettings.shared.bwiLastAdminCanDowngradeHimself || ![self.mxRoomMember.userId isEqualToString:self.mainSession.myUser.userId] || ![self isLastAdmin:self.mainSession.myUser.userId]; switch (button.tag) diff --git a/Riot/Modules/Room/Members/RoomParticipantsViewController.m b/Riot/Modules/Room/Members/RoomParticipantsViewController.m index 8366afa1a..38cf561fc 100644 --- a/Riot/Modules/Room/Members/RoomParticipantsViewController.m +++ b/Riot/Modules/Room/Members/RoomParticipantsViewController.m @@ -542,7 +542,7 @@ { AccountRestrictionService *service = [[AccountRestrictionService alloc] initWithMxSession:room.mxSession]; - self.showInviteUserFab = !(room.isDirect || BwiBuildSettings.allowInviteOnDirectRooms) && !room.isPersonalNotesRoom + self.showInviteUserFab = !(room.isDirect || BWIBuildSettings.shared.allowInviteOnDirectRooms) && !room.isPersonalNotesRoom && ![service isAddressListRestriction]; if (_showInviteUserFab) @@ -782,7 +782,7 @@ // ...and then alphabetically. // We could tiebreak instead by "last recently spoken in this room" if we wanted to. NSComparator comparator = ^NSComparisonResult(Contact *contactA, Contact *contactB) { - if (BwiBuildSettings.bwiUserLabelParticipantSorting == true) { + if (BWIBuildSettings.shared.bwiUserLabelParticipantSorting == true) { return [self bwiParticipantsCompareLeft:contactA right:contactB]; } @@ -1122,13 +1122,13 @@ participantCell.contactDisplayNameLabel.text = [roomState.members memberName:contact.mxMember.userId]; } - if (BwiBuildSettings.bwiUserLabelsParticipantsVisible) { + if (BWIBuildSettings.shared.bwiUserLabelsParticipantsVisible) { contact.bwiUserLabel = [self.bwiUserLabelService getUserLabelWithUser:contact.mxMember.userId]; participantCell.powerLevelLabel.text = contact.bwiUserLabel; } - if (BuildSettings.bwiPersonalState && contact.mxMember.userId) { + if (BWIBuildSettings.shared.bwiPersonalState && contact.mxMember.userId) { MXUser *user = [self.mxRoom.mxSession userWithUserId:contact.mxMember.userId]; participantCell.contactInformationLabel.text = user.statusMsg; participantCell.contactInformationLabel.hidden = user.statusMsg.length <= 0; diff --git a/Riot/Modules/Room/RoomInfo/RoomInfoList/RoomInfoListViewController.swift b/Riot/Modules/Room/RoomInfo/RoomInfoList/RoomInfoListViewController.swift index c283cb773..55c9a42c5 100644 --- a/Riot/Modules/Room/RoomInfo/RoomInfoList/RoomInfoListViewController.swift +++ b/Riot/Modules/Room/RoomInfo/RoomInfoList/RoomInfoListViewController.swift @@ -221,7 +221,7 @@ final class RoomInfoListViewController: UIViewController { var rows = [rowSettings] - if BuildSettings.bwiRollsAndRights && !(viewModel.isPersonalNotesRoom() || viewModel.isDirectRoom()) { + if BWIBuildSettings.shared.bwiRollsAndRights && !(viewModel.isPersonalNotesRoom() || viewModel.isDirectRoom()) { rows.append(rowRollsAndRights) } if BuildSettings.showNotificationsV2 { @@ -233,11 +233,11 @@ final class RoomInfoListViewController: UIViewController { rows.append(rowMembers) rows.append(rowUploads) - if BwiBuildSettings.bwiShowRoomSearch { + if BWIBuildSettings.shared.bwiShowRoomSearch { rows.append(rowSearch) } - if BwiBuildSettings.bwiAllowRoomPermalink { + if BWIBuildSettings.shared.bwiAllowRoomPermalink { rows.append(rowPermalink) } @@ -253,7 +253,7 @@ final class RoomInfoListViewController: UIViewController { VectorL10n.roomParticipantsLeavePromptTitleForDm : VectorL10n.roomParticipantsLeavePromptTitle let rowLeave = Row(type: .destructive, icon: Asset.Images.roomActionLeave.image, text: leaveTitle, accessoryType: .none) { - if BuildSettings.lastAdminIsNotAllowedToLeaveRoom { + if BWIBuildSettings.shared.lastAdminIsNotAllowedToLeaveRoom { self.present(self.getLeaveAlertController(), animated: true, completion: nil) } else { self.present(self.leaveAlertController, animated: true, completion: nil) @@ -521,7 +521,7 @@ extension RoomInfoListViewController { rows.append(rowUploads) - if BuildSettings.bwiPersonalNotesRoomLeavable { + if BWIBuildSettings.shared.bwiPersonalNotesRoomLeavable { let leaveTitle = VectorL10n.roomParticipantsLeavePromptTitle let rowLeave = Row(type: .destructive, icon: Asset.Images.roomActionLeave.image, text: leaveTitle, accessoryType: .none) { self.present(self.leaveAlertController, animated: true, completion: nil) diff --git a/Riot/Modules/Room/RoomInfo/RoomInfoList/Views/RoomInfoBasicView.swift b/Riot/Modules/Room/RoomInfo/RoomInfoList/Views/RoomInfoBasicView.swift index 6e89e14df..ca6c1c85c 100644 --- a/Riot/Modules/Room/RoomInfo/RoomInfoList/Views/RoomInfoBasicView.swift +++ b/Riot/Modules/Room/RoomInfo/RoomInfoList/Views/RoomInfoBasicView.swift @@ -78,7 +78,7 @@ class RoomInfoBasicView: UIView { func configure(withViewData viewData: RoomInfoBasicViewData) { let avatarImage = AvatarGenerator.generateAvatar(forMatrixItem: viewData.roomId, withDisplayName: viewData.roomDisplayName) - if BwiBuildSettings.bwiUseCustomPersonalNotesAvatar { + if BWIBuildSettings.shared.bwiUseCustomPersonalNotesAvatar { if let session = AppDelegate.theDelegate().mxSessions.first as? MXSession { let service = PersonalNotesDefaultService(mxSession: session) if let personalNotesRoomId = service.personalNotesRoomId(), personalNotesRoomId == viewData.roomId { diff --git a/Riot/Modules/Room/RoomViewController.m b/Riot/Modules/Room/RoomViewController.m index b73503b24..f692d37be 100644 --- a/Riot/Modules/Room/RoomViewController.m +++ b/Riot/Modules/Room/RoomViewController.m @@ -337,7 +337,7 @@ static CGSize kThreadListBarButtonItemImageSize; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(eventDidChangeIdentifier:) name:kMXEventDidChangeIdentifierNotification object:nil]; // Show / hide actions button in document preview according BuildSettings - self.allowActionsInDocumentPreview = BuildSettings.messageDetailsAllowShare; + self.allowActionsInDocumentPreview = BWIBuildSettings.shared.messageDetailsAllowShare; _voiceMessageController = [[VoiceMessageController alloc] initWithThemeService:ThemeService.shared mediaServiceProvider:VoiceMessageMediaServiceProvider.sharedProvider]; self.voiceMessageController.delegate = self; @@ -352,7 +352,7 @@ static CGSize kThreadListBarButtonItemImageSize; [self vc_removeBackTitle]; - if (BuildSettings.enableAntivirusScan) + if (BWIBuildSettings.shared.enableAntivirusScan) { // Register antivirus scan cells [self registerContentScannerCells]; @@ -606,7 +606,7 @@ static CGSize kThreadListBarButtonItemImageSize; [VoiceMessageMediaServiceProvider.sharedProvider pauseAllServices]; - if([BwiBuildSettings showMentionsInRoom]) { + if([BWIBuildSettings.shared showMentionsInRoom]) { [Mentions setCountMentionsToZeroWithRoomID:self.roomDataSource.roomId]; } @@ -1764,7 +1764,7 @@ static CGSize kThreadListBarButtonItemImageSize; return NO; } BOOL callOptionAllowed = (self.roomDataSource.room.isDirect && RiotSettings.shared.roomScreenAllowVoIPForDirectRoom) || (!self.roomDataSource.room.isDirect && RiotSettings.shared.roomScreenAllowVoIPForNonDirectRoom); - return callOptionAllowed && BuildSettings.allowVoIPUsage && self.roomDataSource.mxSession.callManager && self.roomDataSource.room.summary.membersCount.joined >= 2; + return callOptionAllowed && BWIBuildSettings.shared.allowVoIPUsage && self.roomDataSource.mxSession.callManager && self.roomDataSource.room.summary.membersCount.joined >= 2; } - (BOOL)isCallActive @@ -1926,7 +1926,7 @@ static CGSize kThreadListBarButtonItemImageSize; // Set user picture in input toolbar // bwi: if the room is a personal notes room a local image is used as room avatar if (userPictureView) { - if (BwiBuildSettings.bwiUseCustomPersonalNotesAvatar + if (BWIBuildSettings.shared.bwiUseCustomPersonalNotesAvatar && [self.roomDataSource.room isPersonalNotesRoom]) { PersonalNotesDefaultService *service = [PersonalNotesDefaultService service:self.mainSession]; @@ -2555,7 +2555,7 @@ static CGSize kThreadListBarButtonItemImageSize; - (ScreenPresentationParameters*)buildUniversalLinkPresentationParameters { - return [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:BuildSettings.allowSplitViewDetailsScreenStacking sender:self sourceView:nil]; + return [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:BWIBuildSettings.shared.allowSplitViewDetailsScreenStacking sender:self sourceView:nil]; } - (BOOL)handleUniversalLinkURL:(NSURL*)url @@ -3019,7 +3019,7 @@ static CGSize kThreadListBarButtonItemImageSize; } // Select the suitable table view cell class, by considering first the empty bubble cell. - if (BuildSettings.enableAntivirusScan && bubbleData.showAntivirusScanStatus) + if (BWIBuildSettings.shared.enableAntivirusScan && bubbleData.showAntivirusScanStatus) { // FRANK181 cellIdentifier = [self contentScannerClassForBubbleCellData:roomBubbleCellData]; @@ -3905,7 +3905,7 @@ static CGSize kThreadListBarButtonItemImageSize; }]]; } - if (!isJitsiCallEvent && BuildSettings.messageDetailsAllowShare && selectedEvent.eventType != MXEventTypePollStart && + if (!isJitsiCallEvent && BWIBuildSettings.shared.messageDetailsAllowShare && selectedEvent.eventType != MXEventTypePollStart && selectedEvent.eventType != MXEventTypeBeaconInfo) { [self.eventMenuBuilder addItemWithType:EventMenuItemTypeShare @@ -3956,7 +3956,7 @@ static CGSize kThreadListBarButtonItemImageSize; }]]; } - if (BuildSettings.messageDetailsAllowSave) + if (BWIBuildSettings.shared.messageDetailsAllowSave) { if (attachment.type == MXKAttachmentTypeImage || attachment.type == MXKAttachmentTypeVideo) { @@ -4031,7 +4031,7 @@ static CGSize kThreadListBarButtonItemImageSize; if (attachment.type != MXKAttachmentTypeSticker) { - if (BuildSettings.messageDetailsAllowShare) + if (BWIBuildSettings.shared.messageDetailsAllowShare) { [self.eventMenuBuilder addItemWithType:EventMenuItemTypeShare action:[UIAlertAction actionWithTitle:[VectorL10n roomEventActionShare] @@ -4101,7 +4101,7 @@ static CGSize kThreadListBarButtonItemImageSize; } } - if (BuildSettings.messageDetailsAllowPermalink) + if (BWIBuildSettings.shared.messageDetailsAllowPermalink) { [self.eventMenuBuilder addItemWithType:EventMenuItemTypePermalink action:[UIAlertAction actionWithTitle:[BWIL10n roomEventActionPermalink] @@ -4131,7 +4131,7 @@ static CGSize kThreadListBarButtonItemImageSize; }]]; } - if (BuildSettings.messageDetailsAllowViewSource) + if (BWIBuildSettings.shared.messageDetailsAllowViewSource) { [self.eventMenuBuilder addItemWithType:EventMenuItemTypeViewSource action:[UIAlertAction actionWithTitle:[VectorL10n roomEventActionViewSource] @@ -5466,7 +5466,7 @@ static CGSize kThreadListBarButtonItemImageSize; } // bwi remove ignored users from typing users - if (BwiBuildSettings.bwiBetterIgnoredUsers) { + if (BWIBuildSettings.shared.bwiBetterIgnoredUsers) { for (NSString* ignoredId in self.mainSession.ignoredUsers) { NSUInteger index = [typingUsers indexOfObject:ignoredId]; if (index != NSNotFound) @@ -6974,7 +6974,7 @@ static CGSize kThreadListBarButtonItemImageSize; BOOL result = !attachment || attachment.type != MXKAttachmentTypeSticker; - if (attachment && !BuildSettings.messageDetailsAllowCopyMedia) + if (attachment && !BWIBuildSettings.shared.messageDetailsAllowCopyMedia) { result = NO; } @@ -7147,7 +7147,7 @@ static CGSize kThreadListBarButtonItemImageSize; return !self.roomDataSource.threadId && !event.threadId && (RiotSettings.shared.enableThreads || self.mainSession.store.supportedMatrixVersions.supportsThreads) - && BwiBuildSettings.bwiShowThreads; + && BWIBuildSettings.shared.bwiShowThreads; } - (void)showThreadsNotice diff --git a/Riot/Modules/Room/Settings/RoomSettingsViewController.m b/Riot/Modules/Room/Settings/RoomSettingsViewController.m index 80c6310c1..cedb5a913 100644 --- a/Riot/Modules/Room/Settings/RoomSettingsViewController.m +++ b/Riot/Modules/Room/Settings/RoomSettingsViewController.m @@ -521,7 +521,7 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti NSMutableArray *tmpSections = [NSMutableArray arrayWithCapacity:SECTION_TAG_BANNED_ADVANCED + 1]; Section *sectionMain = [Section sectionWithTag:SECTION_TAG_MAIN]; - if(!mxRoom.isDirect || BwiBuildSettings.showUnrelatedRoomSettingsForDirectMessages) { + if(!mxRoom.isDirect || BWIBuildSettings.shared.showUnrelatedRoomSettingsForDirectMessages) { [sectionMain addRowWithTag:ROOM_SETTINGS_MAIN_SECTION_ROW_PHOTO]; [sectionMain addRowWithTag:ROOM_SETTINGS_MAIN_SECTION_ROW_NAME]; [sectionMain addRowWithTag:ROOM_SETTINGS_MAIN_SECTION_ROW_TOPIC]; @@ -531,7 +531,7 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti { [sectionMain addRowWithTag:ROOM_SETTINGS_MAIN_SECTION_ROW_DIRECT_CHAT]; } - if (BwiBuildSettings.bwiNotificationTimes) + if (BWIBuildSettings.shared.bwiNotificationTimes) { [sectionMain addRowWithTag:ROOM_SETTINGS_MAIN_SECTION_ROW_REST_TIME]; [sectionMain addRowWithTag:ROOM_SETTINGS_MAIN_SECTION_ROW_REST_TIME_INFO]; @@ -543,7 +543,7 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti [sectionMain addRowWithTag:ROOM_SETTINGS_MAIN_SECTION_ROW_LEAVE]; [tmpSections addObject:sectionMain]; - if (!BuildSettings.roomSettingsScreenRemoveLeave) { + if (!BWIBuildSettings.shared.roomSettingsScreenRemoveLeave) { Section *sectionLeave = [Section sectionWithTag:SECTION_TAG_MAIN]; [sectionLeave addRowWithTag:ROOM_SETTINGS_MAIN_SECTION_ROW_LEAVE]; [tmpSections addObject:sectionLeave]; @@ -587,7 +587,7 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti } } - if ( BuildSettings.roomSettingsScreenShowAccessSettingsBW && !mxRoom.isDirect ){ + if ( BWIBuildSettings.shared.roomSettingsScreenShowAccessSettingsBW && !mxRoom.isDirect ){ [tmpSections addObject:[self sectionForAccessSwitch]]; } @@ -2230,7 +2230,7 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti else { // bwi if the room is a personal notes room use a local image - if (BwiBuildSettings.bwiUseCustomPersonalNotesAvatar && [mxRoom isPersonalNotesRoom] ) { + if (BWIBuildSettings.shared.bwiUseCustomPersonalNotesAvatar && [mxRoom isPersonalNotesRoom] ) { PersonalNotesDefaultService *service = [[PersonalNotesDefaultService alloc] initWithMxSession:self.mainSession]; roomPhotoCell.mxkImageView.image = [UIImage imageNamed:service.avatarImageUrl]; diff --git a/Riot/Modules/Room/VoiceMessages/VoiceMessagePlaybackController.swift b/Riot/Modules/Room/VoiceMessages/VoiceMessagePlaybackController.swift index 34254a73b..eb4f9b1c0 100644 --- a/Riot/Modules/Room/VoiceMessages/VoiceMessagePlaybackController.swift +++ b/Riot/Modules/Room/VoiceMessages/VoiceMessagePlaybackController.swift @@ -71,7 +71,7 @@ class VoiceMessagePlaybackController: VoiceMessageAudioPlayerDelegate, VoiceMess updateTheme() updateUI() - if BwiBuildSettings.bwiResignPlayingVoiceMessageInBackground { + if BWIBuildSettings.shared.bwiResignPlayingVoiceMessageInBackground { NotificationCenter.default.addObserver(self, selector: #selector(appMovedToBackground), name: UIApplication.willResignActiveNotification, object: nil) } diff --git a/Riot/Modules/Rooms/ShowDirectory/PublicRoomsDirectoryViewModel.swift b/Riot/Modules/Rooms/ShowDirectory/PublicRoomsDirectoryViewModel.swift index eee9c5540..a011f67dc 100644 --- a/Riot/Modules/Rooms/ShowDirectory/PublicRoomsDirectoryViewModel.swift +++ b/Riot/Modules/Rooms/ShowDirectory/PublicRoomsDirectoryViewModel.swift @@ -33,8 +33,8 @@ class PublicRoomsDirectoryViewModel { } var directoryServerDisplayname: String? { - if BuildSettings.showCustomServerDisplayName { - return BuildSettings.customServerDisplayName + if BWIBuildSettings.shared.showCustomServerDisplayName { + return BWIBuildSettings.shared.customServerDisplayName } else { return dataSource.directoryServerDisplayname } diff --git a/Riot/Modules/Rooms/ShowDirectory/ShowDirectoryCoordinator.swift b/Riot/Modules/Rooms/ShowDirectory/ShowDirectoryCoordinator.swift index 8937cb7bc..88ce187f3 100644 --- a/Riot/Modules/Rooms/ShowDirectory/ShowDirectoryCoordinator.swift +++ b/Riot/Modules/Rooms/ShowDirectory/ShowDirectoryCoordinator.swift @@ -67,7 +67,7 @@ final class ShowDirectoryCoordinator: ShowDirectoryCoordinatorType { controller.finalizeInit() let dataSource: MXKDirectoryServersDataSource = MXKDirectoryServersDataSource(matrixSession: session) dataSource.finalizeInitialization() - dataSource.roomDirectoryServers = BuildSettings.publicRoomsDirectoryServers + dataSource.roomDirectoryServers = BWIBuildSettings.shared.publicRoomsDirectoryServers controller.display(with: dataSource) { [weak self] (cellData) in guard let self = self else { return } diff --git a/Riot/Modules/Secrets/Recover/RecoverWithPassphrase/SecretsRecoveryWithPassphraseViewController.swift b/Riot/Modules/Secrets/Recover/RecoverWithPassphrase/SecretsRecoveryWithPassphraseViewController.swift index 317b26f46..462462291 100644 --- a/Riot/Modules/Secrets/Recover/RecoverWithPassphrase/SecretsRecoveryWithPassphraseViewController.swift +++ b/Riot/Modules/Secrets/Recover/RecoverWithPassphrase/SecretsRecoveryWithPassphraseViewController.swift @@ -166,7 +166,7 @@ final class SecretsRecoveryWithPassphraseViewController: UIViewController { useRecoveryKeyAttributedString.append(unknownRecoveryKeyAttributedStringPart2) useRecoveryKeyAttributedString.append(unknownRecoveryKeyAttributedStringPart3) - if BuildSettings.showRecoverWithKey == true { + if BWIBuildSettings.shared.showRecoverWithKey == true { self.useRecoveryKeyButton.setAttributedTitle(useRecoveryKeyAttributedString, for: .normal) } else { self.useRecoveryKeyButton?.visiblity(gone: true, dimension: 0.0) diff --git a/Riot/Modules/Secrets/Setup/RecoveryKey/SecretsSetupRecoveryKeyViewController.swift b/Riot/Modules/Secrets/Setup/RecoveryKey/SecretsSetupRecoveryKeyViewController.swift index fb542879d..aa64d4e39 100644 --- a/Riot/Modules/Secrets/Setup/RecoveryKey/SecretsSetupRecoveryKeyViewController.swift +++ b/Riot/Modules/Secrets/Setup/RecoveryKey/SecretsSetupRecoveryKeyViewController.swift @@ -142,7 +142,7 @@ final class SecretsSetupRecoveryKeyViewController: UIViewController { self.renderLoaded(passphraseOnly: passphraseOnly) case .recoveryCreated(let recoveryKey): self.renderRecoveryCreated(recoveryKey: recoveryKey) - if BuildSettings.skipKeyBackupStep { + if BWIBuildSettings.shared.skipKeyBackupStep { self.viewModel.process(viewAction: .done) } case .error(let error): diff --git a/Riot/Modules/SecureBackup/Setup/Intro/SecureBackupSetupIntroViewController.swift b/Riot/Modules/SecureBackup/Setup/Intro/SecureBackupSetupIntroViewController.swift index a897a1628..91139a6c5 100644 --- a/Riot/Modules/SecureBackup/Setup/Intro/SecureBackupSetupIntroViewController.swift +++ b/Riot/Modules/SecureBackup/Setup/Intro/SecureBackupSetupIntroViewController.swift @@ -204,7 +204,7 @@ final class SecureBackupSetupIntroViewController: UIViewController { if keyBackup.keyBackupVersion != nil && keyBackup.hasPrivateKeyInCryptoStore == false { // don't show dialog if forced, already asked before in mandatory verification recover - if BuildSettings.forceResetBackupIfLost { + if BWIBuildSettings.shared.forceResetBackupIfLost { let alertController = UIAlertController(title: VectorL10n.secureKeyBackupSetupExistingBackupErrorTitle, message: VectorL10n.secureKeyBackupSetupExistingBackupErrorInfo, preferredStyle: .alert) diff --git a/Riot/Modules/SetPinCode/EnterPinCode/EnterPinCodeViewController.swift b/Riot/Modules/SetPinCode/EnterPinCode/EnterPinCodeViewController.swift index 6b3a78796..f11e92e6e 100644 --- a/Riot/Modules/SetPinCode/EnterPinCode/EnterPinCodeViewController.swift +++ b/Riot/Modules/SetPinCode/EnterPinCode/EnterPinCodeViewController.swift @@ -184,7 +184,7 @@ final class EnterPinCodeViewController: UIViewController { } // show BuM Logo instead of Element logo - if BwiBuildSettings.bwiEnableBuMUI { + if BWIBuildSettings.shared.bwiEnableBuMUI { logoImageView.image = Asset.Images.launchScreenLogo.image } } diff --git a/Riot/Modules/SetPinCode/PinCodePreferences.swift b/Riot/Modules/SetPinCode/PinCodePreferences.swift index 6a8558c84..1800cf0fb 100644 --- a/Riot/Modules/SetPinCode/PinCodePreferences.swift +++ b/Riot/Modules/SetPinCode/PinCodePreferences.swift @@ -95,12 +95,12 @@ final class PinCodePreferences: NSObject { /// Setting to force protection by pin code var forcePinProtection: Bool { - return BwiBuildSettings.forcedPinProtection + return BWIBuildSettings.shared.forcePinProtection } /// Not allowed pin codes. User won't be able to select one of the pin in the list. var notAllowedPINs: [String] { - return BuildSettings.notAllowedPINs + return BWIBuildSettings.shared.notAllowedPINs } /// Maximum number of allowed pin failures when unlocking, before force logging out the user @@ -136,7 +136,7 @@ final class PinCodePreferences: NSObject { /// Max allowed time to continue using the app without prompting PIN var graceTimeInSeconds: TimeInterval { - return BuildSettings.pinCodeGraceTimeInSeconds + return BWIBuildSettings.shared.pinCodeGraceTimeInSeconds } /// Number of digits for the PIN diff --git a/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m b/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m index cb43c261e..353eeb238 100644 --- a/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m +++ b/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m @@ -386,7 +386,7 @@ enum { cell.imageView.image = AssetImages.encryptionWarning.image; } - if (BuildSettings.bwiDisableSecuritySettingsUntrustedDevices && !deviceInfo.trustLevel.isVerified) { + if (BWIBuildSettings.shared.bwiDisableSecuritySettingsUntrustedDevices && !deviceInfo.trustLevel.isVerified) { cell.accessoryType = UITableViewCellAccessoryNone; } else { [cell vc_setAccessoryDisclosureIndicatorWithCurrentTheme]; @@ -552,7 +552,7 @@ enum { } - (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath { - if (BuildSettings.bwiDisableSecuritySettingsUntrustedDevices) { + if (BWIBuildSettings.shared.bwiDisableSecuritySettingsUntrustedDevices) { if (indexPath.section == SECTION_SESSION_INFO && indexPath.row == SESSION_INFO_TRUST) { NSString *deviceId = device.deviceId; MXDeviceInfo *deviceInfo = [self.mainSession.crypto deviceWithDeviceId:deviceId ofUser:self.mainSession.myUser.userId]; diff --git a/Riot/Modules/Settings/Security/SecurityViewController.m b/Riot/Modules/Settings/Security/SecurityViewController.m index 529c6b36f..555fb2bc7 100644 --- a/Riot/Modules/Settings/Security/SecurityViewController.m +++ b/Riot/Modules/Settings/Security/SecurityViewController.m @@ -348,7 +348,7 @@ TableViewSectionsDelegate> } else { - if (BwiBuildSettings.bwiShowSessionSettingsFooter) { + if (BWIBuildSettings.shared.bwiShowSessionSettingsFooter) { sessionsSection.footerTitle = VectorL10n.securitySettingsCryptoSessionsDescription2; } [sessionsSection addRowsWithCount:devicesArray.count]; @@ -372,7 +372,7 @@ TableViewSectionsDelegate> // Cross-Signing - if (!BuildSettings.disableSelfUserVerification) { + if (!BWIBuildSettings.shared.disableSelfUserVerification) { Section *crossSigningSection = [Section sectionWithTag:SECTION_CROSSSIGNING]; crossSigningSection.headerTitle = [VectorL10n securitySettingsCrosssigning]; diff --git a/Riot/Modules/Settings/SettingsViewController.m b/Riot/Modules/Settings/SettingsViewController.m index d98f9b571..2fc1a5d74 100644 --- a/Riot/Modules/Settings/SettingsViewController.m +++ b/Riot/Modules/Settings/SettingsViewController.m @@ -406,7 +406,7 @@ ChangePasswordCoordinatorBridgePresenterDelegate> [tmpSections addObject:sectionDowntime]; } - if (BwiBuildSettings.bwiCheckAppVersion && [[[ValidAppVersionsDefaultService alloc] init] isCurrentAppVersionOutdated]) { + if (BWIBuildSettings.shared.bwiCheckAppVersion && [[[ValidAppVersionsDefaultService alloc] init] isCurrentAppVersionOutdated]) { Section *sectionOutdated = [Section sectionWithTag:SECTION_TAG_OUTDATED_WARNING]; [sectionOutdated addRowWithTag:OUTDATED_WARNING]; sectionOutdated.headerTitle = [BWIL10n bwiOutdatedSettingsHeader]; @@ -416,7 +416,7 @@ ChangePasswordCoordinatorBridgePresenterDelegate> Section *sectionUserSettings = [Section sectionWithTag:SECTION_TAG_USER_SETTINGS]; [sectionUserSettings addRowWithTag:USER_SETTINGS_PROFILE_PICTURE_INDEX]; [sectionUserSettings addRowWithTag:USER_SETTINGS_DISPLAYNAME_INDEX]; - if (BwiBuildSettings.bwiEnablePersonalState) { + if (BWIBuildSettings.shared.bwiEnablePersonalState) { [sectionUserSettings addRowWithTag:USER_SETTINGS_PERSONAL_STATE_INDEX]; } if (RiotSettings.shared.settingsScreenShowChangePassword) @@ -433,7 +433,7 @@ ChangePasswordCoordinatorBridgePresenterDelegate> } MXKAccount* account = [MXKAccountManager sharedManager].activeAccounts.firstObject; // add linked emails - if (BuildSettings.settingsScreenAllowAddingLinkedEmails) + if (BWIBuildSettings.shared.settingsScreenAllowAddingLinkedEmails) { for (NSInteger index = 0; index < account.linkedEmails.count; index++) { @@ -441,22 +441,22 @@ ChangePasswordCoordinatorBridgePresenterDelegate> } } // add linked phone numbers - if (BuildSettings.settingsScreenAllowAddingPhoneNumbers) + if (BWIBuildSettings.shared.settingsScreenAllowAddingPhoneNumbers) { for (NSInteger index = 0; index < account.linkedPhoneNumbers.count; index++) { [sectionUserSettings addRowWithTag: USER_SETTINGS_PHONENUMBERS_OFFSET + index]; } } - if (BuildSettings.settingsScreenAllowAddingEmailThreepids) + if (BWIBuildSettings.shared.settingsScreenAllowAddingEmailThreepids) { [sectionUserSettings addRowWithTag:USER_SETTINGS_ADD_EMAIL_INDEX]; } - if (BuildSettings.settingsScreenAllowAddingPhoneThreepids) + if (BWIBuildSettings.shared.settingsScreenAllowAddingPhoneThreepids) { [sectionUserSettings addRowWithTag:USER_SETTINGS_ADD_PHONENUMBER_INDEX]; } - if (BuildSettings.settingsScreenShowThreepidExplanatory) + if (BWIBuildSettings.shared.settingsScreenShowThreepidExplanatory) { NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:[VectorL10n settingsThreePidsManagementInformationPart1] attributes:@{}]; [attributedString appendAttributedString:[[NSAttributedString alloc] initWithString:[VectorL10n settingsThreePidsManagementInformationPart2] attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.tintColor}]]; @@ -467,7 +467,7 @@ ChangePasswordCoordinatorBridgePresenterDelegate> sectionUserSettings.headerTitle = [VectorL10n settingsUserSettings]; [tmpSections addObject:sectionUserSettings]; - if (BuildSettings.bwiShowNewFeatures) + if (BWIBuildSettings.shared.bwiShowNewFeatures) { Section *sectionNewFeatures = [Section sectionWithTag:SECTION_TAG_NEW_FEATURES]; [sectionNewFeatures addRowWithTag:SHOW_NEW_FEATURES]; @@ -475,7 +475,7 @@ ChangePasswordCoordinatorBridgePresenterDelegate> [tmpSections addObject:sectionNewFeatures]; } - if (BuildSettings.settingsScreenShowConfirmMediaSize) + if (BWIBuildSettings.shared.settingsScreenShowConfirmMediaSize) { Section *sectionMedia = [Section sectionWithTag:SECTION_TAG_SENDING_MEDIA]; [sectionMedia addRowWithTag:SENDING_MEDIA_CONFIRM_SIZE]; @@ -484,7 +484,7 @@ ChangePasswordCoordinatorBridgePresenterDelegate> [tmpSections addObject:sectionMedia]; } - if (BuildSettings.settingsScreenShowLinkPreviews) + if (BWIBuildSettings.shared.settingsScreenShowLinkPreviews) { Section *sectionLinks = [Section sectionWithTag:SECTION_TAG_LINKS]; [sectionLinks addRowWithTag:LINKS_SHOW_URL_PREVIEWS_INDEX]; @@ -511,7 +511,7 @@ ChangePasswordCoordinatorBridgePresenterDelegate> if (RiotSettings.shared.settingsScreenShowSystemSettingsOption) { [sectionNotificationSettings addRowWithTag:NOTIFICATION_SETTINGS_SYSTEM_SETTINGS]; } - if (BwiBuildSettings.bwiSettingsShowInAppNotifications) { + if (BWIBuildSettings.shared.bwiSettingsShowInAppNotifications) { [sectionNotificationSettings addRowWithTag:NOTIFICATION_SETTINGS_SHOW_IN_APP_INDEX]; } if (RiotSettings.shared.settingsScreenShowNotificationDecodedContentOption) @@ -519,7 +519,7 @@ ChangePasswordCoordinatorBridgePresenterDelegate> [sectionNotificationSettings addRowWithTag:NOTIFICATION_SETTINGS_SHOW_DECODED_CONTENT]; } - if (BwiBuildSettings.bwiShowPinnedNotificationSettings) { + if (BWIBuildSettings.shared.bwiShowPinnedNotificationSettings) { [sectionNotificationSettings addRowWithTag:NOTIFICATION_SETTINGS_PIN_MISSED_NOTIFICATIONS_INDEX]; [sectionNotificationSettings addRowWithTag:NOTIFICATION_SETTINGS_PIN_UNREAD_INDEX]; } @@ -530,7 +530,7 @@ ChangePasswordCoordinatorBridgePresenterDelegate> if (RiotSettings.shared.settingsNotificationsShowMentions) { [sectionNotificationSettings addRowWithTag:NOTIFICATION_SETTINGS_MENTION_AND_KEYWORDS_SETTINGS_INDEX]; } - if (BwiBuildSettings.bwiNotificationTimes) { + if (BWIBuildSettings.shared.bwiNotificationTimes) { [sectionNotificationSettings addRowWithTag:NOTIFICATION_SETTINGS_NOTIFICATION_TIMES_INDEX]; } if (RiotSettings.shared.settingsNotificationsShowAdvanced) { @@ -540,20 +540,20 @@ ChangePasswordCoordinatorBridgePresenterDelegate> sectionNotificationSettings.headerTitle = [VectorL10n settingsNotifications]; [tmpSections addObject:sectionNotificationSettings]; - if (BuildSettings.allowVoIPUsage && BuildSettings.stunServerFallbackUrlString && RiotSettings.shared.settingsScreenShowEnableStunServerFallback) + if (BWIBuildSettings.shared.allowVoIPUsage && BWIBuildSettings.shared.stunServerFallbackUrlString && RiotSettings.shared.settingsScreenShowEnableStunServerFallback) { Section *sectionCalls = [Section sectionWithTag:SECTION_TAG_CALLS]; sectionCalls.headerTitle = [VectorL10n settingsCallsSettings]; // Remove "stun:" - NSString* stunFallbackHost = [BuildSettings.stunServerFallbackUrlString componentsSeparatedByString:@":"].lastObject; + NSString* stunFallbackHost = [BWIBuildSettings.shared.stunServerFallbackUrlString componentsSeparatedByString:@":"].lastObject; sectionCalls.footerTitle = [VectorL10n settingsCallsStunServerFallbackDescription:stunFallbackHost]; [sectionCalls addRowWithTag:CALLS_ENABLE_STUN_SERVER_FALLBACK_INDEX]; [tmpSections addObject:sectionCalls]; } - if (BuildSettings.settingsScreenShowDiscoverySettings) + if (BWIBuildSettings.shared.settingsScreenShowDiscoverySettings) { Section *sectionDiscovery = [Section sectionWithTag:SECTION_TAG_DISCOVERY]; NSInteger count = self.settingsDiscoveryTableViewSection.numberOfRows; @@ -566,7 +566,7 @@ ChangePasswordCoordinatorBridgePresenterDelegate> [tmpSections addObject:sectionDiscovery]; } - if (BuildSettings.settingsScreenAllowIdentityServerConfig) + if (BWIBuildSettings.shared.settingsScreenAllowIdentityServerConfig) { Section *sectionIdentityServer = [Section sectionWithTag:SECTION_TAG_IDENTITY_SERVER]; [sectionIdentityServer addRowWithTag:IDENTITY_SERVER_INDEX]; @@ -576,7 +576,7 @@ ChangePasswordCoordinatorBridgePresenterDelegate> [tmpSections addObject:sectionIdentityServer]; } - if (BuildSettings.allowLocalContactsAccess) + if (BWIBuildSettings.shared.allowLocalContactsAccess) { Section *sectionLocalContacts = [Section sectionWithTag:SECTION_TAG_LOCAL_CONTACTS]; [sectionLocalContacts addRowWithTag:LOCAL_CONTACTS_SYNC_INDEX]; @@ -596,7 +596,7 @@ ChangePasswordCoordinatorBridgePresenterDelegate> { Section *sectionIgnoredUsers = [Section sectionWithTag:SECTION_TAG_IGNORED_USERS]; - if (BwiBuildSettings.bwiBetterIgnoredUsers) { + if (BWIBuildSettings.shared.bwiBetterIgnoredUsers) { [sectionIgnoredUsers addRowWithTag:IGNORED_USERS_INDEX]; } else { for (NSInteger index = 0; index < session.ignoredUsers.count; index++) @@ -629,11 +629,11 @@ ChangePasswordCoordinatorBridgePresenterDelegate> sectionUserInterface = [self updateTimeLine:sectionUserInterface]; [tmpSections addObject: sectionUserInterface]; - if (BuildSettings.bwiPersonalNotesRoom) { + if (BWIBuildSettings.shared.bwiPersonalNotesRoom) { [sectionUserInterface addRowWithTag:USER_INTERFACE_PERSONAL_NOTES]; } - if (BuildSettings.bwiShowTimelineSettings) { + if (BWIBuildSettings.shared.bwiShowTimelineSettings) { Section *sectionTimeline = [Section sectionWithTag:SECTION_TAG_TIMELINE]; sectionTimeline.headerTitle = VectorL10n.settingsTimeline; @@ -660,7 +660,7 @@ ChangePasswordCoordinatorBridgePresenterDelegate> Section *sectionAdvanced = [Section sectionWithTag:SECTION_TAG_ADVANCED]; sectionAdvanced.headerTitle = [VectorL10n settingsAdvanced]; - if (BuildSettings.settingsScreenShowAdvancedSettings) + if (BWIBuildSettings.shared.settingsScreenShowAdvancedSettings) { Section *sectionAdvanced = [Section sectionWithTag:SECTION_TAG_ADVANCED]; sectionAdvanced.headerTitle = [VectorL10n settingsAdvanced]; @@ -670,17 +670,17 @@ ChangePasswordCoordinatorBridgePresenterDelegate> [sectionAdvanced addRowWithTag:ADVANCED_SHOW_NSFW_ROOMS_INDEX]; } - if (BuildSettings.settingsScreenAllowChangingCrashUsageDataSettings) + if (BWIBuildSettings.shared.settingsScreenAllowChangingCrashUsageDataSettings) { [sectionAdvanced addRowWithTag:ADVANCED_CRASH_REPORT_INDEX]; } - if (BuildSettings.settingsScreenAllowChangingRageshakeSettings) + if (BWIBuildSettings.shared.settingsScreenAllowChangingRageshakeSettings) { [sectionAdvanced addRowWithTag:ADVANCED_ENABLE_RAGESHAKE_INDEX]; } [sectionAdvanced addRowWithTag:ADVANCED_MARK_ALL_AS_READ_INDEX]; [sectionAdvanced addRowWithTag:ADVANCED_CLEAR_CACHE_INDEX]; - if (BuildSettings.settingsScreenAllowBugReportingManually) + if (BWIBuildSettings.shared.settingsScreenAllowBugReportingManually) { [sectionAdvanced addRowWithTag:ADVANCED_REPORT_BUG_INDEX]; } @@ -693,12 +693,12 @@ ChangePasswordCoordinatorBridgePresenterDelegate> [sectionAbout addRowWithTag:ABOUT_OLM_VERSION_INDEX]; // bwi 2098 - show element base version - if ([BuildSettings showElementBaseVersion]) + if ([BWIBuildSettings.shared showElementBaseVersion]) { [sectionAbout addRowWithTag:ABOUT_ELEMENT_VERSION_INDEX]; } - if (BuildSettings.settingsScreenShowSupportSetting) + if (BWIBuildSettings.shared.settingsScreenShowSupportSetting) { [sectionAbout addRowWithTag:ABOUT_SUPPORT_INDEX]; } @@ -714,7 +714,7 @@ ChangePasswordCoordinatorBridgePresenterDelegate> { [sectionAbout addRowWithTag:ABOUT_TERM_CONDITIONS_INDEX]; } - if (BuildSettings.applicationPrivacyPolicyUrlString.length) + if (BWIBuildSettings.shared.applicationPrivacyPolicyUrlString.length) { [sectionAbout addRowWithTag:ABOUT_PRIVACY_INDEX]; } @@ -724,21 +724,21 @@ ChangePasswordCoordinatorBridgePresenterDelegate> [sectionAbout addRowWithTag:ABOUT_MARK_ALL_AS_READ_INDEX]; [sectionAbout addRowWithTag:ABOUT_CLEAR_CACHE_INDEX]; - if (BuildSettings.bwiShowDeveloperSettings) { + if (BWIBuildSettings.shared.bwiShowDeveloperSettings) { Section *sectionDeveloper = [Section sectionWithTag:SECTION_TAG_DEVELOPER]; [sectionDeveloper addRowWithTag:DEVELOPER_SHOW_SETTINGS_INDEX]; sectionDeveloper.headerTitle = BWIL10n.bwiSettingsDeveloper; [tmpSections addObject:sectionDeveloper]; } - if (BuildSettings.settingsScreenShowAdvancedSettings) + if (BWIBuildSettings.shared.settingsScreenShowAdvancedSettings) { sectionAbout.footerTitle = [self buildAboutSectionFooterTitleWithAccount:account]; } [tmpSections addObject:sectionAbout]; - if (BuildSettings.settingsScreenShowLabSettings) + if (BWIBuildSettings.shared.settingsScreenShowLabSettings) { Section *sectionLabs = [Section sectionWithTag:SECTION_TAG_LABS]; [sectionLabs addRowWithTag:LABS_ENABLE_RINGING_FOR_GROUP_CALLS_INDEX]; @@ -757,7 +757,7 @@ ChangePasswordCoordinatorBridgePresenterDelegate> } } - if (BuildSettings.settingsScreenAllowDeactivatingAccount) + if (BWIBuildSettings.shared.settingsScreenAllowDeactivatingAccount) { Section *sectionDeactivate = [Section sectionWithTag:SECTION_TAG_DEACTIVATE_ACCOUNT]; [sectionDeactivate addRowWithTag:0]; @@ -2513,7 +2513,7 @@ ChangePasswordCoordinatorBridgePresenterDelegate> else if (section == SECTION_TAG_IGNORED_USERS) { MXKTableViewCell *ignoredUserCell = [self getDefaultTableViewCell:tableView]; - if (BwiBuildSettings.bwiBetterIgnoredUsers) { + if (BWIBuildSettings.shared.bwiBetterIgnoredUsers) { ignoredUserCell.textLabel.text = BWIL10n.bwiSettingsIgnoredUsersText; } else { ignoredUserCell.textLabel.text = session.ignoredUsers[row]; @@ -2606,7 +2606,7 @@ ChangePasswordCoordinatorBridgePresenterDelegate> { MXKTableViewCell *versionCell = [self getDefaultTableViewCell:tableView]; - versionCell.textLabel.text = [BWIL10n settingsElementVersion:[BuildSettings elementBaseVersion]]; + versionCell.textLabel.text = [BWIL10n settingsElementVersion:[BWIBuildSettings.shared elementBaseVersion]]; versionCell.selectionStyle = UITableViewCellSelectionStyleNone; @@ -3150,7 +3150,7 @@ ChangePasswordCoordinatorBridgePresenterDelegate> } else if (section == SECTION_TAG_IGNORED_USERS) { - if (BwiBuildSettings.bwiBetterIgnoredUsers) { + if (BWIBuildSettings.shared.bwiBetterIgnoredUsers) { [self bwiShowIgnoredUsersScreen]; } else { MXSession* session = self.mainSession; @@ -3218,7 +3218,7 @@ ChangePasswordCoordinatorBridgePresenterDelegate> { if (row == ABOUT_COPYRIGHT_INDEX) { - WebViewViewController *webViewViewController = [[WebViewViewController alloc] initWithURL:BuildSettings.applicationCopyrightUrlString]; + WebViewViewController *webViewViewController = [[WebViewViewController alloc] initWithURL:BWIBuildSettings.shared.applicationCopyrightUrlString]; webViewViewController.title = [BWIL10n settingsCopyright]; @@ -3244,7 +3244,7 @@ ChangePasswordCoordinatorBridgePresenterDelegate> } else if (row == ABOUT_PRIVACY_INDEX) { - WebViewViewController *webViewViewController = [[WebViewViewController alloc] initWithURL:BuildSettings.applicationPrivacyPolicyUrlString]; + WebViewViewController *webViewViewController = [[WebViewViewController alloc] initWithURL:BWIBuildSettings.shared.applicationPrivacyPolicyUrlString]; webViewViewController.title = [VectorL10n settingsPrivacyPolicy]; @@ -3603,7 +3603,7 @@ ChangePasswordCoordinatorBridgePresenterDelegate> { RiotSettings.shared.allowStunServerFallback = sender.isOn; - self.mainSession.callManager.fallbackSTUNServer = RiotSettings.shared.allowStunServerFallback ? BuildSettings.stunServerFallbackUrlString : nil; + self.mainSession.callManager.fallbackSTUNServer = RiotSettings.shared.allowStunServerFallback ? BWIBuildSettings.shared.stunServerFallbackUrlString : nil; } - (void)toggleAllowIntegrations:(UISwitch *)sender @@ -5020,7 +5020,7 @@ ChangePasswordCoordinatorBridgePresenterDelegate> if (RiotSettings.shared.settingsScreenShowSimpleTimeLineOptions) { [timelineSection addRowWithTag:TIMELINE_SIMPLE_INDEX]; } else { - if (BuildSettings.bwiShowMessageBubbles) + if (BWIBuildSettings.shared.bwiShowMessageBubbles) { [timelineSection addRowWithTag:USER_INTERFACE_TIMELINE_STYLE_INDEX]; } diff --git a/Riot/Modules/SideMenu/SideMenuViewModel.swift b/Riot/Modules/SideMenu/SideMenuViewModel.swift index 991e42e0c..2d781034b 100644 --- a/Riot/Modules/SideMenu/SideMenuViewModel.swift +++ b/Riot/Modules/SideMenu/SideMenuViewModel.swift @@ -114,7 +114,7 @@ final class SideMenuViewModel: SideMenuViewModelType { if RiotSettings.shared.settingsScreenShowFeedback { sideMenuItems.append(.feedback) } - if BuildSettings.sideMenuShowInviteFriends { + if BWIBuildSettings.shared.sideMenuShowInviteFriends { sideMenuItems += [.inviteFriends] } diff --git a/Riot/Modules/StartChat/StartChatViewController.m b/Riot/Modules/StartChat/StartChatViewController.m index 35a412ea2..3ebde8a3f 100644 --- a/Riot/Modules/StartChat/StartChatViewController.m +++ b/Riot/Modules/StartChat/StartChatViewController.m @@ -146,7 +146,7 @@ - (void)showInviteFriendsHeaderView:(BOOL)show { - if (!BuildSettings.directChatShowInviteFriends) + if (!BWIBuildSettings.shared.directChatShowInviteFriends) { show = NO; } diff --git a/Riot/Modules/TabBar/MasterTabBarController.m b/Riot/Modules/TabBar/MasterTabBarController.m index 7b6d8d836..f19aaedb0 100644 --- a/Riot/Modules/TabBar/MasterTabBarController.m +++ b/Riot/Modules/TabBar/MasterTabBarController.m @@ -116,7 +116,7 @@ }]; // replace link - if (BwiBuildSettings.bwiReplaceFeatureLink) { + if (BWIBuildSettings.shared.bwiReplaceFeatureLink) { [[[BwiNewFeatureHelper alloc] init] replaceFeatureHistoryLink]; } } @@ -235,7 +235,7 @@ } } - if (BwiBuildSettings.bwiClearMediaCacheOnRoomExit) { + if (BWIBuildSettings.shared.bwiClearMediaCacheOnRoomExit) { [MXMediaManager clearCache]; } } @@ -1095,13 +1095,13 @@ - (void) bwiCheckForPersonalNotesRoom { PersonalNotesDefaultService *service = [PersonalNotesDefaultService service:self.mxSessions.firstObject]; - if (BuildSettings.bwiResetPersonalNotesAccountData) { + if (BWIBuildSettings.shared.bwiResetPersonalNotesAccountData) { [service resetPersonalNotesRoom]; } - if (BuildSettings.bwiPersonalNotesRoom) { + if (BWIBuildSettings.shared.bwiPersonalNotesRoom) { [service createPersonalNotesRoomIfNeeded]; } - if (BwiBuildSettings.bwiUseCustomPersonalNotesAvatar) { + if (BWIBuildSettings.shared.bwiUseCustomPersonalNotesAvatar) { MXSession *mainSession = mxSessionArray.firstObject; if (mainSession) { @@ -1128,7 +1128,7 @@ preferredStyle:UIAlertControllerStyleAlert]; [alert addAction:[UIAlertAction actionWithTitle:BWIL10n.bwiAnalyticsAlertInfoButton style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { - WebViewViewController *webViewViewController = [[WebViewViewController alloc] initWithURL:BuildSettings.applicationPrivacyPolicyUrlString]; + WebViewViewController *webViewViewController = [[WebViewViewController alloc] initWithURL:BWIBuildSettings.shared.applicationPrivacyPolicyUrlString]; webViewViewController.title = [VectorL10n settingsPrivacyPolicy]; [self.navigationController pushViewController:webViewViewController animated:YES]; }]]; diff --git a/Riot/Modules/TabBar/TabBarCoordinator.swift b/Riot/Modules/TabBar/TabBarCoordinator.swift index bcfe28941..1e6a04995 100644 --- a/Riot/Modules/TabBar/TabBarCoordinator.swift +++ b/Riot/Modules/TabBar/TabBarCoordinator.swift @@ -117,7 +117,7 @@ final class TabBarCoordinator: NSObject, SplitViewMasterCoordinatorProtocol { self.addMatrixSessionToMasterTabBarController(userSession.matrixSession) } - if BuildSettings.enableSideMenu { + if BWIBuildSettings.shared.enableSideMenu { self.setupSideMenuGestures() } @@ -206,7 +206,7 @@ final class TabBarCoordinator: NSObject, SplitViewMasterCoordinatorProtocol { func pinUnlocked() { let serverDownTime = ServerDowntimeDefaultService() - if BwiBuildSettings.useTestDataForDowntime { + if BWIBuildSettings.shared.useTestDataForDowntime { serverDownTime.fetchDowntimes { self.createSettingsButton(self.masterTabBarController) } @@ -749,7 +749,7 @@ final class TabBarCoordinator: NSObject, SplitViewMasterCoordinatorProtocol { return } - guard BuildSettings.enableSideMenu else { + guard BWIBuildSettings.shared.enableSideMenu else { let settingsBarButtonItem: MXKBarButtonItem = MXKBarButtonItem(image: Asset.Images.settingsIcon.image, style: .plain) { [weak self] in self?.showSettings() } @@ -787,7 +787,7 @@ final class TabBarCoordinator: NSObject, SplitViewMasterCoordinatorProtocol { }) var subMenuActions: [UIAction] = [] - if BuildSettings.sideMenuShowInviteFriends { + if BWIBuildSettings.shared.sideMenuShowInviteFriends { subMenuActions.append(UIAction(title: VectorL10n.inviteTo(AppInfo.current.displayName), image: UIImage(systemName: "envelope")) { [weak self] action in self?.showInviteFriends(from: nil) }) @@ -960,7 +960,7 @@ final class TabBarCoordinator: NSObject, SplitViewMasterCoordinatorProtocol { let serverDownTime = ServerDowntimeDefaultService() if serverDownTime.isDowntimePresentable() { settingsBarButtonItem = ServerDowntimeBadge().createBadgeBarButton(color: serverDownTime.downtimeColor(), target: self, selector: #selector(showSettings)) - } else if BwiBuildSettings.bwiCheckAppVersion && ValidAppVersionsDefaultService().isCurrentAppVersionOutdated() { + } else if BWIBuildSettings.shared.bwiCheckAppVersion && ValidAppVersionsDefaultService().isCurrentAppVersionOutdated() { settingsBarButtonItem = ServerDowntimeBadge().createBadgeBarButton(color: .yellow, target: self, selector: #selector(showSettings)) } else { settingsBarButtonItem = MXKBarButtonItem(image: Asset.Images.settingsIcon.image, style: .plain) { [weak self] in @@ -997,7 +997,7 @@ extension TabBarCoordinator: MasterTabBarControllerDelegate { } func masterTabBarController(_ masterTabBarController: MasterTabBarController!, needsSideMenuIconWithNotification displayNotification: Bool) { - guard BuildSettings.enableSideMenu else { + guard BWIBuildSettings.shared.enableSideMenu else { return } diff --git a/Riot/Utils/EventFormatter.m b/Riot/Utils/EventFormatter.m index 64da8950b..4313d0e30 100644 --- a/Riot/Utils/EventFormatter.m +++ b/Riot/Utils/EventFormatter.m @@ -276,7 +276,7 @@ static NSString *const kEventFormatterTimeFormat = @"HH:mm"; return [self renderString:displayText forEvent:event]; } } else if (event.eventType == MXEventTypeCustom) { - if (BwiBuildSettings.bwiUserLabelsTimelineEventVisible && [event.type isEqualToString:BwiBuildSettings.bwiUserLabelEventTypeString]) { + if (BWIBuildSettings.shared.bwiUserLabelsTimelineEventVisible && [event.type isEqualToString:BWIBuildSettings.shared.bwiUserLabelEventTypeString]) { return [self bwiRenderUserLabel:event]; } } @@ -706,7 +706,7 @@ static NSString *const kEventFormatterTimeFormat = @"HH:mm"; { NSString* displayName = [super senderDisplayNameForEvent:event withRoomState:roomState]; - if (BwiBuildSettings.bwiUserLabelsTimelineDisplayNameVisible) { + if (BWIBuildSettings.shared.bwiUserLabelsTimelineDisplayNameVisible) { [self.bwiUserLabelService setRoom:[mxSession vc_roomWithIdOrAlias:event.roomId]]; NSString* function = [self.bwiUserLabelService getUserLabelWithUser:event.sender]; diff --git a/Riot/Utils/MediaCompressionHelper.swift b/Riot/Utils/MediaCompressionHelper.swift index c25bfb275..989459423 100644 --- a/Riot/Utils/MediaCompressionHelper.swift +++ b/Riot/Utils/MediaCompressionHelper.swift @@ -22,11 +22,11 @@ class MediaCompressionHelper: NSObject { /// and the `showMediaCompressionPrompt` Riot setting. @objc static var defaultCompressionMode: MXKRoomInputToolbarCompressionMode { // When the compression mode build setting hasn't been customised, use the media compression prompt setting to determine what to do. - if BuildSettings.roomInputToolbarCompressionMode == .prompt { + if BWIBuildSettings.shared.roomInputToolbarCompressionMode == .prompt { return RiotSettings.shared.showMediaCompressionPrompt ? MXKRoomInputToolbarCompressionModePrompt : MXKRoomInputToolbarCompressionModeNone } else { // Otherwise use the compression mode defined in the build settings. - return BuildSettings.roomInputToolbarCompressionMode.mxkCompressionMode + return BWIBuildSettings.shared.roomInputToolbarCompressionMode.mxkCompressionMode } } } diff --git a/Riot/Utils/Tools.m b/Riot/Utils/Tools.m index e0600b078..d71531f6f 100644 --- a/Riot/Utils/Tools.m +++ b/Riot/Utils/Tools.m @@ -69,11 +69,11 @@ { BOOL isUniversalLink = NO; - for (NSString *matrixPermalinkHost in BuildSettings.permalinkSupportedHosts) + for (NSString *matrixPermalinkHost in BWIBuildSettings.shared.permalinkSupportedHosts) { if ([url.host isEqualToString:matrixPermalinkHost]) { - NSArray *hostPaths = BuildSettings.permalinkSupportedHosts[matrixPermalinkHost]; + NSArray *hostPaths = BWIBuildSettings.shared.permalinkSupportedHosts[matrixPermalinkHost]; if (hostPaths.count) { // iOS Patch: fix urls before using it diff --git a/Riot/target-bum-beta.yml b/Riot/target-bum-beta.yml index bd747efbb..8e3c2657c 100644 --- a/Riot/target-bum-beta.yml +++ b/Riot/target-bum-beta.yml @@ -77,7 +77,6 @@ targets: - path: ../Config excludes: - "AppIdentifiers.xcconfig" - - "BuildSettings.swift" - "BuM" - "*.sh" - path: . diff --git a/RiotNSE/NotificationService.swift b/RiotNSE/NotificationService.swift index c22c25949..e44eff1bb 100644 --- a/RiotNSE/NotificationService.swift +++ b/RiotNSE/NotificationService.swift @@ -532,7 +532,7 @@ class NotificationService: UNNotificationServiceExtension { } // bwi: hide content in message notifications - if BwiBuildSettings.bwiHideNotificationMessageBody { + if BWIBuildSettings.shared.bwiHideNotificationMessageBody { // Hide the content notificationTitle = nil notificationBody = NotificationService.localizedString(forKey: "MESSAGE_PROTECTED") @@ -613,7 +613,7 @@ class NotificationService: UNNotificationServiceExtension { } // bwi: hide content in other message types, too to be sure - if BwiBuildSettings.bwiHideNotificationMessageBody { + if BWIBuildSettings.shared.bwiHideNotificationMessageBody { // Hide the content notificationTitle = nil notificationBody = NotificationService.localizedString(forKey: "MESSAGE_PROTECTED") @@ -624,7 +624,7 @@ class NotificationService: UNNotificationServiceExtension { notificationBody = NotificationService.localizedString(forKey: "STICKER_FROM_USER", eventSenderName) // bwi: hide content in other message types, too to be sure - if BwiBuildSettings.bwiHideNotificationMessageBody { + if BWIBuildSettings.shared.bwiHideNotificationMessageBody { // Hide the content notificationTitle = nil notificationBody = NotificationService.localizedString(forKey: "MESSAGE_PROTECTED") @@ -640,7 +640,7 @@ class NotificationService: UNNotificationServiceExtension { notificationBody = NotificationService.localizedString(forKey: "GENERIC_REACTION_FROM_USER", eventSenderName) } // bwi: hide content in other message types, too to be sure - if BwiBuildSettings.bwiHideNotificationMessageBody { + if BWIBuildSettings.shared.bwiHideNotificationMessageBody { // Hide the content notificationTitle = nil notificationBody = NotificationService.localizedString(forKey: "MESSAGE_PROTECTED") @@ -663,7 +663,7 @@ class NotificationService: UNNotificationServiceExtension { } } // bwi: hide content in other message types, too to be sure - if BwiBuildSettings.bwiHideNotificationMessageBody { + if BWIBuildSettings.shared.bwiHideNotificationMessageBody { // Hide the content notificationTitle = nil notificationBody = NotificationService.localizedString(forKey: "MESSAGE_PROTECTED") @@ -673,7 +673,7 @@ class NotificationService: UNNotificationServiceExtension { notificationBody = MXEventContentPollStart(fromJSON: event.content)?.question // bwi: hide content in other message types, too to be sure - if BwiBuildSettings.bwiHideNotificationMessageBody { + if BWIBuildSettings.shared.bwiHideNotificationMessageBody { // Hide the content notificationTitle = nil notificationBody = NotificationService.localizedString(forKey: "MESSAGE_PROTECTED") @@ -715,7 +715,7 @@ class NotificationService: UNNotificationServiceExtension { var validatedNotificationBody: String? = notificationBody var validatedNotificationTitle: String? = notificationTitle - if self.localAuthenticationService.isProtectionSet || BwiBuildSettings.bwiHideNotificationMessageBody { + if self.localAuthenticationService.isProtectionSet || BWIBuildSettings.shared.bwiHideNotificationMessageBody { MXLog.debug("[NotificationService] validateNotificationContentAndComplete: Resetting title and body because app protection is set") validatedNotificationBody = NotificationService.localizedString(forKey: "MESSAGE_PROTECTED") validatedNotificationTitle = nil diff --git a/RiotNSE/target.yml b/RiotNSE/target.yml index 888381fc0..a8139194d 100644 --- a/RiotNSE/target.yml +++ b/RiotNSE/target.yml @@ -48,10 +48,10 @@ targets: - path: ../bwi/NotificationTimes/NotificationTimesRoomSettings.swift - path: ../bwi/NotificationTimes/NotificationTimesWeekday.swift - path: ../bwi/NotificationTimes/Date+fromHourMinute.swift - - path: ../bwi/BwiBuildSettings.swift - - path: ../Config/BwiSettings.swift - path: ../Riot/Managers/Settings/RiotSettings.swift - path: ../Config/BuildSettings.swift + - path: ../Config/BWIBuildSettings.swift + - path: ../Config/BuM/BWIBuildSettings+BuM.swift - path: ../bwi/UserAgent/UserAgentService.swift - path: ../Riot/Utils/DataProtectionHelper.swift - path: ../Config/CommonConfiguration.swift diff --git a/RiotShareExtension/target.yml b/RiotShareExtension/target.yml index 1edc9858b..58f2379f0 100644 --- a/RiotShareExtension/target.yml +++ b/RiotShareExtension/target.yml @@ -43,13 +43,13 @@ targets: - path: ../bwi/SecureStorage - path: ../bwi/ServerURLs - path: ../bwi/AppConfig - - path: ../bwi/BwiBuildSettings.swift - - path: ../Config/BwiSettings.swift - path: ../Riot/Modules/Common/SegmentedViewController/SegmentedViewController.m - path: ../Riot/Categories/Bundle.swift - path: ../Riot/Managers/Theme/ - path: ../Riot/Utils/AvatarGenerator.m - path: ../Config/BuildSettings.swift + - path: ../Config/BWIBuildSettings.swift + - path: ../Config/BuM/BWIBuildSettings+BuM.swift - path: ../bwi/UserAgent/UserAgentService.swift - path: ../Riot/Categories/Character.swift - path: ../Riot/Categories/MXKImageView.swift diff --git a/RiotSwiftUI/Modules/AnalyticsPrompt/Coordinator/AnalyticsPromptCoordinator.swift b/RiotSwiftUI/Modules/AnalyticsPrompt/Coordinator/AnalyticsPromptCoordinator.swift index b4d9daf80..f52004f4f 100644 --- a/RiotSwiftUI/Modules/AnalyticsPrompt/Coordinator/AnalyticsPromptCoordinator.swift +++ b/RiotSwiftUI/Modules/AnalyticsPrompt/Coordinator/AnalyticsPromptCoordinator.swift @@ -54,7 +54,7 @@ final class AnalyticsPromptCoordinator: Coordinator, Presentable { promptType = .newUser } - let viewModel = AnalyticsPromptViewModel(promptType: promptType, strings: strings, termsURL: BuildSettings.analyticsConfiguration.termsURL) + let viewModel = AnalyticsPromptViewModel(promptType: promptType, strings: strings, termsURL: BWIBuildSettings.shared.analyticsConfiguration.termsURL) let view = AnalyticsPrompt(viewModel: viewModel.context) _analyticsPromptViewModel = viewModel diff --git a/RiotSwiftUI/Modules/Authentication/Common/Service/MatrixSDK/AuthenticationService.swift b/RiotSwiftUI/Modules/Authentication/Common/Service/MatrixSDK/AuthenticationService.swift index 2f9a5f274..8af5502b4 100644 --- a/RiotSwiftUI/Modules/Authentication/Common/Service/MatrixSDK/AuthenticationService.swift +++ b/RiotSwiftUI/Modules/Authentication/Common/Service/MatrixSDK/AuthenticationService.swift @@ -109,8 +109,8 @@ class AuthenticationService: NSObject { // not logged in // update the state with given HS and IS addresses state = AuthenticationState(flow: flow, - homeserverAddress: hsUrl ?? BuildSettings.serverConfigDefaultHomeserverUrlString, - identityServer: isUrl ?? BuildSettings.serverConfigDefaultIdentityServerUrlString) + homeserverAddress: hsUrl ?? BWIBuildSettings.shared.serverConfigDefaultHomeserverUrlString, + identityServer: isUrl ?? BWIBuildSettings.shared.serverConfigDefaultIdentityServerUrlString) // store the link to override the default homeserver address. provisioningLink = universalLink @@ -143,7 +143,7 @@ class AuthenticationService: NSObject { /// - homeserverAddress: The homeserver to start the flow for, or `nil` to use the default. /// If a provisioning link has been set, it will override the default homeserver when passing `nil`. func startFlow(_ flow: AuthenticationFlow, for homeserverAddress: String? = nil) async throws { - let address = homeserverAddress ?? provisioningLink?.homeserverUrl ?? BuildSettings.serverConfigDefaultHomeserverUrlString + let address = homeserverAddress ?? provisioningLink?.homeserverUrl ?? BWIBuildSettings.shared.serverConfigDefaultHomeserverUrlString var (client, homeserver) = try await loginFlow(for: address) @@ -197,7 +197,7 @@ class AuthenticationService: NSObject { // This address will be replaced when `startFlow` is called, but for // completeness revert to the default homeserver if requested anyway. - let address = useDefaultServer ? BuildSettings.serverConfigDefaultHomeserverUrlString : state.homeserver.addressFromUser ?? state.homeserver.address + let address = useDefaultServer ? BWIBuildSettings.shared.serverConfigDefaultHomeserverUrlString : state.homeserver.addressFromUser ?? state.homeserver.address let identityServer = state.identityServer state = AuthenticationState(flow: .login, homeserverAddress: address, diff --git a/RiotSwiftUI/Modules/Common/Util/PrimaryActionButtonStyle.swift b/RiotSwiftUI/Modules/Common/Util/PrimaryActionButtonStyle.swift index 269150af2..ed926fe8e 100644 --- a/RiotSwiftUI/Modules/Common/Util/PrimaryActionButtonStyle.swift +++ b/RiotSwiftUI/Modules/Common/Util/PrimaryActionButtonStyle.swift @@ -28,7 +28,7 @@ struct PrimaryActionButtonStyle: ButtonStyle { } private var backgroundColor: Color { - if BwiBuildSettings.bwiEnableBuMUI { + if BWIBuildSettings.shared.bwiEnableBuMUI { return Color(hex: 0x108194) } else { return customColor ?? theme.colors.accent diff --git a/RiotSwiftUI/Modules/LocationSharing/LiveLocationSharingViewer/Test/Unit/LiveLocationSharingViewerViewModelTests.swift b/RiotSwiftUI/Modules/LocationSharing/LiveLocationSharingViewer/Test/Unit/LiveLocationSharingViewerViewModelTests.swift index cefe1c2ed..26c100f62 100644 --- a/RiotSwiftUI/Modules/LocationSharing/LiveLocationSharingViewer/Test/Unit/LiveLocationSharingViewerViewModelTests.swift +++ b/RiotSwiftUI/Modules/LocationSharing/LiveLocationSharingViewer/Test/Unit/LiveLocationSharingViewerViewModelTests.swift @@ -27,7 +27,7 @@ class LiveLocationSharingViewerViewModelTests: XCTestCase { override func setUpWithError() throws { service = MockLiveLocationSharingViewerService() - viewModel = LiveLocationSharingViewerViewModel(mapStyleURL: BuildSettings.defaultTileServerMapStyleURL, service: service) + viewModel = LiveLocationSharingViewerViewModel(mapStyleURL: BWIBuildSettings.shared.defaultTileServerMapStyleURL, service: service) context = viewModel.context } } diff --git a/RiotSwiftUI/Modules/LocationSharing/StaticLocationSharingViewer/StaticLocationViewingModels.swift b/RiotSwiftUI/Modules/LocationSharing/StaticLocationSharingViewer/StaticLocationViewingModels.swift index d05b72055..1f4ded9e9 100644 --- a/RiotSwiftUI/Modules/LocationSharing/StaticLocationSharingViewer/StaticLocationViewingModels.swift +++ b/RiotSwiftUI/Modules/LocationSharing/StaticLocationSharingViewer/StaticLocationViewingModels.swift @@ -49,7 +49,7 @@ struct StaticLocationViewingViewState: BindableState { } var shareButtonVisible: Bool { - BwiBuildSettings.bwiLocationShareButtonVisible + BWIBuildSettings.shared.bwiLocationShareButtonVisible } let errorSubject = PassthroughSubject() diff --git a/RiotSwiftUI/Modules/LocationSharing/StaticLocationSharingViewer/View/StaticLocationView.swift b/RiotSwiftUI/Modules/LocationSharing/StaticLocationSharingViewer/View/StaticLocationView.swift index a23dc6621..6081e0f5a 100644 --- a/RiotSwiftUI/Modules/LocationSharing/StaticLocationSharingViewer/View/StaticLocationView.swift +++ b/RiotSwiftUI/Modules/LocationSharing/StaticLocationSharingViewer/View/StaticLocationView.swift @@ -62,7 +62,7 @@ struct StaticLocationView: View { } .disabled(!viewModel.viewState.shareButtonEnabled) .accessibilityIdentifier("shareButton") - .opacity(BwiBuildSettings.bwiLocationShareButtonVisible ? 1.0 : 0.0) + .opacity(BWIBuildSettings.shared.bwiLocationShareButtonVisible ? 1.0 : 0.0) } } .navigationBarTitleDisplayMode(.inline) diff --git a/RiotSwiftUI/Modules/Onboarding/SplashScreen/View/OnboardingSplashScreen.swift b/RiotSwiftUI/Modules/Onboarding/SplashScreen/View/OnboardingSplashScreen.swift index b94a590f3..0bfe99976 100644 --- a/RiotSwiftUI/Modules/Onboarding/SplashScreen/View/OnboardingSplashScreen.swift +++ b/RiotSwiftUI/Modules/Onboarding/SplashScreen/View/OnboardingSplashScreen.swift @@ -93,7 +93,7 @@ struct OnboardingSplashScreen: View { /// The main action buttons. var buttons: some View { VStack(spacing: 12) { - if BwiBuildSettings.bwiOnboardingSplashScreenEnableRegister { + if BWIBuildSettings.shared.bwiOnboardingSplashScreenEnableRegister { Button { viewModel.send(viewAction: .register) } label: { Text(VectorL10n.onboardingSplashRegisterButtonTitle) } diff --git a/RiotSwiftUI/Modules/Room/PollEditForm/View/PollEditFormTypePicker.swift b/RiotSwiftUI/Modules/Room/PollEditForm/View/PollEditFormTypePicker.swift index 3650c308d..c0f07333d 100644 --- a/RiotSwiftUI/Modules/Room/PollEditForm/View/PollEditFormTypePicker.swift +++ b/RiotSwiftUI/Modules/Room/PollEditForm/View/PollEditFormTypePicker.swift @@ -27,7 +27,7 @@ struct PollEditFormTypePicker: View { .font(theme.fonts.title3SB) .foregroundColor(theme.colors.primaryContent) PollEditFormTypeButton(type: .disclosed, selectedType: $selectedType) - if BwiBuildSettings.bwiShowClosedPolls { + if BWIBuildSettings.shared.bwiShowClosedPolls { PollEditFormTypeButton(type: .undisclosed, selectedType: $selectedType) } } diff --git a/RiotSwiftUI/Modules/Settings/Notifications/Model/NotificationSettingsScreen.swift b/RiotSwiftUI/Modules/Settings/Notifications/Model/NotificationSettingsScreen.swift index 4a349e504..cc7aa1b96 100644 --- a/RiotSwiftUI/Modules/Settings/Notifications/Model/NotificationSettingsScreen.swift +++ b/RiotSwiftUI/Modules/Settings/Notifications/Model/NotificationSettingsScreen.swift @@ -32,7 +32,7 @@ extension NotificationSettingsScreen: Identifiable { extension NotificationSettingsScreen { /// Defines which rules are handled by each of the screens. var pushRules: [NotificationPushRuleId] { - if BuildSettings.settingsNotificationsBWIDefaultSet { + if BWIBuildSettings.shared.settingsNotificationsBWIDefaultSet { switch self { case .defaultNotifications: return [.oneToOneEncryptedRoom, .encrypted, .inviteMe] diff --git a/RiotSwiftUI/target.yml b/RiotSwiftUI/target.yml index 9086e890b..7c7e349ef 100644 --- a/RiotSwiftUI/target.yml +++ b/RiotSwiftUI/target.yml @@ -51,6 +51,8 @@ targets: - path: ../Riot/Managers/Theme/ - path: ../Riot/Managers/Locale/LocaleProviderType.swift - path: ../Config/BuildSettings.swift + - path: ../Config/BWIBuildSettings.swift + - path: ../Config/BuM/BWIBuildSettings+BuM.swift - path: ../Riot/Modules/Room/TimelineCells/Styles/RoomTimelineStyleIdentifier.swift - path: ../Riot/Categories/String.swift - path: ../Riot/Categories/Character.swift diff --git a/RiotSwiftUI/targetUITests.yml b/RiotSwiftUI/targetUITests.yml index 1b23dab5c..02d9045be 100644 --- a/RiotSwiftUI/targetUITests.yml +++ b/RiotSwiftUI/targetUITests.yml @@ -60,6 +60,8 @@ targets: - path: ../Riot/Managers/Theme/ - path: ../Riot/Managers/Locale/LocaleProviderType.swift - path: ../Config/BuildSettings.swift + - path: ../Config/BWIBuildSettings.swift + - path: ../Config/BuM/BWIBuildSettings+BuM.swift - path: ../Riot/Modules/Room/TimelineCells/Styles/RoomTimelineStyleIdentifier.swift - path: ../Riot/Categories/String.swift - path: ../Riot/Categories/Character.swift diff --git a/RiotTests/Modules/Authentication/AuthenticationServiceTests.swift b/RiotTests/Modules/Authentication/AuthenticationServiceTests.swift index 697573aed..e71a056f1 100644 --- a/RiotTests/Modules/Authentication/AuthenticationServiceTests.swift +++ b/RiotTests/Modules/Authentication/AuthenticationServiceTests.swift @@ -91,7 +91,7 @@ import XCTest service.reset(useDefaultServer: true) // Then the service should reset back to the default server. - XCTAssertEqual(service.state.homeserver.address, BuildSettings.serverConfigDefaultHomeserverUrlString, + XCTAssertEqual(service.state.homeserver.address, BWIBuildSettings.shared.serverConfigDefaultHomeserverUrlString, "The address should reset to the value configured in the build settings.") } @@ -124,7 +124,7 @@ import XCTest // Then the link should be forgotten. XCTAssertNil(service.provisioningLink, "The provisioning link should be forgotten after resetting back to the default server.") XCTAssertNil(service.state.homeserver.addressFromUser, "There shouldn't be an address from the user after resetting the service.") - XCTAssertEqual(service.state.homeserver.address, BuildSettings.serverConfigDefaultHomeserverUrlString, + XCTAssertEqual(service.state.homeserver.address, BWIBuildSettings.shared.serverConfigDefaultHomeserverUrlString, "The address should reset to the value configured in the build settings.") } diff --git a/RiotTests/target.yml b/RiotTests/target.yml index cec7a88ca..0c042516f 100644 --- a/RiotTests/target.yml +++ b/RiotTests/target.yml @@ -60,8 +60,8 @@ targets: - path: . - path: ../Config/Configurable.swift - path: ../Config/BuildSettings.swift - - path: ../bwi/BwiBuildSettings.swift - - path: ../Config/BwiSettings.swift + - path: ../Config/BWIBuildSettings.swift + - path: ../Config/BuM/BWIBuildSettings+BuM.swift - path: ../Config/AppConfiguration.swift - path: ../Config/CommonConfiguration.swift - path: ../Riot/Categories/Bundle.swift diff --git a/SiriIntents/target.yml b/SiriIntents/target.yml index 21597f87f..a58e09ba3 100644 --- a/SiriIntents/target.yml +++ b/SiriIntents/target.yml @@ -44,6 +44,8 @@ targets: - path: ../Riot/Categories/Bundle.swift - path: ../Config/CommonConfiguration.swift - path: ../Config/BuildSettings.swift + - path: ../Config/BWIBuildSettings.swift + - path: ../Config/BuM/BWIBuildSettings+BuM.swift - path: ../Config/Configurable.swift - path: ../Riot/Managers/Settings/RiotSettings.swift - path: ../Riot/Managers/EncryptionKeyManager/EncryptionKeyManager.swift diff --git a/bwi/AppConfig/AppConfigService.swift b/bwi/AppConfig/AppConfigService.swift index d2e717095..4eb7864c2 100644 --- a/bwi/AppConfig/AppConfigService.swift +++ b/bwi/AppConfig/AppConfigService.swift @@ -141,7 +141,7 @@ extension UserDefaults } else if let url = ServerURLHelper.shared.serverUrl() { return url } else { - return BuildSettings.serverConfigDefaultHomeserverUrlString + return BWIBuildSettings.shared.serverConfigDefaultHomeserverUrlString } } @@ -151,7 +151,7 @@ extension UserDefaults } else if let url = ServerURLHelper.shared.pusherUrl() { return url } else { - return BuildSettings.serverConfigSygnalAPIUrlString + return BWIBuildSettings.shared.serverConfigSygnalAPIUrlString } } @@ -173,7 +173,7 @@ extension UserDefaults } else if let url = ServerURLHelper.shared.analytics() { return url } else { - return BuildSettings.bwiAnalyticsServerUrlString + return BWIBuildSettings.shared.bwiAnalyticsServerUrlString } } } diff --git a/bwi/BwiBuildSettings.swift b/bwi/BwiBuildSettings.swift deleted file mode 100644 index 14e7722fc..000000000 --- a/bwi/BwiBuildSettings.swift +++ /dev/null @@ -1,139 +0,0 @@ -// -/* - * Copyright (c) 2021 BWI GmbH - * - * 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 - -@objcMembers -final class BwiBuildSettings: NSObject { - - // Integration check - static let forcedPinProtection = true - - // Jailbreak check - static let forcedNoneJailbroken = true - - /// Default number of iterations for secure storage. Do not change this value after going live. - static let iterationsForSecureStorage: UInt = 100000 - - /// Allow split view detail view stacking - static let allowSplitViewDetailsScreenStacking: Bool = true - - // direct rooms are for two persons only in bwi context - static let allowInviteOnDirectRooms: Bool = false - - // test setup for downtime: should be false for all builds - static let useTestDataForDowntime: Bool = false - - static let flavor = "" - - static let showBwiSplashScreen: Bool = false - - static let bwiShowRoomSearch: Bool = false - - static let bwiAllowRoomPermalink: Bool = false - - static let bwiAllowUserPermalink: Bool = false - - static let bwiCheckAppVersion = true - - static let bwiSettingsShowSecureBackupSection = false - static let bwiSettingsShowCrossSigningSection = false - - static let bwiNotificationTimes = true - - static let bwiUserLabelsAdminSettingsVisible = true - static let bwiUserLabelsMemberDetailsVisible = true - static let bwiUserLabelsParticipantsVisible = true - static let bwiUserLabelsTimelineDisplayNameVisible = true - static let bwiUserLabelsTimelineEventVisible = true - - static let bwiUserLabelEventTypeString = "de.bwi.room.user_function_labels" - - static let bwiUserLabelParticipantSorting = true - - static let bwiShowClosedPolls = true - static let bwiShowThreads = false - - static let bwiShowRoomCreationSectionFooter = false - - static let bwiAutoCreateAliasOnRoomCreation = true - - static let bwiLocationShareButtonVisible = true - static let bwiUseCustomPersonalNotesAvatar = true - static let bwiBetterIgnoredUsers = true - static let bwiSettingsShowInAppNotifications = false - static let bwiFilteredContextMenu = true - - static let bwiShowPinnedNotificationSettings = false - static let bwiShowSessionSettingsFooter = false - - static let bwiEnablePersonalState = false - - // In onboarding splash screen dis/enable register button - static let bwiOnboardingSplashScreenEnableRegister = false - - // make sure that the NSE extention always resets message body and title - static let bwiHideNotificationMessageBody = true - - // in Auth screen dis/enable register button even with onboarding splash screen enabled - static let bwiAuthentificationScreenEnableRegister = false - - // enable BuM style authentication UI (more Info text and a logo) - static let bwiEnableBuMAuthentificationUI = true - - // voicemessages should resignplaying when the app enters the background - static let bwiResignPlayingVoiceMessageInBackground = true - - // enable BUM style UI in pincode and maybe other places - static let bwiEnableBuMUI = true - - // clear media cache every time when leaving a room vc: no media should be saved on device for security purposes - static let bwiClearMediaCacheOnRoomExit = true - - static let bwiEnableLoginProtection = true - - static let bwiHashes = [ "a3f65e35a7476799afe8d80282fb3c45b39dab06d0d8c70dc98e45ab7d8e93a9", - "2fda1a831655c22a5e6096d7cfbff4429fbf27881141e191b46adbf168142a11", - "4f8cbb3fef885f7284d0477d797d7007f0e1ba76221834132652f4d645796e28", - "24c2ec541e61e8e68941b96dc45ed5df12f6bdbda283cb0b3a322742aa970256", - "1be0b314a6c915d4475290522baef5b642db1b6d68937992b8e0eb5b7b0d6666" ] - - // use a different badge color if the user was mentioned in a room - static let showMentionsInRoom = true - - // replace feature history link variable with the appropiate build setting - static let bwiFeatureHistoryLink = "https://messenger.bwi.de/#c4783" - static let bwiReplaceFeatureLink = true - - // login with matrix id should only be enabled in some configurations - static let bwiEnableLoginWithMatrixID = true - - // show app specific loading icons instead of the rotating element logo - static let showBUMLottieAnimation = true - - // DMs don't need all roomsettings (like changing avatar, name, topic) - static let showUnrelatedRoomSettingsForDirectMessages = false - - // create rooms without shared history - static let enableSharedHistoryOnRoomCreation = false - - // explicitly set sdk option for key sharing => We don't want to share even if the room setting allows it - static let allowKeySharingOnRoomInvite = true - - // DMs don't need all roomsettings (like changing avatar, name, topic) - static let allowDoubleTapOnImageAttachmentsForZoom = true -} diff --git a/bwi/MatomoAnalytics/BWIAnalytics.swift b/bwi/MatomoAnalytics/BWIAnalytics.swift index 211e4d28f..85562766e 100644 --- a/bwi/MatomoAnalytics/BWIAnalytics.swift +++ b/bwi/MatomoAnalytics/BWIAnalytics.swift @@ -48,13 +48,13 @@ import MatomoTracker appName = Bundle.main.object(forInfoDictionaryKey: "CFBundleDisplayName") as! String appVersion = AppDelegate.theDelegate().appVersion - if BuildSettings.bwiEnableErrorTracking { + if BWIBuildSettings.shared.bwiEnableErrorTracking { guard let url = URL(string: AppConfigService.shared.analyticsUrl()) else { matomo = nil return } - matomo = MatomoTracker.init(siteId: BuildSettings.bwiAnalyticsAppId, baseURL:url, userAgent: nil) + matomo = MatomoTracker.init(siteId: BWIBuildSettings.shared.bwiAnalyticsAppId, baseURL:url, userAgent: nil) matomo?.isOptedOut = false @@ -72,7 +72,7 @@ import MatomoTracker } func needsToShowPromt() -> Bool { - if !BuildSettings.bwiEnableErrorTracking { + if !BWIBuildSettings.shared.bwiEnableErrorTracking { return false } diff --git a/bwi/SecureStorage/SecureFileStorage.swift b/bwi/SecureStorage/SecureFileStorage.swift index 30b940719..44139a26b 100644 --- a/bwi/SecureStorage/SecureFileStorage.swift +++ b/bwi/SecureStorage/SecureFileStorage.swift @@ -54,8 +54,8 @@ class SecureFileStorage { do { try memoryVault.set(makeSalt(), forKey: saltKeyName) dict[saltKeyName] = makeSalt().data(using: .utf8) - try memoryVault.set(BwiBuildSettings.iterationsForSecureStorage, forKey: iterationsKeyName) - dict[iterationsKeyName] = String(BwiBuildSettings.iterationsForSecureStorage).data(using: .utf8) + try memoryVault.set(BWIBuildSettings.shared.iterationsForSecureStorage, forKey: iterationsKeyName) + dict[iterationsKeyName] = String(BWIBuildSettings.shared.iterationsForSecureStorage).data(using: .utf8) saveToFile() } catch { diff --git a/bwi/Security/IntegrityCheck.swift b/bwi/Security/IntegrityCheck.swift index 47904985a..b778189db 100644 --- a/bwi/Security/IntegrityCheck.swift +++ b/bwi/Security/IntegrityCheck.swift @@ -20,7 +20,7 @@ import Foundation @objcMembers class IntegrityCheck : NSObject, SecurityCheck { func isBreached() -> Bool { - return (BwiBuildSettings.forcedPinProtection && !PinCodePreferences.shared.isPinSet) + return (BWIBuildSettings.shared.forcedPinProtection && !PinCodePreferences.shared.isPinSet) } func breachAlert() -> UIAlertController { diff --git a/bwi/Security/JailbreakCheck.swift b/bwi/Security/JailbreakCheck.swift index f56158ea6..f736be034 100644 --- a/bwi/Security/JailbreakCheck.swift +++ b/bwi/Security/JailbreakCheck.swift @@ -21,7 +21,7 @@ import DTTJailbreakDetection @objcMembers class JailbreakCheck : NSObject, SecurityCheck { func isBreached() -> Bool { - if BwiBuildSettings.forcedNoneJailbroken { + if BWIBuildSettings.shared.forcedNoneJailbroken { return DTTJailbreakDetection.isJailbroken() } return false diff --git a/bwi/SplashScreen/Coordinator/OnboardingBwiSplashScreenCoordinator.swift b/bwi/SplashScreen/Coordinator/OnboardingBwiSplashScreenCoordinator.swift index c3507ebc3..e1937b171 100644 --- a/bwi/SplashScreen/Coordinator/OnboardingBwiSplashScreenCoordinator.swift +++ b/bwi/SplashScreen/Coordinator/OnboardingBwiSplashScreenCoordinator.swift @@ -43,7 +43,7 @@ final class OnboardingBwiSplashScreenCoordinator: OnboardingBwiSplashScreenCoord let viewModel = OnboardingBwiSplashScreenViewModel() onboardingSplashScreenViewModel = viewModel - if BwiBuildSettings.showBUMLottieAnimation { + if BWIBuildSettings.shared.showBUMLottieAnimation { onboardingSplashScreenHostingController = BUMLaunchLoadingViewController() } else { let view = OnboardingBwiSplashScreen(viewModel: viewModel.context) @@ -61,7 +61,7 @@ final class OnboardingBwiSplashScreenCoordinator: OnboardingBwiSplashScreenCoord // MARK: - Public func start() { - if BwiBuildSettings.showBUMLottieAnimation { + if BWIBuildSettings.shared.showBUMLottieAnimation { timer?.invalidate() timer = Timer.scheduledTimer(withTimeInterval: 5, repeats: false) { timer in timer.invalidate() diff --git a/bwi/Tests/BWIAnalyticsTests.swift b/bwi/Tests/BWIAnalyticsTests.swift index 7b0c49807..bf7b8cb8c 100644 --- a/bwi/Tests/BWIAnalyticsTests.swift +++ b/bwi/Tests/BWIAnalyticsTests.swift @@ -24,11 +24,11 @@ class BWIAnalyticsTests: XCTestCase { // So we must check that host and key is not set in the BuildSettings. func testAnalyticsHost() throws { - XCTAssertNil(BuildSettings.analyticsHost) + XCTAssertNil(BWIBuildSettings.shared.analyticsHost) } func testAnalyticsKey() throws { - XCTAssertNil(BuildSettings.analyticsKey) + XCTAssertNil(BWIBuildSettings.shared.analyticsKey) } } diff --git a/bwi/Tools/BWINewFeatureHelper.swift b/bwi/Tools/BWINewFeatureHelper.swift index c8c83f5de..63e3ea858 100644 --- a/bwi/Tools/BWINewFeatureHelper.swift +++ b/bwi/Tools/BWINewFeatureHelper.swift @@ -27,7 +27,7 @@ import Foundation //reading do { var text = try String(contentsOf: urlPath, encoding: .utf8) - text = text.replacingOccurrences(of: "$FEATURELINK", with: BwiBuildSettings.bwiFeatureHistoryLink) + text = text.replacingOccurrences(of: "$FEATURELINK", with: BWIBuildSettings.shared.bwiFeatureHistoryLink) try text.write(to: urlPath, atomically: false, encoding: .utf8) } catch { diff --git a/bwi/UserAgent/UserAgentService.swift b/bwi/UserAgent/UserAgentService.swift index d60df05c9..539242ab3 100644 --- a/bwi/UserAgent/UserAgentService.swift +++ b/bwi/UserAgent/UserAgentService.swift @@ -66,7 +66,7 @@ import WebKit var bwiUserAgent: String { - var flavor = BwiBuildSettings.flavor + var flavor = BWIBuildSettings.shared.flavor if (ServerURLHelper.shared.flavor() != nil) { flavor = ServerURLHelper.shared.flavor()! diff --git a/bwi/UserLabels/UserLabelDefaultService.swift b/bwi/UserLabels/UserLabelDefaultService.swift index 93e28d372..7a1697329 100644 --- a/bwi/UserLabels/UserLabelDefaultService.swift +++ b/bwi/UserLabels/UserLabelDefaultService.swift @@ -50,11 +50,11 @@ extension UserLabelDefaultService : UserLabelService { return } - if state.powerLevels.events[BwiBuildSettings.bwiUserLabelEventTypeString] == nil { + if state.powerLevels.events[BWIBuildSettings.shared.bwiUserLabelEventTypeString] == nil { if var newContent = state.powerLevels.jsonDictionary() as? [String : Any] { if var events = newContent["events"] as? [String : Any] { - events[BwiBuildSettings.bwiUserLabelEventTypeString] = RoomPowerLevel.admin.rawValue + events[BWIBuildSettings.shared.bwiUserLabelEventTypeString] = RoomPowerLevel.admin.rawValue newContent["events"] = events room.sendStateEvent(.roomPowerLevels, content: newContent, stateKey: "", completion: { response in @@ -68,20 +68,20 @@ extension UserLabelDefaultService : UserLabelService { } } - if var currentLabel = state.stateEvents(with: .custom(BwiBuildSettings.bwiUserLabelEventTypeString))?.last?.content { + if var currentLabel = state.stateEvents(with: .custom(BWIBuildSettings.shared.bwiUserLabelEventTypeString))?.last?.content { if userLabel != nil { currentLabel[user] = userLabel } else { currentLabel.removeValue(forKey: user) } - room.sendStateEvent(.custom(BwiBuildSettings.bwiUserLabelEventTypeString), content: currentLabel, stateKey: "", completion: { response in + room.sendStateEvent(.custom(BWIBuildSettings.shared.bwiUserLabelEventTypeString), content: currentLabel, stateKey: "", completion: { response in completion(response.isSuccess) }) } else if userLabel != nil { var newUserLabel = Dictionary() newUserLabel[user] = userLabel - room.sendStateEvent(.custom(BwiBuildSettings.bwiUserLabelEventTypeString), content: newUserLabel, stateKey: "", completion: { response in + room.sendStateEvent(.custom(BWIBuildSettings.shared.bwiUserLabelEventTypeString), content: newUserLabel, stateKey: "", completion: { response in completion(response.isSuccess) }) } @@ -100,7 +100,7 @@ extension UserLabelDefaultService : UserLabelService { return } - if let labels = state.stateEvents(with: .custom(BwiBuildSettings.bwiUserLabelEventTypeString))?.last?.content { + if let labels = state.stateEvents(with: .custom(BWIBuildSettings.shared.bwiUserLabelEventTypeString))?.last?.content { if let tmp = labels[user] as? String { label = tmp }