1
0
mirror of https://gitcode.com/gh_mirrors/re/react-native-pushy.git synced 2025-11-01 13:53:11 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

Add client info and uuid

This commit is contained in:
sunnylqm
2020-08-31 11:47:08 +08:00
parent 9e6c7ea769
commit c6f9bb20a1
4 changed files with 38 additions and 2592 deletions

View File

@@ -5,6 +5,11 @@ import {
} from './endpoint';
import { NativeAppEventEmitter, NativeModules, Platform } from 'react-native';
export { setCustomEndpoints };
const {
version: v,
} = require('react-native/Libraries/Core/ReactNativeVersion');
const RNVersion = `${v.major}.${v.minor}.${v.patch}`;
import { v4 as uuidv4 } from 'uuid';
let Pushy = NativeModules.Pushy;
@@ -19,6 +24,7 @@ export const isFirstTime = Pushy.isFirstTime;
export const isRolledBack = Pushy.isRolledBack;
export const buildTime = Pushy.buildTime;
let blockUpdate = Pushy.blockUpdate;
let uuid = Pushy.uuid;
if (Platform.OS === 'android' && !Pushy.isUsingBundleUrl) {
throw new Error(
@@ -26,6 +32,13 @@ if (Platform.OS === 'android' && !Pushy.isUsingBundleUrl) {
);
}
if (!uuid) {
uuid = uuidv4();
Pushy.setUuid(uuid);
}
console.log('Pushy uuid: ' + uuid);
/*
Return json:
Package expired:
@@ -77,6 +90,12 @@ export async function checkUpdate(APPKEY, isRetry) {
packageVersion,
hash: currentVersion,
buildTime,
cInfo: {
pushy: require('../package.json').version,
rn: RNVersion,
os: Platform.OS + ' ' + Platform.Version,
uuid,
},
}),
});
} catch (e) {