Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Calling VPN churn billing and mixing it with StoreKit functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
soner-yuksel committed Sep 25, 2023
1 parent ce4d728 commit b8c2b13
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
8 changes: 2 additions & 6 deletions Sources/Brave/Frontend/Browser/BrowserViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1101,12 +1101,8 @@ public class BrowserViewController: UIViewController {
}
}

private func checkCrashRestorationOrSetupTabs() {
if crashedLastSession {
showRestoreTabsAlert()
} else {
setupTabs()
}
private func checkCrashRestorationOrSetupTabs() {
setupTabs()
}

fileprivate func showRestoreTabsAlert() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import SwiftUI
import BraveVPN
import Onboarding
import SafariServices
import StoreKit

// MARK: - Callouts

Expand Down Expand Up @@ -264,9 +265,27 @@ extension BrowserViewController {
return
}
}


#if compiler(>=5.8)
if #available(iOS 16.4, *) {
if #available(iOS 16.4, *) {
Task { @MainActor in
for await message in StoreKit.Message.messages {
guard let windowScene = currentScene else {
return
}

try? message.display(in: windowScene)
}
}
} else {
presentVPNChurnBilling()
}
#else
presentVPNChurnBilling()
#endif

func presentVPNChurnBilling() {
presentVPNChurnPromoCallout(for: .updateBillingExpired) {
// Opens Apple's 'manage subscription' screen
guard let url = URL.apple.manageSubscriptions else { return }
Expand All @@ -276,7 +295,6 @@ extension BrowserViewController {
}
}
}
#endif
}

// MARK: Helper Methods for Presentation
Expand Down

0 comments on commit b8c2b13

Please sign in to comment.