Fixes #4881 - Replaced InfoPlist.cfBundleDisplayName with AppInfo.current.displayName and removed the now unused InfoPlist generated class.

This commit is contained in:
Stefan Ceriu 2021-09-22 16:59:47 +03:00
parent 0848f66cdb
commit 388d828c2b
14 changed files with 19 additions and 123 deletions

View file

@ -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<T>(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<T>(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

View file

@ -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<T>(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

View file

@ -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];

View file

@ -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;
}
}

View file

@ -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))
}

View file

@ -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
}

View file

@ -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)

View file

@ -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;

View file

@ -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]];
}

View file

@ -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

View file

@ -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

View file

@ -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/

View file

@ -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

View file

@ -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