react-native-rate-app 1.1.4 → 1.2.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/RateApp.podspec +42 -0
- package/android/build.gradle +36 -15
- package/android/gradle.properties +4 -4
- package/android/src/main/AndroidManifest.xml +3 -1
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/rateapp/RateAppModule.kt +5 -6
- package/android/src/main/java/com/rateapp/RateAppPackage.kt +4 -5
- package/app.plugin.js +1 -0
- package/ios/RateApp.h +1 -1
- package/lib/commonjs/NativeRateApp.js.map +1 -0
- package/lib/commonjs/index.js +4 -4
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/plugin/withReactNativeRateApp.js +51 -0
- package/lib/commonjs/plugin/withReactNativeRateApp.js.map +1 -0
- package/lib/module/NativeRateApp.js.map +1 -0
- package/lib/module/index.js +8 -8
- package/lib/module/index.js.map +1 -1
- package/lib/module/plugin/withReactNativeRateApp.js +47 -0
- package/lib/module/plugin/withReactNativeRateApp.js.map +1 -0
- package/lib/typescript/NativeRateApp.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +2 -2
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/plugin/withReactNativeRateApp.d.ts +11 -0
- package/lib/typescript/plugin/withReactNativeRateApp.d.ts.map +1 -0
- package/package.json +24 -13
- package/react-native.config.js +12 -0
- package/src/index.tsx +8 -10
- package/src/plugin/withReactNativeRateApp.ts +45 -0
- package/android/src/newarch/RateApp.kt +0 -8
- package/android/src/oldarch/RateApp.kt +0 -14
- package/lib/commonjs/codegenSpec/NativeRateApp.js.map +0 -1
- package/lib/module/codegenSpec/NativeRateApp.js.map +0 -1
- package/lib/typescript/codegenSpec/NativeRateApp.d.ts.map +0 -1
- package/react-native-rate-app.podspec +0 -23
- /package/lib/commonjs/{codegenSpec/NativeRateApp.js → NativeRateApp.js} +0 -0
- /package/lib/module/{codegenSpec/NativeRateApp.js → NativeRateApp.js} +0 -0
- /package/lib/typescript/{codegenSpec/NativeRateApp.d.ts → NativeRateApp.d.ts} +0 -0
- /package/src/{codegenSpec/NativeRateApp.ts → NativeRateApp.ts} +0 -0
package/RateApp.podspec
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
5
|
+
|
|
6
|
+
Pod::Spec.new do |s|
|
|
7
|
+
s.name = "RateApp"
|
|
8
|
+
s.version = package["version"]
|
|
9
|
+
s.summary = package["description"]
|
|
10
|
+
s.homepage = package["homepage"]
|
|
11
|
+
s.license = package["license"]
|
|
12
|
+
s.authors = package["author"]
|
|
13
|
+
|
|
14
|
+
s.platforms = { :ios => min_ios_version_supported }
|
|
15
|
+
s.source = { :git => "https://github.com/huextrat/react-native-rate-app.git", :tag => "#{s.version}" }
|
|
16
|
+
|
|
17
|
+
s.source_files = "ios/**/*.{h,m,mm,cpp}"
|
|
18
|
+
s.private_header_files = "ios/generated/**/*.h"
|
|
19
|
+
|
|
20
|
+
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
21
|
+
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
|
22
|
+
if respond_to?(:install_modules_dependencies, true)
|
|
23
|
+
install_modules_dependencies(s)
|
|
24
|
+
else
|
|
25
|
+
s.dependency "React-Core"
|
|
26
|
+
|
|
27
|
+
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
28
|
+
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
29
|
+
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
|
30
|
+
s.pod_target_xcconfig = {
|
|
31
|
+
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
|
32
|
+
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
|
|
33
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
|
34
|
+
}
|
|
35
|
+
s.dependency "React-Codegen"
|
|
36
|
+
s.dependency "RCT-Folly"
|
|
37
|
+
s.dependency "RCTRequired"
|
|
38
|
+
s.dependency "RCTTypeSafety"
|
|
39
|
+
s.dependency "ReactCommon/turbomodule/core"
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
package/android/build.gradle
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
buildscript {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
ext.getExtOrDefault = {name ->
|
|
3
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['RateApp_' + name]
|
|
4
|
+
}
|
|
4
5
|
|
|
5
6
|
repositories {
|
|
6
7
|
google()
|
|
@@ -8,12 +9,13 @@ buildscript {
|
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
dependencies {
|
|
11
|
-
classpath "com.android.tools.build:gradle:7.2
|
|
12
|
+
classpath "com.android.tools.build:gradle:8.7.2"
|
|
12
13
|
// noinspection DifferentKotlinGradleVersion
|
|
13
|
-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$
|
|
14
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
|
|
18
|
+
|
|
17
19
|
def isNewArchitectureEnabled() {
|
|
18
20
|
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
19
21
|
}
|
|
@@ -25,18 +27,28 @@ if (isNewArchitectureEnabled()) {
|
|
|
25
27
|
apply plugin: "com.facebook.react"
|
|
26
28
|
}
|
|
27
29
|
|
|
28
|
-
def getExtOrDefault(name) {
|
|
29
|
-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["RateApp_" + name]
|
|
30
|
-
}
|
|
31
|
-
|
|
32
30
|
def getExtOrIntegerDefault(name) {
|
|
33
31
|
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["RateApp_" + name]).toInteger()
|
|
34
32
|
}
|
|
35
33
|
|
|
34
|
+
def supportsNamespace() {
|
|
35
|
+
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
|
|
36
|
+
def major = parsed[0].toInteger()
|
|
37
|
+
def minor = parsed[1].toInteger()
|
|
38
|
+
|
|
39
|
+
// Namespace support was added in 7.3.0
|
|
40
|
+
return (major == 7 && minor >= 3) || major >= 8
|
|
41
|
+
}
|
|
42
|
+
|
|
36
43
|
android {
|
|
37
|
-
|
|
38
|
-
if (agpVersion.tokenize('.')[0].toInteger() >= 7) {
|
|
44
|
+
if (supportsNamespace()) {
|
|
39
45
|
namespace "com.rateapp"
|
|
46
|
+
|
|
47
|
+
sourceSets {
|
|
48
|
+
main {
|
|
49
|
+
manifest.srcFile "src/main/AndroidManifestNew.xml"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
40
52
|
}
|
|
41
53
|
|
|
42
54
|
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
@@ -44,6 +56,7 @@ android {
|
|
|
44
56
|
defaultConfig {
|
|
45
57
|
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
46
58
|
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
59
|
+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
47
60
|
}
|
|
48
61
|
|
|
49
62
|
buildFeatures {
|
|
@@ -68,9 +81,10 @@ android {
|
|
|
68
81
|
sourceSets {
|
|
69
82
|
main {
|
|
70
83
|
if (isNewArchitectureEnabled()) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
84
|
+
java.srcDirs += [
|
|
85
|
+
"generated/java",
|
|
86
|
+
"generated/jni"
|
|
87
|
+
]
|
|
74
88
|
}
|
|
75
89
|
}
|
|
76
90
|
}
|
|
@@ -84,8 +98,15 @@ repositories {
|
|
|
84
98
|
def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
85
99
|
|
|
86
100
|
dependencies {
|
|
87
|
-
|
|
88
|
-
implementation "com.facebook.react:react-native:+"
|
|
101
|
+
implementation "com.facebook.react:react-android"
|
|
89
102
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
90
103
|
implementation "com.google.android.play:review:2.0.1"
|
|
91
104
|
}
|
|
105
|
+
|
|
106
|
+
if (isNewArchitectureEnabled()) {
|
|
107
|
+
react {
|
|
108
|
+
jsRootDir = file("../src/")
|
|
109
|
+
libraryName = "RateApp"
|
|
110
|
+
codegenJavaPackageName = "com.rateapp"
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
RateApp_kotlinVersion=
|
|
2
|
-
RateApp_minSdkVersion=
|
|
1
|
+
RateApp_kotlinVersion=2.0.21
|
|
2
|
+
RateApp_minSdkVersion=24
|
|
3
3
|
RateApp_targetSdkVersion=34
|
|
4
|
-
RateApp_compileSdkVersion=
|
|
5
|
-
|
|
4
|
+
RateApp_compileSdkVersion=35
|
|
5
|
+
RateApp_ndkVersion=27.1.12297006
|
|
@@ -12,22 +12,23 @@ import com.facebook.react.bridge.ActivityEventListener
|
|
|
12
12
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
13
13
|
import com.facebook.react.bridge.ReactMethod
|
|
14
14
|
import com.facebook.react.bridge.Promise
|
|
15
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
15
16
|
|
|
16
17
|
import com.google.android.play.core.review.ReviewManager
|
|
17
18
|
import com.google.android.play.core.review.ReviewManagerFactory
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
@ReactModule(name = RateAppModule.NAME)
|
|
21
|
+
class RateAppModule(reactContext: ReactApplicationContext) :
|
|
22
|
+
NativeRateAppSpec(reactContext), ActivityEventListener {
|
|
21
23
|
|
|
22
24
|
init {
|
|
23
|
-
|
|
25
|
+
reactContext.addActivityEventListener(this)
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
override fun getName(): String {
|
|
27
29
|
return NAME
|
|
28
30
|
}
|
|
29
31
|
|
|
30
|
-
@ReactMethod
|
|
31
32
|
override fun requestReview(promise: Promise) {
|
|
32
33
|
val manager: ReviewManager = ReviewManagerFactory.create(reactApplicationContext)
|
|
33
34
|
val request = manager.requestReviewFlow()
|
|
@@ -52,7 +53,6 @@ class RateAppModule internal constructor(context: ReactApplicationContext) :
|
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
55
|
|
|
55
|
-
@ReactMethod
|
|
56
56
|
override fun requestReviewAppGallery(promise: Promise) {
|
|
57
57
|
promiseAppGallery = promise;
|
|
58
58
|
val intent = Intent("com.huawei.appmarket.intent.action.guidecomment")
|
|
@@ -72,7 +72,6 @@ class RateAppModule internal constructor(context: ReactApplicationContext) :
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
@ReactMethod
|
|
76
75
|
override fun requestReviewGalaxyStore(packageName: String, promise: Promise) {
|
|
77
76
|
val ai = reactApplicationContext.packageManager.getApplicationInfo("com.sec.android.app.samsungapps", PackageManager.GET_META_DATA)
|
|
78
77
|
val inappReviewVersion = ai.metaData.getInt("com.sec.android.app.samsungapps.review.inappReview", 0)
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
package com.rateapp
|
|
2
2
|
|
|
3
|
-
import com.facebook.react.
|
|
4
|
-
import com.facebook.react.bridge.ReactApplicationContext
|
|
3
|
+
import com.facebook.react.BaseReactPackage
|
|
5
4
|
import com.facebook.react.bridge.NativeModule
|
|
6
|
-
import com.facebook.react.
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
7
6
|
import com.facebook.react.module.model.ReactModuleInfo
|
|
7
|
+
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
8
8
|
import java.util.HashMap
|
|
9
9
|
|
|
10
|
-
class RateAppPackage :
|
|
10
|
+
class RateAppPackage : BaseReactPackage() {
|
|
11
11
|
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
|
|
12
12
|
return if (name == RateAppModule.NAME) {
|
|
13
13
|
RateAppModule(reactContext)
|
|
@@ -24,7 +24,6 @@ class RateAppPackage : TurboReactPackage() {
|
|
|
24
24
|
RateAppModule.NAME,
|
|
25
25
|
false, // canOverrideExistingModule
|
|
26
26
|
false, // needsEagerInit
|
|
27
|
-
true, // hasConstants
|
|
28
27
|
false, // isCxxModule
|
|
29
28
|
true // isTurboModule
|
|
30
29
|
)
|
package/app.plugin.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("./lib/commonjs/plugin/withReactNativeRateApp");
|
package/ios/RateApp.h
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeRateApp.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAmD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAQpCC,gCAAmB,CAACC,YAAY,CAAO,SAAS,CAAC","ignoreList":[]}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -10,7 +10,7 @@ var _exportNames = {
|
|
|
10
10
|
};
|
|
11
11
|
exports.requestReview = exports.openStoreForReview = exports.getAndroidMarketUrl = exports.default = void 0;
|
|
12
12
|
var _reactNative = require("react-native");
|
|
13
|
-
var _NativeRateApp = _interopRequireDefault(require("./
|
|
13
|
+
var _NativeRateApp = _interopRequireDefault(require("./NativeRateApp"));
|
|
14
14
|
var _constants = require("./constants");
|
|
15
15
|
Object.keys(_constants).forEach(function (key) {
|
|
16
16
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -45,7 +45,7 @@ class RateAppError extends Error {
|
|
|
45
45
|
this.name = "RateAppError";
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
const
|
|
48
|
+
const RNRateApp = {
|
|
49
49
|
/**
|
|
50
50
|
* Requests a review from the user.
|
|
51
51
|
*
|
|
@@ -132,9 +132,9 @@ const {
|
|
|
132
132
|
requestReview,
|
|
133
133
|
openStoreForReview,
|
|
134
134
|
getAndroidMarketUrl
|
|
135
|
-
} =
|
|
135
|
+
} = RNRateApp;
|
|
136
136
|
exports.getAndroidMarketUrl = getAndroidMarketUrl;
|
|
137
137
|
exports.openStoreForReview = openStoreForReview;
|
|
138
138
|
exports.requestReview = requestReview;
|
|
139
|
-
var _default = exports.default =
|
|
139
|
+
var _default = exports.default = RNRateApp;
|
|
140
140
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_NativeRateApp","_interopRequireDefault","_constants","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_types","e","__esModule","default","RateAppError","Error","constructor","message","name","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_NativeRateApp","_interopRequireDefault","_constants","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_types","e","__esModule","default","RateAppError","Error","constructor","message","name","RNRateApp","requestReview","androidMarket","AndroidMarket","GOOGLE","androidPackageName","Platform","OS","SAMSUNG","RateApp","requestReviewGalaxyStore","HUAWEI","requestReviewAppGallery","error","openStoreForReview","iOSAppId","isIOS","ismacOS","isAndroid","url","IOS_REVIEW_URL","getAndroidMarketUrl","canOpenURL","Linking","openURL","urlTemplate","ANDROID_MARKET_URLS","replace","_default"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;AAAA,IAAAA,YA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
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _configPlugins = require("@expo/config-plugins");
|
|
8
|
+
/**
|
|
9
|
+
* Modifies the `Info.plist` file to add `LSApplicationQueriesSchemes`,
|
|
10
|
+
* allowing the app to open App Store links.
|
|
11
|
+
*
|
|
12
|
+
* @param {ConfigPlugin} config - The Expo configuration object.
|
|
13
|
+
* @returns {ConfigPlugin} - The modified Expo configuration.
|
|
14
|
+
*/
|
|
15
|
+
const withCustomInfoPlist = config => {
|
|
16
|
+
return (0, _configPlugins.withInfoPlist)(config, config => {
|
|
17
|
+
config.modResults.LSApplicationQueriesSchemes = ["itms-apps"];
|
|
18
|
+
return config;
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Adds the `StoreKit.framework` to the iOS Xcode project.
|
|
24
|
+
* This framework is required for in-app review prompts.
|
|
25
|
+
*
|
|
26
|
+
* @param {ConfigPlugin} config - The Expo configuration object.
|
|
27
|
+
* @returns {ConfigPlugin} - The modified Expo configuration.
|
|
28
|
+
*/
|
|
29
|
+
const withStoreKitFramework = config => {
|
|
30
|
+
return (0, _configPlugins.withXcodeProject)(config, config => {
|
|
31
|
+
config.modResults.addFramework("StoreKit.framework", {
|
|
32
|
+
required: true
|
|
33
|
+
});
|
|
34
|
+
return config;
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Applies both `withCustomInfoPlist` and `withStoreKitFramework`
|
|
40
|
+
* to enable in-app rating functionality in a React Native app.
|
|
41
|
+
*
|
|
42
|
+
* @param {ConfigPlugin} config - The Expo configuration object.
|
|
43
|
+
* @returns {ConfigPlugin} - The modified Expo configuration.
|
|
44
|
+
*/
|
|
45
|
+
const withReactNativeRateApp = config => {
|
|
46
|
+
const configWithInfoPlist = withCustomInfoPlist(config);
|
|
47
|
+
const configWithStoreKit = withStoreKitFramework(configWithInfoPlist);
|
|
48
|
+
return configWithStoreKit;
|
|
49
|
+
};
|
|
50
|
+
var _default = exports.default = withReactNativeRateApp;
|
|
51
|
+
//# sourceMappingURL=withReactNativeRateApp.js.map
|
|
@@ -0,0 +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;IACvCA,MAAM,CAACE,UAAU,CAACC,2BAA2B,GAAG,CAAC,WAAW,CAAC;IAC7D,OAAOH,MAAM;EACf,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMI,qBAAmC,GAAIJ,MAAM,IAAK;EACtD,OAAO,IAAAK,+BAAgB,EAACL,MAAM,EAAGA,MAAM,IAAK;IAC1CA,MAAM,CAACE,UAAU,CAACI,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,GAAGN,qBAAqB,CAACK,mBAAmB,CAAC;EACrE,OAAOC,kBAAkB;AAC3B,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaL,sBAAsB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeRateApp.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;AAQlD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,SAAS,CAAC","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { Linking, Platform } from "react-native";
|
|
4
|
-
import
|
|
4
|
+
import RateApp from "./NativeRateApp";
|
|
5
5
|
import { ANDROID_MARKET_URLS, IOS_REVIEW_URL } from "./constants";
|
|
6
6
|
import { AndroidMarket } from "./types";
|
|
7
7
|
|
|
@@ -14,7 +14,7 @@ class RateAppError extends Error {
|
|
|
14
14
|
this.name = "RateAppError";
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
const
|
|
17
|
+
const RNRateApp = {
|
|
18
18
|
/**
|
|
19
19
|
* Requests a review from the user.
|
|
20
20
|
*
|
|
@@ -34,14 +34,14 @@ const RateApp = {
|
|
|
34
34
|
if (!androidPackageName) {
|
|
35
35
|
throw new RateAppError("androidPackageName is required for Samsung Galaxy Store");
|
|
36
36
|
}
|
|
37
|
-
return await
|
|
37
|
+
return await RateApp.requestReviewGalaxyStore(androidPackageName);
|
|
38
38
|
case AndroidMarket.HUAWEI:
|
|
39
|
-
return await
|
|
39
|
+
return await RateApp.requestReviewAppGallery();
|
|
40
40
|
default:
|
|
41
|
-
return await
|
|
41
|
+
return await RateApp.requestReview();
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
return await
|
|
44
|
+
return await RateApp.requestReview();
|
|
45
45
|
} catch (error) {
|
|
46
46
|
throw new RateAppError(`Failed to request review: ${error}`);
|
|
47
47
|
}
|
|
@@ -103,6 +103,6 @@ export const {
|
|
|
103
103
|
requestReview,
|
|
104
104
|
openStoreForReview,
|
|
105
105
|
getAndroidMarketUrl
|
|
106
|
-
} =
|
|
107
|
-
export default
|
|
106
|
+
} = RNRateApp;
|
|
107
|
+
export default RNRateApp;
|
|
108
108
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Linking","Platform","
|
|
1
|
+
{"version":3,"names":["Linking","Platform","RateApp","ANDROID_MARKET_URLS","IOS_REVIEW_URL","AndroidMarket","RateAppError","Error","constructor","message","name","RNRateApp","requestReview","androidMarket","GOOGLE","androidPackageName","OS","SAMSUNG","requestReviewGalaxyStore","HUAWEI","requestReviewAppGallery","error","openStoreForReview","iOSAppId","isIOS","ismacOS","isAndroid","url","getAndroidMarketUrl","canOpenURL","openURL","urlTemplate","replace"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,OAAO,EAAEC,QAAQ,QAAQ,cAAc;AAChD,OAAOC,OAAO,MAAM,iBAAiB;AACrC,SAASC,mBAAmB,EAAEC,cAAc,QAAQ,aAAa;AACjE,SACEC,aAAa,QAGR,SAAS;;AAEhB;AACA;AACA;AACA,MAAMC,YAAY,SAASC,KAAK,CAAC;EAC/BC,WAAWA,CAACC,OAAe,EAAE;IAC3B,KAAK,CAACA,OAAO,CAAC;IACd,IAAI,CAACC,IAAI,GAAG,cAAc;EAC5B;AACF;AAEA,MAAMC,SAAS,GAAG;EAChB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAMC,aAAaA,CAAC;IAClBC,aAAa,GAAGR,aAAa,CAACS,MAAM;IACpCC;EACkB,CAAC,GAAG,CAAC,CAAC,EAAoB;IAC5C,IAAI;MACF,IAAId,QAAQ,CAACe,EAAE,KAAK,SAAS,EAAE;QAC7B,QAAQH,aAAa;UACnB,KAAKR,aAAa,CAACY,OAAO;YACxB,IAAI,CAACF,kBAAkB,EAAE;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ChE;IAEA,IAAI;MACF,MAAMa,UAAU,GAAG,MAAM7B,OAAO,CAAC6B,UAAU,CAACF,GAAG,CAAC;MAChD,IAAIE,UAAU,EAAE;QACd,MAAM7B,OAAO,CAAC8B,OAAO,CAACH,GAAG,CAAC;MAC5B;MACA,OAAOE,UAAU;IACnB,CAAC,CAAC,OAAOR,KAAK,EAAE;MACd,MAAM,IAAIf,YAAY,CAAC,oCAAoCe,KAAK,EAAE,CAAC;IACrE;EACF,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;EACEO,mBAAmBA,CACjBf,aAA4B,EAC5BE,kBAA0B,EAClB;IACR,MAAMgB,WAAW,GAAG5B,mBAAmB,CAACU,aAAa,CAAC;IACtD,IAAI,CAACkB,WAAW,EAAE;MAChB,MAAM,IAAIzB,YAAY,CAAC,+BAA+BO,aAAa,EAAE,CAAC;IACxE;IACA,OAAOkB,WAAW,CAACC,OAAO,CAAC,eAAe,EAAEjB,kBAAkB,CAAC;EACjE;AACF,CAAC;AAED,cAAc,SAAS;AACvB,cAAc,aAAa;AAC3B,OAAO,MAAM;EAAEH,aAAa;EAAEU,kBAAkB;EAAEM;AAAoB,CAAC,GACrEjB,SAAS;AACX,eAAeA,SAAS","ignoreList":[]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { withInfoPlist, withXcodeProject } from "@expo/config-plugins";
|
|
4
|
+
/**
|
|
5
|
+
* Modifies the `Info.plist` file to add `LSApplicationQueriesSchemes`,
|
|
6
|
+
* allowing the app to open App Store links.
|
|
7
|
+
*
|
|
8
|
+
* @param {ConfigPlugin} config - The Expo configuration object.
|
|
9
|
+
* @returns {ConfigPlugin} - The modified Expo configuration.
|
|
10
|
+
*/
|
|
11
|
+
const withCustomInfoPlist = config => {
|
|
12
|
+
return withInfoPlist(config, config => {
|
|
13
|
+
config.modResults.LSApplicationQueriesSchemes = ["itms-apps"];
|
|
14
|
+
return config;
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Adds the `StoreKit.framework` to the iOS Xcode project.
|
|
20
|
+
* This framework is required for in-app review prompts.
|
|
21
|
+
*
|
|
22
|
+
* @param {ConfigPlugin} config - The Expo configuration object.
|
|
23
|
+
* @returns {ConfigPlugin} - The modified Expo configuration.
|
|
24
|
+
*/
|
|
25
|
+
const withStoreKitFramework = config => {
|
|
26
|
+
return withXcodeProject(config, config => {
|
|
27
|
+
config.modResults.addFramework("StoreKit.framework", {
|
|
28
|
+
required: true
|
|
29
|
+
});
|
|
30
|
+
return config;
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Applies both `withCustomInfoPlist` and `withStoreKitFramework`
|
|
36
|
+
* to enable in-app rating functionality in a React Native app.
|
|
37
|
+
*
|
|
38
|
+
* @param {ConfigPlugin} config - The Expo configuration object.
|
|
39
|
+
* @returns {ConfigPlugin} - The modified Expo configuration.
|
|
40
|
+
*/
|
|
41
|
+
const withReactNativeRateApp = config => {
|
|
42
|
+
const configWithInfoPlist = withCustomInfoPlist(config);
|
|
43
|
+
const configWithStoreKit = withStoreKitFramework(configWithInfoPlist);
|
|
44
|
+
return configWithStoreKit;
|
|
45
|
+
};
|
|
46
|
+
export default withReactNativeRateApp;
|
|
47
|
+
//# sourceMappingURL=withReactNativeRateApp.js.map
|
|
@@ -0,0 +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;IACvCA,MAAM,CAACC,UAAU,CAACC,2BAA2B,GAAG,CAAC,WAAW,CAAC;IAC7D,OAAOF,MAAM;EACf,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,qBAAmC,GAAIH,MAAM,IAAK;EACtD,OAAOF,gBAAgB,CAACE,MAAM,EAAGA,MAAM,IAAK;IAC1CA,MAAM,CAACC,UAAU,CAACG,YAAY,CAAC,oBAAoB,EAAE;MAAEC,QAAQ,EAAE;IAAK,CAAC,CAAC;IACxE,OAAOL,MAAM;EACf,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMM,sBAAoC,GAAIN,MAAM,IAAK;EACvD,MAAMO,mBAAmB,GAAGR,mBAAmB,CAACC,MAAM,CAAC;EACvD,MAAMQ,kBAAkB,GAAGL,qBAAqB,CAACI,mBAAmB,CAAC;EACrE,OAAOC,kBAAkB;AAC3B,CAAC;AAED,eAAeF,sBAAsB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeRateApp.d.ts","sourceRoot":"","sources":["../../src/NativeRateApp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAClC,uBAAuB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5C,wBAAwB,CAAC,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACxE;;AAED,wBAAiE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AndroidMarket, type OpenStoreForReviewProps, type RequestReviewProps } from "./types";
|
|
2
|
-
declare const
|
|
2
|
+
declare const RNRateApp: {
|
|
3
3
|
/**
|
|
4
4
|
* Requests a review from the user.
|
|
5
5
|
*
|
|
@@ -26,5 +26,5 @@ declare const RateApp: {
|
|
|
26
26
|
export * from "./types";
|
|
27
27
|
export * from "./constants";
|
|
28
28
|
export declare const requestReview: ({ androidMarket, androidPackageName, }?: RequestReviewProps) => Promise<boolean>, openStoreForReview: ({ iOSAppId, androidPackageName, androidMarket, }: OpenStoreForReviewProps) => Promise<boolean>, getAndroidMarketUrl: (androidMarket: AndroidMarket, androidPackageName: string) => string;
|
|
29
|
-
export default
|
|
29
|
+
export default RNRateApp;
|
|
30
30
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,EACb,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACxB,MAAM,SAAS,CAAC;AAYjB,QAAA,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,EACb,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACxB,MAAM,SAAS,CAAC;AAYjB,QAAA,MAAM,SAAS;IACb;;;;;;;OAOG;2DAIA,kBAAkB,GAAQ,OAAO,CAAC,OAAO,CAAC;IAuB7C;;;;OAIG;yEAKA,uBAAuB,GAAG,OAAO,CAAC,OAAO,CAAC;IA+B7C;;;;;OAKG;uCAEc,aAAa,sBACR,MAAM,GACzB,MAAM;CAOV,CAAC;AAEF,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,eAAO,MAAQ,aAAa,4CAnFvB,kBAAkB,KAAQ,OAAO,CAAC,OAAO,CAAC,EAmFjB,kBAAkB,qDAnD3C,uBAAuB,KAAG,OAAO,CAAC,OAAO,CAAC,EAmDG,mBAAmB,kBAblD,aAAa,sBACR,MAAM,KACzB,MAYM,CAAC;AACZ,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ConfigPlugin } from "expo/config-plugins";
|
|
2
|
+
/**
|
|
3
|
+
* Applies both `withCustomInfoPlist` and `withStoreKitFramework`
|
|
4
|
+
* to enable in-app rating functionality in a React Native app.
|
|
5
|
+
*
|
|
6
|
+
* @param {ConfigPlugin} config - The Expo configuration object.
|
|
7
|
+
* @returns {ConfigPlugin} - The modified Expo configuration.
|
|
8
|
+
*/
|
|
9
|
+
declare const withReactNativeRateApp: ConfigPlugin;
|
|
10
|
+
export default withReactNativeRateApp;
|
|
11
|
+
//# sourceMappingURL=withReactNativeRateApp.d.ts.map
|
|
@@ -0,0 +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;AA8BxD;;;;;;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.
|
|
3
|
+
"version": "1.2.0",
|
|
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",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"ios",
|
|
15
15
|
"cpp",
|
|
16
16
|
"*.podspec",
|
|
17
|
+
"react-native.config.js",
|
|
17
18
|
"!ios/build",
|
|
18
19
|
"!android/build",
|
|
19
20
|
"!android/gradle",
|
|
@@ -23,7 +24,8 @@
|
|
|
23
24
|
"!**/__tests__",
|
|
24
25
|
"!**/__fixtures__",
|
|
25
26
|
"!**/__mocks__",
|
|
26
|
-
"!**/.*"
|
|
27
|
+
"!**/.*",
|
|
28
|
+
"app.plugin.js"
|
|
27
29
|
],
|
|
28
30
|
"scripts": {
|
|
29
31
|
"example": "yarn workspace react-native-rate-app-example",
|
|
@@ -65,32 +67,39 @@
|
|
|
65
67
|
"@biomejs/biome": "1.9.4",
|
|
66
68
|
"@commitlint/cli": "19.7.1",
|
|
67
69
|
"@commitlint/config-conventional": "19.7.1",
|
|
70
|
+
"@react-native-community/cli": "15.1.3",
|
|
68
71
|
"@semantic-release/changelog": "6.0.3",
|
|
69
72
|
"@semantic-release/git": "10.0.1",
|
|
70
73
|
"@types/jest": "29.5.14",
|
|
71
74
|
"@types/react": "19.0.10",
|
|
72
75
|
"commitlint": "19.7.1",
|
|
73
76
|
"del-cli": "6.0.0",
|
|
77
|
+
"expo": "^52.0.31",
|
|
74
78
|
"husky": "9.1.7",
|
|
75
79
|
"jest": "29.7.0",
|
|
76
80
|
"react": "19.0.0",
|
|
77
81
|
"react-native": "0.78.0",
|
|
78
82
|
"react-native-builder-bob": "0.37.0",
|
|
79
83
|
"semantic-release": "24.2.3",
|
|
80
|
-
"turbo": "2.4.
|
|
81
|
-
"typescript": "5.
|
|
84
|
+
"turbo": "2.4.4",
|
|
85
|
+
"typescript": "5.8.2"
|
|
82
86
|
},
|
|
83
87
|
"resolutions": {
|
|
84
|
-
"@types/react": "19.0.10"
|
|
88
|
+
"@types/react": "^19.0.10"
|
|
85
89
|
},
|
|
86
90
|
"peerDependencies": {
|
|
87
91
|
"react": "*",
|
|
88
92
|
"react-native": "*"
|
|
89
93
|
},
|
|
94
|
+
"peerDependenciesMeta": {
|
|
95
|
+
"expo": {
|
|
96
|
+
"optional": true
|
|
97
|
+
}
|
|
98
|
+
},
|
|
90
99
|
"workspaces": [
|
|
91
100
|
"example"
|
|
92
101
|
],
|
|
93
|
-
"packageManager": "yarn@
|
|
102
|
+
"packageManager": "yarn@3.6.1",
|
|
94
103
|
"jest": {
|
|
95
104
|
"preset": "react-native",
|
|
96
105
|
"modulePathIgnorePatterns": [
|
|
@@ -104,7 +113,8 @@
|
|
|
104
113
|
"src/**/*.ts",
|
|
105
114
|
"src/**/*.tsx",
|
|
106
115
|
"!src/types.ts",
|
|
107
|
-
"!src/
|
|
116
|
+
"!src/NativeRateApp.ts",
|
|
117
|
+
"!src/plugin/**"
|
|
108
118
|
],
|
|
109
119
|
"collectCoverage": true
|
|
110
120
|
},
|
|
@@ -123,20 +133,21 @@
|
|
|
123
133
|
]
|
|
124
134
|
},
|
|
125
135
|
"codegenConfig": {
|
|
126
|
-
"name": "
|
|
127
|
-
"type": "
|
|
128
|
-
"jsSrcsDir": "
|
|
136
|
+
"name": "RNRateAppSpec",
|
|
137
|
+
"type": "modules",
|
|
138
|
+
"jsSrcsDir": "src",
|
|
129
139
|
"outputDir": {
|
|
130
140
|
"ios": "ios/generated",
|
|
131
141
|
"android": "android/generated"
|
|
132
142
|
},
|
|
133
143
|
"android": {
|
|
134
144
|
"javaPackageName": "com.rateapp"
|
|
135
|
-
}
|
|
145
|
+
},
|
|
146
|
+
"includesGeneratedCode": true
|
|
136
147
|
},
|
|
137
148
|
"create-react-native-library": {
|
|
138
|
-
"type": "module
|
|
149
|
+
"type": "turbo-module",
|
|
139
150
|
"languages": "kotlin-objc",
|
|
140
|
-
"version": "0.
|
|
151
|
+
"version": "0.48.3"
|
|
141
152
|
}
|
|
142
153
|
}
|
package/src/index.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Linking, Platform } from "react-native";
|
|
2
|
-
import
|
|
2
|
+
import RateApp from "./NativeRateApp";
|
|
3
3
|
import { ANDROID_MARKET_URLS, IOS_REVIEW_URL } from "./constants";
|
|
4
4
|
import {
|
|
5
5
|
AndroidMarket,
|
|
@@ -17,7 +17,7 @@ class RateAppError extends Error {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
const
|
|
20
|
+
const RNRateApp = {
|
|
21
21
|
/**
|
|
22
22
|
* Requests a review from the user.
|
|
23
23
|
*
|
|
@@ -39,16 +39,14 @@ const RateApp = {
|
|
|
39
39
|
"androidPackageName is required for Samsung Galaxy Store",
|
|
40
40
|
);
|
|
41
41
|
}
|
|
42
|
-
return await
|
|
43
|
-
androidPackageName,
|
|
44
|
-
);
|
|
42
|
+
return await RateApp.requestReviewGalaxyStore(androidPackageName);
|
|
45
43
|
case AndroidMarket.HUAWEI:
|
|
46
|
-
return await
|
|
44
|
+
return await RateApp.requestReviewAppGallery();
|
|
47
45
|
default:
|
|
48
|
-
return await
|
|
46
|
+
return await RateApp.requestReview();
|
|
49
47
|
}
|
|
50
48
|
}
|
|
51
|
-
return await
|
|
49
|
+
return await RateApp.requestReview();
|
|
52
50
|
} catch (error) {
|
|
53
51
|
throw new RateAppError(`Failed to request review: ${error}`);
|
|
54
52
|
}
|
|
@@ -115,5 +113,5 @@ const RateApp = {
|
|
|
115
113
|
export * from "./types";
|
|
116
114
|
export * from "./constants";
|
|
117
115
|
export const { requestReview, openStoreForReview, getAndroidMarketUrl } =
|
|
118
|
-
|
|
119
|
-
export default
|
|
116
|
+
RNRateApp;
|
|
117
|
+
export default RNRateApp;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { withInfoPlist, withXcodeProject } from "@expo/config-plugins";
|
|
2
|
+
import type { ConfigPlugin } from "expo/config-plugins";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Modifies the `Info.plist` file to add `LSApplicationQueriesSchemes`,
|
|
6
|
+
* allowing the app to open App Store links.
|
|
7
|
+
*
|
|
8
|
+
* @param {ConfigPlugin} config - The Expo configuration object.
|
|
9
|
+
* @returns {ConfigPlugin} - The modified Expo configuration.
|
|
10
|
+
*/
|
|
11
|
+
const withCustomInfoPlist: ConfigPlugin = (config) => {
|
|
12
|
+
return withInfoPlist(config, (config) => {
|
|
13
|
+
config.modResults.LSApplicationQueriesSchemes = ["itms-apps"];
|
|
14
|
+
return config;
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Adds the `StoreKit.framework` to the iOS Xcode project.
|
|
20
|
+
* This framework is required for in-app review prompts.
|
|
21
|
+
*
|
|
22
|
+
* @param {ConfigPlugin} config - The Expo configuration object.
|
|
23
|
+
* @returns {ConfigPlugin} - The modified Expo configuration.
|
|
24
|
+
*/
|
|
25
|
+
const withStoreKitFramework: ConfigPlugin = (config) => {
|
|
26
|
+
return withXcodeProject(config, (config) => {
|
|
27
|
+
config.modResults.addFramework("StoreKit.framework", { required: true });
|
|
28
|
+
return config;
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Applies both `withCustomInfoPlist` and `withStoreKitFramework`
|
|
34
|
+
* to enable in-app rating functionality in a React Native app.
|
|
35
|
+
*
|
|
36
|
+
* @param {ConfigPlugin} config - The Expo configuration object.
|
|
37
|
+
* @returns {ConfigPlugin} - The modified Expo configuration.
|
|
38
|
+
*/
|
|
39
|
+
const withReactNativeRateApp: ConfigPlugin = (config) => {
|
|
40
|
+
const configWithInfoPlist = withCustomInfoPlist(config);
|
|
41
|
+
const configWithStoreKit = withStoreKitFramework(configWithInfoPlist);
|
|
42
|
+
return configWithStoreKit;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export default withReactNativeRateApp;
|
|
@@ -1,8 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../../src","sources":["codegenSpec/NativeRateApp.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAmD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAQpCC,gCAAmB,CAACC,YAAY,CAAO,SAAS,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../../src","sources":["codegenSpec/NativeRateApp.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;AAQlD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,SAAS,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NativeRateApp.d.ts","sourceRoot":"","sources":["../../../src/codegenSpec/NativeRateApp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAClC,uBAAuB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5C,wBAAwB,CAAC,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACxE;;AAED,wBAAiE"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
require "json"
|
|
2
|
-
|
|
3
|
-
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
-
|
|
5
|
-
Pod::Spec.new do |s|
|
|
6
|
-
s.name = "react-native-rate-app"
|
|
7
|
-
s.version = package["version"]
|
|
8
|
-
s.summary = package["description"]
|
|
9
|
-
s.homepage = package["homepage"]
|
|
10
|
-
s.license = package["license"]
|
|
11
|
-
s.authors = package["author"]
|
|
12
|
-
|
|
13
|
-
s.platforms = { :ios => "14.0" }
|
|
14
|
-
s.source = { :git => "https://github.com/huextrat/react-native-rate-app.git", :tag => "v#{s.version}" }
|
|
15
|
-
|
|
16
|
-
s.source_files = "ios/**/*.{h,m,mm,cpp}"
|
|
17
|
-
|
|
18
|
-
if defined?(install_modules_dependencies()) != nil
|
|
19
|
-
install_modules_dependencies(s)
|
|
20
|
-
else
|
|
21
|
-
s.dependency "React-Core"
|
|
22
|
-
end
|
|
23
|
-
end
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|