From c2594ddfb18f66b79a5dec5f7c7bab5db7ca0ff6 Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Fri, 7 Oct 2022 20:58:07 +0200 Subject: [PATCH 1/3] Include app name in default session display name --- .../Resources/Localizations/en.lproj/Untranslated.strings | 3 +++ ElementX/Sources/Generated/InfoPlist.swift | 1 + ElementX/Sources/Generated/Strings+Untranslated.swift | 4 ++++ ElementX/Sources/Other/Extensions/UIDevice.swift | 3 +-- ElementX/SupportingFiles/Info.plist | 2 ++ ElementX/SupportingFiles/target.yml | 1 + 6 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ElementX/Resources/Localizations/en.lproj/Untranslated.strings b/ElementX/Resources/Localizations/en.lproj/Untranslated.strings index 1b2cd9cbe5..a421c4abf2 100644 --- a/ElementX/Resources/Localizations/en.lproj/Untranslated.strings +++ b/ElementX/Resources/Localizations/en.lproj/Untranslated.strings @@ -27,3 +27,6 @@ "login_tablet_device" = "Tablet"; "a11y_all_chats_user_avatar_menu" = "User menu"; + +// Parameter is the application display name (e.g. "ElementX") +"default_session_display_name" = "%@ iOS"; diff --git a/ElementX/Sources/Generated/InfoPlist.swift b/ElementX/Sources/Generated/InfoPlist.swift index 7eddc05be6..7761548751 100644 --- a/ElementX/Sources/Generated/InfoPlist.swift +++ b/ElementX/Sources/Generated/InfoPlist.swift @@ -13,6 +13,7 @@ internal enum ElementInfoPlist { private static let _document = PlistDocument(path: "Info.plist") internal static let cfBundleDevelopmentRegion: String = _document["CFBundleDevelopmentRegion"] + internal static let cfBundleDisplayName: String = _document["CFBundleDisplayName"] internal static let cfBundleExecutable: String = _document["CFBundleExecutable"] internal static let cfBundleIdentifier: String = _document["CFBundleIdentifier"] internal static let cfBundleInfoDictionaryVersion: String = _document["CFBundleInfoDictionaryVersion"] diff --git a/ElementX/Sources/Generated/Strings+Untranslated.swift b/ElementX/Sources/Generated/Strings+Untranslated.swift index 82c45598c4..c8b0f217b1 100644 --- a/ElementX/Sources/Generated/Strings+Untranslated.swift +++ b/ElementX/Sources/Generated/Strings+Untranslated.swift @@ -16,6 +16,10 @@ extension ElementL10n { public static let actionConfirm = ElementL10n.tr("Untranslated", "action_confirm") /// Match public static let actionMatch = ElementL10n.tr("Untranslated", "action_match") + /// %@ iOS + public static func defaultSessionDisplayName(_ p1: Any) -> String { + return ElementL10n.tr("Untranslated", "default_session_display_name", String(describing: p1)) + } /// Mobile public static let loginMobileDevice = ElementL10n.tr("Untranslated", "login_mobile_device") /// Tablet diff --git a/ElementX/Sources/Other/Extensions/UIDevice.swift b/ElementX/Sources/Other/Extensions/UIDevice.swift index c3c00713ef..14a0364177 100644 --- a/ElementX/Sources/Other/Extensions/UIDevice.swift +++ b/ElementX/Sources/Other/Extensions/UIDevice.swift @@ -23,7 +23,6 @@ extension UIDevice { } var initialDisplayName: String { - let string = isPhone ? ElementL10n.loginMobileDevice : ElementL10n.loginTabletDevice - return "X \(string)" + ElementL10n.defaultSessionDisplayName(ElementInfoPlist.cfBundleDisplayName) } } diff --git a/ElementX/SupportingFiles/Info.plist b/ElementX/SupportingFiles/Info.plist index 49fd47fa1f..2240a5e892 100644 --- a/ElementX/SupportingFiles/Info.plist +++ b/ElementX/SupportingFiles/Info.plist @@ -4,6 +4,8 @@ CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + $(PRODUCT_NAME) CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier diff --git a/ElementX/SupportingFiles/target.yml b/ElementX/SupportingFiles/target.yml index 488b21da0d..e671055b54 100644 --- a/ElementX/SupportingFiles/target.yml +++ b/ElementX/SupportingFiles/target.yml @@ -36,6 +36,7 @@ targets: path: ../SupportingFiles/Info.plist properties: UILaunchStoryboardName: LaunchScreen + CFBundleDisplayName: $(PRODUCT_NAME) CFBundleShortVersionString: $(MARKETING_VERSION) CFBundleVersion: $(CURRENT_PROJECT_VERSION) UISupportedInterfaceOrientations: [ From 669f78bc3ecb644b8369e7a39140141df07af795 Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Fri, 7 Oct 2022 21:04:30 +0200 Subject: [PATCH 2/3] Add changelog --- changelog.d/227.change | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/227.change diff --git a/changelog.d/227.change b/changelog.d/227.change new file mode 100644 index 0000000000..397c9250d7 --- /dev/null +++ b/changelog.d/227.change @@ -0,0 +1 @@ +Include app name in default session display name From 90cbf9aae0b087fe38da372d9b10f5425021f744 Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Thu, 13 Oct 2022 20:36:56 +0200 Subject: [PATCH 3/3] Use bundle display name everywhere --- .../Screens/AnalyticsPrompt/AnalyticsPromptModels.swift | 4 ++-- .../Screens/AnalyticsPrompt/View/AnalyticsPrompt.swift | 2 +- .../Sources/Screens/HomeScreen/HomeScreenCoordinator.swift | 2 +- .../Sources/Screens/SplashScreen/SplashScreenModels.swift | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ElementX/Sources/Screens/AnalyticsPrompt/AnalyticsPromptModels.swift b/ElementX/Sources/Screens/AnalyticsPrompt/AnalyticsPromptModels.swift index aa1e245e72..40d0bcb965 100644 --- a/ElementX/Sources/Screens/AnalyticsPrompt/AnalyticsPromptModels.swift +++ b/ElementX/Sources/Screens/AnalyticsPrompt/AnalyticsPromptModels.swift @@ -44,10 +44,10 @@ struct AnalyticsPromptStrings { init() { // Create the opt in content with a placeholder. let linkPlaceholder = "{link}" - var optInContent = AttributedString(ElementL10n.analyticsOptInContent(ElementInfoPlist.cfBundleName, linkPlaceholder)) + var optInContent = AttributedString(ElementL10n.analyticsOptInContent(ElementInfoPlist.cfBundleDisplayName, linkPlaceholder)) guard let range = optInContent.range(of: linkPlaceholder) else { - self.optInContent = AttributedString(ElementL10n.analyticsOptInContent(ElementInfoPlist.cfBundleName, + self.optInContent = AttributedString(ElementL10n.analyticsOptInContent(ElementInfoPlist.cfBundleDisplayName, ElementL10n.analyticsOptInContentLink)) MXLog.failure("Failed to add a link attribute to the opt in content.") return diff --git a/ElementX/Sources/Screens/AnalyticsPrompt/View/AnalyticsPrompt.swift b/ElementX/Sources/Screens/AnalyticsPrompt/View/AnalyticsPrompt.swift index 25fac688aa..29f18c1e50 100644 --- a/ElementX/Sources/Screens/AnalyticsPrompt/View/AnalyticsPrompt.swift +++ b/ElementX/Sources/Screens/AnalyticsPrompt/View/AnalyticsPrompt.swift @@ -67,7 +67,7 @@ struct AnalyticsPrompt: View { Image(uiImage: Asset.Images.analyticsLogo.image) .padding(.bottom, 25) - Text(ElementL10n.analyticsOptInTitle(ElementInfoPlist.cfBundleName)) + Text(ElementL10n.analyticsOptInTitle(ElementInfoPlist.cfBundleDisplayName)) .font(.element.title2Bold) .multilineTextAlignment(.center) .foregroundColor(.element.primaryContent) diff --git a/ElementX/Sources/Screens/HomeScreen/HomeScreenCoordinator.swift b/ElementX/Sources/Screens/HomeScreen/HomeScreenCoordinator.swift index 041880db64..e0dd6a0c7f 100644 --- a/ElementX/Sources/Screens/HomeScreen/HomeScreenCoordinator.swift +++ b/ElementX/Sources/Screens/HomeScreen/HomeScreenCoordinator.swift @@ -101,7 +101,7 @@ final class HomeScreenCoordinator: Coordinator, Presentable { guard let permalink = try? PermalinkBuilder.permalinkTo(userIdentifier: parameters.userSession.userID).absoluteString else { return } - let shareText = ElementL10n.inviteFriendsText(ElementInfoPlist.cfBundleName, permalink) + let shareText = ElementL10n.inviteFriendsText(ElementInfoPlist.cfBundleDisplayName, permalink) let vc = UIActivityViewController(activityItems: [shareText], applicationActivities: nil) hostingController.present(vc, animated: true) } diff --git a/ElementX/Sources/Screens/SplashScreen/SplashScreenModels.swift b/ElementX/Sources/Screens/SplashScreen/SplashScreenModels.swift index 2621f48e53..8ad831804a 100644 --- a/ElementX/Sources/Screens/SplashScreen/SplashScreenModels.swift +++ b/ElementX/Sources/Screens/SplashScreen/SplashScreenModels.swift @@ -79,7 +79,7 @@ struct SplashScreenViewState: BindableState { message: ElementL10n.ftueAuthCarouselEncryptedBody, image: Asset.Images.splashScreenPage3), SplashScreenPageContent(title: page4Title.tinting("."), - message: ElementL10n.ftueAuthCarouselWorkplaceBody(ElementInfoPlist.cfBundleName), + message: ElementL10n.ftueAuthCarouselWorkplaceBody(ElementInfoPlist.cfBundleDisplayName), image: Asset.Images.splashScreenPage4) ] bindings = SplashScreenBindings()