react-native-update 10.39.0-beta.0 → 10.39.0-beta.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/android/src/main/java/cn/reactnative/modules/update/DownloadTask.java +8 -1
- package/harmony/pushy/src/main/ets/DownloadTask.ts +41 -32
- package/harmony/pushy/src/main/ets/PushyPackage.ets +16 -0
- package/harmony/pushy/src/main/ets/PushyPackageCompat.ts +16 -0
- package/harmony/pushy/src/main/ets/PushyTurboModule.ts +6 -4
- package/harmony/pushy/src/main/ets/UpdateModuleImpl.ts +1 -1
- package/harmony/pushy.har +0 -0
- package/package.json +2 -2
- package/src/utils.ts +0 -6
- package/android/bin/.settings/org.eclipse.buildship.core.prefs +0 -13
- package/harmony/pushy/src/main/ets/PushyPackage.ts +0 -22
|
@@ -291,9 +291,16 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> {
|
|
|
291
291
|
// e.g., "res/drawable-xxhdpi-v4/img.png" → "res/drawable-xxhdpi/img.png"
|
|
292
292
|
private static final Pattern VERSION_QUALIFIER_PATTERN =
|
|
293
293
|
Pattern.compile("-v\\d+(?=/)");
|
|
294
|
+
// AAB internal paths are prefixed with "base/" (e.g., "base/res/drawable-xxhdpi/img.png")
|
|
295
|
+
// which does not exist in standard APK layout
|
|
296
|
+
private static final String AAB_BASE_PREFIX = "base/";
|
|
294
297
|
|
|
295
298
|
private String normalizeResPath(String path) {
|
|
296
|
-
|
|
299
|
+
String result = path;
|
|
300
|
+
if (result.startsWith(AAB_BASE_PREFIX)) {
|
|
301
|
+
result = result.substring(AAB_BASE_PREFIX.length());
|
|
302
|
+
}
|
|
303
|
+
return VERSION_QUALIFIER_PATTERN.matcher(result).replaceAll("");
|
|
297
304
|
}
|
|
298
305
|
|
|
299
306
|
private String findDrawableFallback(String originalToPath, HashMap<String, String> copiesMap, HashMap<String, ZipEntry> availableEntries, HashMap<String, String> normalizedEntryMap) {
|
|
@@ -68,7 +68,13 @@ export class DownloadTask {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
if (!fileIo.accessSync(path)) {
|
|
71
|
-
|
|
71
|
+
try {
|
|
72
|
+
await fileIo.mkdir(path);
|
|
73
|
+
} catch (error) {
|
|
74
|
+
if (!fileIo.accessSync(path)) {
|
|
75
|
+
throw error;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
72
78
|
}
|
|
73
79
|
}
|
|
74
80
|
|
|
@@ -99,22 +105,14 @@ export class DownloadTask {
|
|
|
99
105
|
}
|
|
100
106
|
|
|
101
107
|
private async listEntryNames(directory: string): Promise<string[]> {
|
|
102
|
-
const entryNames: string[] = [];
|
|
103
108
|
const files = await fileIo.listFile(directory);
|
|
109
|
+
const validFiles = files.filter(file => file !== '.' && file !== '..');
|
|
104
110
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
const filePath = `${directory}/${file}`;
|
|
111
|
-
const stat = await fileIo.stat(filePath);
|
|
112
|
-
if (!stat.isDirectory()) {
|
|
113
|
-
entryNames.push(file);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
111
|
+
const stats = await Promise.all(
|
|
112
|
+
validFiles.map(file => fileIo.stat(`${directory}/${file}`)),
|
|
113
|
+
);
|
|
116
114
|
|
|
117
|
-
return
|
|
115
|
+
return validFiles.filter((_, index) => !stats[index].isDirectory());
|
|
118
116
|
}
|
|
119
117
|
|
|
120
118
|
private async writeFileContent(
|
|
@@ -432,11 +430,10 @@ export class DownloadTask {
|
|
|
432
430
|
await this.recreateDirectory(params.unzipDirectory);
|
|
433
431
|
|
|
434
432
|
await zlib.decompressFile(params.targetFile, params.unzipDirectory);
|
|
435
|
-
const entryNames = await
|
|
436
|
-
|
|
437
|
-
params.unzipDirectory,
|
|
438
|
-
|
|
439
|
-
);
|
|
433
|
+
const [entryNames, manifestArrays] = await Promise.all([
|
|
434
|
+
this.listEntryNames(params.unzipDirectory),
|
|
435
|
+
this.readManifestArrays(params.unzipDirectory, true),
|
|
436
|
+
]);
|
|
440
437
|
|
|
441
438
|
NativePatchCore.buildArchivePatchPlan(
|
|
442
439
|
ARCHIVE_PATCH_TYPE_FROM_PACKAGE,
|
|
@@ -475,11 +472,10 @@ export class DownloadTask {
|
|
|
475
472
|
await this.recreateDirectory(params.unzipDirectory);
|
|
476
473
|
|
|
477
474
|
await zlib.decompressFile(params.targetFile, params.unzipDirectory);
|
|
478
|
-
const entryNames = await
|
|
479
|
-
|
|
480
|
-
params.unzipDirectory,
|
|
481
|
-
|
|
482
|
-
);
|
|
475
|
+
const [entryNames, manifestArrays] = await Promise.all([
|
|
476
|
+
this.listEntryNames(params.unzipDirectory),
|
|
477
|
+
this.readManifestArrays(params.unzipDirectory, false),
|
|
478
|
+
]);
|
|
483
479
|
|
|
484
480
|
const plan = NativePatchCore.buildArchivePatchPlan(
|
|
485
481
|
ARCHIVE_PATCH_TYPE_FROM_PPK,
|
|
@@ -524,23 +520,36 @@ export class DownloadTask {
|
|
|
524
520
|
.replace('resources/base/media/', '')
|
|
525
521
|
.split('.')[0];
|
|
526
522
|
const mediaBuffer = await resourceManager.getMediaByName(mediaName);
|
|
527
|
-
const
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
523
|
+
const parentDirs = [
|
|
524
|
+
...new Set(
|
|
525
|
+
targets.map(t => t.substring(0, t.lastIndexOf('/'))).filter(Boolean),
|
|
526
|
+
),
|
|
527
|
+
];
|
|
528
|
+
for (const dir of parentDirs) {
|
|
529
|
+
await this.ensureDirectory(dir);
|
|
531
530
|
}
|
|
531
|
+
await Promise.all(
|
|
532
|
+
targets.map(target => this.writeFileContent(target, mediaBuffer.buffer)),
|
|
533
|
+
);
|
|
532
534
|
continue;
|
|
533
535
|
}
|
|
534
536
|
const fromContent = await resourceManager.getRawFd(currentFrom);
|
|
535
537
|
const [firstTarget, ...restTargets] = targets;
|
|
536
|
-
|
|
538
|
+
const parentDirs = [
|
|
539
|
+
...new Set(
|
|
540
|
+
targets.map(t => t.substring(0, t.lastIndexOf('/'))).filter(Boolean),
|
|
541
|
+
),
|
|
542
|
+
];
|
|
543
|
+
for (const dir of parentDirs) {
|
|
544
|
+
await this.ensureDirectory(dir);
|
|
545
|
+
}
|
|
537
546
|
if (fileIo.accessSync(firstTarget)) {
|
|
538
547
|
await fileIo.unlink(firstTarget);
|
|
539
548
|
}
|
|
540
549
|
saveFileToSandbox(fromContent, firstTarget);
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
550
|
+
await Promise.all(
|
|
551
|
+
restTargets.map(target => this.copySandboxFile(firstTarget, target)),
|
|
552
|
+
);
|
|
544
553
|
}
|
|
545
554
|
} catch (error) {
|
|
546
555
|
error.message =
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RNOHPackage,
|
|
3
|
+
UITurboModule,
|
|
4
|
+
UITurboModuleContext,
|
|
5
|
+
} from '@rnoh/react-native-openharmony';
|
|
6
|
+
import { PushyTurboModule } from './PushyTurboModule';
|
|
7
|
+
|
|
8
|
+
export class PushyPackage extends RNOHPackage {
|
|
9
|
+
override getUITurboModuleFactoryByNameMap(): Map<
|
|
10
|
+
string,
|
|
11
|
+
(ctx: UITurboModuleContext) => UITurboModule | null
|
|
12
|
+
> {
|
|
13
|
+
return new Map<string, (ctx: UITurboModuleContext) => UITurboModule>()
|
|
14
|
+
.set(PushyTurboModule.NAME, (ctx) => new PushyTurboModule(ctx));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RNPackage,
|
|
3
|
+
UITurboModule,
|
|
4
|
+
UITurboModuleContext,
|
|
5
|
+
} from '@rnoh/react-native-openharmony/ts';
|
|
6
|
+
import { PushyTurboModule } from './PushyTurboModule';
|
|
7
|
+
|
|
8
|
+
export class PushyPackage extends RNPackage {
|
|
9
|
+
override getUITurboModuleFactoryByNameMap(): Map<
|
|
10
|
+
string,
|
|
11
|
+
(ctx: UITurboModuleContext) => UITurboModule | null
|
|
12
|
+
> {
|
|
13
|
+
return new Map<string, (ctx: UITurboModuleContext) => UITurboModule>()
|
|
14
|
+
.set(PushyTurboModule.NAME, (ctx) => new PushyTurboModule(ctx));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
UITurboModule,
|
|
3
|
+
UITurboModuleContext,
|
|
4
4
|
} from '@rnoh/react-native-openharmony/ts';
|
|
5
5
|
import common from '@ohos.app.ability.common';
|
|
6
6
|
import { bundleManager } from '@kit.AbilityKit';
|
|
@@ -12,11 +12,13 @@ import { util } from '@kit.ArkTS';
|
|
|
12
12
|
|
|
13
13
|
const TAG = 'PushyTurboModule';
|
|
14
14
|
|
|
15
|
-
export class PushyTurboModule extends
|
|
15
|
+
export class PushyTurboModule extends UITurboModule {
|
|
16
|
+
public static readonly NAME = 'Pushy';
|
|
17
|
+
|
|
16
18
|
mUiCtx: common.UIAbilityContext;
|
|
17
19
|
context: UpdateContext;
|
|
18
20
|
|
|
19
|
-
constructor(protected ctx:
|
|
21
|
+
constructor(protected ctx: UITurboModuleContext) {
|
|
20
22
|
super(ctx);
|
|
21
23
|
logger.debug(TAG, ',PushyTurboModule constructor');
|
|
22
24
|
this.mUiCtx = ctx.uiAbilityContext;
|
package/harmony/pushy.har
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-update",
|
|
3
|
-
"version": "10.39.0-beta.
|
|
3
|
+
"version": "10.39.0-beta.2",
|
|
4
4
|
"description": "react-native hot update",
|
|
5
5
|
"main": "src/index",
|
|
6
6
|
"scripts": {
|
|
@@ -78,4 +78,4 @@
|
|
|
78
78
|
"ts-jest": "^29.4.6",
|
|
79
79
|
"typescript": "^5.6.3"
|
|
80
80
|
}
|
|
81
|
-
}
|
|
81
|
+
}
|
package/src/utils.ts
CHANGED
|
@@ -124,12 +124,6 @@ export const fetchWithTimeout = (
|
|
|
124
124
|
});
|
|
125
125
|
};
|
|
126
126
|
|
|
127
|
-
// export const isAndroid70AndBelow = () => {
|
|
128
|
-
// // android 7.0 and below devices do not support letsencrypt cert
|
|
129
|
-
// // https://letsencrypt.org/2023/07/10/cross-sign-expiration/
|
|
130
|
-
// return Platform.OS === 'android' && Platform.Version <= 24;
|
|
131
|
-
// };
|
|
132
|
-
|
|
133
127
|
export const enhancedFetch = async (
|
|
134
128
|
url: string,
|
|
135
129
|
params: Parameters<typeof fetch>[1],
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
arguments=--init-script /var/folders/l6/0fn3x28s5s585ld3p04gsy1h0000gn/T/db3b08fc4a9ef609cb16b96b200fa13e563f396e9bb1ed0905fdab7bc3bc513b.gradle --init-script /var/folders/l6/0fn3x28s5s585ld3p04gsy1h0000gn/T/52cde0cfcf3e28b8b7510e992210d9614505e0911af0c190bd590d7158574963.gradle
|
|
2
|
-
auto.sync=false
|
|
3
|
-
build.scans.enabled=false
|
|
4
|
-
connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(8.9))
|
|
5
|
-
connection.project.dir=
|
|
6
|
-
eclipse.preferences.version=1
|
|
7
|
-
gradle.user.home=
|
|
8
|
-
java.home=/Users/sunny/.sdkman/candidates/java/17.0.9-zulu/zulu-17.jdk/Contents/Home
|
|
9
|
-
jvm.arguments=
|
|
10
|
-
offline.mode=false
|
|
11
|
-
override.workspace.settings=true
|
|
12
|
-
show.console.view=true
|
|
13
|
-
show.executions.view=true
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { RNPackage, TurboModulesFactory } from '@rnoh/react-native-openharmony/ts';
|
|
2
|
-
import type { TurboModule, TurboModuleContext } from '@rnoh/react-native-openharmony/ts';
|
|
3
|
-
import { PushyTurboModule } from './PushyTurboModule';
|
|
4
|
-
|
|
5
|
-
class PushyTurboModulesFactory extends TurboModulesFactory {
|
|
6
|
-
createTurboModule(name: string): TurboModule | null {
|
|
7
|
-
if (name === 'Pushy') {
|
|
8
|
-
return new PushyTurboModule(this.ctx);
|
|
9
|
-
}
|
|
10
|
-
return null;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
hasTurboModule(name: string): boolean {
|
|
14
|
-
return name === 'Pushy';
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export class PushyPackage extends RNPackage {
|
|
19
|
-
createTurboModulesFactory(ctx: TurboModuleContext): TurboModulesFactory {
|
|
20
|
-
return new PushyTurboModulesFactory(ctx);
|
|
21
|
-
}
|
|
22
|
-
}
|