react-native-update 10.43.2 → 10.43.3
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.
|
@@ -61,18 +61,62 @@ export class PushyTurboModule extends UITurboModule {
|
|
|
61
61
|
bundleName: bundleInfo.name,
|
|
62
62
|
abilityName: this.mUiCtx.abilityInfo?.name,
|
|
63
63
|
};
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
try {
|
|
65
|
+
const applicationContext = this.mUiCtx.getApplicationContext();
|
|
66
|
+
if (applicationContext && typeof (applicationContext as any).restartApp === 'function') {
|
|
67
|
+
logger.debug(TAG, 'restartAbility via applicationContext.restartApp');
|
|
68
|
+
(applicationContext as any).restartApp(want);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
} catch (e) {
|
|
72
|
+
logger.error(TAG, `restartAbility via restartApp failed: ${getErrorMessage(e)}`);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
logger.debug(TAG, 'restartAbility via startAbility fallback');
|
|
76
|
+
try {
|
|
77
|
+
await this.mUiCtx.startAbility(want);
|
|
78
|
+
await this.mUiCtx.terminateSelf();
|
|
79
|
+
} catch (e) {
|
|
80
|
+
logger.error(TAG, `restartAbility via startAbility/terminateSelf fallback failed: ${getErrorMessage(e)}`);
|
|
81
|
+
// Last resort: terminateSelf first
|
|
82
|
+
await this.mUiCtx.terminateSelf();
|
|
83
|
+
await this.mUiCtx.startAbility(want);
|
|
84
|
+
}
|
|
66
85
|
}
|
|
67
86
|
|
|
68
87
|
private async reloadBridge(): Promise<void> {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
devToolsController
|
|
88
|
+
if (this.ctx.isDebugModeEnabled) {
|
|
89
|
+
logger.debug(TAG, 'reloadBridge via devToolsController RELOAD (debug mode)');
|
|
90
|
+
const devToolsController = (this.ctx as Record<string, any>).devToolsController;
|
|
91
|
+
if (devToolsController) {
|
|
92
|
+
devToolsController.eventEmitter.emit("RELOAD", { reason: 'HotReload2' });
|
|
93
|
+
}
|
|
73
94
|
} else {
|
|
74
|
-
logger.debug(TAG, 'reloadBridge via restartAbility');
|
|
75
|
-
|
|
95
|
+
logger.debug(TAG, 'reloadBridge via restartAbility (release mode)');
|
|
96
|
+
let restarted = false;
|
|
97
|
+
const fallbackTimer = setTimeout(() => {
|
|
98
|
+
if (!restarted) {
|
|
99
|
+
logger.warn(TAG, 'restartAbility did not restart the app within 1.5s, triggering soft reload fallback');
|
|
100
|
+
const devToolsController = (this.ctx as Record<string, any>).devToolsController;
|
|
101
|
+
if (devToolsController) {
|
|
102
|
+
devToolsController.eventEmitter.emit("RELOAD", { reason: 'HotReload2' });
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}, 1500);
|
|
106
|
+
|
|
107
|
+
try {
|
|
108
|
+
await this.restartAbility();
|
|
109
|
+
restarted = true;
|
|
110
|
+
clearTimeout(fallbackTimer);
|
|
111
|
+
} catch (error) {
|
|
112
|
+
restarted = false;
|
|
113
|
+
clearTimeout(fallbackTimer);
|
|
114
|
+
logger.error(TAG, `restartAbility failed: ${getErrorMessage(error)}, triggering soft reload fallback`);
|
|
115
|
+
const devToolsController = (this.ctx as Record<string, any>).devToolsController;
|
|
116
|
+
if (devToolsController) {
|
|
117
|
+
devToolsController.eventEmitter.emit("RELOAD", { reason: 'HotReload2' });
|
|
118
|
+
}
|
|
119
|
+
}
|
|
76
120
|
}
|
|
77
121
|
}
|
|
78
122
|
|
package/harmony/pushy.har
CHANGED
|
Binary file
|