@norcy/react-native-toolkit 0.1.29 → 0.1.31
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/lib/commonjs/LoginManager.js +3 -8
- package/lib/commonjs/LoginManager.js.map +1 -1
- package/lib/commonjs/MessageModel.js +1 -1
- package/lib/commonjs/MessageModel.js.map +1 -1
- package/lib/commonjs/Tool.js +5 -0
- package/lib/commonjs/Tool.js.map +1 -1
- package/lib/commonjs/VipAndroidManager.js +2 -9
- package/lib/commonjs/VipAndroidManager.js.map +1 -1
- package/lib/commonjs/VipManager.js +5 -15
- package/lib/commonjs/VipManager.js.map +1 -1
- package/lib/module/LoginManager.js +3 -8
- package/lib/module/LoginManager.js.map +1 -1
- package/lib/module/MessageModel.js +1 -1
- package/lib/module/MessageModel.js.map +1 -1
- package/lib/module/Tool.js +5 -0
- package/lib/module/Tool.js.map +1 -1
- package/lib/module/VipAndroidManager.js +3 -10
- package/lib/module/VipAndroidManager.js.map +1 -1
- package/lib/module/VipManager.js +6 -16
- package/lib/module/VipManager.js.map +1 -1
- package/lib/typescript/LoginManager.d.ts +0 -1
- package/lib/typescript/Tool.d.ts +8 -1
- package/lib/typescript/VipAndroidManager.d.ts +0 -3
- package/lib/typescript/VipManager.d.ts +1 -5
- package/package.json +1 -1
- package/src/LoginManager.ts +5 -12
- package/src/MessageModel.ts +1 -1
- package/src/Tool.ts +17 -1
- package/src/VipAndroidManager.ts +3 -9
- package/src/VipManager.ts +6 -20
package/src/MessageModel.ts
CHANGED
package/src/Tool.ts
CHANGED
|
@@ -5,14 +5,24 @@ import { ReportUtil } from './ReportUtil';
|
|
|
5
5
|
|
|
6
6
|
export interface ToolkitConfigType {
|
|
7
7
|
iOSStoreUrl: string;
|
|
8
|
-
|
|
8
|
+
AndroidStoreUrl: string;
|
|
9
9
|
iOSStoreScheme: string;
|
|
10
10
|
AndroidStoreScheme: string;
|
|
11
11
|
iOSReviewUrl: string;
|
|
12
12
|
AndroidPackageName: string;
|
|
13
|
+
|
|
13
14
|
AppWebsite: string;
|
|
15
|
+
|
|
14
16
|
PolicyUrl: string;
|
|
15
17
|
TermsUrl: string;
|
|
18
|
+
|
|
19
|
+
PushDeerUrl: string;
|
|
20
|
+
|
|
21
|
+
RC_API_KEY: string;
|
|
22
|
+
RC_ENTITLEMENT_ID: string;
|
|
23
|
+
WeChatPayServer: string;
|
|
24
|
+
WeiXinId: string;
|
|
25
|
+
WeiXinSecret: string;
|
|
16
26
|
}
|
|
17
27
|
|
|
18
28
|
export let ToolkitConfig: ToolkitConfigType;
|
|
@@ -192,4 +202,10 @@ export const Tool = {
|
|
|
192
202
|
Linking.openURL(ToolkitConfig.AppWebsite);
|
|
193
203
|
}
|
|
194
204
|
},
|
|
205
|
+
|
|
206
|
+
notifyMe: async (text: string) => {
|
|
207
|
+
if (!__DEV__) {
|
|
208
|
+
await fetch(ToolkitConfig.PushDeerUrl + encodeURIComponent(text));
|
|
209
|
+
}
|
|
210
|
+
},
|
|
195
211
|
};
|
package/src/VipAndroidManager.ts
CHANGED
|
@@ -2,20 +2,14 @@ import Purchases, { PurchasesPackage } from 'react-native-purchases';
|
|
|
2
2
|
import * as WeChat from 'react-native-wechat-lib';
|
|
3
3
|
import { ConfigDataModel } from './ConfigDataModel';
|
|
4
4
|
import { LoginManager } from './LoginManager';
|
|
5
|
-
import { Tool } from './Tool';
|
|
6
|
-
|
|
7
|
-
let SERVER_URL = '';
|
|
5
|
+
import { Tool, ToolkitConfig } from './Tool';
|
|
8
6
|
|
|
9
7
|
export const VipAndroidManager = {
|
|
10
|
-
init: ({ WeChatPayServer }: { WeChatPayServer: string }) => {
|
|
11
|
-
SERVER_URL = WeChatPayServer;
|
|
12
|
-
},
|
|
13
|
-
|
|
14
8
|
queryOrder: async (orderId?: string) => {
|
|
15
9
|
const user = LoginManager.currentUser();
|
|
16
10
|
// Step1:生成预订单
|
|
17
11
|
try {
|
|
18
|
-
const rawResponse = await fetch(
|
|
12
|
+
const rawResponse = await fetch(ToolkitConfig.WeChatPayServer, {
|
|
19
13
|
method: 'POST',
|
|
20
14
|
headers: {
|
|
21
15
|
'Accept': 'application/json',
|
|
@@ -64,7 +58,7 @@ export const VipAndroidManager = {
|
|
|
64
58
|
try {
|
|
65
59
|
const user = LoginManager.currentUser();
|
|
66
60
|
// Step1:生成预订单
|
|
67
|
-
const rawResponse = await fetch(
|
|
61
|
+
const rawResponse = await fetch(ToolkitConfig.WeChatPayServer, {
|
|
68
62
|
method: 'POST',
|
|
69
63
|
headers: {
|
|
70
64
|
'Accept': 'application/json',
|
package/src/VipManager.ts
CHANGED
|
@@ -7,32 +7,17 @@ import { DevConfig } from './DevConfig';
|
|
|
7
7
|
import { LoginManager } from './LoginManager';
|
|
8
8
|
import { Notification } from './Notification';
|
|
9
9
|
import { BuildInPrefs } from './PrefData';
|
|
10
|
-
import { Tool } from './Tool';
|
|
10
|
+
import { Tool, ToolkitConfig } from './Tool';
|
|
11
11
|
import { VipAndroidManager } from './VipAndroidManager';
|
|
12
12
|
import { UserType } from './constant';
|
|
13
13
|
|
|
14
14
|
let _customerInfo: CustomerInfo | null;
|
|
15
|
-
let _RC_ENTITLEMENT_ID: string = '';
|
|
16
15
|
|
|
17
16
|
export const VipManager = {
|
|
18
|
-
init: ({
|
|
19
|
-
RC_API_KEY,
|
|
20
|
-
RC_ENTITLEMENT_ID,
|
|
21
|
-
WeChatPayServer,
|
|
22
|
-
}: {
|
|
23
|
-
RC_API_KEY: string;
|
|
24
|
-
RC_ENTITLEMENT_ID: string;
|
|
25
|
-
WeChatPayServer: string;
|
|
26
|
-
}) => {
|
|
17
|
+
init: () => {
|
|
27
18
|
console.log('Vip 模块初始化');
|
|
28
19
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
_RC_ENTITLEMENT_ID = RC_ENTITLEMENT_ID;
|
|
32
|
-
|
|
33
|
-
Purchases.configure({
|
|
34
|
-
apiKey: RC_API_KEY,
|
|
35
|
-
});
|
|
20
|
+
Purchases.configure({ apiKey: ToolkitConfig.RC_API_KEY });
|
|
36
21
|
|
|
37
22
|
VipManager.refreshVip();
|
|
38
23
|
|
|
@@ -78,8 +63,9 @@ export const VipManager = {
|
|
|
78
63
|
|
|
79
64
|
await VipManager.refreshVip(customerInfo);
|
|
80
65
|
if (
|
|
81
|
-
typeof customerInfo.entitlements.active[
|
|
82
|
-
|
|
66
|
+
typeof customerInfo.entitlements.active[
|
|
67
|
+
ToolkitConfig.RC_ENTITLEMENT_ID
|
|
68
|
+
] !== 'undefined'
|
|
83
69
|
) {
|
|
84
70
|
console.log('购买成功');
|
|
85
71
|
return { errorCode: 0 };
|