react-native-rate-app 1.2.0 → 1.2.2
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/README.md +15 -3
- package/android/build.gradle +6 -3
- package/android/src/main/java/com/rateapp/RateAppModule.kt +4 -1
- package/android/src/newarch/RateApp.kt +8 -0
- package/android/src/oldarch/RateApp.kt +14 -0
- package/lib/commonjs/plugin/withReactNativeRateApp.js +6 -1
- package/lib/commonjs/plugin/withReactNativeRateApp.js.map +1 -1
- package/lib/module/plugin/withReactNativeRateApp.js +6 -1
- package/lib/module/plugin/withReactNativeRateApp.js.map +1 -1
- package/lib/typescript/plugin/withReactNativeRateApp.d.ts.map +1 -1
- package/package.json +3 -4
- package/src/plugin/withReactNativeRateApp.ts +6 -1
package/README.md
CHANGED
|
@@ -38,11 +38,23 @@ or
|
|
|
38
38
|
npm install react-native-rate-app
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
##
|
|
41
|
+
## Expo
|
|
42
|
+
|
|
43
|
+
For Expo projects, you can use the Expo plugin in `app.json`
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
"plugins": [
|
|
47
|
+
"react-native-rate-app"
|
|
48
|
+
],
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Bare RN
|
|
52
|
+
|
|
53
|
+
### iOS Setup
|
|
42
54
|
|
|
43
55
|
To use the in-app review functionality on iOS, you need to add the `StoreKit` framework to your project and update your `Info.plist` file.
|
|
44
56
|
|
|
45
|
-
|
|
57
|
+
#### Adding the StoreKit Framework
|
|
46
58
|
|
|
47
59
|
1. Open your project in Xcode.
|
|
48
60
|
2. Select your project in the Project Navigator.
|
|
@@ -51,7 +63,7 @@ To use the in-app review functionality on iOS, you need to add the `StoreKit` fr
|
|
|
51
63
|
5. Expand the "Link Binary With Libraries" section.
|
|
52
64
|
6. Click the "+" button and add `StoreKit.framework`.
|
|
53
65
|
|
|
54
|
-
|
|
66
|
+
#### Updating Info.plist
|
|
55
67
|
|
|
56
68
|
To allow your app to open the App Store and handle the in-app review functionality, you need to add the `LSApplicationQueriesSchemes` key to your `Info.plist` file.
|
|
57
69
|
|
package/android/build.gradle
CHANGED
|
@@ -81,10 +81,13 @@ android {
|
|
|
81
81
|
sourceSets {
|
|
82
82
|
main {
|
|
83
83
|
if (isNewArchitectureEnabled()) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
java.srcDirs += [
|
|
85
|
+
"src/newarch",
|
|
86
|
+
"generated/java",
|
|
87
|
+
"generated/jni"
|
|
87
88
|
]
|
|
89
|
+
} else {
|
|
90
|
+
java.srcDirs += ["src/oldarch"]
|
|
88
91
|
}
|
|
89
92
|
}
|
|
90
93
|
}
|
|
@@ -19,7 +19,7 @@ import com.google.android.play.core.review.ReviewManagerFactory
|
|
|
19
19
|
|
|
20
20
|
@ReactModule(name = RateAppModule.NAME)
|
|
21
21
|
class RateAppModule(reactContext: ReactApplicationContext) :
|
|
22
|
-
|
|
22
|
+
RateAppSpec(reactContext), ActivityEventListener {
|
|
23
23
|
|
|
24
24
|
init {
|
|
25
25
|
reactContext.addActivityEventListener(this)
|
|
@@ -29,6 +29,7 @@ class RateAppModule(reactContext: ReactApplicationContext) :
|
|
|
29
29
|
return NAME
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
@ReactMethod
|
|
32
33
|
override fun requestReview(promise: Promise) {
|
|
33
34
|
val manager: ReviewManager = ReviewManagerFactory.create(reactApplicationContext)
|
|
34
35
|
val request = manager.requestReviewFlow()
|
|
@@ -53,6 +54,7 @@ class RateAppModule(reactContext: ReactApplicationContext) :
|
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
56
|
|
|
57
|
+
@ReactMethod
|
|
56
58
|
override fun requestReviewAppGallery(promise: Promise) {
|
|
57
59
|
promiseAppGallery = promise;
|
|
58
60
|
val intent = Intent("com.huawei.appmarket.intent.action.guidecomment")
|
|
@@ -72,6 +74,7 @@ class RateAppModule(reactContext: ReactApplicationContext) :
|
|
|
72
74
|
}
|
|
73
75
|
}
|
|
74
76
|
|
|
77
|
+
@ReactMethod
|
|
75
78
|
override fun requestReviewGalaxyStore(packageName: String, promise: Promise) {
|
|
76
79
|
val ai = reactApplicationContext.packageManager.getApplicationInfo("com.sec.android.app.samsungapps", PackageManager.GET_META_DATA)
|
|
77
80
|
val inappReviewVersion = ai.metaData.getInt("com.sec.android.app.samsungapps.review.inappReview", 0)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
package com.rateapp
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.ActivityEventListener
|
|
4
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
|
+
|
|
6
|
+
abstract class RateAppSpec internal constructor(context: ReactApplicationContext) :
|
|
7
|
+
NativeRateAppSpec(context), ActivityEventListener {
|
|
8
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
package com.rateapp
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.ActivityEventListener
|
|
4
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
6
|
+
import com.facebook.react.bridge.Promise
|
|
7
|
+
|
|
8
|
+
abstract class RateAppSpec internal constructor(context: ReactApplicationContext) :
|
|
9
|
+
ReactContextBaseJavaModule(context), ActivityEventListener {
|
|
10
|
+
|
|
11
|
+
abstract fun requestReview(promise: Promise)
|
|
12
|
+
abstract fun requestReviewAppGallery(promise: Promise)
|
|
13
|
+
abstract fun requestReviewGalaxyStore(packageName: String, promise: Promise)
|
|
14
|
+
}
|
|
@@ -14,7 +14,12 @@ var _configPlugins = require("@expo/config-plugins");
|
|
|
14
14
|
*/
|
|
15
15
|
const withCustomInfoPlist = config => {
|
|
16
16
|
return (0, _configPlugins.withInfoPlist)(config, config => {
|
|
17
|
-
config.modResults.LSApplicationQueriesSchemes
|
|
17
|
+
if (!config.modResults.LSApplicationQueriesSchemes) {
|
|
18
|
+
config.modResults.LSApplicationQueriesSchemes = [];
|
|
19
|
+
}
|
|
20
|
+
if (!config.modResults.LSApplicationQueriesSchemes.includes("itms-apps")) {
|
|
21
|
+
config.modResults.LSApplicationQueriesSchemes.push("itms-apps");
|
|
22
|
+
}
|
|
18
23
|
return config;
|
|
19
24
|
});
|
|
20
25
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_configPlugins","require","withCustomInfoPlist","config","withInfoPlist","modResults","LSApplicationQueriesSchemes","withStoreKitFramework","withXcodeProject","addFramework","required","withReactNativeRateApp","configWithInfoPlist","configWithStoreKit","_default","exports","default"],"sourceRoot":"../../../src","sources":["plugin/withReactNativeRateApp.ts"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,mBAAiC,GAAIC,MAAM,IAAK;EACpD,OAAO,IAAAC,4BAAa,EAACD,MAAM,EAAGA,MAAM,IAAK;
|
|
1
|
+
{"version":3,"names":["_configPlugins","require","withCustomInfoPlist","config","withInfoPlist","modResults","LSApplicationQueriesSchemes","includes","push","withStoreKitFramework","withXcodeProject","addFramework","required","withReactNativeRateApp","configWithInfoPlist","configWithStoreKit","_default","exports","default"],"sourceRoot":"../../../src","sources":["plugin/withReactNativeRateApp.ts"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,mBAAiC,GAAIC,MAAM,IAAK;EACpD,OAAO,IAAAC,4BAAa,EAACD,MAAM,EAAGA,MAAM,IAAK;IACvC,IAAI,CAACA,MAAM,CAACE,UAAU,CAACC,2BAA2B,EAAE;MAClDH,MAAM,CAACE,UAAU,CAACC,2BAA2B,GAAG,EAAE;IACpD;IACA,IAAI,CAACH,MAAM,CAACE,UAAU,CAACC,2BAA2B,CAACC,QAAQ,CAAC,WAAW,CAAC,EAAE;MACxEJ,MAAM,CAACE,UAAU,CAACC,2BAA2B,CAACE,IAAI,CAAC,WAAW,CAAC;IACjE;IACA,OAAOL,MAAM;EACf,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMM,qBAAmC,GAAIN,MAAM,IAAK;EACtD,OAAO,IAAAO,+BAAgB,EAACP,MAAM,EAAGA,MAAM,IAAK;IAC1CA,MAAM,CAACE,UAAU,CAACM,YAAY,CAAC,oBAAoB,EAAE;MAAEC,QAAQ,EAAE;IAAK,CAAC,CAAC;IACxE,OAAOT,MAAM;EACf,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMU,sBAAoC,GAAIV,MAAM,IAAK;EACvD,MAAMW,mBAAmB,GAAGZ,mBAAmB,CAACC,MAAM,CAAC;EACvD,MAAMY,kBAAkB,GAAGN,qBAAqB,CAACK,mBAAmB,CAAC;EACrE,OAAOC,kBAAkB;AAC3B,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaL,sBAAsB","ignoreList":[]}
|
|
@@ -10,7 +10,12 @@ import { withInfoPlist, withXcodeProject } from "@expo/config-plugins";
|
|
|
10
10
|
*/
|
|
11
11
|
const withCustomInfoPlist = config => {
|
|
12
12
|
return withInfoPlist(config, config => {
|
|
13
|
-
config.modResults.LSApplicationQueriesSchemes
|
|
13
|
+
if (!config.modResults.LSApplicationQueriesSchemes) {
|
|
14
|
+
config.modResults.LSApplicationQueriesSchemes = [];
|
|
15
|
+
}
|
|
16
|
+
if (!config.modResults.LSApplicationQueriesSchemes.includes("itms-apps")) {
|
|
17
|
+
config.modResults.LSApplicationQueriesSchemes.push("itms-apps");
|
|
18
|
+
}
|
|
14
19
|
return config;
|
|
15
20
|
});
|
|
16
21
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withInfoPlist","withXcodeProject","withCustomInfoPlist","config","modResults","LSApplicationQueriesSchemes","withStoreKitFramework","addFramework","required","withReactNativeRateApp","configWithInfoPlist","configWithStoreKit"],"sourceRoot":"../../../src","sources":["plugin/withReactNativeRateApp.ts"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,gBAAgB,QAAQ,sBAAsB;AAGtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,mBAAiC,GAAIC,MAAM,IAAK;EACpD,OAAOH,aAAa,CAACG,MAAM,EAAGA,MAAM,IAAK;
|
|
1
|
+
{"version":3,"names":["withInfoPlist","withXcodeProject","withCustomInfoPlist","config","modResults","LSApplicationQueriesSchemes","includes","push","withStoreKitFramework","addFramework","required","withReactNativeRateApp","configWithInfoPlist","configWithStoreKit"],"sourceRoot":"../../../src","sources":["plugin/withReactNativeRateApp.ts"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,gBAAgB,QAAQ,sBAAsB;AAGtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,mBAAiC,GAAIC,MAAM,IAAK;EACpD,OAAOH,aAAa,CAACG,MAAM,EAAGA,MAAM,IAAK;IACvC,IAAI,CAACA,MAAM,CAACC,UAAU,CAACC,2BAA2B,EAAE;MAClDF,MAAM,CAACC,UAAU,CAACC,2BAA2B,GAAG,EAAE;IACpD;IACA,IAAI,CAACF,MAAM,CAACC,UAAU,CAACC,2BAA2B,CAACC,QAAQ,CAAC,WAAW,CAAC,EAAE;MACxEH,MAAM,CAACC,UAAU,CAACC,2BAA2B,CAACE,IAAI,CAAC,WAAW,CAAC;IACjE;IACA,OAAOJ,MAAM;EACf,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMK,qBAAmC,GAAIL,MAAM,IAAK;EACtD,OAAOF,gBAAgB,CAACE,MAAM,EAAGA,MAAM,IAAK;IAC1CA,MAAM,CAACC,UAAU,CAACK,YAAY,CAAC,oBAAoB,EAAE;MAAEC,QAAQ,EAAE;IAAK,CAAC,CAAC;IACxE,OAAOP,MAAM;EACf,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMQ,sBAAoC,GAAIR,MAAM,IAAK;EACvD,MAAMS,mBAAmB,GAAGV,mBAAmB,CAACC,MAAM,CAAC;EACvD,MAAMU,kBAAkB,GAAGL,qBAAqB,CAACI,mBAAmB,CAAC;EACrE,OAAOC,kBAAkB;AAC3B,CAAC;AAED,eAAeF,sBAAsB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withReactNativeRateApp.d.ts","sourceRoot":"","sources":["../../../src/plugin/withReactNativeRateApp.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"withReactNativeRateApp.d.ts","sourceRoot":"","sources":["../../../src/plugin/withReactNativeRateApp.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAmCxD;;;;;;GAMG;AACH,QAAA,MAAM,sBAAsB,EAAE,YAI7B,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-rate-app",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "React Native module for In App Rating on Android and iOS",
|
|
5
5
|
"source": "src/index.tsx",
|
|
6
6
|
"main": "lib/commonjs/index.js",
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"workspaces": [
|
|
100
100
|
"example"
|
|
101
101
|
],
|
|
102
|
-
"packageManager": "yarn@
|
|
102
|
+
"packageManager": "yarn@4.6.0",
|
|
103
103
|
"jest": {
|
|
104
104
|
"preset": "react-native",
|
|
105
105
|
"modulePathIgnorePatterns": [
|
|
@@ -113,8 +113,7 @@
|
|
|
113
113
|
"src/**/*.ts",
|
|
114
114
|
"src/**/*.tsx",
|
|
115
115
|
"!src/types.ts",
|
|
116
|
-
"!src/NativeRateApp.ts"
|
|
117
|
-
"!src/plugin/**"
|
|
116
|
+
"!src/NativeRateApp.ts"
|
|
118
117
|
],
|
|
119
118
|
"collectCoverage": true
|
|
120
119
|
},
|
|
@@ -10,7 +10,12 @@ import type { ConfigPlugin } from "expo/config-plugins";
|
|
|
10
10
|
*/
|
|
11
11
|
const withCustomInfoPlist: ConfigPlugin = (config) => {
|
|
12
12
|
return withInfoPlist(config, (config) => {
|
|
13
|
-
config.modResults.LSApplicationQueriesSchemes
|
|
13
|
+
if (!config.modResults.LSApplicationQueriesSchemes) {
|
|
14
|
+
config.modResults.LSApplicationQueriesSchemes = [];
|
|
15
|
+
}
|
|
16
|
+
if (!config.modResults.LSApplicationQueriesSchemes.includes("itms-apps")) {
|
|
17
|
+
config.modResults.LSApplicationQueriesSchemes.push("itms-apps");
|
|
18
|
+
}
|
|
14
19
|
return config;
|
|
15
20
|
});
|
|
16
21
|
};
|