From d1b619a5b5fa59f6503e8cc07364f5009b6da8f1 Mon Sep 17 00:00:00 2001 From: SynthesOne Date: Thu, 22 Aug 2024 10:08:31 +0500 Subject: [PATCH] add new config key --- Sources/General/MPPresenter.swift | 10 ++++++++-- Sources/General/MPUIConfiguration.swift | 4 ++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Sources/General/MPPresenter.swift b/Sources/General/MPPresenter.swift index 386fa48..05deb60 100644 --- a/Sources/General/MPPresenter.swift +++ b/Sources/General/MPPresenter.swift @@ -85,8 +85,14 @@ public final class MPPresenter: NSObject { } private func showNoAuthAlert() { - let alert = Alert(message: Lang.notAuthPhotos, { - Action.cancel(Lang.ok) + let alert = Alert(message: Lang.notAuthPhotos, { [weak self] in + if self?.config.uiConfig.showOpenSettingsButton == true { + Action.default(Lang.changeSettings, action: { + guard let url = URL(string: UIApplication.openSettingsURLString) else { return } + UIApplication.shared.open(url, options: [:]) + }) + } + Action.cancel(Lang.cancel) }) if isIpad { diff --git a/Sources/General/MPUIConfiguration.swift b/Sources/General/MPUIConfiguration.swift index 9759c1c..39c304e 100644 --- a/Sources/General/MPUIConfiguration.swift +++ b/Sources/General/MPUIConfiguration.swift @@ -57,6 +57,10 @@ public struct MPUIConfiguration { MPFontDeploy.nameSpace = customFontName } } + + /// If access is denied to Photo + /// Determines whether to show a button to open settings + public var showOpenSettingsButton = true } enum MPFontDeploy {