mirror of
https://gitcode.com/gh_mirrors/re/react-native-pushy.git
synced 2025-10-07 19:05:13 +08:00
fix: optimize
This commit is contained in:
19
lib/main.js
19
lib/main.js
@@ -23,19 +23,20 @@ const Pushy = isTurboModuleEnabled ?
|
||||
if (!Pushy) {
|
||||
throw new Error('react-native-update模块无法加载,请对照安装文档检查配置。');
|
||||
}
|
||||
const PushyConstants = isTurboModuleEnabled ? Pushy.getConstants(): Pushy;
|
||||
|
||||
export const downloadRootDir = isTurboModuleEnabled ? Pushy.getConstants().downloadRootDir : Pushy.downloadRootDir;
|
||||
export const packageVersion = isTurboModuleEnabled ? Pushy.getConstants().packageVersion : Pushy.packageVersion;
|
||||
export const currentVersion = isTurboModuleEnabled ? Pushy.getConstants().currentVersion : Pushy.currentVersion;
|
||||
export const isFirstTime = isTurboModuleEnabled ? Pushy.getConstants().isFirstTime : Pushy.isFirstTime;
|
||||
const rolledBackVersion = isTurboModuleEnabled ? Pushy.getConstants().rolledBackVersion : Pushy.rolledBackVersion;
|
||||
export const downloadRootDir = PushyConstants.downloadRootDir;
|
||||
export const packageVersion = PushyConstants.packageVersion;
|
||||
export const currentVersion = PushyConstants.currentVersion;
|
||||
export const isFirstTime = PushyConstants.isFirstTime;
|
||||
const rolledBackVersion = PushyConstants.rolledBackVersion;
|
||||
export const isRolledBack = typeof rolledBackVersion === 'string';
|
||||
|
||||
export const buildTime = isTurboModuleEnabled ? Pushy.getConstants().buildTime : Pushy.buildTime;
|
||||
let blockUpdate = isTurboModuleEnabled ? Pushy.getConstants().blockUpdate : Pushy.blockUpdate;
|
||||
let uuid = isTurboModuleEnabled ? Pushy.getConstants().uuid : Pushy.uuid;
|
||||
export const buildTime = PushyConstants.buildTime;
|
||||
let blockUpdate = PushyConstants.blockUpdate;
|
||||
let uuid = PushyConstants.uuid;
|
||||
|
||||
if (Platform.OS === 'android' && !(isTurboModuleEnabled ? Pushy.getConstants().isUsingBundleUrl : Pushy.isUsingBundleUrl)) {
|
||||
if (Platform.OS === 'android' && !PushyConstants.isUsingBundleUrl) {
|
||||
throw new Error(
|
||||
'react-native-update模块无法加载,请对照文档检查Bundle URL的配置',
|
||||
);
|
||||
|
Reference in New Issue
Block a user