react-native-rate-app 1.5.0 → 1.5.1
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 +1 -1
- package/android/build.gradle +1 -0
- package/ios/RateApp.mm +59 -4
- package/lib/module/plugin/withReactNativeRateApp.js +5 -2
- package/lib/module/plugin/withReactNativeRateApp.js.map +1 -1
- package/package.json +4 -3
- package/src/plugin/{withReactNativeRateApp.ts → withReactNativeRateApp.js} +5 -9
- package/ios/RateApp-Bridging-Header.h +0 -1
- package/ios/RateApp.swift +0 -63
- package/lib/typescript/src/plugin/withReactNativeRateApp.d.ts +0 -11
- package/lib/typescript/src/plugin/withReactNativeRateApp.d.ts.map +0 -1
package/RateApp.podspec
CHANGED
|
@@ -13,7 +13,7 @@ Pod::Spec.new do |s|
|
|
|
13
13
|
s.platforms = { :ios => min_ios_version_supported }
|
|
14
14
|
s.source = { :git => "https://github.com/huextrat/react-native-rate-app.git", :tag => "#{s.version}" }
|
|
15
15
|
|
|
16
|
-
s.source_files = "ios/**/*.{h,m,mm,swift,cpp
|
|
16
|
+
s.source_files = "ios/**/*.{h,m,mm,swift,cpp}"
|
|
17
17
|
s.private_header_files = "ios/**/*.h"
|
|
18
18
|
|
|
19
19
|
install_modules_dependencies(s)
|
package/android/build.gradle
CHANGED
package/ios/RateApp.mm
CHANGED
|
@@ -1,9 +1,64 @@
|
|
|
1
1
|
#import "RateApp.h"
|
|
2
|
-
#import
|
|
2
|
+
#import <React/RCTBridgeModule.h>
|
|
3
|
+
#import <StoreKit/StoreKit.h>
|
|
4
|
+
#import <UIKit/UIKit.h>
|
|
3
5
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
static NSString *const kNoActiveSceneError = @"no_active_scene";
|
|
7
|
+
static NSString *const kUnsupportedPlatformError = @"unsupported_platform";
|
|
8
|
+
|
|
9
|
+
@implementation RateApp
|
|
10
|
+
|
|
11
|
+
#pragma mark - Private
|
|
12
|
+
|
|
13
|
+
- (UIWindowScene *)findActiveScene
|
|
14
|
+
{
|
|
15
|
+
if (@available(iOS 13.0, *)) {
|
|
16
|
+
NSSet<UIScene *> *scenes = [UIApplication sharedApplication].connectedScenes;
|
|
17
|
+
for (UIScene *scene in scenes) {
|
|
18
|
+
if ([scene isKindOfClass:[UIWindowScene class]] &&
|
|
19
|
+
scene.activationState == UISceneActivationStateForegroundActive) {
|
|
20
|
+
return (UIWindowScene *)scene;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return nil;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
#pragma mark - NativeRateAppSpec
|
|
28
|
+
|
|
29
|
+
- (void)requestReview:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject
|
|
30
|
+
{
|
|
31
|
+
UIWindowScene *scene = [self findActiveScene];
|
|
32
|
+
if (scene == nil) {
|
|
33
|
+
reject(kNoActiveSceneError, @"No active scene found", nil);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
38
|
+
if (@available(iOS 14.0, *)) {
|
|
39
|
+
[SKStoreReviewController requestReviewInScene:scene];
|
|
40
|
+
} else {
|
|
41
|
+
[SKStoreReviewController requestReview];
|
|
42
|
+
}
|
|
43
|
+
resolve(@YES);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
- (void)requestReviewAppGallery:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject
|
|
48
|
+
{
|
|
49
|
+
reject(kUnsupportedPlatformError,
|
|
50
|
+
@"App Gallery reviews are not supported on iOS",
|
|
51
|
+
nil);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
- (void)requestReviewGalaxyStore:(NSString *)packageName
|
|
55
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
56
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
57
|
+
{
|
|
58
|
+
reject(kUnsupportedPlatformError,
|
|
59
|
+
@"Galaxy Store reviews are not supported on iOS",
|
|
60
|
+
nil);
|
|
61
|
+
}
|
|
7
62
|
|
|
8
63
|
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
9
64
|
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const {
|
|
4
|
+
withInfoPlist,
|
|
5
|
+
withXcodeProject
|
|
6
|
+
} = require('@expo/config-plugins');
|
|
4
7
|
|
|
5
8
|
/**
|
|
6
9
|
* Modifies the `Info.plist` file to add `LSApplicationQueriesSchemes`,
|
|
@@ -49,5 +52,5 @@ const withReactNativeRateApp = config => {
|
|
|
49
52
|
const configWithStoreKit = withStoreKitFramework(configWithInfoPlist);
|
|
50
53
|
return configWithStoreKit;
|
|
51
54
|
};
|
|
52
|
-
|
|
55
|
+
module.exports = withReactNativeRateApp;
|
|
53
56
|
//# sourceMappingURL=withReactNativeRateApp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withInfoPlist","withXcodeProject","withCustomInfoPlist","config","modResults","LSApplicationQueriesSchemes","includes","push","withStoreKitFramework","addFramework","required","withReactNativeRateApp","configWithInfoPlist","configWithStoreKit"],"sourceRoot":"../../../src","sources":["plugin/withReactNativeRateApp.
|
|
1
|
+
{"version":3,"names":["withInfoPlist","withXcodeProject","require","withCustomInfoPlist","config","modResults","LSApplicationQueriesSchemes","includes","push","withStoreKitFramework","addFramework","required","withReactNativeRateApp","configWithInfoPlist","configWithStoreKit","module","exports"],"sourceRoot":"../../../src","sources":["plugin/withReactNativeRateApp.js"],"mappings":";;AAAA,MAAM;EAAEA,aAAa;EAAEC;AAAiB,CAAC,GAAGC,OAAO,CAAC,sBAAsB,CAAC;;AAE3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,mBAAmB,GAAIC,MAAM,IAAK;EACtC,OAAOJ,aAAa,CAACI,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,qBAAqB,GAAIL,MAAM,IAAK;EACxC,OAAOH,gBAAgB,CAACG,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,sBAAsB,GAAIR,MAAM,IAAK;EACzC,MAAMS,mBAAmB,GAAGV,mBAAmB,CAACC,MAAM,CAAC;EACvD,MAAMU,kBAAkB,GAAGL,qBAAqB,CAACI,mBAAmB,CAAC;EACrE,OAAOC,kBAAkB;AAC3B,CAAC;AAEDC,MAAM,CAACC,OAAO,GAAGJ,sBAAsB","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-rate-app",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "React Native module for In App Rating on Android and iOS",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"types": "./lib/typescript/src/index.d.ts",
|
|
11
11
|
"default": "./lib/module/index.js"
|
|
12
12
|
},
|
|
13
|
-
"./package.json": "./package.json"
|
|
13
|
+
"./package.json": "./package.json",
|
|
14
|
+
"./app.plugin.js": "./app.plugin.js"
|
|
14
15
|
},
|
|
15
16
|
"files": [
|
|
16
17
|
"src",
|
|
@@ -68,7 +69,7 @@
|
|
|
68
69
|
"devDependencies": {
|
|
69
70
|
"@commitlint/cli": "20.4.3",
|
|
70
71
|
"@commitlint/config-conventional": "20.4.3",
|
|
71
|
-
"@eslint/compat": "2.0.
|
|
72
|
+
"@eslint/compat": "2.0.3",
|
|
72
73
|
"@eslint/eslintrc": "3.3.5",
|
|
73
74
|
"@eslint/js": "9.35.0",
|
|
74
75
|
"@react-native/babel-preset": "0.84.1",
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
type ConfigPlugin,
|
|
3
|
-
withInfoPlist,
|
|
4
|
-
withXcodeProject,
|
|
5
|
-
} from '@expo/config-plugins';
|
|
1
|
+
const { withInfoPlist, withXcodeProject } = require('@expo/config-plugins');
|
|
6
2
|
|
|
7
3
|
/**
|
|
8
4
|
* Modifies the `Info.plist` file to add `LSApplicationQueriesSchemes`,
|
|
@@ -11,7 +7,7 @@ import {
|
|
|
11
7
|
* @param {ConfigPlugin} config - The Expo configuration object.
|
|
12
8
|
* @returns {ConfigPlugin} - The modified Expo configuration.
|
|
13
9
|
*/
|
|
14
|
-
const withCustomInfoPlist
|
|
10
|
+
const withCustomInfoPlist = (config) => {
|
|
15
11
|
return withInfoPlist(config, (config) => {
|
|
16
12
|
if (!config.modResults.LSApplicationQueriesSchemes) {
|
|
17
13
|
config.modResults.LSApplicationQueriesSchemes = [];
|
|
@@ -30,7 +26,7 @@ const withCustomInfoPlist: ConfigPlugin = (config) => {
|
|
|
30
26
|
* @param {ConfigPlugin} config - The Expo configuration object.
|
|
31
27
|
* @returns {ConfigPlugin} - The modified Expo configuration.
|
|
32
28
|
*/
|
|
33
|
-
const withStoreKitFramework
|
|
29
|
+
const withStoreKitFramework = (config) => {
|
|
34
30
|
return withXcodeProject(config, (config) => {
|
|
35
31
|
config.modResults.addFramework('StoreKit.framework', { required: true });
|
|
36
32
|
return config;
|
|
@@ -44,10 +40,10 @@ const withStoreKitFramework: ConfigPlugin = (config) => {
|
|
|
44
40
|
* @param {ConfigPlugin} config - The Expo configuration object.
|
|
45
41
|
* @returns {ConfigPlugin} - The modified Expo configuration.
|
|
46
42
|
*/
|
|
47
|
-
const withReactNativeRateApp
|
|
43
|
+
const withReactNativeRateApp = (config) => {
|
|
48
44
|
const configWithInfoPlist = withCustomInfoPlist(config);
|
|
49
45
|
const configWithStoreKit = withStoreKitFramework(configWithInfoPlist);
|
|
50
46
|
return configWithStoreKit;
|
|
51
47
|
};
|
|
52
48
|
|
|
53
|
-
|
|
49
|
+
module.exports = withReactNativeRateApp;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//
|
package/ios/RateApp.swift
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import Foundation
|
|
2
|
-
import React
|
|
3
|
-
import StoreKit
|
|
4
|
-
|
|
5
|
-
@objc(RateApp)
|
|
6
|
-
class RateApp: NSObject {
|
|
7
|
-
|
|
8
|
-
private let noActiveSceneError = "no_active_scene"
|
|
9
|
-
private let unsupportedPlatformError = "unsupported_platform"
|
|
10
|
-
|
|
11
|
-
@objc
|
|
12
|
-
static func requiresMainQueueSetup() -> Bool {
|
|
13
|
-
return false
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
@objc
|
|
17
|
-
func requestReview(
|
|
18
|
-
_ resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock
|
|
19
|
-
) {
|
|
20
|
-
if let scene = findActiveScene() {
|
|
21
|
-
if #available(iOS 16.0, *) {
|
|
22
|
-
Task { @MainActor in
|
|
23
|
-
AppStore.requestReview(in: scene)
|
|
24
|
-
}
|
|
25
|
-
} else {
|
|
26
|
-
if #available(iOS 14.0, *) {
|
|
27
|
-
SKStoreReviewController.requestReview(in: scene)
|
|
28
|
-
} else {
|
|
29
|
-
SKStoreReviewController.requestReview()
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
resolve(true)
|
|
33
|
-
} else {
|
|
34
|
-
reject(noActiveSceneError, "No active scene found", nil)
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
@objc
|
|
39
|
-
func requestReviewAppGallery(
|
|
40
|
-
_ resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock
|
|
41
|
-
) {
|
|
42
|
-
reject(unsupportedPlatformError, "App Gallery reviews are not supported on iOS", nil)
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
@objc
|
|
46
|
-
func requestReviewGalaxyStore(
|
|
47
|
-
_ packageName: String, resolve: @escaping RCTPromiseResolveBlock,
|
|
48
|
-
reject: @escaping RCTPromiseRejectBlock
|
|
49
|
-
) {
|
|
50
|
-
reject(unsupportedPlatformError, "Galaxy Store reviews are not supported on iOS", nil)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
private func findActiveScene() -> UIWindowScene? {
|
|
54
|
-
for scene in UIApplication.shared.connectedScenes {
|
|
55
|
-
if let windowScene = scene as? UIWindowScene,
|
|
56
|
-
windowScene.activationState == .foregroundActive
|
|
57
|
-
{
|
|
58
|
-
return windowScene
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return nil
|
|
62
|
-
}
|
|
63
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"withReactNativeRateApp.d.ts","sourceRoot":"","sources":["../../../../src/plugin/withReactNativeRateApp.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EAGlB,MAAM,sBAAsB,CAAC;AAmC9B;;;;;;GAMG;AACH,QAAA,MAAM,sBAAsB,EAAE,YAI7B,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|