mirror of
https://github.com/Gongxh0901/kunpolibrary
synced 2025-04-22 03:18:41 +00:00
调整热更新跳过检查逻辑
This commit is contained in:
parent
be4e48e8a0
commit
a927aa428b
@ -25,8 +25,6 @@ export interface IManifestResult extends IPromiseResult {
|
||||
export enum HotUpdateCode {
|
||||
/** 成功 */
|
||||
Succeed = 0,
|
||||
/** 出错了 */
|
||||
Error = -1,
|
||||
/** 平台不支持 不需要热更新 */
|
||||
PlatformNotSupported = -1000,
|
||||
/** 未初始化 */
|
||||
@ -146,8 +144,6 @@ export class HotUpdate {
|
||||
} else {
|
||||
this._complete(res.code, res.message);
|
||||
}
|
||||
}).catch((err) => {
|
||||
this._complete(HotUpdateCode.Error, JSON.stringify(err));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ export class HotUpdateManager {
|
||||
/** 是否正在更新 或者 正在检查更新 */
|
||||
private _updating: boolean = false;
|
||||
|
||||
/** 更新实例 只有更新的时候初始化 检查更新不赋值 */
|
||||
/** 更新实例 */
|
||||
private _hotUpdate: HotUpdate = null;
|
||||
|
||||
/**
|
||||
@ -117,12 +117,10 @@ export class HotUpdateManager {
|
||||
return;
|
||||
}
|
||||
this._updating = true;
|
||||
new HotUpdate().checkUpdate().then((res) => {
|
||||
this._hotUpdate = new HotUpdate();
|
||||
this._hotUpdate.checkUpdate().then((res) => {
|
||||
this._updating = false;
|
||||
resolve(res);
|
||||
}).catch((err) => {
|
||||
this._updating = false;
|
||||
resolve({ code: HotUpdateCode.Error, message: JSON.stringify(err) });
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -147,7 +145,7 @@ export class HotUpdateManager {
|
||||
return;
|
||||
}
|
||||
this._updating = true;
|
||||
this._hotUpdate = new HotUpdate();
|
||||
if (res.skipCheck && this._hotUpdate) {
|
||||
this._hotUpdate.startUpdate({
|
||||
skipCheck: res.skipCheck,
|
||||
progress: res.progress,
|
||||
@ -156,6 +154,17 @@ export class HotUpdateManager {
|
||||
res.complete(code, message);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this._hotUpdate = new HotUpdate();
|
||||
this._hotUpdate.startUpdate({
|
||||
skipCheck: false,
|
||||
progress: res.progress,
|
||||
complete: (code: HotUpdateCode, message: string) => {
|
||||
this._updating = false;
|
||||
res.complete(code, message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/** 重试失败的资源 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user