react-native-update 10.42.5 → 10.42.6
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.
|
@@ -9,36 +9,35 @@ import { UpdateContext } from './UpdateContext';
|
|
|
9
9
|
|
|
10
10
|
export class PushyFileJSBundleProvider extends JSBundleProvider {
|
|
11
11
|
private updateContext: UpdateContext;
|
|
12
|
-
private path: string = '';
|
|
13
12
|
|
|
14
13
|
constructor(context: common.UIAbilityContext) {
|
|
15
14
|
super();
|
|
16
15
|
this.updateContext = new UpdateContext(context);
|
|
17
|
-
this.path = this.updateContext.getBundleUrl();
|
|
18
16
|
}
|
|
19
17
|
|
|
20
18
|
getURL(): string {
|
|
21
|
-
return this.
|
|
19
|
+
return this.updateContext.getBundleUrl();
|
|
22
20
|
}
|
|
23
21
|
|
|
24
22
|
async getBundle(): Promise<FileJSBundle> {
|
|
25
|
-
|
|
23
|
+
const path = this.updateContext.getBundleUrl();
|
|
24
|
+
if (!path) {
|
|
26
25
|
throw new JSBundleProviderError({
|
|
27
26
|
whatHappened: 'No pushy bundle found. using default bundle',
|
|
28
27
|
howCanItBeFixed: [''],
|
|
29
28
|
});
|
|
30
29
|
}
|
|
31
30
|
try {
|
|
32
|
-
await fs.access(
|
|
31
|
+
await fs.access(path, fs.OpenMode.READ_ONLY);
|
|
33
32
|
return {
|
|
34
|
-
filePath:
|
|
33
|
+
filePath: path,
|
|
35
34
|
};
|
|
36
35
|
} catch (error) {
|
|
37
36
|
throw new JSBundleProviderError({
|
|
38
|
-
whatHappened: `Couldn't load JSBundle from ${
|
|
37
|
+
whatHappened: `Couldn't load JSBundle from ${path}`,
|
|
39
38
|
extraData: error,
|
|
40
39
|
howCanItBeFixed: [
|
|
41
|
-
`Check if a bundle exists at "${
|
|
40
|
+
`Check if a bundle exists at "${path}" on your device.`,
|
|
42
41
|
],
|
|
43
42
|
});
|
|
44
43
|
}
|
|
@@ -65,6 +65,17 @@ export class PushyTurboModule extends UITurboModule {
|
|
|
65
65
|
await this.mUiCtx.startAbility(want);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
private async reloadBridge(): Promise<void> {
|
|
69
|
+
const devToolsController = (this.ctx as Record<string, any>).devToolsController;
|
|
70
|
+
if (devToolsController) {
|
|
71
|
+
logger.debug(TAG, 'reloadBridge via devToolsController RELOAD');
|
|
72
|
+
devToolsController.eventEmitter.emit("RELOAD", { reason: 'HotReload2' });
|
|
73
|
+
} else {
|
|
74
|
+
logger.debug(TAG, 'reloadBridge via restartAbility');
|
|
75
|
+
await this.restartAbility();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
68
79
|
getConstants(): Object {
|
|
69
80
|
logger.debug(TAG, ',call getConstants');
|
|
70
81
|
const packageVersion = this.context.getPackageVersion();
|
|
@@ -121,7 +132,7 @@ export class PushyTurboModule extends UITurboModule {
|
|
|
121
132
|
|
|
122
133
|
try {
|
|
123
134
|
this.context.switchVersion(hash);
|
|
124
|
-
await this.
|
|
135
|
+
await this.reloadBridge();
|
|
125
136
|
} catch (error) {
|
|
126
137
|
logger.error(TAG, `reloadUpdate failed: ${getErrorMessage(error)}`);
|
|
127
138
|
throw Error(`switchVersion failed ${getErrorMessage(error)}`);
|
|
@@ -131,7 +142,7 @@ export class PushyTurboModule extends UITurboModule {
|
|
|
131
142
|
async restartApp(): Promise<void> {
|
|
132
143
|
logger.debug(TAG, ',call restartApp');
|
|
133
144
|
try {
|
|
134
|
-
await this.
|
|
145
|
+
await this.reloadBridge();
|
|
135
146
|
} catch (error) {
|
|
136
147
|
logger.error(TAG, `restartApp failed: ${getErrorMessage(error)}`);
|
|
137
148
|
throw Error(`restartApp failed ${getErrorMessage(error)}`);
|
package/harmony/pushy.har
CHANGED
|
Binary file
|