react-native-update 10.37.8 → 10.37.9
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.
|
@@ -6,6 +6,7 @@ import { EventHub } from './EventHub';
|
|
|
6
6
|
import { DownloadTaskParams } from './DownloadTaskParams';
|
|
7
7
|
import Pushy from 'librnupdate.so';
|
|
8
8
|
import { saveFileToSandbox } from './SaveFile';
|
|
9
|
+
import { util } from '@kit.ArkTS';
|
|
9
10
|
|
|
10
11
|
interface ZipEntry {
|
|
11
12
|
filename: string;
|
|
@@ -255,12 +256,10 @@ export class DownloadTask {
|
|
|
255
256
|
|
|
256
257
|
if (fn === '__diff.json') {
|
|
257
258
|
foundDiff = true;
|
|
258
|
-
let jsonContent = '';
|
|
259
259
|
const bufferArray = new Uint8Array(entry.content);
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
const obj = JSON.parse(jsonContent);
|
|
260
|
+
const obj = JSON.parse(
|
|
261
|
+
new util.TextDecoder().decodeToString(bufferArray),
|
|
262
|
+
);
|
|
264
263
|
|
|
265
264
|
const copies = obj.copies as Record<string, string>;
|
|
266
265
|
for (const [to, rawPath] of Object.entries(copies)) {
|
|
@@ -345,12 +344,10 @@ export class DownloadTask {
|
|
|
345
344
|
console.error('copy error:', error);
|
|
346
345
|
});
|
|
347
346
|
|
|
348
|
-
let jsonContent = '';
|
|
349
347
|
const bufferArray = new Uint8Array(entry.content);
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
const obj = JSON.parse(jsonContent);
|
|
348
|
+
const obj = JSON.parse(
|
|
349
|
+
new util.TextDecoder().decodeToString(bufferArray),
|
|
350
|
+
);
|
|
354
351
|
|
|
355
352
|
const { copies, deletes } = obj;
|
|
356
353
|
for (const [to, from] of Object.entries(copies)) {
|
|
@@ -431,9 +428,7 @@ export class DownloadTask {
|
|
|
431
428
|
for (const [from, targets] of copyList.entries()) {
|
|
432
429
|
currentFrom = from;
|
|
433
430
|
if (from.startsWith('resources/base/media/')) {
|
|
434
|
-
const mediaName = from
|
|
435
|
-
.replace('resources/base/media/', '')
|
|
436
|
-
.split('.')[0];
|
|
431
|
+
const mediaName = from.replace('resources/base/media/', '');
|
|
437
432
|
const mediaBuffer = await resourceManager.getMediaByName(mediaName);
|
|
438
433
|
for (const target of targets) {
|
|
439
434
|
const fileStream = fileIo.createStreamSync(target, 'w+');
|
|
@@ -9,6 +9,7 @@ import logger from './Logger';
|
|
|
9
9
|
import { UpdateModuleImpl } from './UpdateModuleImpl';
|
|
10
10
|
import { UpdateContext } from './UpdateContext';
|
|
11
11
|
import { EventHub } from './EventHub';
|
|
12
|
+
import { util } from '@kit.ArkTS';
|
|
12
13
|
|
|
13
14
|
const TAG = 'PushyTurboModule';
|
|
14
15
|
|
|
@@ -44,7 +45,20 @@ export class PushyTurboModule extends TurboModule {
|
|
|
44
45
|
'',
|
|
45
46
|
) as string;
|
|
46
47
|
const currentVersionInfo = this.context.getKv(`hash_${currentVersion}`);
|
|
47
|
-
|
|
48
|
+
let buildTime = preferencesManager.getSync('buildTime', '') as string;
|
|
49
|
+
if (!buildTime) {
|
|
50
|
+
try {
|
|
51
|
+
const resourceManager = this.mUiCtx.resourceManager;
|
|
52
|
+
const content = resourceManager.getRawFileContentSync('metadata.json');
|
|
53
|
+
const metaData = JSON.parse(
|
|
54
|
+
new util.TextDecoder().decodeToString(content),
|
|
55
|
+
);
|
|
56
|
+
if (metaData.buildTime) {
|
|
57
|
+
buildTime = String(metaData.buildTime);
|
|
58
|
+
preferencesManager.putSync('buildTime', buildTime);
|
|
59
|
+
}
|
|
60
|
+
} catch {}
|
|
61
|
+
}
|
|
48
62
|
const isUsingBundleUrl = this.context.getIsUsingBundleUrl();
|
|
49
63
|
let bundleFlags =
|
|
50
64
|
bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION;
|