Skip to content

Commit

Permalink
Adopted latest SKStoreReviewController API changes in ReviewActions
Browse files Browse the repository at this point in the history
  • Loading branch information
sitomani committed Feb 13, 2024
1 parent b4e8a1a commit d4ef6aa
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion 4champ/Utils/ReviewActions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@
import Foundation
import StoreKit

extension SKStoreReviewController {
public static func requestReviewInCurrentScene() {
if let scene = UIApplication.shared.connectedScenes.first(where: { $0.activationState == .foregroundActive }) as? UIWindowScene {
DispatchQueue.main.async {
requestReview(in: scene)
}
}
}
}

/// Enumeration used to trigger AppStore review requests
enum ReviewActions: String {

Expand Down Expand Up @@ -46,7 +56,7 @@ enum ReviewActions: String {
return
}

SKStoreReviewController.requestReview()
SKStoreReviewController.requestReviewInCurrentScene()

// Reset the defaults
defaults.set(0, forKey: ReviewActions.noteworthyActionCount.rawValue)
Expand Down

0 comments on commit d4ef6aa

Please sign in to comment.