Verify profile before presenting interactive login (#893)

If the profile is ineligible for features other than .interactiveLogin,
the interactive prompt would still be presented, but the user would hit
the paywall right afterwards.
This commit is contained in:
Davide 2024-11-19 11:46:42 +01:00 committed by GitHub
parent 35c10309a7
commit 9528cecc27
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 5 deletions

View File

@ -111,16 +111,15 @@ private extension TunnelToggleButton {
} }
} }
if canConnect && profile.isInteractive { if canConnect && profile.isInteractive {
do {
// ineligible, suppress interactive login try iapManager.verify(profile)
if !iapManager.isEligible(for: .interactiveLogin) {
pp_log(.app, .notice, "Ineligible, suppress interactive login")
} else {
pp_log(.app, .notice, "Present interactive login") pp_log(.app, .notice, "Present interactive login")
interactiveManager.present(with: profile) { interactiveManager.present(with: profile) {
await perform(with: $0) await perform(with: $0)
} }
return return
} catch {
pp_log(.app, .notice, "Ineligible, suppress interactive login")
} }
} }
await perform(with: profile) await perform(with: profile)