|
|
@ -92,15 +92,15 @@ |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
this.globalData.privacyInitialized = true |
|
|
this.globalData.privacyInitialized = true |
|
|
// #ifdef APP-PLUS |
|
|
|
|
|
jpushModule = uni.requireNativePlugin("JG-JPush"); |
|
|
|
|
|
audioObj = uni.getBackgroundAudioManager(); |
|
|
|
|
|
// #endif |
|
|
|
|
|
const baseUrl = getApp().globalData.mainurl |
|
|
const baseUrl = getApp().globalData.mainurl |
|
|
//这里是热更新的代码 |
|
|
//这里是热更新的代码 |
|
|
// #ifdef APP-PLUS |
|
|
// #ifdef APP-PLUS |
|
|
this.checkAppUpdate(baseUrl) |
|
|
this.checkAppUpdate(baseUrl) |
|
|
// #endif |
|
|
// #endif |
|
|
|
|
|
// #ifdef APP-PLUS |
|
|
|
|
|
jpushModule = uni.requireNativePlugin("JG-JPush"); |
|
|
|
|
|
audioObj = uni.getBackgroundAudioManager(); |
|
|
|
|
|
// #endif |
|
|
// this.getRegistrationID() |
|
|
// this.getRegistrationID() |
|
|
// #ifdef APP-PLUS |
|
|
// #ifdef APP-PLUS |
|
|
if (jpushModule.setLoggerEnable) { |
|
|
if (jpushModule.setLoggerEnable) { |
|
|
@ -238,8 +238,15 @@ |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
checkAppUpdate(baseUrl) { |
|
|
checkAppUpdate(baseUrl) { |
|
|
|
|
|
console.log('app update check start:', baseUrl) |
|
|
|
|
|
try { |
|
|
|
|
|
if (!plus || !plus.runtime) { |
|
|
|
|
|
console.error('app update skipped: plus.runtime is unavailable') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
plus.runtime.getProperty(plus.runtime.appid, (widgetInfo) => { |
|
|
plus.runtime.getProperty(plus.runtime.appid, (widgetInfo) => { |
|
|
const currentVersion = widgetInfo && widgetInfo.version ? widgetInfo.version : plus.runtime.version |
|
|
const currentVersion = widgetInfo && widgetInfo.version ? widgetInfo.version : plus.runtime.version |
|
|
|
|
|
console.log('app update current widget:', JSON.stringify(widgetInfo), 'runtime:', plus.runtime.version) |
|
|
uni.request({ |
|
|
uni.request({ |
|
|
url: baseUrl + '/setting/app-update/latest', |
|
|
url: baseUrl + '/setting/app-update/latest', |
|
|
data: {}, |
|
|
data: {}, |
|
|
@ -256,6 +263,7 @@ |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
const downloadUrl = this.appendUpdateQuery(data.url, data.version) |
|
|
const downloadUrl = this.appendUpdateQuery(data.url, data.version) |
|
|
|
|
|
console.log('app update downloading:', downloadUrl) |
|
|
this.downloadAndInstallWgt(downloadUrl) |
|
|
this.downloadAndInstallWgt(downloadUrl) |
|
|
}, |
|
|
}, |
|
|
fail: (err) => { |
|
|
fail: (err) => { |
|
|
@ -263,6 +271,9 @@ |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
console.error('app update check error:', JSON.stringify(e)) |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
downloadAndInstallWgt(url) { |
|
|
downloadAndInstallWgt(url) { |
|
|
uni.downloadFile({ |
|
|
uni.downloadFile({ |
|
|
|