mirror of
https://gitcode.com/gh_mirrors/re/react-native-pushy.git
synced 2025-10-24 01:58:53 +08:00
add currentversioninfo
This commit is contained in:
@@ -32,6 +32,7 @@ getConstants(): Object {
|
||||
const rolledBackVersion = preferencesManager.getSync("rolledBackVersion", "") as string;
|
||||
const uuid = preferencesManager.getSync("uuid", "") as string;
|
||||
const currentVersion = preferencesManager.getSync("currentVersion", "") as string;
|
||||
const currentVersionInfo = this.context.getKv(`hash_${currentVersion}`);
|
||||
const buildTime = preferencesManager.getSync("buildTime", "") as string;
|
||||
const isUsingBundleUrl = this.context.getIsUsingBundleUrl();
|
||||
let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION;
|
||||
@@ -53,6 +54,7 @@ getConstants(): Object {
|
||||
|
||||
return {
|
||||
downloadRootDir: `${context.filesDir}/_update`,
|
||||
currentVersionInfo,
|
||||
packageVersion,
|
||||
currentVersion,
|
||||
buildTime,
|
||||
@@ -64,13 +66,13 @@ getConstants(): Object {
|
||||
}
|
||||
|
||||
|
||||
async setLocalHashInfo(hash: string, info: string): Promise<boolean> {
|
||||
setLocalHashInfo(hash: string, info: string): boolean {
|
||||
logger.debug(TAG, ",call setLocalHashInfo");
|
||||
return UpdateModuleImpl.setLocalHashInfo(this.context,hash,info);
|
||||
return UpdateModuleImpl.setLocalHashInfo(this.context, hash, info);
|
||||
}
|
||||
|
||||
async getLocalHashInfo(hash: string): Promise<string> {
|
||||
return UpdateModuleImpl.getLocalHashInfo(this.context,hash);
|
||||
getLocalHashInfo(hash: string): string {
|
||||
return UpdateModuleImpl.getLocalHashInfo(this.context, hash);
|
||||
}
|
||||
|
||||
async setUuid(uuid: string): Promise<boolean> {
|
||||
|
@@ -50,8 +50,8 @@ export class UpdateContext {
|
||||
this.preferences.flush();
|
||||
}
|
||||
|
||||
public getKv(key: string): string {
|
||||
return this.preferences.getSync(key, '') as string;
|
||||
public getKv(key: string): string {
|
||||
return this.preferences.getSync(key, '') as string;
|
||||
}
|
||||
|
||||
public isFirstTime(): boolean {
|
||||
|
@@ -171,27 +171,20 @@ export class UpdateModuleImpl {
|
||||
}
|
||||
}
|
||||
|
||||
static async setLocalHashInfo(
|
||||
static setLocalHashInfo(
|
||||
updateContext: UpdateContext,
|
||||
hash: string,
|
||||
info: string
|
||||
): Promise<boolean> {
|
||||
if (!this.checkJson(info)) {
|
||||
await updateContext.setKv(`hash_${hash}`, info);
|
||||
throw new Error('校验报错:json字符串格式错误');
|
||||
}
|
||||
await updateContext.setKv(`hash_${hash}`, info);
|
||||
): boolean {
|
||||
updateContext.setKv(`hash_${hash}`, info);
|
||||
return true;
|
||||
}
|
||||
|
||||
static async getLocalHashInfo(
|
||||
static getLocalHashInfo(
|
||||
updateContext: UpdateContext,
|
||||
hash: string
|
||||
): Promise<string> {
|
||||
const value = await updateContext.getKv(`hash_${hash}`);
|
||||
if (!this.checkJson(value)) {
|
||||
throw new Error('校验报错:json字符串格式错误');
|
||||
}
|
||||
): string {
|
||||
const value = updateContext.getKv(`hash_${hash}`);
|
||||
return value;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user