1 import ABI47_0_0ExpoModulesCore
2 import StoreKit
3 
4 public class StoreReviewModule: Module {
definitionnull5   public func definition() -> ModuleDefinition {
6     Name("ExpoStoreReview")
7 
8     AsyncFunction("isAvailableAsync") { () -> Bool in
9       return true
10     }
11 
12     AsyncFunction("requestReview") {
13       if #available(iOS 15, *) {
14         guard let currentScene = UIApplication.shared.connectedScenes.first as? UIWindowScene else {
15           throw MissingCurrentWindowSceneException()
16         }
17 
18         SKStoreReviewController.requestReview(in: currentScene)
19       } else {
20         SKStoreReviewController.requestReview()
21       }
22     }.runOnQueue(DispatchQueue.main)
23   }
24 }
25