From c3f5d9f2189e5d2d1d10e584d52b9d499eb6189f Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Wed, 14 Jun 2023 18:51:34 -0700 Subject: [PATCH] fix(MDC): use free app limit for messages instead of hardcoding 3 it might be better to specify "with MDC" --- AltStore/Managing Apps/AppManager.swift | 10 +++++----- AltStore/SwiftUI/Helper/SideloadingManager.swift | 2 +- AltStore/UIKit/My Apps/MyAppsViewController.swift | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/AltStore/Managing Apps/AppManager.swift b/AltStore/Managing Apps/AppManager.swift index fc28cfba..c10b7e90 100644 --- a/AltStore/Managing Apps/AppManager.swift +++ b/AltStore/Managing Apps/AppManager.swift @@ -250,26 +250,26 @@ extension AppManager .filter { $0.bundleIdentifier != app.bundleIdentifier } // Don't count app towards total if it matches activating app .sorted { ($0.name, $0.refreshedDate) < ($1.name, $1.refreshedDate) } - var title: String = NSLocalizedString("Cannot Activate More than 3 Apps", comment: "") + var title: String = NSLocalizedString("Cannot Activate More than \(InstalledApp.freeAccountActiveAppsLimit) Apps", comment: "") let message: String if UserDefaults.standard.activeAppLimitIncludesExtensions { if app.appExtensions.isEmpty { - message = NSLocalizedString("Non-developer Apple IDs are limited to 3 active apps and app extensions. Please choose an app to deactivate.", comment: "") + message = NSLocalizedString("Non-developer Apple IDs are limited to \(InstalledApp.freeAccountActiveAppsLimit) active apps and app extensions. Please choose an app to deactivate.", comment: "") } else { - title = NSLocalizedString("Cannot Activate More than 3 Apps and App Extensions", comment: "") + title = NSLocalizedString("Cannot Activate More than \(InstalledApp.freeAccountActiveAppsLimit) Apps and App Extensions", comment: "") let appExtensionText = app.appExtensions.count == 1 ? NSLocalizedString("app extension", comment: "") : NSLocalizedString("app extensions", comment: "") - message = String(format: NSLocalizedString("Non-developer Apple IDs are limited to 3 active apps and app extensions, and “%@” contains %@ %@. Please choose an app to deactivate.", comment: ""), app.name, NSNumber(value: app.appExtensions.count), appExtensionText) + message = String(format: NSLocalizedString("Non-developer Apple IDs are limited to \(InstalledApp.freeAccountActiveAppsLimit) active apps and app extensions, and “%@” contains %@ %@. Please choose an app to deactivate.", comment: ""), app.name, NSNumber(value: app.appExtensions.count), appExtensionText) } } else { - message = NSLocalizedString("Non-developer Apple IDs are limited to 3 active apps. Please choose an app to deactivate.", comment: "") + message = NSLocalizedString("Non-developer Apple IDs are limited to \(InstalledApp.freeAccountActiveAppsLimit) active apps. Please choose an app to deactivate.", comment: "") } let activeAppsCount = activeApps.map { $0.requiredActiveSlots }.reduce(0, +) diff --git a/AltStore/SwiftUI/Helper/SideloadingManager.swift b/AltStore/SwiftUI/Helper/SideloadingManager.swift index 8075d62d..4c0972a1 100644 --- a/AltStore/SwiftUI/Helper/SideloadingManager.swift +++ b/AltStore/SwiftUI/Helper/SideloadingManager.swift @@ -216,7 +216,7 @@ class SideloadingManager { if UserDefaults.standard.activeAppLimitIncludesExtensions { - firstSentence = NSLocalizedString("Non-developer Apple IDs are limited to 3 active apps and app extensions.", comment: "") + firstSentence = NSLocalizedString("Non-developer Apple IDs are limited to \(InstalledApp.freeAccountActiveAppsLimit) active apps and app extensions.", comment: "") } else { diff --git a/AltStore/UIKit/My Apps/MyAppsViewController.swift b/AltStore/UIKit/My Apps/MyAppsViewController.swift index 9f968e16..c22eac45 100644 --- a/AltStore/UIKit/My Apps/MyAppsViewController.swift +++ b/AltStore/UIKit/My Apps/MyAppsViewController.swift @@ -934,11 +934,11 @@ private extension MyAppsViewController if UserDefaults.standard.activeAppLimitIncludesExtensions { - message = NSLocalizedString("Non-developer Apple IDs are limited to 3 apps and app extensions. Inactive apps don't count towards your total, but cannot be opened until activated.", comment: "") + message = NSLocalizedString("Non-developer Apple IDs are limited to \(InstalledApp.freeAccountActiveAppsLimit) apps and app extensions. Inactive apps don't count towards your total, but cannot be opened until activated.", comment: "") } else { - message = NSLocalizedString("Non-developer Apple IDs are limited to 3 apps. Inactive apps are backed up and uninstalled so they don't count towards your total, but will be reinstalled with all their data when activated again.", comment: "") + message = NSLocalizedString("Non-developer Apple IDs are limited to \(InstalledApp.freeAccountActiveAppsLimit) apps. Inactive apps are backed up and uninstalled so they don't count towards your total, but will be reinstalled with all their data when activated again.", comment: "") } let alertController = UIAlertController(title: NSLocalizedString("What are inactive apps?", comment: ""), message: message, preferredStyle: .alert) @@ -964,7 +964,7 @@ private extension MyAppsViewController if UserDefaults.standard.activeAppLimitIncludesExtensions { - firstSentence = NSLocalizedString("Non-developer Apple IDs are limited to 3 active apps and app extensions.", comment: "") + firstSentence = NSLocalizedString("Non-developer Apple IDs are limited to \(InstalledApp.freeAccountActiveAppsLimit) active apps and app extensions.", comment: "") } else {