react-native-update 10.3.0-beta.0 → 10.3.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.
@@ -69,13 +69,6 @@ public class UpdateContext {
69
69
  return context.getString(R.string.pushy_build_time);
70
70
  }
71
71
 
72
- public Map getBlockUpdate() {
73
- return new HashMap<String, Object>() {{
74
- put("until", sp.getInt("blockUntil", 0));
75
- put("reason", sp.getString("blockReason", null));
76
- }};
77
- }
78
-
79
72
  public boolean getIsUsingBundleUrl() {
80
73
  return isUsingBundleUrl;
81
74
  }
@@ -166,13 +159,6 @@ public class UpdateContext {
166
159
  return sp.getString(key, null);
167
160
  }
168
161
 
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
-
176
162
  public String getCurrentVersion() {
177
163
  return sp.getString("currentVersion", null);
178
164
  }
@@ -192,23 +192,6 @@ 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
-
212
195
  public static void setUuid(UpdateContext updateContext, String uuid, Promise promise) {
213
196
  try {
214
197
  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 NativeUpdateSpec {
17
+ public class UpdateModule extends NativePushySpec {
18
18
  UpdateContext updateContext;
19
19
  public static ReactApplicationContext mContext;
20
20
  public UpdateModule(ReactApplicationContext reactContext, UpdateContext updateContext) {
@@ -45,7 +45,6 @@ public class UpdateModule extends NativeUpdateSpec {
45
45
  if (rolledBackVersion != null) {
46
46
  updateContext.clearRollbackMark();
47
47
  }
48
- constants.put("blockUpdate", updateContext.getBlockUpdate());
49
48
  constants.put("uuid", updateContext.getKv("uuid"));
50
49
  return constants;
51
50
  }
@@ -108,11 +107,6 @@ public class UpdateModule extends NativeUpdateSpec {
108
107
  UpdateModuleImpl.markSuccess(updateContext,promise);
109
108
  }
110
109
 
111
- @Override
112
- public void setBlockUpdate(ReadableMap options,Promise promise) {
113
- UpdateModuleImpl.setBlockUpdate(updateContext,options,promise);
114
- }
115
-
116
110
  @Override
117
111
  public void setUuid(final String uuid, Promise promise) {
118
112
  UpdateModuleImpl.setUuid(updateContext,uuid,promise);
@@ -59,7 +59,6 @@ public class UpdateModule extends ReactContextBaseJavaModule {
59
59
  if (rolledBackVersion != null) {
60
60
  updateContext.clearRollbackMark();
61
61
  }
62
- constants.put("blockUpdate", updateContext.getBlockUpdate());
63
62
  constants.put("uuid", updateContext.getKv("uuid"));
64
63
  return constants;
65
64
  }
@@ -239,18 +238,6 @@ public class UpdateModule extends ReactContextBaseJavaModule {
239
238
  });
240
239
  }
241
240
 
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
-
254
241
  @ReactMethod
255
242
  public void setUuid(final String uuid) {
256
243
  UiThreadUtil.runOnUiThread(new Runnable() {
@@ -16,7 +16,6 @@ static NSString *const paramLastVersion = @"lastVersion";
16
16
  static NSString *const paramCurrentVersion = @"currentVersion";
17
17
  static NSString *const paramIsFirstTime = @"isFirstTime";
18
18
  static NSString *const paramIsFirstLoadOk = @"isFirstLoadOK";
19
- static NSString *const keyBlockUpdate = @"REACTNATIVECN_PUSHY_BLOCKUPDATE";
20
19
  static NSString *const keyUuid = @"REACTNATIVECN_PUSHY_UUID";
21
20
  static NSString *const keyHashInfo = @"REACTNATIVECN_PUSHY_HASH_";
22
21
  static NSString *const keyFirstLoadMarked = @"REACTNATIVECN_PUSHY_FIRSTLOADMARKED_KEY";
@@ -157,7 +156,6 @@ RCT_EXPORT_MODULE(RCTPushy);
157
156
  ret[@"buildTime"] = [RCTPushy buildTime];
158
157
  ret[@"rolledBackVersion"] = [defaults objectForKey:keyRolledBackMarked];
159
158
  ret[@"isFirstTime"] = [defaults objectForKey:keyFirstLoadMarked];
160
- ret[@"blockUpdate"] = [defaults objectForKey:keyBlockUpdate];
161
159
  ret[@"uuid"] = [defaults objectForKey:keyUuid];
162
160
  NSDictionary *pushyInfo = [defaults dictionaryForKey:keyPushyInfo];
163
161
  ret[@"currentVersion"] = [pushyInfo objectForKey:paramCurrentVersion];
@@ -192,24 +190,6 @@ RCT_EXPORT_MODULE(RCTPushy);
192
190
  return self;
193
191
  }
194
192
 
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
-
213
193
  RCT_EXPORT_METHOD(setUuid:(NSString *)uuid resolver:(RCTPromiseResolveBlock)resolve
214
194
  rejecter:(RCTPromiseRejectBlock)reject)
215
195
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-update",
3
- "version": "10.3.0-beta.0",
3
+ "version": "10.3.1",
4
4
  "description": "react-native hot update",
5
5
  "main": "src/index.ts",
6
6
  "scripts": {
@@ -48,13 +48,9 @@
48
48
  "nanoid": "^3.3.3"
49
49
  },
50
50
  "codegenConfig": {
51
- "libraries": [
52
- {
53
- "name": "RCTPushySpec",
54
- "type": "modules",
55
- "jsSrcsDir": "src"
56
- }
57
- ]
51
+ "name": "RCTPushySpec",
52
+ "type": "modules",
53
+ "jsSrcsDir": "src"
58
54
  },
59
55
  "devDependencies": {
60
56
  "@babel/core": "^7.24.0",
@@ -1,5 +1,4 @@
1
- import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport';
2
- import { TurboModuleRegistry } from 'react-native';
1
+ import { TurboModule, TurboModuleRegistry } from 'react-native';
3
2
 
4
3
  export interface Spec extends TurboModule {
5
4
  getConstants: () => {
package/src/core.ts CHANGED
@@ -9,7 +9,7 @@ const isTurboModuleEnabled =
9
9
  global.__turboModuleProxy != null;
10
10
 
11
11
  export const PushyModule = isTurboModuleEnabled
12
- ? require('./turboModuleSpec').default
12
+ ? require('./NativePushy').default
13
13
  : NativeModules.Pushy;
14
14
 
15
15
  if (!PushyModule) {
package/src/provider.tsx CHANGED
@@ -124,20 +124,20 @@ export const PushyProvider = ({
124
124
  setUpdateInfo(info);
125
125
  if (info.expired) {
126
126
  const { downloadUrl } = info;
127
- showAlert('提示', '您的应用版本已更新,点击更新下载安装新版本', [
128
- {
129
- text: '更新',
130
- onPress: () => {
131
- if (downloadUrl) {
127
+ if (downloadUrl) {
128
+ showAlert('提示', '您的应用版本已更新,点击更新下载安装新版本', [
129
+ {
130
+ text: '更新',
131
+ onPress: () => {
132
132
  if (Platform.OS === 'android' && downloadUrl.endsWith('.apk')) {
133
133
  downloadAndInstallApk(downloadUrl);
134
134
  } else {
135
135
  Linking.openURL(downloadUrl);
136
136
  }
137
- }
137
+ },
138
138
  },
139
- },
140
- ]);
139
+ ]);
140
+ }
141
141
  } else if (info.update) {
142
142
  showAlert(
143
143
  '提示',
package/tea.yaml DELETED
@@ -1,6 +0,0 @@
1
- # https://tea.xyz/what-is-this-file
2
- ---
3
- version: 1.0.0
4
- codeOwners:
5
- - '0x10D90dC0034E2e82F0AC55954B3ed4EC0550ECe7'
6
- quorum: 1