react-native-update 10.29.4 → 10.29.6

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.
@@ -0,0 +1,2 @@
1
+ @import React;
2
+
@@ -93,8 +93,7 @@ RCT_EXPORT_MODULE(RCTPushy);
93
93
  BOOL needRollback = (!ignoreRollback && isFirstTime == NO && isFirstLoadOK == NO) || loadVersion.length<=0;
94
94
  if (needRollback) {
95
95
  loadVersion = [self rollback];
96
- }
97
- else if (isFirstTime && !ignoreRollback){
96
+ } else if (isFirstTime && !ignoreRollback){
98
97
  // bundleURL may be called many times, ignore rollbacks before process restarted again.
99
98
  ignoreRollback = true;
100
99
 
@@ -302,34 +301,34 @@ RCT_EXPORT_METHOD(setNeedUpdate:(NSDictionary *)options
302
301
 
303
302
 
304
303
  resolve(@true);
305
- }else{
304
+ } else {
306
305
  reject(@"执行报错", nil, nil);
307
306
  }
308
307
  }
309
308
 
310
309
  RCT_EXPORT_METHOD(reloadUpdate:(NSDictionary *)options
311
310
  resolver:(RCTPromiseResolveBlock)resolve
312
- rejecter:(RCTPromiseRejectBlock)reject)
311
+ rejecter:(RCTPromiseRejectBlock)reject)
313
312
  {
314
313
  @try {
315
314
  NSString *hash = options[@"hash"];
316
315
  if (hash.length) {
317
- [self setNeedUpdate:options resolver:resolve rejecter:reject];
318
-
319
- // reload in earlier version
320
- dispatch_async(dispatch_get_main_queue(), ^{
321
- [self.bridge setValue:[[self class] bundleURL] forKey:@"bundleURL"];
322
- [self.bridge reload];
323
- });
324
-
325
- #if __has_include("RCTReloadCommand.h")
326
- // reload 0.62+
327
- RCTReloadCommandSetBundleURL([[self class] bundleURL]);
328
- RCTTriggerReloadCommandListeners(@"pushy reload");
329
- #endif
330
-
331
- resolve(@true);
332
- }else{
316
+ // 只在 setNeedUpdate 成功后 resolve
317
+ [self setNeedUpdate:options resolver:^(id result) {
318
+ dispatch_async(dispatch_get_main_queue(), ^{
319
+ #if __has_include("RCTReloadCommand.h")
320
+ // reload 0.62+
321
+ RCTReloadCommandSetBundleURL([[self class] bundleURL]);
322
+ RCTTriggerReloadCommandListeners(@"pushy reloadUpdate");
323
+ #else
324
+ [self.bridge reload];
325
+ #endif
326
+ });
327
+ resolve(@true);
328
+ } rejecter:^(NSString *code, NSString *message, NSError *error) {
329
+ reject(code, message, error);
330
+ }];
331
+ } else {
333
332
  reject(@"执行报错", nil, nil);
334
333
  }
335
334
  }
@@ -343,13 +342,14 @@ RCT_EXPORT_METHOD(restartApp:(RCTPromiseResolveBlock)resolve
343
342
  {
344
343
  @try {
345
344
  dispatch_async(dispatch_get_main_queue(), ^{
346
- [self.bridge reload];
345
+ #if __has_include("RCTReloadCommand.h")
346
+ // reload 0.62+
347
+ RCTReloadCommandSetBundleURL([[self class] bundleURL]);
348
+ RCTTriggerReloadCommandListeners(@"pushy restartApp");
349
+ #else
350
+ [self.bridge reload];
351
+ #endif
347
352
  });
348
- #if __has_include("RCTReloadCommand.h")
349
- // reload 0.62+
350
- RCTReloadCommandSetBundleURL([[self class] bundleURL]);
351
- RCTTriggerReloadCommandListeners(@"pushy restartApp");
352
- #endif
353
353
 
354
354
  resolve(@true);
355
355
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-update",
3
- "version": "10.29.4",
3
+ "version": "10.29.6",
4
4
  "description": "react-native hot update",
5
5
  "main": "src/index",
6
6
  "scripts": {
@@ -90,13 +90,6 @@ Pod::Spec.new do |s|
90
90
 
91
91
  s.source = { :git => 'https://github.com/reactnativecn/react-native-update.git', :tag => '#{s.version}' }
92
92
 
93
- # Conditionally set source files
94
- if valid_expo_project
95
- s.source_files = Dir.glob("ios/**/*.{h,m,mm,swift}") # Include Expo files
96
- else
97
- s.source_files = Dir.glob("ios/**/*.{h,m,mm,swift}").reject { |f| f.start_with?("ios/Expo/") } # Exclude Expo files
98
- end
99
-
100
93
  s.libraries = 'bz2', 'z'
101
94
  s.vendored_libraries = 'RCTPushy/libRCTPushy.a'
102
95
  s.pod_target_xcconfig = {
@@ -112,22 +105,18 @@ Pod::Spec.new do |s|
112
105
 
113
106
  # Conditionally add Expo dependency
114
107
  if valid_expo_project
108
+ s.public_header_files = ['ios/ImportReact.h']
115
109
  s.dependency 'ExpoModulesCore'
116
110
  end
117
111
 
118
112
  s.subspec 'RCTPushy' do |ss|
119
- ss.source_files = 'ios/RCTPushy/*.{h,m,mm,swift}'
120
- ss.public_header_files = ['ios/RCTPushy/*.h']
121
- end
122
-
123
- s.subspec 'HDiffPatch' do |ss|
124
- ss.source_files = ['ios/RCTPushy/HDiffPatch/**/*.{h,m,c}',
113
+ ss.source_files = ['ios/RCTPushy/**/*.{h,m,mm,c}',
125
114
  'android/jni/hpatch.{h,c}',
126
115
  'android/jni/HDiffPatch/libHDiffPatch/HPatch/*.{h,c}',
127
116
  'android/jni/HDiffPatch/file_for_patch.{h,c}',
128
117
  'android/jni/lzma/C/LzmaDec.{h,c}',
129
118
  'android/jni/lzma/C/Lzma2Dec.{h,c}']
130
- ss.public_header_files = 'ios/RCTPushy/HDiffPatch/**/*.h'
119
+ ss.public_header_files = ['ios/RCTPushy/**/*.h']
131
120
  end
132
121
 
133
122
  # Conditionally add Expo subspec and check ExpoModulesCore version