From 0ad9ceaa95fd80276506e218fd68e85f8fda1d1f Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Fri, 1 Dec 2023 16:38:31 -0600 Subject: [PATCH] Disables actions for Patreon apps with expired pledges instead of hiding them --- AltStore/My Apps/MyAppsViewController.swift | 34 ++++++++++++++------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/AltStore/My Apps/MyAppsViewController.swift b/AltStore/My Apps/MyAppsViewController.swift index 8328d46a..4d11ffcb 100644 --- a/AltStore/My Apps/MyAppsViewController.swift +++ b/AltStore/My Apps/MyAppsViewController.swift @@ -1895,18 +1895,30 @@ extension MyAppsViewController let error = OperationError.pledgeInactive(appName: installedApp.name) title = error.localizedDescription - // Limit options for apps requiring pledges that we are no longer pledged to. - actions = actions.filter { - $0 == openMenu || - $0 == deactivateAction || - $0 == removeAction || - $0 == backupAction || - $0 == exportBackupAction || - ($0 == refreshAction && storeApp.bundleIdentifier == StoreApp.altstoreAppID) // Always show refresh option for AltStore so the menu will be shown. - } + let allowedActions: Set = [ + openMenu, + deactivateAction, + removeAction, + backupAction, + exportBackupAction + ] - // Disable refresh action for AltStore. - refreshAction.attributes = .disabled + for action in actions where !allowedActions.contains(action) + { + // Disable options for Patreon apps that we are no longer pledged to. + + if let action = action as? UIAction + { + action.attributes = .disabled + } + else if let menu = action as? UIMenu + { + for case let action as UIAction in menu.children + { + action.attributes = .disabled + } + } + } } let menu = UIMenu(title: title ?? "", children: actions)