react-native-update 10.31.0-beta.3 → 10.31.0
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.
|
@@ -23,6 +23,38 @@ import java.util.Map;
|
|
|
23
23
|
public class UpdateModuleImpl {
|
|
24
24
|
|
|
25
25
|
public static final String NAME = "Pushy";
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 获取字段的兼容性方法,尝试带m前缀和不带m前缀的字段名
|
|
29
|
+
* @param clazz 目标类
|
|
30
|
+
* @param fieldName 基础字段名(不带m前缀)
|
|
31
|
+
* @return 找到的字段对象
|
|
32
|
+
* @throws NoSuchFieldException 如果两种命名都找不到字段
|
|
33
|
+
*/
|
|
34
|
+
private static Field getCompatibleField(Class<?> clazz, String fieldName) throws NoSuchFieldException {
|
|
35
|
+
// 首先尝试带m前缀的字段名
|
|
36
|
+
try {
|
|
37
|
+
return clazz.getDeclaredField("m" + capitalize(fieldName));
|
|
38
|
+
} catch (NoSuchFieldException e) {
|
|
39
|
+
// 如果找不到带m前缀的,尝试不带m前缀的
|
|
40
|
+
try {
|
|
41
|
+
return clazz.getDeclaredField(fieldName);
|
|
42
|
+
} catch (NoSuchFieldException e2) {
|
|
43
|
+
// 如果都找不到,抛出异常并包含两种尝试的信息
|
|
44
|
+
throw new NoSuchFieldException("Field not found with either name: m" + capitalize(fieldName) + " or " + fieldName);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* 首字母大写的辅助方法
|
|
51
|
+
*/
|
|
52
|
+
private static String capitalize(String str) {
|
|
53
|
+
if (str == null || str.length() == 0) {
|
|
54
|
+
return str;
|
|
55
|
+
}
|
|
56
|
+
return str.substring(0, 1).toUpperCase() + str.substring(1);
|
|
57
|
+
}
|
|
26
58
|
|
|
27
59
|
public static void downloadFullUpdate(UpdateContext updateContext, final ReadableMap options, final Promise promise) {
|
|
28
60
|
String url = options.getString("updateUrl");
|
|
@@ -143,16 +175,16 @@ public class UpdateModuleImpl {
|
|
|
143
175
|
ReactDelegate reactDelegate = (ReactDelegate)
|
|
144
176
|
getReactDelegateMethod.invoke(currentActivity);
|
|
145
177
|
|
|
146
|
-
Field reactHostField = ReactDelegate.class
|
|
178
|
+
Field reactHostField = getCompatibleField(ReactDelegate.class, "reactHost");
|
|
147
179
|
reactHostField.setAccessible(true);
|
|
148
180
|
Object reactHost = reactHostField.get(reactDelegate);
|
|
149
181
|
|
|
150
|
-
Field devSupport = reactHost.getClass()
|
|
182
|
+
Field devSupport = getCompatibleField(reactHost.getClass(), "useDevSupport");
|
|
151
183
|
devSupport.setAccessible(true);
|
|
152
184
|
devSupport.set(reactHost, false);
|
|
153
185
|
|
|
154
|
-
// Access the
|
|
155
|
-
Field reactHostDelegateField = reactHost.getClass()
|
|
186
|
+
// Access the ReactHostDelegate field (compatible with mReactHostDelegate/reactHostDelegate)
|
|
187
|
+
Field reactHostDelegateField = getCompatibleField(reactHost.getClass(), "reactHostDelegate");
|
|
156
188
|
reactHostDelegateField.setAccessible(true);
|
|
157
189
|
Object reactHostDelegate = reactHostDelegateField.get(reactHost);
|
|
158
190
|
|
package/package.json
CHANGED
package/.cursor/mcp.json
DELETED
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
|