@ives_xxz/framework 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/manager/FWHotUpdateManager.ts +27 -10
- package/package.json +1 -1
|
@@ -89,22 +89,22 @@ export default class FWHotUpdateManager extends FWManager implements FW.HotUpdat
|
|
|
89
89
|
|
|
90
90
|
private checkEventHandle(event: any) {
|
|
91
91
|
const code = event.getEventCode();
|
|
92
|
-
FWLog.debug('getEventCode -> ', code);
|
|
92
|
+
FWLog.debug('checkEvent getEventCode -> ', code);
|
|
93
93
|
switch (code) {
|
|
94
94
|
case jsb.EventAssetsManager.ERROR_NO_LOCAL_MANIFEST:
|
|
95
|
-
FWLog.debug('getEventCode -> ', 'ERROR_NO_LOCAL_MANIFEST');
|
|
95
|
+
FWLog.debug('checkEvent getEventCode -> ', 'ERROR_NO_LOCAL_MANIFEST');
|
|
96
96
|
break;
|
|
97
97
|
case jsb.EventAssetsManager.ERROR_DOWNLOAD_MANIFEST:
|
|
98
|
-
FWLog.debug('getEventCode -> ', 'ERROR_DOWNLOAD_MANIFEST');
|
|
98
|
+
FWLog.debug('checkEvent getEventCode -> ', 'ERROR_DOWNLOAD_MANIFEST');
|
|
99
99
|
break;
|
|
100
100
|
case jsb.EventAssetsManager.ERROR_PARSE_MANIFEST:
|
|
101
|
-
FWLog.debug('getEventCode -> ', 'ERROR_PARSE_MANIFEST');
|
|
101
|
+
FWLog.debug('checkEvent getEventCode -> ', 'ERROR_PARSE_MANIFEST');
|
|
102
102
|
break;
|
|
103
103
|
case jsb.EventAssetsManager.ALREADY_UP_TO_DATE:
|
|
104
|
-
FWLog.debug('getEventCode -> ', 'ALREADY_UP_TO_DATE');
|
|
104
|
+
FWLog.debug('checkEvent getEventCode -> ', 'ALREADY_UP_TO_DATE');
|
|
105
105
|
break;
|
|
106
106
|
case jsb.EventAssetsManager.NEW_VERSION_FOUND:
|
|
107
|
-
FWLog.debug('getEventCode -> ', 'NEW_VERSION_FOUND');
|
|
107
|
+
FWLog.debug('checkEvent getEventCode -> ', 'NEW_VERSION_FOUND');
|
|
108
108
|
break;
|
|
109
109
|
default:
|
|
110
110
|
return;
|
|
@@ -113,16 +113,17 @@ export default class FWHotUpdateManager extends FWManager implements FW.HotUpdat
|
|
|
113
113
|
this.listener.checkHotUpdateHandle?.(code);
|
|
114
114
|
this.assetMgr.setEventCallback(null!);
|
|
115
115
|
this.isUpdate = false;
|
|
116
|
-
|
|
116
|
+
FWLog.debug('isFind New Version -> ', event.getEventCode() == jsb.EventAssetsManager.NEW_VERSION_FOUND);
|
|
117
117
|
if (event.getEventCode() == jsb.EventAssetsManager.NEW_VERSION_FOUND) {
|
|
118
118
|
this.hotUpdate();
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
private hotUpdate() {
|
|
123
|
+
FWLog.debug('start hotUpdate ->', this.assetMgr, this.isUpdate);
|
|
123
124
|
if (this.assetMgr && !this.isUpdate) {
|
|
124
125
|
this.assetMgr.setEventCallback(this.updateEventHandle.bind(this));
|
|
125
|
-
|
|
126
|
+
FWLog.debug('assetMgr state ->', this.assetMgr.getState() === jsb.AssetsManager.State.UNINITED);
|
|
126
127
|
if (this.assetMgr.getState() === jsb.AssetsManager.State.UNINITED) {
|
|
127
128
|
this.assetMgr.loadLocalManifest(this.localManifest.nativeUrl);
|
|
128
129
|
}
|
|
@@ -143,11 +144,16 @@ export default class FWHotUpdateManager extends FWManager implements FW.HotUpdat
|
|
|
143
144
|
let convertTotalBytes: string = '';
|
|
144
145
|
const code = event.getEventCode();
|
|
145
146
|
const msg = event.getMessage();
|
|
147
|
+
FWLog.debug('updateEvent getEventCode -> ', code);
|
|
148
|
+
let str = '';
|
|
146
149
|
switch (code) {
|
|
147
150
|
case jsb.EventAssetsManager.ERROR_NO_LOCAL_MANIFEST:
|
|
148
151
|
failed = true;
|
|
152
|
+
str = 'ERROR_NO_LOCAL_MANIFEST';
|
|
149
153
|
break;
|
|
150
154
|
case jsb.EventAssetsManager.UPDATE_PROGRESSION:
|
|
155
|
+
str = 'UPDATE_PROGRESSION';
|
|
156
|
+
FWLog.debug('updateEvent percent -> ', event.getPercent());
|
|
151
157
|
if (event.getPercent() > 0) {
|
|
152
158
|
downloadedFiles = event.getDownloadedFiles();
|
|
153
159
|
totalFiles = event.getTotalFiles();
|
|
@@ -156,31 +162,40 @@ export default class FWHotUpdateManager extends FWManager implements FW.HotUpdat
|
|
|
156
162
|
convertDownloadedBytes = this.convertBytes(downloadedBytes);
|
|
157
163
|
convertTotalBytes = this.convertBytes(totalBytes);
|
|
158
164
|
percent = event.getPercent();
|
|
165
|
+
FWLog.debug('正在更新中 -> ', '下载文件数量:', downloadedFiles, ',下载文件总数量:', totalFiles, ',已下载大小:', convertDownloadedBytes, ',下载总大小:', convertTotalBytes);
|
|
159
166
|
}
|
|
160
167
|
break;
|
|
161
168
|
case jsb.EventAssetsManager.ERROR_DOWNLOAD_MANIFEST:
|
|
169
|
+
str = 'ERROR_DOWNLOAD_MANIFEST';
|
|
162
170
|
break;
|
|
163
171
|
case jsb.EventAssetsManager.ERROR_PARSE_MANIFEST:
|
|
172
|
+
str = 'ERROR_PARSE_MANIFEST';
|
|
164
173
|
failed = true;
|
|
165
174
|
break;
|
|
166
175
|
case jsb.EventAssetsManager.ALREADY_UP_TO_DATE:
|
|
176
|
+
str = 'ALREADY_UP_TO_DATE';
|
|
167
177
|
failed = true;
|
|
168
178
|
break;
|
|
169
179
|
case jsb.EventAssetsManager.UPDATE_FINISHED:
|
|
180
|
+
str = 'UPDATE_FINISHED';
|
|
170
181
|
needRestart = true;
|
|
171
182
|
break;
|
|
172
183
|
case jsb.EventAssetsManager.UPDATE_FAILED:
|
|
184
|
+
str = 'UPDATE_FAILED';
|
|
173
185
|
this.isUpdate = false;
|
|
174
186
|
this.isRetry = true;
|
|
175
187
|
break;
|
|
176
188
|
case jsb.EventAssetsManager.ERROR_UPDATING:
|
|
189
|
+
str = 'ERROR_UPDATING';
|
|
177
190
|
break;
|
|
178
191
|
case jsb.EventAssetsManager.ERROR_DECOMPRESS:
|
|
192
|
+
str = 'ERROR_DECOMPRESS';
|
|
179
193
|
break;
|
|
180
194
|
default:
|
|
181
195
|
break;
|
|
182
196
|
}
|
|
183
197
|
|
|
198
|
+
FWLog.debug('热更新中->', str);
|
|
184
199
|
this.listener.hotUpdatingHandle?.(code, {
|
|
185
200
|
percent: percent,
|
|
186
201
|
downloadedFiles: downloadedFiles,
|
|
@@ -190,14 +205,16 @@ export default class FWHotUpdateManager extends FWManager implements FW.HotUpdat
|
|
|
190
205
|
convertDownloadedBytes: convertDownloadedBytes,
|
|
191
206
|
convertTotalBytes: convertTotalBytes,
|
|
192
207
|
});
|
|
193
|
-
|
|
208
|
+
FWLog.debug('热更新中结果 failed -> ', failed);
|
|
194
209
|
if (failed) {
|
|
210
|
+
FWLog.debug('下载失败');
|
|
195
211
|
this.assetMgr.setEventCallback(null!);
|
|
196
212
|
this.isUpdate = false;
|
|
197
213
|
this.retry();
|
|
198
214
|
}
|
|
199
|
-
|
|
215
|
+
FWLog.debug('热更新中结果 needRestart -> ', needRestart);
|
|
200
216
|
if (needRestart) {
|
|
217
|
+
FWLog.debug('下载完成');
|
|
201
218
|
this.assetMgr.setEventCallback(null!);
|
|
202
219
|
var searchPaths = jsb.fileUtils.getSearchPaths();
|
|
203
220
|
var newPaths = this.assetMgr.getLocalManifest().getSearchPaths();
|