diff --git a/Riot/Generated/InfoPlist.swift b/Riot/Generated/InfoPlist.swift deleted file mode 100644 index 4f8c6eece..000000000 --- a/Riot/Generated/InfoPlist.swift +++ /dev/null @@ -1,93 +0,0 @@ -// swiftlint:disable all -// Generated using SwiftGen — https://github.com/SwiftGen/SwiftGen - -import Foundation - -// swiftlint:disable superfluous_disable_command -// swiftlint:disable file_length - -// MARK: - Plist Files - -// swiftlint:disable identifier_name line_length type_body_length -@objcMembers -public class InfoPlist: NSObject { - private static let _document = PlistDocument(path: "Info.plist") - - public static let cfBundleDevelopmentRegion: String = _document["CFBundleDevelopmentRegion"] - public static let cfBundleDisplayName: String = _document["CFBundleDisplayName"] - public static let cfBundleExecutable: String = _document["CFBundleExecutable"] - public static let cfBundleIdentifier: String = _document["CFBundleIdentifier"] - public static let cfBundleInfoDictionaryVersion: String = _document["CFBundleInfoDictionaryVersion"] - public static let cfBundleName: String = _document["CFBundleName"] - public static let cfBundlePackageType: String = _document["CFBundlePackageType"] - public static let cfBundleShortVersionString: String = _document["CFBundleShortVersionString"] - public static let cfBundleSignature: String = _document["CFBundleSignature"] - public static let cfBundleURLTypes: [[String: Any]] = _document["CFBundleURLTypes"] - public static let cfBundleVersion: String = _document["CFBundleVersion"] - public static let itsAppUsesNonExemptEncryption: Bool = _document["ITSAppUsesNonExemptEncryption"] - public static let itsEncryptionExportComplianceCode: String = _document["ITSEncryptionExportComplianceCode"] - public static let lsApplicationQueriesSchemes: [String] = _document["LSApplicationQueriesSchemes"] - public static let lsRequiresIPhoneOS: Bool = _document["LSRequiresIPhoneOS"] - public static let nsAppTransportSecurity: [String: Any] = _document["NSAppTransportSecurity"] - public static let nsCalendarsUsageDescription: String = _document["NSCalendarsUsageDescription"] - public static let nsCameraUsageDescription: String = _document["NSCameraUsageDescription"] - public static let nsContactsUsageDescription: String = _document["NSContactsUsageDescription"] - public static let nsFaceIDUsageDescription: String = _document["NSFaceIDUsageDescription"] - public static let nsMicrophoneUsageDescription: String = _document["NSMicrophoneUsageDescription"] - public static let nsPhotoLibraryUsageDescription: String = _document["NSPhotoLibraryUsageDescription"] - public static let nsSiriUsageDescription: String = _document["NSSiriUsageDescription"] - public static let uiBackgroundModes: [String] = _document["UIBackgroundModes"] - public static let uiLaunchStoryboardName: String = _document["UILaunchStoryboardName"] - public static let uiRequiredDeviceCapabilities: [String] = _document["UIRequiredDeviceCapabilities"] - public static let uiStatusBarHidden: Bool = _document["UIStatusBarHidden"] - public static let uiStatusBarTintParameters: [String: Any] = _document["UIStatusBarTintParameters"] - public static let uiSupportedInterfaceOrientations: [String] = _document["UISupportedInterfaceOrientations"] - public static let uiSupportedInterfaceOrientationsIpad: [String] = _document["UISupportedInterfaceOrientations~ipad"] - public static let uiViewControllerBasedStatusBarAppearance: Bool = _document["UIViewControllerBasedStatusBarAppearance"] - public static let userDefaults: String = _document["UserDefaults"] - public static let applicationGroupIdentifier: String = _document["applicationGroupIdentifier"] - public static let baseBundleIdentifier: String = _document["baseBundleIdentifier"] - public static let keychainAccessGroup: String = _document["keychainAccessGroup"] -} -// swiftlint:enable identifier_name line_length type_body_length - -// MARK: - Implementation Details - -private func arrayFromPlist(at path: String) -> [T] { - guard let url = BundleToken.bundle.url(forResource: path, withExtension: nil), - let data = NSArray(contentsOf: url) as? [T] else { - fatalError("Unable to load PLIST at path: \(path)") - } - return data -} - -private struct PlistDocument { - let data: [String: Any] - - init(path: String) { - guard let url = BundleToken.bundle.url(forResource: path, withExtension: nil), - let data = NSDictionary(contentsOf: url) as? [String: Any] else { - fatalError("Unable to load PLIST at path: \(path)") - } - self.data = data - } - - subscript(key: String) -> T { - guard let result = data[key] as? T else { - fatalError("Property '\(key)' is not of type \(T.self)") - } - return result - } -} - -// swiftlint:disable convenience_type -private final class BundleToken { - static let bundle: Bundle = { - #if SWIFT_PACKAGE - return Bundle.module - #else - return Bundle(for: BundleToken.self) - #endif - }() -} -// swiftlint:enable convenience_type diff --git a/Riot/Generated/RiotDefaults.swift b/Riot/Generated/RiotDefaults.swift index 28973433c..793d63662 100644 --- a/Riot/Generated/RiotDefaults.swift +++ b/Riot/Generated/RiotDefaults.swift @@ -12,9 +12,9 @@ import Foundation internal enum RiotDefaults { private static let _document = PlistDocument(path: "Riot-Defaults.plist") - internal static let createConferenceCallsWithJitsi: Bool = _document["createConferenceCallsWithJitsi"] internal static let enableBotCreation: Bool = _document["enableBotCreation"] internal static let enableRageShake: Bool = _document["enableRageShake"] + internal static let enableRingingForGroupCalls: Bool = _document["enableRingingForGroupCalls"] internal static let matrixApps: Bool = _document["matrixApps"] internal static let maxAllowedMediaCacheSize: Int = _document["maxAllowedMediaCacheSize"] internal static let pinRoomsWithMissedNotif: Bool = _document["pinRoomsWithMissedNotif"] @@ -34,8 +34,7 @@ internal enum RiotDefaults { // MARK: - Implementation Details private func arrayFromPlist(at path: String) -> [T] { - let bundle = BundleToken.bundle - guard let url = bundle.url(forResource: path, withExtension: nil), + guard let url = BundleToken.bundle.url(forResource: path, withExtension: nil), let data = NSArray(contentsOf: url) as? [T] else { fatalError("Unable to load PLIST at path: \(path)") } @@ -46,8 +45,7 @@ private struct PlistDocument { let data: [String: Any] init(path: String) { - let bundle = BundleToken.bundle - guard let url = bundle.url(forResource: path, withExtension: nil), + guard let url = BundleToken.bundle.url(forResource: path, withExtension: nil), let data = NSDictionary(contentsOf: url) as? [String: Any] else { fatalError("Unable to load PLIST at path: \(path)") } @@ -65,7 +63,11 @@ private struct PlistDocument { // swiftlint:disable convenience_type private final class BundleToken { static let bundle: Bundle = { - Bundle(for: BundleToken.self) + #if SWIFT_PACKAGE + return Bundle.module + #else + return Bundle(for: BundleToken.self) + #endif }() } // swiftlint:enable convenience_type diff --git a/Riot/Modules/Application/LegacyAppDelegate.m b/Riot/Modules/Application/LegacyAppDelegate.m index d5bf01093..12eef4d39 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.m +++ b/Riot/Modules/Application/LegacyAppDelegate.m @@ -2536,7 +2536,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni { MXLogDebug(@"WARNING: The user has no device. Prompt for login again"); - NSString *msg = [VectorL10n e2eEnablingOnAppUpdate:InfoPlist.cfBundleDisplayName]; + NSString *msg = [VectorL10n e2eEnablingOnAppUpdate:AppInfo.current.displayName]; __weak typeof(self) weakSelf = self; [_errorNotification dismissViewControllerAnimated:NO completion:nil]; diff --git a/Riot/Modules/Contacts/DataSources/ContactsDataSource.m b/Riot/Modules/Contacts/DataSources/ContactsDataSource.m index 28091db61..6d223cd95 100644 --- a/Riot/Modules/Contacts/DataSources/ContactsDataSource.m +++ b/Riot/Modules/Contacts/DataSources/ContactsDataSource.m @@ -651,7 +651,7 @@ default: { // Because the user didn't allow the app to access local contacts - tableViewCell.textLabel.text = [VectorL10n contactsAddressBookPermissionDenied:InfoPlist.cfBundleDisplayName]; + tableViewCell.textLabel.text = [VectorL10n contactsAddressBookPermissionDenied:AppInfo.current.displayName]; break; } } diff --git a/Riot/Modules/Home/VersionCheck/VersionCheckCoordinator.swift b/Riot/Modules/Home/VersionCheck/VersionCheckCoordinator.swift index 8bbe620e2..381642c9d 100644 --- a/Riot/Modules/Home/VersionCheck/VersionCheckCoordinator.swift +++ b/Riot/Modules/Home/VersionCheck/VersionCheckCoordinator.swift @@ -70,10 +70,10 @@ class VersionCheckCoordinator: Coordinator, VersionCheckBannerViewDelegate, Vers if Constants.hasOSVersionBeenDropped { versionCheckBannerView.configureWithDetails(VersionCheckBannerViewDetails(title: VectorL10n.versionCheckBannerTitleDeprecated(String(Constants.osVersionToBeDropped)), - subtitle: VectorL10n.versionCheckBannerSubtitleDeprecated(InfoPlist.cfBundleDisplayName, String(Constants.osVersionToBeDropped), InfoPlist.cfBundleDisplayName))) + subtitle: VectorL10n.versionCheckBannerSubtitleDeprecated(AppInfo.current.displayName, String(Constants.osVersionToBeDropped), AppInfo.current.displayName))) } else { versionCheckBannerView.configureWithDetails(VersionCheckBannerViewDetails(title: VectorL10n.versionCheckBannerTitleSupported(String(Constants.osVersionToBeDropped)), - subtitle: VectorL10n.versionCheckBannerSubtitleSupported(InfoPlist.cfBundleDisplayName, String(Constants.osVersionToBeDropped), InfoPlist.cfBundleDisplayName))) + subtitle: VectorL10n.versionCheckBannerSubtitleSupported(AppInfo.current.displayName, String(Constants.osVersionToBeDropped), AppInfo.current.displayName))) } bannerPresenter.presentBannerView(versionCheckBannerView, animated: true) @@ -93,11 +93,11 @@ class VersionCheckCoordinator: Coordinator, VersionCheckBannerViewDelegate, Vers if Constants.hasOSVersionBeenDropped { versionCheckAlertViewController.configureWithDetails(VersionCheckAlertViewControllerDetails(title: VectorL10n.versionCheckModalTitleDeprecated(String(Constants.osVersionToBeDropped)), - subtitle: VectorL10n.versionCheckModalSubtitleDeprecated(InfoPlist.cfBundleDisplayName, InfoPlist.cfBundleDisplayName), + subtitle: VectorL10n.versionCheckModalSubtitleDeprecated(AppInfo.current.displayName, AppInfo.current.displayName), actionButtonTitle: VectorL10n.versionCheckModalActionTitleDeprecated)) } else { versionCheckAlertViewController.configureWithDetails(VersionCheckAlertViewControllerDetails(title: VectorL10n.versionCheckModalTitleSupported(String(Constants.osVersionToBeDropped)), - subtitle: VectorL10n.versionCheckModalSubtitleSupported(InfoPlist.cfBundleDisplayName, InfoPlist.cfBundleDisplayName), + subtitle: VectorL10n.versionCheckModalSubtitleSupported(AppInfo.current.displayName, AppInfo.current.displayName), actionButtonTitle: VectorL10n.versionCheckModalActionTitleSupported)) } diff --git a/Riot/Modules/KeyVerification/Device/SelfVerifyWait/KeyVerificationSelfVerifyWaitViewController.swift b/Riot/Modules/KeyVerification/Device/SelfVerifyWait/KeyVerificationSelfVerifyWaitViewController.swift index 52369cc60..dd988c45e 100644 --- a/Riot/Modules/KeyVerification/Device/SelfVerifyWait/KeyVerificationSelfVerifyWaitViewController.swift +++ b/Riot/Modules/KeyVerification/Device/SelfVerifyWait/KeyVerificationSelfVerifyWaitViewController.swift @@ -123,12 +123,12 @@ final class KeyVerificationSelfVerifyWaitViewController: UIViewController { self.title = VectorL10n.deviceVerificationSelfVerifyWaitTitle - self.informationLabel.text = VectorL10n.deviceVerificationSelfVerifyWaitInformation(InfoPlist.cfBundleDisplayName) + self.informationLabel.text = VectorL10n.deviceVerificationSelfVerifyWaitInformation(AppInfo.current.displayName) self.desktopClientImageView.image = Asset.Images.monitor.image.withRenderingMode(.alwaysTemplate) self.mobileClientImageView.image = Asset.Images.smartphone.image.withRenderingMode(.alwaysTemplate) - self.additionalInformationLabel.text = VectorL10n.deviceVerificationSelfVerifyWaitAdditionalInformation(InfoPlist.cfBundleDisplayName) + self.additionalInformationLabel.text = VectorL10n.deviceVerificationSelfVerifyWaitAdditionalInformation(AppInfo.current.displayName) self.recoverSecretsAdditionalInformationLabel.text = VectorL10n.deviceVerificationSelfVerifyWaitRecoverSecretsAdditionalInformation } diff --git a/Riot/Modules/MajorUpdate/MajorUpdateViewController.swift b/Riot/Modules/MajorUpdate/MajorUpdateViewController.swift index 5c3fbe55a..0b57526ef 100644 --- a/Riot/Modules/MajorUpdate/MajorUpdateViewController.swift +++ b/Riot/Modules/MajorUpdate/MajorUpdateViewController.swift @@ -121,7 +121,7 @@ final class MajorUpdateViewController: UIViewController { self.disclosureImageView.image = Asset.Images.disclosureIcon.image self.newLogoImageView.image = Asset.Images.launchScreenLogo.image - self.titleLabel.text = VectorL10n.majorUpdateTitle(InfoPlist.cfBundleDisplayName) + self.titleLabel.text = VectorL10n.majorUpdateTitle(AppInfo.current.displayName) self.informationLabel.text = VectorL10n.majorUpdateInformation self.learnMoreButton.setTitle(VectorL10n.majorUpdateLearnMoreAction, for: .normal) diff --git a/Riot/Modules/Room/RoomViewController.m b/Riot/Modules/Room/RoomViewController.m index 021e79f65..249b93f9a 100644 --- a/Riot/Modules/Room/RoomViewController.m +++ b/Riot/Modules/Room/RoomViewController.m @@ -5653,7 +5653,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05; // Show the explanation dialog alert = [UIAlertController alertControllerWithTitle:VectorL10n.rerequestKeysAlertTitle - message:[VectorL10n e2eRoomKeyRequestMessage:InfoPlist.cfBundleDisplayName] + message:[VectorL10n e2eRoomKeyRequestMessage:AppInfo.current.displayName] preferredStyle:UIAlertControllerStyleAlert]; currentAlert = alert; diff --git a/Riot/Modules/Settings/Security/SecurityViewController.m b/Riot/Modules/Settings/Security/SecurityViewController.m index 92dbe1017..b09aec119 100644 --- a/Riot/Modules/Settings/Security/SecurityViewController.m +++ b/Riot/Modules/Settings/Security/SecurityViewController.m @@ -853,7 +853,7 @@ TableViewSectionsDelegate> - (void)displayComingSoon { - [[AppDelegate theDelegate] showAlertWithTitle:nil message:[VectorL10n securitySettingsComingSoon:InfoPlist.cfBundleDisplayName :InfoPlist.cfBundleDisplayName]]; + [[AppDelegate theDelegate] showAlertWithTitle:nil message:[VectorL10n securitySettingsComingSoon:AppInfo.current.displayName :AppInfo.current.displayName]]; } diff --git a/RiotNSE/target.yml b/RiotNSE/target.yml index 18c6022a5..84aa3f64b 100644 --- a/RiotNSE/target.yml +++ b/RiotNSE/target.yml @@ -43,7 +43,6 @@ targets: - path: ../Config/CommonConfiguration.swift - path: ../Riot/Managers/PushNotification/PushNotificationStore.swift - path: ../Riot/Modules/SetPinCode/PinCodePreferences.swift - - path: ../Riot/Generated/InfoPlist.swift - path: ../Riot/Managers/KeyValueStorage/Extensions/Keychain.swift - path: ../Riot/Modules/SetPinCode/SetupBiometrics/BiometricsAuthenticationPresenter.swift - path: ../Riot/Categories/UNUserNotificationCenter.swift diff --git a/RiotShareExtension/target.yml b/RiotShareExtension/target.yml index 37caa3f2b..e9c2653d8 100644 --- a/RiotShareExtension/target.yml +++ b/RiotShareExtension/target.yml @@ -41,7 +41,6 @@ targets: - path: ../Riot/Categories/Bundle.swift - path: ../Riot/Managers/Theme/ - path: ../Riot/Utils/AvatarGenerator.m - - path: ../Riot/Generated/InfoPlist.swift - path: ../Config/BuildSettings.swift - path: ../Riot/Categories/Character.swift - path: ../Riot/Categories/MXRoom+Riot.m diff --git a/RiotTests/target.yml b/RiotTests/target.yml index c32e1c8d9..b07bd2911 100644 --- a/RiotTests/target.yml +++ b/RiotTests/target.yml @@ -60,7 +60,6 @@ targets: - path: ../Config/AppConfiguration.swift - path: ../Config/CommonConfiguration.swift - path: ../Riot/Categories/Bundle.swift - - path: ../Riot/Generated/InfoPlist.swift - path: ../Riot/Managers/Settings/RiotSettings.swift - path: ../Riot/Managers/EncryptionKeyManager/EncryptionKeyManager.swift - path: ../Riot/Managers/KeyValueStorage/ diff --git a/SiriIntents/target.yml b/SiriIntents/target.yml index 3c2d458f5..01b844632 100644 --- a/SiriIntents/target.yml +++ b/SiriIntents/target.yml @@ -40,7 +40,6 @@ targets: sources: - path: . - - path: ../Riot/Generated/InfoPlist.swift - path: ../Riot/Categories/Bundle.swift - path: ../Config/CommonConfiguration.swift - path: ../Config/BuildSettings.swift diff --git a/Tools/SwiftGen/swiftgen-config.yml b/Tools/SwiftGen/swiftgen-config.yml index 708361d19..2a4015052 100755 --- a/Tools/SwiftGen/swiftgen-config.yml +++ b/Tools/SwiftGen/swiftgen-config.yml @@ -30,12 +30,3 @@ plist: output: RiotDefaults.swift params: enumName: RiotDefaults - -plist: - inputs: SupportingFiles/Info.plist - outputs: - templatePath: Templates/Plist/runtime-swift5.stencil - output: InfoPlist.swift - params: - className: InfoPlist - publicAccess: true