expo-store-review 5.2.0 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -10,6 +10,22 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 6.0.0 — 2022-10-25
14
+
15
+ ### 🛠 Breaking changes
16
+
17
+ - Bumped iOS deployment target to 13.0 and deprecated support for iOS 12. ([#18873](https://github.com/expo/expo/pull/18873) by [@tsapeta](https://github.com/tsapeta))
18
+
19
+ ### 🎉 New features
20
+
21
+ - Native module on iOS is now written in Swift using the Sweet API. ([#19467](https://github.com/expo/expo/pull/19467) by [@fobos531](https://github.com/fobos531))
22
+
23
+ ## 5.3.0 — 2022-07-07
24
+
25
+ ### 🐛 Bug fixes
26
+
27
+ - Fixed null pointer exception when store review request failed on Android. ([#16365](https://github.com/expo/expo/pull/16365) by [@mariomurrent-softwaresolutions](https://github.com/mariomurrent-softwaresolutions))
28
+
13
29
  ## 5.2.0 — 2022-04-18
14
30
 
15
31
  ### ⚠️ Notices
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
3
3
  apply plugin: 'maven-publish'
4
4
 
5
5
  group = 'host.exp.exponent'
6
- version = '5.2.0'
6
+ version = '6.0.0'
7
7
 
8
8
  buildscript {
9
9
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
@@ -74,7 +74,7 @@ android {
74
74
  minSdkVersion safeExtGet("minSdkVersion", 21)
75
75
  targetSdkVersion safeExtGet("targetSdkVersion", 31)
76
76
  versionCode 4
77
- versionName "5.2.0"
77
+ versionName "6.0.0"
78
78
  }
79
79
  lintOptions {
80
80
  abortOnError false
@@ -53,7 +53,7 @@ class StoreReviewModule(private val mContext: Context) :
53
53
  }
54
54
  }
55
55
  } else {
56
- promise.reject(null)
56
+ promise.reject("ERR_STORE_REVIEW_FAILED", "Android ReviewManager task was not successful")
57
57
  }
58
58
  }
59
59
  }
@@ -1,3 +1,3 @@
1
- declare const _default: import("expo-modules-core").ProxyNativeModule;
1
+ declare const _default: any;
2
2
  export default _default;
3
3
  //# sourceMappingURL=ExpoStoreReview.native.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoStoreReview.native.d.ts","sourceRoot":"","sources":["../src/ExpoStoreReview.native.ts"],"names":[],"mappings":";AACA,wBAAkD"}
1
+ {"version":3,"file":"ExpoStoreReview.native.d.ts","sourceRoot":"","sources":["../src/ExpoStoreReview.native.ts"],"names":[],"mappings":";AACA,wBAAsD"}
@@ -1,3 +1,3 @@
1
- import { NativeModulesProxy } from 'expo-modules-core';
2
- export default NativeModulesProxy.ExpoStoreReview;
1
+ import { requireNativeModule } from 'expo-modules-core';
2
+ export default requireNativeModule('ExpoStoreReview');
3
3
  //# sourceMappingURL=ExpoStoreReview.native.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoStoreReview.native.js","sourceRoot":"","sources":["../src/ExpoStoreReview.native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,eAAe,kBAAkB,CAAC,eAAe,CAAC","sourcesContent":["import { NativeModulesProxy } from 'expo-modules-core';\nexport default NativeModulesProxy.ExpoStoreReview;\n"]}
1
+ {"version":3,"file":"ExpoStoreReview.native.js","sourceRoot":"","sources":["../src/ExpoStoreReview.native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,eAAe,mBAAmB,CAAC,iBAAiB,CAAC,CAAC","sourcesContent":["import { requireNativeModule } from 'expo-modules-core';\nexport default requireNativeModule('ExpoStoreReview');\n"]}
@@ -2,7 +2,7 @@
2
2
  * Determines if the platform has the capabilities to use `StoreReview.requestReview()`.
3
3
  * @return
4
4
  * This returns a promise fulfills with `boolean`, depending on the platform:
5
- * - On iOS, it will resolve to `true` if the device is running iOS 10.3+.
5
+ * - On iOS, it will always resolve to `true`.
6
6
  * - On Android, it will resolve to `true` if the device is running Android 5.0+.
7
7
  * - On Web, it will resolve to `false`.
8
8
  */
@@ -10,8 +10,7 @@ export declare function isAvailableAsync(): Promise<boolean>;
10
10
  /**
11
11
  * In ideal circumstances this will open a native modal and allow the user to select a star rating
12
12
  * that will then be applied to the App Store, without leaving the app. If the device is running
13
- * a version of iOS lower than 10.3, or a version of Android lower than 5.0, this will attempt
14
- * to get the store URL and link the user to it.
13
+ * a version of Android lower than 5.0, this will attempt to get the store URL and link the user to it.
15
14
  */
16
15
  export declare function requestReview(): Promise<void>;
17
16
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"StoreReview.d.ts","sourceRoot":"","sources":["../src/StoreReview.ts"],"names":[],"mappings":"AAOA;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC,CAEzD;AAGD;;;;;GAKG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAoBnD;AAGD;;;;;GAKG;AACH,wBAAgB,QAAQ,IAAI,MAAM,GAAG,IAAI,CAYxC;AAGD;;;;;;;;;;;;GAYG;AACH,wBAAsB,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,CAElD"}
1
+ {"version":3,"file":"StoreReview.d.ts","sourceRoot":"","sources":["../src/StoreReview.ts"],"names":[],"mappings":"AAOA;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC,CAEzD;AAGD;;;;GAIG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAoBnD;AAGD;;;;;GAKG;AACH,wBAAgB,QAAQ,IAAI,MAAM,GAAG,IAAI,CAYxC;AAGD;;;;;;;;;;;;GAYG;AACH,wBAAsB,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,CAElD"}
@@ -7,7 +7,7 @@ import StoreReview from './ExpoStoreReview';
7
7
  * Determines if the platform has the capabilities to use `StoreReview.requestReview()`.
8
8
  * @return
9
9
  * This returns a promise fulfills with `boolean`, depending on the platform:
10
- * - On iOS, it will resolve to `true` if the device is running iOS 10.3+.
10
+ * - On iOS, it will always resolve to `true`.
11
11
  * - On Android, it will resolve to `true` if the device is running Android 5.0+.
12
12
  * - On Web, it will resolve to `false`.
13
13
  */
@@ -18,8 +18,7 @@ export async function isAvailableAsync() {
18
18
  /**
19
19
  * In ideal circumstances this will open a native modal and allow the user to select a star rating
20
20
  * that will then be applied to the App Store, without leaving the app. If the device is running
21
- * a version of iOS lower than 10.3, or a version of Android lower than 5.0, this will attempt
22
- * to get the store URL and link the user to it.
21
+ * a version of Android lower than 5.0, this will attempt to get the store URL and link the user to it.
23
22
  */
24
23
  export async function requestReview() {
25
24
  if (StoreReview?.requestReview) {
@@ -1 +1 @@
1
- {"version":3,"file":"StoreReview.js","sourceRoot":"","sources":["../src/StoreReview.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,WAAW,MAAM,mBAAmB,CAAC;AAE5C,cAAc;AACd;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,OAAO,WAAW,CAAC,gBAAgB,EAAE,CAAC;AACxC,CAAC;AAED,cAAc;AACd;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,IAAI,WAAW,EAAE,aAAa,EAAE;QAC9B,MAAM,WAAW,CAAC,aAAa,EAAE,CAAC;QAClC,OAAO;KACR;IACD,6GAA6G;IAC7G,MAAM,GAAG,GAAG,QAAQ,EAAE,CAAC;IACvB,IAAI,GAAG,EAAE;QACP,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QAChD,IAAI,CAAC,SAAS,EAAE;YACd,OAAO,CAAC,IAAI,CAAC,0DAA0D,EAAE,GAAG,CAAC,CAAC;SAC/E;aAAM;YACL,MAAM,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;SAC5B;KACF;SAAM;QACL,iDAAiD;QACjD,OAAO,CAAC,IAAI,CACV,oKAAoK,CACrK,CAAC;KACH;AACH,CAAC;AAED,cAAc;AACd;;;;;GAKG;AACH,MAAM,UAAU,QAAQ;IACtB,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,SAAS,CAAC;IAC1C,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,QAAQ,EAAE,GAAG,EAAE;QAC1C,OAAO,QAAQ,CAAC,GAAG,CAAC,WAAW,IAAI,IAAI,CAAC;KACzC;SAAM,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE;QACrE,OAAO,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,WAAW,IAAI,IAAI,CAAC;KAC3D;SAAM,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,IAAI,QAAQ,EAAE,OAAO,EAAE;QACzD,OAAO,QAAQ,CAAC,OAAO,CAAC,YAAY,IAAI,IAAI,CAAC;KAC9C;SAAM,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,IAAI,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE;QAC7E,OAAO,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,YAAY,IAAI,IAAI,CAAC;KAChE;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,cAAc;AACd;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS;IAC7B,OAAO,CAAC,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,gBAAgB,EAAE,CAAC,CAAC;AACpD,CAAC","sourcesContent":["import Constants from 'expo-constants';\nimport * as Linking from 'expo-linking';\nimport { Platform } from 'expo-modules-core';\n\nimport StoreReview from './ExpoStoreReview';\n\n// @needsAudit\n/**\n * Determines if the platform has the capabilities to use `StoreReview.requestReview()`.\n * @return\n * This returns a promise fulfills with `boolean`, depending on the platform:\n * - On iOS, it will resolve to `true` if the device is running iOS 10.3+.\n * - On Android, it will resolve to `true` if the device is running Android 5.0+.\n * - On Web, it will resolve to `false`.\n */\nexport async function isAvailableAsync(): Promise<boolean> {\n return StoreReview.isAvailableAsync();\n}\n\n// @needsAudit\n/**\n * In ideal circumstances this will open a native modal and allow the user to select a star rating\n * that will then be applied to the App Store, without leaving the app. If the device is running\n * a version of iOS lower than 10.3, or a version of Android lower than 5.0, this will attempt\n * to get the store URL and link the user to it.\n */\nexport async function requestReview(): Promise<void> {\n if (StoreReview?.requestReview) {\n await StoreReview.requestReview();\n return;\n }\n // If StoreReview is unavailable then get the store URL from `app.config.js` or `app.json` and open the store\n const url = storeUrl();\n if (url) {\n const supported = await Linking.canOpenURL(url);\n if (!supported) {\n console.warn(\"Expo.StoreReview.requestReview(): Can't open store url: \", url);\n } else {\n await Linking.openURL(url);\n }\n } else {\n // If the store URL is missing, let the dev know.\n console.warn(\n \"Expo.StoreReview.requestReview(): Couldn't link to store, please make sure the `android.playStoreUrl` & `ios.appStoreUrl` fields are filled out in your `app.json`\"\n );\n }\n}\n\n// @needsAudit\n/**\n * This uses the `Constants` API to get the `Constants.manifest.ios.appStoreUrl` on iOS, or the\n * `Constants.manifest.android.playStoreUrl` on Android.\n *\n * On Web this will return `null`.\n */\nexport function storeUrl(): string | null {\n const { manifest, manifest2 } = Constants;\n if (Platform.OS === 'ios' && manifest?.ios) {\n return manifest.ios.appStoreUrl ?? null;\n } else if (Platform.OS === 'ios' && manifest2?.extra?.expoClient?.ios) {\n return manifest2.extra.expoClient.ios.appStoreUrl ?? null;\n } else if (Platform.OS === 'android' && manifest?.android) {\n return manifest.android.playStoreUrl ?? null;\n } else if (Platform.OS === 'android' && manifest2?.extra?.expoClient?.android) {\n return manifest2.extra.expoClient.android.playStoreUrl ?? null;\n }\n return null;\n}\n\n// @needsAudit\n/**\n * @return This returns a promise that fulfills to `true` if `StoreReview.requestReview()` is capable\n * directing the user to some kind of store review flow. If the app config (`app.json`) does not\n * contain store URLs and native store review capabilities are not available then the promise\n * will fulfill to `false`.\n *\n * @example\n * ```ts\n * if (await StoreReview.hasAction()) {\n * // you can call StoreReview.requestReview()\n * }\n * ```\n */\nexport async function hasAction(): Promise<boolean> {\n return !!storeUrl() || (await isAvailableAsync());\n}\n"]}
1
+ {"version":3,"file":"StoreReview.js","sourceRoot":"","sources":["../src/StoreReview.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,WAAW,MAAM,mBAAmB,CAAC;AAE5C,cAAc;AACd;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,OAAO,WAAW,CAAC,gBAAgB,EAAE,CAAC;AACxC,CAAC;AAED,cAAc;AACd;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,IAAI,WAAW,EAAE,aAAa,EAAE;QAC9B,MAAM,WAAW,CAAC,aAAa,EAAE,CAAC;QAClC,OAAO;KACR;IACD,6GAA6G;IAC7G,MAAM,GAAG,GAAG,QAAQ,EAAE,CAAC;IACvB,IAAI,GAAG,EAAE;QACP,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QAChD,IAAI,CAAC,SAAS,EAAE;YACd,OAAO,CAAC,IAAI,CAAC,0DAA0D,EAAE,GAAG,CAAC,CAAC;SAC/E;aAAM;YACL,MAAM,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;SAC5B;KACF;SAAM;QACL,iDAAiD;QACjD,OAAO,CAAC,IAAI,CACV,oKAAoK,CACrK,CAAC;KACH;AACH,CAAC;AAED,cAAc;AACd;;;;;GAKG;AACH,MAAM,UAAU,QAAQ;IACtB,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,SAAS,CAAC;IAC1C,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,QAAQ,EAAE,GAAG,EAAE;QAC1C,OAAO,QAAQ,CAAC,GAAG,CAAC,WAAW,IAAI,IAAI,CAAC;KACzC;SAAM,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE;QACrE,OAAO,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,WAAW,IAAI,IAAI,CAAC;KAC3D;SAAM,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,IAAI,QAAQ,EAAE,OAAO,EAAE;QACzD,OAAO,QAAQ,CAAC,OAAO,CAAC,YAAY,IAAI,IAAI,CAAC;KAC9C;SAAM,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,IAAI,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE;QAC7E,OAAO,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,YAAY,IAAI,IAAI,CAAC;KAChE;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,cAAc;AACd;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS;IAC7B,OAAO,CAAC,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,gBAAgB,EAAE,CAAC,CAAC;AACpD,CAAC","sourcesContent":["import Constants from 'expo-constants';\nimport * as Linking from 'expo-linking';\nimport { Platform } from 'expo-modules-core';\n\nimport StoreReview from './ExpoStoreReview';\n\n// @needsAudit\n/**\n * Determines if the platform has the capabilities to use `StoreReview.requestReview()`.\n * @return\n * This returns a promise fulfills with `boolean`, depending on the platform:\n * - On iOS, it will always resolve to `true`.\n * - On Android, it will resolve to `true` if the device is running Android 5.0+.\n * - On Web, it will resolve to `false`.\n */\nexport async function isAvailableAsync(): Promise<boolean> {\n return StoreReview.isAvailableAsync();\n}\n\n// @needsAudit\n/**\n * In ideal circumstances this will open a native modal and allow the user to select a star rating\n * that will then be applied to the App Store, without leaving the app. If the device is running\n * a version of Android lower than 5.0, this will attempt to get the store URL and link the user to it.\n */\nexport async function requestReview(): Promise<void> {\n if (StoreReview?.requestReview) {\n await StoreReview.requestReview();\n return;\n }\n // If StoreReview is unavailable then get the store URL from `app.config.js` or `app.json` and open the store\n const url = storeUrl();\n if (url) {\n const supported = await Linking.canOpenURL(url);\n if (!supported) {\n console.warn(\"Expo.StoreReview.requestReview(): Can't open store url: \", url);\n } else {\n await Linking.openURL(url);\n }\n } else {\n // If the store URL is missing, let the dev know.\n console.warn(\n \"Expo.StoreReview.requestReview(): Couldn't link to store, please make sure the `android.playStoreUrl` & `ios.appStoreUrl` fields are filled out in your `app.json`\"\n );\n }\n}\n\n// @needsAudit\n/**\n * This uses the `Constants` API to get the `Constants.manifest.ios.appStoreUrl` on iOS, or the\n * `Constants.manifest.android.playStoreUrl` on Android.\n *\n * On Web this will return `null`.\n */\nexport function storeUrl(): string | null {\n const { manifest, manifest2 } = Constants;\n if (Platform.OS === 'ios' && manifest?.ios) {\n return manifest.ios.appStoreUrl ?? null;\n } else if (Platform.OS === 'ios' && manifest2?.extra?.expoClient?.ios) {\n return manifest2.extra.expoClient.ios.appStoreUrl ?? null;\n } else if (Platform.OS === 'android' && manifest?.android) {\n return manifest.android.playStoreUrl ?? null;\n } else if (Platform.OS === 'android' && manifest2?.extra?.expoClient?.android) {\n return manifest2.extra.expoClient.android.playStoreUrl ?? null;\n }\n return null;\n}\n\n// @needsAudit\n/**\n * @return This returns a promise that fulfills to `true` if `StoreReview.requestReview()` is capable\n * directing the user to some kind of store review flow. If the app config (`app.json`) does not\n * contain store URLs and native store review capabilities are not available then the promise\n * will fulfill to `false`.\n *\n * @example\n * ```ts\n * if (await StoreReview.hasAction()) {\n * // you can call StoreReview.requestReview()\n * }\n * ```\n */\nexport async function hasAction(): Promise<boolean> {\n return !!storeUrl() || (await isAvailableAsync());\n}\n"]}
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "expo-store-review",
3
+ "platforms": ["ios", "android"],
4
+ "ios": {
5
+ "modules": ["StoreReviewModule"]
6
+ }
7
+ }
@@ -3,23 +3,30 @@ require 'json'
3
3
  package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
4
4
 
5
5
  Pod::Spec.new do |s|
6
- s.name = 'EXStoreReview'
6
+ s.name = 'ExpoStoreReview'
7
7
  s.version = package['version']
8
8
  s.summary = package['description']
9
9
  s.description = package['description']
10
10
  s.license = package['license']
11
11
  s.author = package['author']
12
12
  s.homepage = package['homepage']
13
- s.platform = :ios, '12.0'
13
+ s.platform = :ios, '13.0'
14
+ s.swift_version = '5.4'
14
15
  s.source = { git: 'https://github.com/expo/expo.git' }
15
16
  s.static_framework = true
16
17
 
17
18
  s.dependency 'ExpoModulesCore'
18
19
 
20
+ # Swift/Objective-C compatibility
21
+ s.pod_target_xcconfig = {
22
+ 'DEFINES_MODULE' => 'YES',
23
+ 'SWIFT_COMPILATION_MODE' => 'wholemodule'
24
+ }
25
+
19
26
  if !$ExpoUseSources&.include?(package['name']) && ENV['EXPO_USE_SOURCE'].to_i == 0 && File.exist?("#{s.name}.xcframework") && Gem::Version.new(Pod::VERSION) >= Gem::Version.new('1.10.0')
20
- s.source_files = "#{s.name}/**/*.h"
27
+ s.source_files = "**/*.h"
21
28
  s.vendored_frameworks = "#{s.name}.xcframework"
22
29
  else
23
- s.source_files = "#{s.name}/**/*.{h,m}"
30
+ s.source_files = "**/*.{h,m,swift}"
24
31
  end
25
32
  end
@@ -0,0 +1,7 @@
1
+ import ExpoModulesCore
2
+
3
+ internal class MissingCurrentWindowSceneException: Exception {
4
+ override var reason: String {
5
+ "Cannot determine the current window scene in which to present the modal for requesting a review."
6
+ }
7
+ }
@@ -0,0 +1,24 @@
1
+ import ExpoModulesCore
2
+ import StoreKit
3
+
4
+ public class StoreReviewModule: Module {
5
+ 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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-store-review",
3
- "version": "5.2.0",
3
+ "version": "6.0.0",
4
4
  "description": "ExpoStoreReview standalone module",
5
5
  "main": "build/StoreReview.js",
6
6
  "types": "build/StoreReview.d.ts",
@@ -31,10 +31,10 @@
31
31
  "homepage": "https://docs.expo.dev/versions/latest/sdk/storereview/",
32
32
  "dependencies": {},
33
33
  "devDependencies": {
34
- "expo-module-scripts": "^2.0.0"
34
+ "expo-module-scripts": "^3.0.0"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "expo": "*"
38
38
  },
39
- "gitHead": "22dce752354bb429c84851bc4389abe47a766b1f"
39
+ "gitHead": "eab2b09c735fb0fc2bf734a3f29a6593adba3838"
40
40
  }
@@ -1,2 +1,2 @@
1
- import { NativeModulesProxy } from 'expo-modules-core';
2
- export default NativeModulesProxy.ExpoStoreReview;
1
+ import { requireNativeModule } from 'expo-modules-core';
2
+ export default requireNativeModule('ExpoStoreReview');
@@ -9,7 +9,7 @@ import StoreReview from './ExpoStoreReview';
9
9
  * Determines if the platform has the capabilities to use `StoreReview.requestReview()`.
10
10
  * @return
11
11
  * This returns a promise fulfills with `boolean`, depending on the platform:
12
- * - On iOS, it will resolve to `true` if the device is running iOS 10.3+.
12
+ * - On iOS, it will always resolve to `true`.
13
13
  * - On Android, it will resolve to `true` if the device is running Android 5.0+.
14
14
  * - On Web, it will resolve to `false`.
15
15
  */
@@ -21,8 +21,7 @@ export async function isAvailableAsync(): Promise<boolean> {
21
21
  /**
22
22
  * In ideal circumstances this will open a native modal and allow the user to select a star rating
23
23
  * that will then be applied to the App Store, without leaving the app. If the device is running
24
- * a version of iOS lower than 10.3, or a version of Android lower than 5.0, this will attempt
25
- * to get the store URL and link the user to it.
24
+ * a version of Android lower than 5.0, this will attempt to get the store URL and link the user to it.
26
25
  */
27
26
  export async function requestReview(): Promise<void> {
28
27
  if (StoreReview?.requestReview) {
package/tsconfig.json CHANGED
@@ -5,5 +5,5 @@
5
5
  "outDir": "./build"
6
6
  },
7
7
  "include": ["./src"],
8
- "exclude": ["**/__mocks__/*", "**/__tests__/*"]
8
+ "exclude": ["**/__mocks__/*", "**/__tests__/*", "**/__stories__/*"]
9
9
  }
@@ -1,8 +0,0 @@
1
- // Copyright © 2018 650 Industries. All rights reserved.
2
-
3
- #import <ExpoModulesCore/EXExportedModule.h>
4
- #import <ExpoModulesCore/EXModuleRegistryConsumer.h>
5
-
6
- @interface EXStoreReviewModule : EXExportedModule
7
-
8
- @end
@@ -1,28 +0,0 @@
1
- // Copyright 2018-present 650 Industries. All rights reserved.
2
-
3
- #import <EXStoreReview/EXStoreReviewModule.h>
4
- #import <StoreKit/SKStoreReviewController.h>
5
-
6
- @implementation EXStoreReviewModule
7
-
8
- EX_EXPORT_MODULE(ExpoStoreReview);
9
-
10
- EX_EXPORT_METHOD_AS(isAvailableAsync,
11
- isAvailableAsync:(EXPromiseResolveBlock)resolve
12
- rejecter:(EXPromiseRejectBlock)reject)
13
- {
14
- BOOL isAvailable = [SKStoreReviewController class] ? YES : NO;
15
- resolve(@(isAvailable));
16
- }
17
-
18
- EX_EXPORT_METHOD_AS(requestReview,
19
- resolver:(EXPromiseResolveBlock)resolve
20
- rejecter:(EXPromiseRejectBlock)reject)
21
- {
22
- dispatch_async(dispatch_get_main_queue(), ^{
23
- [SKStoreReviewController requestReview];
24
- resolve(nil);
25
- });
26
- }
27
-
28
- @end
package/unimodule.json DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "name": "expo-store-review",
3
- "platforms": ["ios", "android"]
4
- }