react-native-update 10.2.9 → 10.3.0-beta.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.
- package/android/src/main/java/cn/reactnative/modules/update/UpdateContext.java +7 -0
- package/android/src/main/java/cn/reactnative/modules/update/UpdateModuleImpl.java +17 -0
- package/android/src/newarch/cn/reactnative/modules/update/UpdateModule.java +6 -1
- package/android/src/oldarch/cn/reactnative/modules/update/UpdateModule.java +12 -0
- package/ios/RCTPushy/RCTPushy.mm +18 -0
- package/package.json +8 -4
- package/src/NativePushy.ts +2 -1
- package/tea.yaml +6 -0
|
@@ -166,6 +166,13 @@ public class UpdateContext {
|
|
|
166
166
|
return sp.getString(key, null);
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
+
public void setBlockUpdate(int until, String reason) {
|
|
170
|
+
SharedPreferences.Editor editor = sp.edit();
|
|
171
|
+
editor.putInt("blockUntil", until);
|
|
172
|
+
editor.putString("blockReason", reason);
|
|
173
|
+
editor.apply();
|
|
174
|
+
}
|
|
175
|
+
|
|
169
176
|
public String getCurrentVersion() {
|
|
170
177
|
return sp.getString("currentVersion", null);
|
|
171
178
|
}
|
|
@@ -192,6 +192,23 @@ public class UpdateModuleImpl {
|
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
+
public static void setBlockUpdate(UpdateContext updateContext, ReadableMap options,Promise promise) {
|
|
196
|
+
try {
|
|
197
|
+
final int until = options.getInt("until");
|
|
198
|
+
final String reason = options.getString("reason");
|
|
199
|
+
UiThreadUtil.runOnUiThread(new Runnable() {
|
|
200
|
+
@Override
|
|
201
|
+
public void run() {
|
|
202
|
+
updateContext.setBlockUpdate(until, reason);
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
promise.resolve(true);
|
|
206
|
+
}catch (Exception e){
|
|
207
|
+
promise.reject("执行报错:"+e.getMessage());
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
}
|
|
211
|
+
|
|
195
212
|
public static void setUuid(UpdateContext updateContext, String uuid, Promise promise) {
|
|
196
213
|
try {
|
|
197
214
|
UiThreadUtil.runOnUiThread(new Runnable() {
|
|
@@ -14,7 +14,7 @@ import java.io.File;
|
|
|
14
14
|
import java.util.HashMap;
|
|
15
15
|
import java.util.Map;
|
|
16
16
|
|
|
17
|
-
public class UpdateModule extends
|
|
17
|
+
public class UpdateModule extends NativeUpdateSpec {
|
|
18
18
|
UpdateContext updateContext;
|
|
19
19
|
public static ReactApplicationContext mContext;
|
|
20
20
|
public UpdateModule(ReactApplicationContext reactContext, UpdateContext updateContext) {
|
|
@@ -108,6 +108,11 @@ public class UpdateModule extends NativePushySpec {
|
|
|
108
108
|
UpdateModuleImpl.markSuccess(updateContext,promise);
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
@Override
|
|
112
|
+
public void setBlockUpdate(ReadableMap options,Promise promise) {
|
|
113
|
+
UpdateModuleImpl.setBlockUpdate(updateContext,options,promise);
|
|
114
|
+
}
|
|
115
|
+
|
|
111
116
|
@Override
|
|
112
117
|
public void setUuid(final String uuid, Promise promise) {
|
|
113
118
|
UpdateModuleImpl.setUuid(updateContext,uuid,promise);
|
|
@@ -239,6 +239,18 @@ public class UpdateModule extends ReactContextBaseJavaModule {
|
|
|
239
239
|
});
|
|
240
240
|
}
|
|
241
241
|
|
|
242
|
+
@ReactMethod
|
|
243
|
+
public void setBlockUpdate(ReadableMap options) {
|
|
244
|
+
final int until = options.getInt("until");
|
|
245
|
+
final String reason = options.getString("reason");
|
|
246
|
+
UiThreadUtil.runOnUiThread(new Runnable() {
|
|
247
|
+
@Override
|
|
248
|
+
public void run() {
|
|
249
|
+
updateContext.setBlockUpdate(until, reason);
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
|
|
242
254
|
@ReactMethod
|
|
243
255
|
public void setUuid(final String uuid) {
|
|
244
256
|
UiThreadUtil.runOnUiThread(new Runnable() {
|
package/ios/RCTPushy/RCTPushy.mm
CHANGED
|
@@ -192,6 +192,24 @@ RCT_EXPORT_MODULE(RCTPushy);
|
|
|
192
192
|
return self;
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
+
RCT_EXPORT_METHOD(setBlockUpdate:(NSDictionary *)options
|
|
196
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
197
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
198
|
+
{
|
|
199
|
+
// NSMutableDictionary *blockUpdateInfo = [NSMutableDictionary new];
|
|
200
|
+
// blockUpdateInfo[@"reason"] = options[@"reason"];
|
|
201
|
+
// blockUpdateInfo[@"until"] = options[@"until"];
|
|
202
|
+
@try {
|
|
203
|
+
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
|
204
|
+
[defaults setObject:options forKey:keyBlockUpdate];
|
|
205
|
+
[defaults synchronize];
|
|
206
|
+
resolve(@true);
|
|
207
|
+
}
|
|
208
|
+
@catch (NSException *exception) {
|
|
209
|
+
reject(@"执行报错", nil, nil);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
195
213
|
RCT_EXPORT_METHOD(setUuid:(NSString *)uuid resolver:(RCTPromiseResolveBlock)resolve
|
|
196
214
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
197
215
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-update",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.3.0-beta.0",
|
|
4
4
|
"description": "react-native hot update",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -48,9 +48,13 @@
|
|
|
48
48
|
"nanoid": "^3.3.3"
|
|
49
49
|
},
|
|
50
50
|
"codegenConfig": {
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
"libraries": [
|
|
52
|
+
{
|
|
53
|
+
"name": "RCTPushySpec",
|
|
54
|
+
"type": "modules",
|
|
55
|
+
"jsSrcsDir": "src"
|
|
56
|
+
}
|
|
57
|
+
]
|
|
54
58
|
},
|
|
55
59
|
"devDependencies": {
|
|
56
60
|
"@babel/core": "^7.24.0",
|
package/src/NativePushy.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { TurboModule
|
|
1
|
+
import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport';
|
|
2
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
2
3
|
|
|
3
4
|
export interface Spec extends TurboModule {
|
|
4
5
|
getConstants: () => {
|