Skip to content

Commit

Permalink
Improve refresh token
Browse files Browse the repository at this point in the history
  • Loading branch information
afterxleep committed Apr 8, 2024
1 parent 1c61816 commit 926e38a
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ final class SubscriptionRestoreViewModel: ObservableObject {
func onFirstAppear() async {
Pixel.fire(pixel: .privacyProSettingsAddDevice)
await setupTransactionObserver()
await refreshToken()
}

private func cleanUp() {
Expand All @@ -87,14 +88,14 @@ final class SubscriptionRestoreViewModel: ObservableObject {
}

private func refreshToken() async {
await AppStoreAccountManagementFlow.refreshAuthTokenIfNeeded(subscriptionAppGroup: Bundle.main.appGroup(bundle: .subs))
if state.isAddingDevice {
await AppStoreAccountManagementFlow.refreshAuthTokenIfNeeded(subscriptionAppGroup: Bundle.main.appGroup(bundle: .subs))
}
}

private func setupContent() async {
if state.isAddingDevice {

await refreshToken()

DispatchQueue.main.async {
self.state.isLoading = true
}
Expand Down

0 comments on commit 926e38a

Please sign in to comment.