expo-store-review 6.8.2 → 7.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,19 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 7.0.0 — 2024-04-18
14
+
15
+ ### 💡 Others
16
+
17
+ - drop unused web `name` property. ([#27437](https://github.com/expo/expo/pull/27437) by [@EvanBacon](https://github.com/EvanBacon))
18
+ - Removed deprecated backward compatible Gradle settings. ([#28083](https://github.com/expo/expo/pull/28083) by [@kudo](https://github.com/kudo))
19
+
20
+ ## 6.8.3 - 2024-01-18
21
+
22
+ ### 💡 Others
23
+
24
+ - Remove expo-linking dependency and use React Native Linking instead. ([#26428](https://github.com/expo/expo/pull/26428) by [@gabrieldonadel](https://github.com/gabrieldonadel))
25
+
13
26
  ## 6.8.2 — 2023-12-15
14
27
 
15
28
  _This version does not introduce any user-facing changes._
@@ -1,110 +1,24 @@
1
1
  apply plugin: 'com.android.library'
2
- apply plugin: 'kotlin-android'
3
- apply plugin: 'maven-publish'
4
2
 
5
3
  group = 'host.exp.exponent'
6
- version = '6.8.2'
4
+ version = '7.0.0'
7
5
 
8
6
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
9
- if (expoModulesCorePlugin.exists()) {
10
- apply from: expoModulesCorePlugin
11
- applyKotlinExpoModulesCorePlugin()
12
- // Remove this check, but keep the contents after SDK49 support is dropped
13
- if (safeExtGet("expoProvidesDefaultConfig", false)) {
14
- useExpoPublishing()
15
- useCoreDependencies()
16
- }
17
- }
18
-
19
- buildscript {
20
- // Simple helper that allows the root project to override versions declared by this library.
21
- ext.safeExtGet = { prop, fallback ->
22
- rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
23
- }
24
-
25
- // Ensures backward compatibility
26
- ext.getKotlinVersion = {
27
- if (ext.has("kotlinVersion")) {
28
- ext.kotlinVersion()
29
- } else {
30
- ext.safeExtGet("kotlinVersion", "1.8.10")
31
- }
32
- }
33
-
34
- repositories {
35
- mavenCentral()
36
- }
37
-
38
- dependencies {
39
- classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getKotlinVersion()}")
40
- }
41
- }
42
-
43
- // Remove this if and it's contents, when support for SDK49 is dropped
44
- if (!safeExtGet("expoProvidesDefaultConfig", false)) {
45
- afterEvaluate {
46
- publishing {
47
- publications {
48
- release(MavenPublication) {
49
- from components.release
50
- }
51
- }
52
- repositories {
53
- maven {
54
- url = mavenLocal().url
55
- }
56
- }
57
- }
58
- }
59
- }
7
+ apply from: expoModulesCorePlugin
8
+ applyKotlinExpoModulesCorePlugin()
9
+ useCoreDependencies()
10
+ useDefaultAndroidSdkVersions()
11
+ useExpoPublishing()
60
12
 
61
13
  android {
62
- // Remove this if and it's contents, when support for SDK49 is dropped
63
- if (!safeExtGet("expoProvidesDefaultConfig", false)) {
64
- compileSdkVersion safeExtGet("compileSdkVersion", 34)
65
-
66
- defaultConfig {
67
- minSdkVersion safeExtGet("minSdkVersion", 23)
68
- targetSdkVersion safeExtGet("targetSdkVersion", 34)
69
- }
70
-
71
- publishing {
72
- singleVariant("release") {
73
- withSourcesJar()
74
- }
75
- }
76
-
77
- lintOptions {
78
- abortOnError false
79
- }
80
- }
81
-
82
- def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
83
- if (agpVersion.tokenize('.')[0].toInteger() < 8) {
84
- compileOptions {
85
- sourceCompatibility JavaVersion.VERSION_11
86
- targetCompatibility JavaVersion.VERSION_11
87
- }
88
-
89
- kotlinOptions {
90
- jvmTarget = JavaVersion.VERSION_11.majorVersion
91
- }
92
- }
93
-
94
14
  namespace "expo.modules.storereview"
95
15
  defaultConfig {
96
16
  versionCode 4
97
- versionName "6.8.2"
17
+ versionName "7.0.0"
98
18
  }
99
19
  }
100
20
 
101
21
  dependencies {
102
- // Remove this if and it's contents, when support for SDK49 is dropped
103
- if (!safeExtGet("expoProvidesDefaultConfig", false)) {
104
- implementation project(':expo-modules-core')
105
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
106
- }
107
-
108
22
  implementation "com.google.android.play:review:2.0.1"
109
23
  implementation "com.google.android.play:review-ktx:2.0.0"
110
24
  api "com.google.android.gms:play-services-base:17.3.0"
@@ -2,7 +2,6 @@ package expo.modules.storereview
2
2
 
3
3
  import android.content.Context
4
4
  import android.content.pm.PackageManager
5
- import android.os.Build
6
5
  import com.google.android.gms.common.GooglePlayServicesUtil
7
6
  import com.google.android.play.core.review.ReviewManager
8
7
  import com.google.android.play.core.review.ReviewManagerFactory
@@ -22,8 +21,8 @@ class StoreReviewModule : Module() {
22
21
  override fun definition() = ModuleDefinition {
23
22
  Name("ExpoStoreReview")
24
23
 
25
- AsyncFunction("isAvailableAsync") {
26
- return@AsyncFunction Build.VERSION.SDK_INT >= 21 && isPlayStoreInstalled()
24
+ AsyncFunction<Boolean>("isAvailableAsync") {
25
+ return@AsyncFunction isPlayStoreInstalled()
27
26
  }
28
27
 
29
28
  AsyncFunction("requestReview") { promise: Promise ->
@@ -1,7 +1,6 @@
1
- declare const _default: {
2
- readonly name: string;
3
- isAvailableAsync(): Promise<boolean>;
4
- requestReview: (() => Promise<void>) | null;
5
- };
1
+ declare const _default: Partial<{
2
+ isAvailableAsync: () => Promise<boolean>;
3
+ requestReview: () => Promise<void>;
4
+ }>;
6
5
  export default _default;
7
6
  //# sourceMappingURL=ExpoStoreReview.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoStoreReview.d.ts","sourceRoot":"","sources":["../src/ExpoStoreReview.ts"],"names":[],"mappings":";;wBAK4B,QAAQ,OAAO,CAAC;0BAGL,QAAQ,IAAI,CAAC;;AAPpD,wBAQE"}
1
+ {"version":3,"file":"ExpoStoreReview.d.ts","sourceRoot":"","sources":["../src/ExpoStoreReview.ts"],"names":[],"mappings":"wBACqB,OAAO,CAAC;IAC3B,gBAAgB,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IACzC,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC,CAAC;AAHF,wBAGG"}
@@ -1,11 +1,3 @@
1
1
  // Unimplemented on web
2
- export default {
3
- get name() {
4
- return 'ExpoStoreReview';
5
- },
6
- async isAvailableAsync() {
7
- return false;
8
- },
9
- requestReview: null,
10
- };
2
+ export default {};
11
3
  //# sourceMappingURL=ExpoStoreReview.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoStoreReview.js","sourceRoot":"","sources":["../src/ExpoStoreReview.ts"],"names":[],"mappings":"AAAA,uBAAuB;AACvB,eAAe;IACb,IAAI,IAAI;QACN,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IACD,KAAK,CAAC,gBAAgB;QACpB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,aAAa,EAAE,IAAoC;CACpD,CAAC","sourcesContent":["// Unimplemented on web\nexport default {\n get name(): string {\n return 'ExpoStoreReview';\n },\n async isAvailableAsync(): Promise<boolean> {\n return false;\n },\n requestReview: null as null | (() => Promise<void>),\n};\n"]}
1
+ {"version":3,"file":"ExpoStoreReview.js","sourceRoot":"","sources":["../src/ExpoStoreReview.ts"],"names":[],"mappings":"AAAA,uBAAuB;AACvB,eAAe,EAGb,CAAC","sourcesContent":["// Unimplemented on web\nexport default {} as Partial<{\n isAvailableAsync: () => Promise<boolean>;\n requestReview: () => Promise<void>;\n}>;\n"]}
@@ -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;;;;GAIG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAoBnD;AAGD;;;;;GAKG;AACH,wBAAgB,QAAQ,IAAI,MAAM,GAAG,IAAI,CAQxC;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,CAmBnD;AAGD;;;;;GAKG;AACH,wBAAgB,QAAQ,IAAI,MAAM,GAAG,IAAI,CAQxC;AAGD;;;;;;;;;;;;GAYG;AACH,wBAAsB,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,CAElD"}
@@ -1,6 +1,6 @@
1
1
  import Constants from 'expo-constants';
2
- import * as Linking from 'expo-linking';
3
2
  import { Platform } from 'expo-modules-core';
3
+ import { Linking } from 'react-native';
4
4
  import StoreReview from './ExpoStoreReview';
5
5
  // @needsAudit
6
6
  /**
@@ -12,7 +12,7 @@ import StoreReview from './ExpoStoreReview';
12
12
  * - On Web, it will resolve to `false`.
13
13
  */
14
14
  export async function isAvailableAsync() {
15
- return StoreReview.isAvailableAsync();
15
+ return StoreReview.isAvailableAsync?.() ?? false;
16
16
  }
17
17
  // @needsAudit
18
18
  /**
@@ -22,15 +22,14 @@ export async function isAvailableAsync() {
22
22
  */
23
23
  export async function requestReview() {
24
24
  if (StoreReview?.requestReview) {
25
- await StoreReview.requestReview();
26
- return;
25
+ return StoreReview.requestReview();
27
26
  }
28
27
  // If StoreReview is unavailable then get the store URL from `app.config.js` or `app.json` and open the store
29
28
  const url = storeUrl();
30
29
  if (url) {
31
30
  const supported = await Linking.canOpenURL(url);
32
31
  if (!supported) {
33
- console.warn("Expo.StoreReview.requestReview(): Can't open store url: ", url);
32
+ console.warn("StoreReview.requestReview(): Can't open store url: ", url);
34
33
  }
35
34
  else {
36
35
  await Linking.openURL(url);
@@ -38,7 +37,7 @@ export async function requestReview() {
38
37
  }
39
38
  else {
40
39
  // If the store URL is missing, let the dev know.
41
- console.warn("Expo.StoreReview.requestReview(): Couldn't link to store, please make sure the `android.playStoreUrl` & `ios.appStoreUrl` fields are filled out in your `app.json`");
40
+ console.warn("StoreReview.requestReview(): Couldn't link to store, please make sure the `android.playStoreUrl` & `ios.appStoreUrl` fields are filled out in your `app.json`");
42
41
  }
43
42
  }
44
43
  // @needsAudit
@@ -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;;;;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,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC;IACxC,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,UAAU,EAAE,GAAG,EAAE;QAC5C,OAAO,UAAU,CAAC,GAAG,CAAC,WAAW,IAAI,IAAI,CAAC;KAC3C;SAAM,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,IAAI,UAAU,EAAE,OAAO,EAAE;QAC3D,OAAO,UAAU,CAAC,OAAO,CAAC,YAAY,IAAI,IAAI,CAAC;KAChD;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` unless the app is distributed through TestFlight.\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.expoConfig.ios.appStoreUrl` on iOS, or the\n * `Constants.expoConfig.android.playStoreUrl` on Android.\n *\n * On Web this will return `null`.\n */\nexport function storeUrl(): string | null {\n const expoConfig = Constants.expoConfig;\n if (Platform.OS === 'ios' && expoConfig?.ios) {\n return expoConfig.ios.appStoreUrl ?? null;\n } else if (Platform.OS === 'android' && expoConfig?.android) {\n return expoConfig.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,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,WAAW,MAAM,mBAAmB,CAAC;AAE5C,cAAc;AACd;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,OAAO,WAAW,CAAC,gBAAgB,EAAE,EAAE,IAAI,KAAK,CAAC;AACnD,CAAC;AAED,cAAc;AACd;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,IAAI,WAAW,EAAE,aAAa,EAAE,CAAC;QAC/B,OAAO,WAAW,CAAC,aAAa,EAAE,CAAC;IACrC,CAAC;IACD,6GAA6G;IAC7G,MAAM,GAAG,GAAG,QAAQ,EAAE,CAAC;IACvB,IAAI,GAAG,EAAE,CAAC;QACR,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QAChD,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO,CAAC,IAAI,CAAC,qDAAqD,EAAE,GAAG,CAAC,CAAC;QAC3E,CAAC;aAAM,CAAC;YACN,MAAM,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;SAAM,CAAC;QACN,iDAAiD;QACjD,OAAO,CAAC,IAAI,CACV,+JAA+J,CAChK,CAAC;IACJ,CAAC;AACH,CAAC;AAED,cAAc;AACd;;;;;GAKG;AACH,MAAM,UAAU,QAAQ;IACtB,MAAM,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC;IACxC,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,UAAU,EAAE,GAAG,EAAE,CAAC;QAC7C,OAAO,UAAU,CAAC,GAAG,CAAC,WAAW,IAAI,IAAI,CAAC;IAC5C,CAAC;SAAM,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,IAAI,UAAU,EAAE,OAAO,EAAE,CAAC;QAC5D,OAAO,UAAU,CAAC,OAAO,CAAC,YAAY,IAAI,IAAI,CAAC;IACjD,CAAC;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 { Platform } from 'expo-modules-core';\nimport { Linking } from 'react-native';\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` unless the app is distributed through TestFlight.\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?.() ?? false;\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 return StoreReview.requestReview();\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(\"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 \"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.expoConfig.ios.appStoreUrl` on iOS, or the\n * `Constants.expoConfig.android.playStoreUrl` on Android.\n *\n * On Web this will return `null`.\n */\nexport function storeUrl(): string | null {\n const expoConfig = Constants.expoConfig;\n if (Platform.OS === 'ios' && expoConfig?.ios) {\n return expoConfig.ios.appStoreUrl ?? null;\n } else if (Platform.OS === 'android' && expoConfig?.android) {\n return expoConfig.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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-store-review",
3
- "version": "6.8.2",
3
+ "version": "7.0.0",
4
4
  "description": "ExpoStoreReview standalone module",
5
5
  "main": "build/StoreReview.js",
6
6
  "types": "build/StoreReview.d.ts",
@@ -36,5 +36,5 @@
36
36
  "peerDependencies": {
37
37
  "expo": "*"
38
38
  },
39
- "gitHead": "1a7c4e8ffed182e00cf1cf654ca2401441a7377a"
39
+ "gitHead": "4165b8d72e1b9a1889c2767534cc619e21468110"
40
40
  }
@@ -1,10 +1,5 @@
1
1
  // Unimplemented on web
2
- export default {
3
- get name(): string {
4
- return 'ExpoStoreReview';
5
- },
6
- async isAvailableAsync(): Promise<boolean> {
7
- return false;
8
- },
9
- requestReview: null as null | (() => Promise<void>),
10
- };
2
+ export default {} as Partial<{
3
+ isAvailableAsync: () => Promise<boolean>;
4
+ requestReview: () => Promise<void>;
5
+ }>;
@@ -1,6 +1,6 @@
1
1
  import Constants from 'expo-constants';
2
- import * as Linking from 'expo-linking';
3
2
  import { Platform } from 'expo-modules-core';
3
+ import { Linking } from 'react-native';
4
4
 
5
5
  import StoreReview from './ExpoStoreReview';
6
6
 
@@ -14,7 +14,7 @@ import StoreReview from './ExpoStoreReview';
14
14
  * - On Web, it will resolve to `false`.
15
15
  */
16
16
  export async function isAvailableAsync(): Promise<boolean> {
17
- return StoreReview.isAvailableAsync();
17
+ return StoreReview.isAvailableAsync?.() ?? false;
18
18
  }
19
19
 
20
20
  // @needsAudit
@@ -25,22 +25,21 @@ export async function isAvailableAsync(): Promise<boolean> {
25
25
  */
26
26
  export async function requestReview(): Promise<void> {
27
27
  if (StoreReview?.requestReview) {
28
- await StoreReview.requestReview();
29
- return;
28
+ return StoreReview.requestReview();
30
29
  }
31
30
  // If StoreReview is unavailable then get the store URL from `app.config.js` or `app.json` and open the store
32
31
  const url = storeUrl();
33
32
  if (url) {
34
33
  const supported = await Linking.canOpenURL(url);
35
34
  if (!supported) {
36
- console.warn("Expo.StoreReview.requestReview(): Can't open store url: ", url);
35
+ console.warn("StoreReview.requestReview(): Can't open store url: ", url);
37
36
  } else {
38
37
  await Linking.openURL(url);
39
38
  }
40
39
  } else {
41
40
  // If the store URL is missing, let the dev know.
42
41
  console.warn(
43
- "Expo.StoreReview.requestReview(): Couldn't link to store, please make sure the `android.playStoreUrl` & `ios.appStoreUrl` fields are filled out in your `app.json`"
42
+ "StoreReview.requestReview(): Couldn't link to store, please make sure the `android.playStoreUrl` & `ios.appStoreUrl` fields are filled out in your `app.json`"
44
43
  );
45
44
  }
46
45
  }