react-native-update 10.29.0-beta.2 → 10.29.1
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/proguard.pro +35 -1
- package/android/src/main/java/cn/reactnative/modules/update/UpdateContext.java +12 -10
- package/android/src/main/java/cn/reactnative/modules/update/UpdateModuleImpl.java +10 -1
- package/package.json +2 -3
- package/src/client.ts +29 -35
- package/android/.project +0 -28
- package/android/bin/.project +0 -34
- package/android/bin/.settings/org.eclipse.buildship.core.prefs +0 -13
package/android/proguard.pro
CHANGED
|
@@ -1,3 +1,37 @@
|
|
|
1
|
+
# Keep our update module classes
|
|
1
2
|
-keepnames class cn.reactnative.modules.update.DownloadTask { *; }
|
|
2
3
|
-keepnames class cn.reactnative.modules.update.UpdateModuleImpl { *; }
|
|
3
|
-
-keepnames class
|
|
4
|
+
-keepnames class cn.reactnative.modules.update.** { *; }
|
|
5
|
+
|
|
6
|
+
# Keep React Native classes
|
|
7
|
+
-keepnames class com.facebook.react.ReactInstanceManager { *; }
|
|
8
|
+
-keepnames class com.facebook.react.** { *; }
|
|
9
|
+
-keepnames class com.facebook.react.bridge.** { *; }
|
|
10
|
+
-keepnames class com.facebook.react.devsupport.** { *; }
|
|
11
|
+
|
|
12
|
+
# Keep fields used in reflection
|
|
13
|
+
-keepclassmembers class com.facebook.react.ReactInstanceManager {
|
|
14
|
+
private JSBundleLoader mBundleLoader;
|
|
15
|
+
private String mJSBundleFile;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
-keepclassmembers class com.facebook.react.ReactDelegate {
|
|
19
|
+
private ReactHost mReactHost;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
-keepclassmembers class com.facebook.react.ReactHost {
|
|
23
|
+
private boolean mUseDevSupport;
|
|
24
|
+
private ReactHostDelegate mReactHostDelegate;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
# Keep Expo related classes
|
|
28
|
+
-keepnames class expo.modules.ExpoReactHostFactory$ExpoReactHostDelegate { *; }
|
|
29
|
+
|
|
30
|
+
# Keep methods used in reflection
|
|
31
|
+
-keepclassmembers class com.facebook.react.ReactActivity {
|
|
32
|
+
public ReactDelegate getReactDelegate();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
-keepclassmembers class com.facebook.react.ReactHost {
|
|
36
|
+
public void reload(java.lang.String);
|
|
37
|
+
}
|
|
@@ -169,17 +169,19 @@ public class UpdateContext {
|
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
public void markSuccess() {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
172
|
+
if (!BuildConfig.DEBUG) {
|
|
173
|
+
SharedPreferences.Editor editor = sp.edit();
|
|
174
|
+
editor.putBoolean("firstTimeOk", true);
|
|
175
|
+
String lastVersion = sp.getString("lastVersion", null);
|
|
176
|
+
String curVersion = sp.getString("currentVersion", null);
|
|
177
|
+
if (lastVersion != null && !lastVersion.equals(curVersion)) {
|
|
178
|
+
editor.remove("lastVersion");
|
|
179
|
+
editor.remove("hash_" + lastVersion);
|
|
180
|
+
}
|
|
181
|
+
editor.apply();
|
|
181
182
|
|
|
182
|
-
|
|
183
|
+
this.cleanUp();
|
|
184
|
+
}
|
|
183
185
|
}
|
|
184
186
|
|
|
185
187
|
public void clearFirstTime() {
|
|
@@ -147,13 +147,22 @@ public class UpdateModuleImpl {
|
|
|
147
147
|
reactHostField.setAccessible(true);
|
|
148
148
|
Object reactHost = reactHostField.get(reactDelegate);
|
|
149
149
|
|
|
150
|
+
Field devSupport = reactHost.getClass().getDeclaredField("mUseDevSupport");
|
|
151
|
+
devSupport.setAccessible(true);
|
|
152
|
+
devSupport.set(reactHost, false);
|
|
153
|
+
|
|
150
154
|
// Access the mReactHostDelegate field
|
|
151
155
|
Field reactHostDelegateField = reactHost.getClass().getDeclaredField("mReactHostDelegate");
|
|
152
156
|
reactHostDelegateField.setAccessible(true);
|
|
153
157
|
Object reactHostDelegate = reactHostDelegateField.get(reactHost);
|
|
154
158
|
|
|
159
|
+
String bundleFieldName = "jsBundleLoader";
|
|
160
|
+
if (reactHostDelegate.getClass().getCanonicalName().equals("expo.modules.ExpoReactHostFactory.ExpoReactHostDelegate")) {
|
|
161
|
+
bundleFieldName = "_jsBundleLoader";
|
|
162
|
+
}
|
|
163
|
+
|
|
155
164
|
// Modify the jsBundleLoader field
|
|
156
|
-
Field jsBundleLoaderField = reactHostDelegate.getClass().getDeclaredField(
|
|
165
|
+
Field jsBundleLoaderField = reactHostDelegate.getClass().getDeclaredField(bundleFieldName);
|
|
157
166
|
jsBundleLoaderField.setAccessible(true);
|
|
158
167
|
jsBundleLoaderField.set(reactHostDelegate, loader);
|
|
159
168
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-update",
|
|
3
|
-
"version": "10.29.
|
|
3
|
+
"version": "10.29.1",
|
|
4
4
|
"description": "react-native hot update",
|
|
5
5
|
"main": "src/index",
|
|
6
6
|
"scripts": {
|
|
@@ -72,6 +72,5 @@
|
|
|
72
72
|
"react-native": "0.73",
|
|
73
73
|
"ts-jest": "^29.3.2",
|
|
74
74
|
"typescript": "^5.6.3"
|
|
75
|
-
}
|
|
76
|
-
"packageManager": "yarn@1.22.21+sha1.1959a18351b811cdeedbd484a8f86c3cc3bbaf72"
|
|
75
|
+
}
|
|
77
76
|
}
|
package/src/client.ts
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { CheckResult, ClientOptions, ProgressData, EventType } from './type';
|
|
2
|
-
import {
|
|
3
|
-
assertWeb,
|
|
4
|
-
emptyObj,
|
|
5
|
-
enhancedFetch,
|
|
6
|
-
joinUrls,
|
|
7
|
-
log,
|
|
8
|
-
noop,
|
|
9
|
-
promiseAny,
|
|
10
|
-
testUrls,
|
|
11
|
-
} from './utils';
|
|
12
1
|
import {
|
|
2
|
+
DeviceEventEmitter,
|
|
13
3
|
EmitterSubscription,
|
|
14
4
|
Platform,
|
|
15
|
-
DeviceEventEmitter,
|
|
16
5
|
} from 'react-native';
|
|
17
|
-
import { PermissionsAndroid } from './permissions';
|
|
18
6
|
import {
|
|
19
7
|
PushyModule,
|
|
20
8
|
buildTime,
|
|
21
9
|
cInfo,
|
|
22
|
-
pushyNativeEventEmitter,
|
|
23
10
|
currentVersion,
|
|
11
|
+
getCurrentVersionInfo,
|
|
12
|
+
isFirstTime,
|
|
13
|
+
isRolledBack,
|
|
24
14
|
packageVersion,
|
|
15
|
+
pushyNativeEventEmitter,
|
|
25
16
|
rolledBackVersion,
|
|
26
17
|
setLocalHashInfo,
|
|
27
|
-
isFirstTime,
|
|
28
|
-
isRolledBack,
|
|
29
|
-
getCurrentVersionInfo,
|
|
30
18
|
} from './core';
|
|
19
|
+
import { PermissionsAndroid } from './permissions';
|
|
20
|
+
import { CheckResult, ClientOptions, EventType, ProgressData } from './type';
|
|
21
|
+
import {
|
|
22
|
+
assertWeb,
|
|
23
|
+
emptyObj,
|
|
24
|
+
enhancedFetch,
|
|
25
|
+
joinUrls,
|
|
26
|
+
log,
|
|
27
|
+
noop,
|
|
28
|
+
promiseAny,
|
|
29
|
+
testUrls,
|
|
30
|
+
} from './utils';
|
|
31
31
|
|
|
32
32
|
const SERVER_PRESETS = {
|
|
33
33
|
// cn
|
|
@@ -395,7 +395,7 @@ export class Pushy {
|
|
|
395
395
|
let lastError: any;
|
|
396
396
|
let errorMessages: string[] = [];
|
|
397
397
|
const diffUrl = await testUrls(joinUrls(paths, diff));
|
|
398
|
-
if (diffUrl) {
|
|
398
|
+
if (diffUrl && !__DEV__) {
|
|
399
399
|
log('downloading diff');
|
|
400
400
|
try {
|
|
401
401
|
await PushyModule.downloadPatchFromPpk({
|
|
@@ -408,16 +408,12 @@ export class Pushy {
|
|
|
408
408
|
const errorMessage = `diff error: ${e.message}`;
|
|
409
409
|
errorMessages.push(errorMessage);
|
|
410
410
|
lastError = new Error(errorMessage);
|
|
411
|
-
|
|
412
|
-
succeeded = 'diff';
|
|
413
|
-
} else {
|
|
414
|
-
log(errorMessage);
|
|
415
|
-
}
|
|
411
|
+
log(errorMessage);
|
|
416
412
|
}
|
|
417
413
|
}
|
|
418
414
|
if (!succeeded) {
|
|
419
415
|
const pdiffUrl = await testUrls(joinUrls(paths, pdiff));
|
|
420
|
-
if (pdiffUrl) {
|
|
416
|
+
if (pdiffUrl && !__DEV__) {
|
|
421
417
|
log('downloading pdiff');
|
|
422
418
|
try {
|
|
423
419
|
await PushyModule.downloadPatchFromPackage({
|
|
@@ -429,12 +425,7 @@ export class Pushy {
|
|
|
429
425
|
const errorMessage = `pdiff error: ${e.message}`;
|
|
430
426
|
errorMessages.push(errorMessage);
|
|
431
427
|
lastError = new Error(errorMessage);
|
|
432
|
-
|
|
433
|
-
succeeded = 'pdiff';
|
|
434
|
-
log('当前是开发环境,无法执行增量式热更新。如果需要在开发环境中测试全量热更新,请打开“忽略时间戳”开关再重试。');
|
|
435
|
-
} else {
|
|
436
|
-
log(errorMessage);
|
|
437
|
-
}
|
|
428
|
+
log(errorMessage);
|
|
438
429
|
}
|
|
439
430
|
}
|
|
440
431
|
}
|
|
@@ -452,12 +443,15 @@ export class Pushy {
|
|
|
452
443
|
const errorMessage = `full patch error: ${e.message}`;
|
|
453
444
|
errorMessages.push(errorMessage);
|
|
454
445
|
lastError = new Error(errorMessage);
|
|
455
|
-
|
|
456
|
-
succeeded = 'full';
|
|
457
|
-
} else {
|
|
458
|
-
log(errorMessage);
|
|
459
|
-
}
|
|
446
|
+
log(errorMessage);
|
|
460
447
|
}
|
|
448
|
+
} else if (__DEV__) {
|
|
449
|
+
log(
|
|
450
|
+
`当前是开发环境,无法执行增量式热更新,重启不会生效。
|
|
451
|
+
如果需要在开发环境中测试可生效的全量热更新(但也会在再次重启后重新连接 metro),
|
|
452
|
+
请打开“忽略时间戳”开关再重试。`,
|
|
453
|
+
);
|
|
454
|
+
succeeded = 'full';
|
|
461
455
|
}
|
|
462
456
|
}
|
|
463
457
|
if (sharedState.progressHandlers[hash]) {
|
package/android/.project
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<projectDescription>
|
|
3
|
-
<name>react-native-update</name>
|
|
4
|
-
<comment>Project react-native-update created by Buildship.</comment>
|
|
5
|
-
<projects>
|
|
6
|
-
</projects>
|
|
7
|
-
<buildSpec>
|
|
8
|
-
<buildCommand>
|
|
9
|
-
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
|
10
|
-
<arguments>
|
|
11
|
-
</arguments>
|
|
12
|
-
</buildCommand>
|
|
13
|
-
</buildSpec>
|
|
14
|
-
<natures>
|
|
15
|
-
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
|
16
|
-
</natures>
|
|
17
|
-
<filteredResources>
|
|
18
|
-
<filter>
|
|
19
|
-
<id>1727963310481</id>
|
|
20
|
-
<name></name>
|
|
21
|
-
<type>30</type>
|
|
22
|
-
<matcher>
|
|
23
|
-
<id>org.eclipse.core.resources.regexFilterMatcher</id>
|
|
24
|
-
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
|
|
25
|
-
</matcher>
|
|
26
|
-
</filter>
|
|
27
|
-
</filteredResources>
|
|
28
|
-
</projectDescription>
|
package/android/bin/.project
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<projectDescription>
|
|
3
|
-
<name>react-native-update</name>
|
|
4
|
-
<comment>Project react-native-update created by Buildship.</comment>
|
|
5
|
-
<projects>
|
|
6
|
-
</projects>
|
|
7
|
-
<buildSpec>
|
|
8
|
-
<buildCommand>
|
|
9
|
-
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
10
|
-
<arguments>
|
|
11
|
-
</arguments>
|
|
12
|
-
</buildCommand>
|
|
13
|
-
<buildCommand>
|
|
14
|
-
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
|
15
|
-
<arguments>
|
|
16
|
-
</arguments>
|
|
17
|
-
</buildCommand>
|
|
18
|
-
</buildSpec>
|
|
19
|
-
<natures>
|
|
20
|
-
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
21
|
-
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
|
22
|
-
</natures>
|
|
23
|
-
<filteredResources>
|
|
24
|
-
<filter>
|
|
25
|
-
<id>1727963310481</id>
|
|
26
|
-
<name></name>
|
|
27
|
-
<type>30</type>
|
|
28
|
-
<matcher>
|
|
29
|
-
<id>org.eclipse.core.resources.regexFilterMatcher</id>
|
|
30
|
-
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
|
|
31
|
-
</matcher>
|
|
32
|
-
</filter>
|
|
33
|
-
</filteredResources>
|
|
34
|
-
</projectDescription>
|
|
@@ -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
|