@appzung/react-native-code-push 10.2.4 → 11.0.0-rc10

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.
Files changed (38) hide show
  1. package/CodePush.podspec +3 -5
  2. package/README.md +22 -20
  3. package/android/app/build.gradle +9 -0
  4. package/android/app/proguard-rules.pro +5 -0
  5. package/android/app/src/main/java/com/appzung/codepush/react/CodePush.java +30 -2
  6. package/android/app/src/main/java/com/appzung/codepush/react/CodePushNativeModule.java +179 -70
  7. package/android/app/src/main/java/com/appzung/codepush/react/ExpoUtils.java +22 -0
  8. package/android/app/src/main/java/com/appzung/codepush/react/ReactHostHolder.java +11 -0
  9. package/ios/CodePush/CodePush.h +8 -0
  10. package/ios/CodePush/{CodePush.m → CodePush.mm} +104 -139
  11. package/ios/CodePush.xcodeproj/project.pbxproj +6 -6
  12. package/lib/commonjs/internals/CodePushEventEmitter.js +10 -0
  13. package/lib/commonjs/internals/CodePushEventEmitter.js.map +1 -0
  14. package/lib/commonjs/internals/RemotePackageImplementation.js +2 -3
  15. package/lib/commonjs/internals/RemotePackageImplementation.js.map +1 -1
  16. package/lib/commonjs/internals/version.js +1 -1
  17. package/lib/commonjs/internals/version.js.map +1 -1
  18. package/lib/module/internals/CodePushEventEmitter.js +6 -0
  19. package/lib/module/internals/CodePushEventEmitter.js.map +1 -0
  20. package/lib/module/internals/RemotePackageImplementation.js +2 -3
  21. package/lib/module/internals/RemotePackageImplementation.js.map +1 -1
  22. package/lib/module/internals/version.js +1 -1
  23. package/lib/module/internals/version.js.map +1 -1
  24. package/lib/typescript/commonjs/src/internals/CodePushEventEmitter.d.ts +3 -0
  25. package/lib/typescript/commonjs/src/internals/CodePushEventEmitter.d.ts.map +1 -0
  26. package/lib/typescript/commonjs/src/internals/RemotePackageImplementation.d.ts.map +1 -1
  27. package/lib/typescript/commonjs/src/internals/version.d.ts +1 -1
  28. package/lib/typescript/commonjs/src/internals/version.d.ts.map +1 -1
  29. package/lib/typescript/module/src/internals/CodePushEventEmitter.d.ts +3 -0
  30. package/lib/typescript/module/src/internals/CodePushEventEmitter.d.ts.map +1 -0
  31. package/lib/typescript/module/src/internals/RemotePackageImplementation.d.ts.map +1 -1
  32. package/lib/typescript/module/src/internals/version.d.ts +1 -1
  33. package/lib/typescript/module/src/internals/version.d.ts.map +1 -1
  34. package/package.json +1 -1
  35. package/react-native.config.js +1 -1
  36. package/src/internals/CodePushEventEmitter.ts +4 -0
  37. package/src/internals/RemotePackageImplementation.ts +2 -3
  38. package/src/internals/version.ts +1 -1
@@ -0,0 +1,22 @@
1
+ package com.appzung.codepush.react;
2
+
3
+ import com.facebook.react.bridge.ReactApplicationContext;
4
+
5
+ public class ExpoUtils {
6
+
7
+ /**
8
+ * Detects if the app is running in an Expo environment by checking for
9
+ * the presence of Expo's ReactNativeHostWrapper class.
10
+ *
11
+ * @param reactContext The React application context
12
+ * @return true if Expo environment is detected, false otherwise
13
+ */
14
+ public static boolean detectExpoEnvironment(ReactApplicationContext reactContext) {
15
+ try {
16
+ Class.forName("expo.modules.ReactNativeHostWrapper");
17
+ return true;
18
+ } catch (ClassNotFoundException e) {
19
+ return false;
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,11 @@
1
+ package com.appzung.codepush.react;
2
+
3
+ import com.facebook.react.ReactHost;
4
+ import com.facebook.react.runtime.ReactHostDelegate;
5
+
6
+ /**
7
+ * Provides access to a {@link ReactHostDelegate}
8
+ */
9
+ public interface ReactHostHolder {
10
+ ReactHost getReactHost();
11
+ }
@@ -216,8 +216,16 @@ failCallback:(void (^)(NSError *err))failCallback;
216
216
 
217
217
  @end
218
218
 
219
+ #ifdef __cplusplus
220
+ extern "C" {
221
+ #endif
222
+
219
223
  void CPLog(NSString *formatString, ...);
220
224
 
225
+ #ifdef __cplusplus
226
+ }
227
+ #endif
228
+
221
229
  typedef NS_ENUM(NSInteger, CodePushInstallMode) {
222
230
  CodePushInstallModeImmediate,
223
231
  CodePushInstallModeOnNextRestart,
@@ -8,7 +8,7 @@
8
8
 
9
9
  #import "CodePush.h"
10
10
 
11
- @interface CodePush () <RCTBridgeModule, RCTFrameUpdateObserver>
11
+ @interface CodePush () <RCTBridgeModule>
12
12
  @end
13
13
 
14
14
  @implementation CodePush {
@@ -21,8 +21,8 @@
21
21
 
22
22
  // Used to coordinate the dispatching of download progress events to JS.
23
23
  long long _latestExpectedContentLength;
24
- long long _latestReceivedConentLength;
25
- BOOL _didUpdateProgress;
24
+ long long _latestReceivedContentLength;
25
+ NSTimeInterval _lastProgressEmitTimestamp;
26
26
 
27
27
  BOOL _allowed;
28
28
  BOOL _restartInProgress;
@@ -246,18 +246,6 @@ static NSString *const LatestRollbackCountKey = @"count";
246
246
  #pragma mark - Private API methods
247
247
 
248
248
  @synthesize methodQueue = _methodQueue;
249
- @synthesize pauseCallback = _pauseCallback;
250
- @synthesize paused = _paused;
251
-
252
- - (void)setPaused:(BOOL)paused
253
- {
254
- if (_paused != paused) {
255
- _paused = paused;
256
- if (_pauseCallback) {
257
- _pauseCallback();
258
- }
259
- }
260
- }
261
249
 
262
250
  /*
263
251
  * This method is used to clear updates that are installed
@@ -293,15 +281,15 @@ static NSString *const LatestRollbackCountKey = @"count";
293
281
  // Export the values of the CodePushInstallMode and CodePushUpdateState
294
282
  // enums so that the script-side can easily stay in sync
295
283
  return @{
296
- @"codePushInstallModeOnNextRestart":@(CodePushInstallModeOnNextRestart),
297
- @"codePushInstallModeImmediate": @(CodePushInstallModeImmediate),
298
- @"codePushInstallModeOnNextResume": @(CodePushInstallModeOnNextResume),
299
- @"codePushInstallModeOnNextSuspend": @(CodePushInstallModeOnNextSuspend),
300
-
301
- @"codePushUpdateStateRunning": @(CodePushUpdateStateRunning),
302
- @"codePushUpdateStatePending": @(CodePushUpdateStatePending),
303
- @"codePushUpdateStateLatest": @(CodePushUpdateStateLatest)
304
- };
284
+ @"codePushInstallModeOnNextRestart":@(CodePushInstallModeOnNextRestart),
285
+ @"codePushInstallModeImmediate": @(CodePushInstallModeImmediate),
286
+ @"codePushInstallModeOnNextResume": @(CodePushInstallModeOnNextResume),
287
+ @"codePushInstallModeOnNextSuspend": @(CodePushInstallModeOnNextSuspend),
288
+
289
+ @"codePushUpdateStateRunning": @(CodePushUpdateStateRunning),
290
+ @"codePushUpdateStatePending": @(CodePushUpdateStatePending),
291
+ @"codePushUpdateStateLatest": @(CodePushUpdateStateLatest)
292
+ };
305
293
  };
306
294
 
307
295
  + (BOOL)requiresMainQueueSetup
@@ -317,14 +305,14 @@ static NSString *const LatestRollbackCountKey = @"count";
317
305
  }
318
306
 
319
307
  - (void)dispatchDownloadProgressEvent {
320
- // Notify the script-side about the progress
321
- [self sendEventWithName:DownloadProgressEvent
322
- body:@{
323
- @"totalBytes" : [NSNumber
324
- numberWithLongLong:_latestExpectedContentLength],
325
- @"receivedBytes" : [NSNumber
326
- numberWithLongLong:_latestReceivedConentLength]
327
- }];
308
+ // Notify the script-side about the progress
309
+ [self sendEventWithName:DownloadProgressEvent
310
+ body:@{
311
+ @"totalBytes" : [NSNumber
312
+ numberWithLongLong:_latestExpectedContentLength],
313
+ @"receivedBytes" : [NSNumber
314
+ numberWithLongLong:_latestReceivedContentLength]
315
+ }];
328
316
  }
329
317
 
330
318
  /*
@@ -336,28 +324,28 @@ static NSString *const LatestRollbackCountKey = @"count";
336
324
  if (![self binaryBundleURL]) {
337
325
  NSString *errorMessage;
338
326
 
339
- #ifdef DEBUG
340
- #if TARGET_IPHONE_SIMULATOR
341
- errorMessage = @"React Native doesn't generate your app's JS bundle by default when deploying to the simulator. "
342
- "If you'd like to test CodePush using the simulator, you can do one of the following depending on your "
343
- "React Native version and/or preferred workflow:\n\n"
327
+ #ifdef DEBUG
328
+ #if TARGET_IPHONE_SIMULATOR
329
+ errorMessage = @"React Native doesn't generate your app's JS bundle by default when deploying to the simulator. "
330
+ "If you'd like to test CodePush using the simulator, you can do one of the following depending on your "
331
+ "React Native version and/or preferred workflow:\n\n"
344
332
 
345
- "1. Update your AppDelegate.m file to load the JS bundle from the packager instead of from CodePush. "
346
- "You can still test your CodePush update experience using this workflow (Debug builds only).\n\n"
333
+ "1. Update your AppDelegate.m file to load the JS bundle from the packager instead of from CodePush. "
334
+ "You can still test your CodePush update experience using this workflow (Debug builds only).\n\n"
347
335
 
348
- "2. Force the JS bundle to be generated in simulator builds by adding 'export FORCE_BUNDLING=true' to the script under "
349
- "\"Build Phases\" > \"Bundle React Native code and images\" (React Native >=0.48 only).\n\n"
336
+ "2. Force the JS bundle to be generated in simulator builds by adding 'export FORCE_BUNDLING=true' to the script under "
337
+ "\"Build Phases\" > \"Bundle React Native code and images\" (React Native >=0.48 only).\n\n"
350
338
 
351
- "3. Force the JS bundle to be generated in simulator builds by removing the if block that echoes "
352
- "\"Skipping bundling for Simulator platform\" in the \"node_modules/react-native/packager/react-native-xcode.sh\" file (React Native <=0.47 only)\n\n"
339
+ "3. Force the JS bundle to be generated in simulator builds by removing the if block that echoes "
340
+ "\"Skipping bundling for Simulator platform\" in the \"node_modules/react-native/packager/react-native-xcode.sh\" file (React Native <=0.47 only)\n\n"
353
341
 
354
- "4. Deploy a Release build to the simulator, which unlike Debug builds, will generate the JS bundle (React Native >=0.22.0 only).";
355
- #else
356
- errorMessage = [NSString stringWithFormat:@"The specified JS bundle file wasn't found within the app's binary. Is \"%@\" the correct file name?", [bundleResourceName stringByAppendingPathExtension:bundleResourceExtension]];
357
- #endif
358
- #else
342
+ "4. Deploy a Release build to the simulator, which unlike Debug builds, will generate the JS bundle (React Native >=0.22.0 only).";
343
+ #else
344
+ errorMessage = [NSString stringWithFormat:@"The specified JS bundle file wasn't found within the app's binary. Is \"%@\" the correct file name?", [bundleResourceName stringByAppendingPathExtension:bundleResourceExtension]];
345
+ #endif
346
+ #else
359
347
  errorMessage = @"Something went wrong. Please verify if generated JS bundle is correct. ";
360
- #endif
348
+ #endif
361
349
 
362
350
  RCTFatal([CodePushErrorUtils errorWithMessage:errorMessage]);
363
351
  }
@@ -387,7 +375,6 @@ static NSString *const LatestRollbackCountKey = @"count";
387
375
  #ifdef DEBUG
388
376
  [self clearDebugUpdates];
389
377
  #endif
390
- self.paused = YES;
391
378
  NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults];
392
379
  NSDictionary *pendingUpdate = [preferences objectForKey:PendingUpdateKey];
393
380
  if (pendingUpdate) {
@@ -508,8 +495,8 @@ static NSString *const LatestRollbackCountKey = @"count";
508
495
  // If there is a pending update whose "state" isn't loading, then we consider it "pending".
509
496
  // Additionally, if a specific hash was provided, we ensure it matches that of the pending update.
510
497
  BOOL updateIsPending = pendingUpdate &&
511
- [pendingUpdate[PendingUpdateIsLoadingKey] boolValue] == NO &&
512
- (!packageHash || [pendingUpdate[PendingUpdateHashKey] isEqualToString:packageHash]);
498
+ [pendingUpdate[PendingUpdateIsLoadingKey] boolValue] == NO &&
499
+ (!packageHash || [pendingUpdate[PendingUpdateHashKey] isEqualToString:packageHash]);
513
500
 
514
501
  return updateIsPending;
515
502
  }
@@ -681,10 +668,10 @@ static NSString *const LatestRollbackCountKey = @"count";
681
668
 
682
669
  if (_installMode == CodePushInstallModeOnNextSuspend && [[self class] isPendingUpdate:nil]) {
683
670
  _appSuspendTimer = [NSTimer scheduledTimerWithTimeInterval:_minimumBackgroundDuration
684
- target:self
685
- selector:@selector(loadBundleOnTick:)
686
- userInfo:nil
687
- repeats:NO];
671
+ target:self
672
+ selector:@selector(loadBundleOnTick:)
673
+ userInfo:nil
674
+ repeats:NO];
688
675
  }
689
676
  }
690
677
 
@@ -699,8 +686,8 @@ static NSString *const LatestRollbackCountKey = @"count";
699
686
  */
700
687
  RCT_EXPORT_METHOD(downloadUpdate:(NSDictionary*)updatePackage
701
688
  notifyProgress:(BOOL)notifyProgress
702
- resolver:(RCTPromiseResolveBlock)resolve
703
- rejecter:(RCTPromiseRejectBlock)reject)
689
+ resolver:(RCTPromiseResolveBlock)resolve
690
+ rejecter:(RCTPromiseRejectBlock)reject)
704
691
  {
705
692
  NSDictionary *mutableUpdatePackage = [updatePackage mutableCopy];
706
693
  NSURL *binaryBundleURL = [CodePush binaryBundleURL];
@@ -709,56 +696,46 @@ RCT_EXPORT_METHOD(downloadUpdate:(NSDictionary*)updatePackage
709
696
  forKey:BinaryBundleDateKey];
710
697
  }
711
698
 
712
- if (notifyProgress) {
713
- // Set up and unpause the frame observer so that it can emit
714
- // progress events every frame if the progress is updated.
715
- _didUpdateProgress = NO;
716
- self.paused = NO;
717
- }
718
-
719
699
  NSString * publicKey = [[CodePushConfig current] publicKey];
720
700
 
721
701
  [CodePushPackage
722
- downloadPackage:mutableUpdatePackage
723
- expectedBundleFileName:[bundleResourceName stringByAppendingPathExtension:bundleResourceExtension]
724
- publicKey:publicKey
725
- operationQueue:_methodQueue
726
- // The download is progressing forward
727
- progressCallback:^(long long expectedContentLength, long long receivedContentLength) {
728
- // Update the download progress so that the frame observer can notify the JS side
729
- _latestExpectedContentLength = expectedContentLength;
730
- _latestReceivedConentLength = receivedContentLength;
731
- _didUpdateProgress = YES;
732
-
733
- // If the download is completed, stop observing frame
734
- // updates and synchronously send the last event.
735
- if (expectedContentLength == receivedContentLength) {
736
- _didUpdateProgress = NO;
737
- self.paused = YES;
702
+ downloadPackage:mutableUpdatePackage
703
+ expectedBundleFileName:[bundleResourceName stringByAppendingPathExtension:bundleResourceExtension]
704
+ publicKey:publicKey
705
+ operationQueue:_methodQueue
706
+ // The download is progressing forward
707
+ progressCallback:^(long long expectedContentLength, long long receivedContentLength) {
708
+ self->_latestExpectedContentLength = expectedContentLength;
709
+ self->_latestReceivedContentLength = receivedContentLength;
710
+
711
+ if (expectedContentLength == receivedContentLength) {
712
+ [self dispatchDownloadProgressEvent];
713
+ } else if (notifyProgress) {
714
+ NSTimeInterval timestamp = [[NSDate date] timeIntervalSince1970];
715
+ if (timestamp - self->_lastProgressEmitTimestamp > 0.3) {
716
+ self->_lastProgressEmitTimestamp = timestamp;
738
717
  [self dispatchDownloadProgressEvent];
739
718
  }
740
719
  }
741
- // The download completed
742
- doneCallback:^{
743
- NSError *err;
744
- NSDictionary *newPackage = [CodePushPackage getPackage:mutableUpdatePackage[PackageHashKey] error:&err];
720
+ }
721
+ // The download completed
722
+ doneCallback:^{
723
+ NSError *err;
724
+ NSDictionary *newPackage = [CodePushPackage getPackage:mutableUpdatePackage[PackageHashKey] error:&err];
745
725
 
746
- if (err) {
747
- return reject([NSString stringWithFormat: @"%lu", (long)err.code], err.localizedDescription, err);
748
- }
749
- resolve(newPackage);
726
+ if (err) {
727
+ return reject([NSString stringWithFormat: @"%lu", (long)err.code], err.localizedDescription, err);
728
+ }
729
+ resolve(newPackage);
730
+ }
731
+ // The download failed
732
+ failCallback:^(NSError *err) {
733
+ if ([CodePushErrorUtils isCodePushError:err]) {
734
+ [self saveFailedUpdate:mutableUpdatePackage];
750
735
  }
751
- // The download failed
752
- failCallback:^(NSError *err) {
753
- if ([CodePushErrorUtils isCodePushError:err]) {
754
- [self saveFailedUpdate:mutableUpdatePackage];
755
- }
756
736
 
757
- // Stop observing frame updates if the download fails.
758
- _didUpdateProgress = NO;
759
- self.paused = YES;
760
- reject([NSString stringWithFormat: @"%lu", (long)err.code], err.localizedDescription, err);
761
- }];
737
+ reject([NSString stringWithFormat: @"%lu", (long)err.code], err.localizedDescription, err);
738
+ }];
762
739
  }
763
740
 
764
741
  - (void)restartAppInternal:(BOOL)onlyIfUpdateIsPending
@@ -795,7 +772,7 @@ RCT_EXPORT_METHOD(downloadUpdate:(NSDictionary*)updatePackage
795
772
  * app version, as well as the release channel public ID that was configured in the Info.plist file.
796
773
  */
797
774
  RCT_EXPORT_METHOD(getConfiguration:(RCTPromiseResolveBlock)resolve
798
- rejecter:(RCTPromiseRejectBlock)reject)
775
+ rejecter:(RCTPromiseRejectBlock)reject)
799
776
  {
800
777
  NSDictionary *configuration = [[CodePushConfig current] configuration];
801
778
  NSError *error;
@@ -829,8 +806,8 @@ RCT_EXPORT_METHOD(getConfiguration:(RCTPromiseResolveBlock)resolve
829
806
  * This method is the native side of the CodePush.getUpdateMetadata method.
830
807
  */
831
808
  RCT_EXPORT_METHOD(getUpdateMetadata:(CodePushUpdateState)updateState
832
- resolver:(RCTPromiseResolveBlock)resolve
833
- rejecter:(RCTPromiseRejectBlock)reject)
809
+ resolver:(RCTPromiseResolveBlock)resolve
810
+ rejecter:(RCTPromiseRejectBlock)reject)
834
811
  {
835
812
  NSError *error;
836
813
  NSMutableDictionary *package = [[CodePushPackage getCurrentPackage:&error] mutableCopy];
@@ -877,10 +854,10 @@ RCT_EXPORT_METHOD(getUpdateMetadata:(CodePushUpdateState)updateState
877
854
  * This method is the native side of the LocalPackage.install method.
878
855
  */
879
856
  RCT_EXPORT_METHOD(installUpdate:(NSDictionary*)updatePackage
880
- installMode:(CodePushInstallMode)installMode
881
- minimumBackgroundDuration:(int)minimumBackgroundDuration
882
- resolver:(RCTPromiseResolveBlock)resolve
883
- rejecter:(RCTPromiseRejectBlock)reject)
857
+ installMode:(CodePushInstallMode)installMode
858
+ minimumBackgroundDuration:(int)minimumBackgroundDuration
859
+ resolver:(RCTPromiseResolveBlock)resolve
860
+ rejecter:(RCTPromiseRejectBlock)reject)
884
861
  {
885
862
  NSError *error;
886
863
  [CodePushPackage installPackage:updatePackage
@@ -930,8 +907,8 @@ RCT_EXPORT_METHOD(installUpdate:(NSDictionary*)updatePackage
930
907
  * module, and is only used internally to populate the RemotePackage.failedInstall property.
931
908
  */
932
909
  RCT_EXPORT_METHOD(isFailedUpdate:(NSString *)packageHash
933
- resolve:(RCTPromiseResolveBlock)resolve
934
- reject:(RCTPromiseRejectBlock)reject)
910
+ resolve:(RCTPromiseResolveBlock)resolve
911
+ reject:(RCTPromiseRejectBlock)reject)
935
912
  {
936
913
  BOOL isFailedHash = [[self class] isFailedHash:packageHash];
937
914
  resolve(@(isFailedHash));
@@ -958,14 +935,14 @@ RCT_EXPORT_METHOD(getLatestRollbackInfo:(RCTPromiseResolveBlock)resolve
958
935
  * module, and is only used internally to populate the LocalPackage.isFirstRun property.
959
936
  */
960
937
  RCT_EXPORT_METHOD(isFirstRun:(NSString *)packageHash
961
- resolve:(RCTPromiseResolveBlock)resolve
962
- rejecter:(RCTPromiseRejectBlock)reject)
938
+ resolve:(RCTPromiseResolveBlock)resolve
939
+ rejecter:(RCTPromiseRejectBlock)reject)
963
940
  {
964
941
  NSError *error;
965
942
  BOOL isFirstRun = _isFirstRunAfterUpdate
966
- && nil != packageHash
967
- && [packageHash length] > 0
968
- && [packageHash isEqualToString:[CodePushPackage getCurrentPackageHash:&error]];
943
+ && nil != packageHash
944
+ && [packageHash length] > 0
945
+ && [packageHash isEqualToString:[CodePushPackage getCurrentPackageHash:&error]];
969
946
 
970
947
  resolve(@(isFirstRun));
971
948
  }
@@ -974,14 +951,14 @@ RCT_EXPORT_METHOD(isFirstRun:(NSString *)packageHash
974
951
  * This method is the native side of the CodePush.notifyApplicationReady() method.
975
952
  */
976
953
  RCT_EXPORT_METHOD(notifyApplicationReady:(RCTPromiseResolveBlock)resolve
977
- rejecter:(RCTPromiseRejectBlock)reject)
954
+ rejecter:(RCTPromiseRejectBlock)reject)
978
955
  {
979
956
  [CodePush removePendingUpdate];
980
957
  resolve(nil);
981
958
  }
982
959
 
983
960
  RCT_EXPORT_METHOD(allow:(RCTPromiseResolveBlock)resolve
984
- rejecter:(RCTPromiseRejectBlock)reject)
961
+ rejecter:(RCTPromiseRejectBlock)reject)
985
962
  {
986
963
  CPLog(@"Re-allowing restarts.");
987
964
  _allowed = YES;
@@ -997,14 +974,14 @@ RCT_EXPORT_METHOD(allow:(RCTPromiseResolveBlock)resolve
997
974
  }
998
975
 
999
976
  RCT_EXPORT_METHOD(clearPendingRestart:(RCTPromiseResolveBlock)resolve
1000
- rejecter:(RCTPromiseRejectBlock)reject)
977
+ rejecter:(RCTPromiseRejectBlock)reject)
1001
978
  {
1002
979
  [_restartQueue removeAllObjects];
1003
980
  resolve(nil);
1004
981
  }
1005
982
 
1006
983
  RCT_EXPORT_METHOD(disallow:(RCTPromiseResolveBlock)resolve
1007
- rejecter:(RCTPromiseRejectBlock)reject)
984
+ rejecter:(RCTPromiseRejectBlock)reject)
1008
985
  {
1009
986
  CPLog(@"Disallowing restarts.");
1010
987
  _allowed = NO;
@@ -1015,8 +992,8 @@ RCT_EXPORT_METHOD(disallow:(RCTPromiseResolveBlock)resolve
1015
992
  * This method is the native side of the CodePush.restartApp() method.
1016
993
  */
1017
994
  RCT_EXPORT_METHOD(restartApp:(BOOL)onlyIfUpdateIsPending
1018
- resolve:(RCTPromiseResolveBlock)resolve
1019
- rejecter:(RCTPromiseRejectBlock)reject)
995
+ resolve:(RCTPromiseResolveBlock)resolve
996
+ rejecter:(RCTPromiseRejectBlock)reject)
1020
997
  {
1021
998
  [self restartAppInternal:onlyIfUpdateIsPending];
1022
999
  resolve(nil);
@@ -1034,36 +1011,36 @@ RCT_EXPORT_METHOD(clearUpdates) {
1034
1011
  }
1035
1012
 
1036
1013
  RCT_EXPORT_METHOD(resetClientUniqueId:(RCTPromiseResolveBlock)resolve
1037
- rejecter:(RCTPromiseRejectBlock)reject)
1014
+ rejecter:(RCTPromiseRejectBlock)reject)
1038
1015
  {
1039
1016
  CPLog(@"On iOS, resetting client device ID does nothing as it is the iOS IDFV.");
1040
1017
  resolve([[CodePushConfig current] clientUniqueId]);
1041
1018
  }
1042
1019
 
1043
1020
  RCT_EXPORT_METHOD(setTelemetryEnabled:(BOOL)enabled
1044
- resolver:(RCTPromiseResolveBlock)resolve
1045
- rejecter:(RCTPromiseRejectBlock)reject)
1021
+ resolver:(RCTPromiseResolveBlock)resolve
1022
+ rejecter:(RCTPromiseRejectBlock)reject)
1046
1023
  {
1047
1024
  [[CodePushConfig current] setTelemetryEnabled:enabled];
1048
1025
  resolve(nil);
1049
1026
  }
1050
1027
 
1051
1028
  RCT_EXPORT_METHOD(getTelemetryEnabled:(RCTPromiseResolveBlock)resolve
1052
- rejecter:(RCTPromiseRejectBlock)reject)
1029
+ rejecter:(RCTPromiseRejectBlock)reject)
1053
1030
  {
1054
1031
  resolve(@([[CodePushConfig current] telemetryEnabled]));
1055
1032
  }
1056
1033
 
1057
1034
  RCT_EXPORT_METHOD(setDataTransmissionEnabled:(BOOL)enabled
1058
- resolver:(RCTPromiseResolveBlock)resolve
1059
- rejecter:(RCTPromiseRejectBlock)reject)
1035
+ resolver:(RCTPromiseResolveBlock)resolve
1036
+ rejecter:(RCTPromiseRejectBlock)reject)
1060
1037
  {
1061
1038
  [[CodePushConfig current] setDataTransmissionEnabled:enabled];
1062
1039
  resolve(nil);
1063
1040
  }
1064
1041
 
1065
1042
  RCT_EXPORT_METHOD(getDataTransmissionEnabled:(RCTPromiseResolveBlock)resolve
1066
- rejecter:(RCTPromiseRejectBlock)reject)
1043
+ rejecter:(RCTPromiseRejectBlock)reject)
1067
1044
  {
1068
1045
  resolve(@([[CodePushConfig current] dataTransmissionEnabled]));
1069
1046
  }
@@ -1088,7 +1065,7 @@ RCT_EXPORT_METHOD(downloadAndReplaceCurrentBundle:(NSString *)remoteBundleUrl)
1088
1065
  * or an update failed) and return its details (version label, status).
1089
1066
  */
1090
1067
  RCT_EXPORT_METHOD(getNewStatusReport:(RCTPromiseResolveBlock)resolve
1091
- rejecter:(RCTPromiseRejectBlock)reject)
1068
+ rejecter:(RCTPromiseRejectBlock)reject)
1092
1069
  {
1093
1070
  if (needToReportRollback) {
1094
1071
  needToReportRollback = NO;
@@ -1133,16 +1110,4 @@ RCT_EXPORT_METHOD(saveStatusReportForRetry:(NSDictionary *)statusReport)
1133
1110
  [CodePushTelemetryManager saveStatusReportForRetry:statusReport];
1134
1111
  }
1135
1112
 
1136
- #pragma mark - RCTFrameUpdateObserver Methods
1137
-
1138
- - (void)didUpdateFrame:(RCTFrameUpdate *)update
1139
- {
1140
- if (!_didUpdateProgress) {
1141
- return;
1142
- }
1143
-
1144
- [self dispatchDownloadProgressEvent];
1145
- _didUpdateProgress = NO;
1146
- }
1147
-
1148
1113
  @end
@@ -7,7 +7,7 @@
7
7
  objects = {
8
8
 
9
9
  /* Begin PBXBuildFile section */
10
- 13BE3DEE1AC21097009241FE /* CodePush.m in Sources */ = {isa = PBXBuildFile; fileRef = 13BE3DED1AC21097009241FE /* CodePush.m */; };
10
+ 13BE3DEE1AC21097009241FE /* CodePush.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13BE3DED1AC21097009241FE /* CodePush.mm */; };
11
11
  1B23B9141BF9267B000BB2F0 /* RCTConvert+CodePushInstallMode.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B23B9131BF9267B000BB2F0 /* RCTConvert+CodePushInstallMode.m */; };
12
12
  1B762E901C9A5E9A006EF800 /* CodePushErrorUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B762E8F1C9A5E9A006EF800 /* CodePushErrorUtils.m */; };
13
13
  1BCC09A71CC19EB700DDC0DD /* RCTConvert+CodePushUpdateState.m in Sources */ = {isa = PBXBuildFile; fileRef = 1BCC09A61CC19EB700DDC0DD /* RCTConvert+CodePushUpdateState.m */; };
@@ -16,7 +16,7 @@
16
16
  5498D8F61D21F14100B5EB43 /* CodePushUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 5498D8F51D21F14100B5EB43 /* CodePushUtils.m */; };
17
17
  54FFEDE01BF550630061DD23 /* CodePushDownloadHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 54FFEDDF1BF550630061DD23 /* CodePushDownloadHandler.m */; };
18
18
  6463C82D1EBA0CFB0095B8CD /* CodePushUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 5498D8F51D21F14100B5EB43 /* CodePushUtils.m */; };
19
- 6463C82E1EBA0CFB0095B8CD /* CodePush.m in Sources */ = {isa = PBXBuildFile; fileRef = 13BE3DED1AC21097009241FE /* CodePush.m */; };
19
+ 6463C82E1EBA0CFB0095B8CD /* CodePush.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13BE3DED1AC21097009241FE /* CodePush.mm */; };
20
20
  6463C82F1EBA0CFB0095B8CD /* CodePushConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 81D51F391B6181C2000DA084 /* CodePushConfig.m */; };
21
21
  6463C8301EBA0CFB0095B8CD /* CodePushDownloadHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 54FFEDDF1BF550630061DD23 /* CodePushDownloadHandler.m */; };
22
22
  6463C8311EBA0CFB0095B8CD /* CodePushErrorUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B762E8F1C9A5E9A006EF800 /* CodePushErrorUtils.m */; };
@@ -59,7 +59,7 @@
59
59
  /* Begin PBXFileReference section */
60
60
  134814201AA4EA6300B7C361 /* libCodePush.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libCodePush.a; sourceTree = BUILT_PRODUCTS_DIR; };
61
61
  13BE3DEC1AC21097009241FE /* CodePush.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CodePush.h; path = CodePush/CodePush.h; sourceTree = "<group>"; };
62
- 13BE3DED1AC21097009241FE /* CodePush.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CodePush.m; path = CodePush/CodePush.m; sourceTree = "<group>"; };
62
+ 13BE3DED1AC21097009241FE /* CodePush.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CodePush.mm; path = CodePush/CodePush.mm; sourceTree = "<group>"; };
63
63
  1B23B9131BF9267B000BB2F0 /* RCTConvert+CodePushInstallMode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "RCTConvert+CodePushInstallMode.m"; path = "CodePush/RCTConvert+CodePushInstallMode.m"; sourceTree = "<group>"; };
64
64
  1B762E8F1C9A5E9A006EF800 /* CodePushErrorUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CodePushErrorUtils.m; path = CodePush/CodePushErrorUtils.m; sourceTree = "<group>"; };
65
65
  1BCC09A61CC19EB700DDC0DD /* RCTConvert+CodePushUpdateState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "RCTConvert+CodePushUpdateState.m"; path = "CodePush/RCTConvert+CodePushUpdateState.m"; sourceTree = "<group>"; };
@@ -105,7 +105,7 @@
105
105
  FF90DEF92C5A808600CA8692 /* PrivacyInfo.xcprivacy */,
106
106
  5498D8F51D21F14100B5EB43 /* CodePushUtils.m */,
107
107
  13BE3DEC1AC21097009241FE /* CodePush.h */,
108
- 13BE3DED1AC21097009241FE /* CodePush.m */,
108
+ 13BE3DED1AC21097009241FE /* CodePush.mm */,
109
109
  81D51F391B6181C2000DA084 /* CodePushConfig.m */,
110
110
  54FFEDDF1BF550630061DD23 /* CodePushDownloadHandler.m */,
111
111
  1B762E8F1C9A5E9A006EF800 /* CodePushErrorUtils.m */,
@@ -233,7 +233,7 @@
233
233
  81D51F3A1B6181C2000DA084 /* CodePushConfig.m in Sources */,
234
234
  54FFEDE01BF550630061DD23 /* CodePushDownloadHandler.m in Sources */,
235
235
  5421FE311C58AD5A00986A55 /* CodePushTelemetryManager.m in Sources */,
236
- 13BE3DEE1AC21097009241FE /* CodePush.m in Sources */,
236
+ 13BE3DEE1AC21097009241FE /* CodePush.mm in Sources */,
237
237
  1B762E901C9A5E9A006EF800 /* CodePushErrorUtils.m in Sources */,
238
238
  5498D8F61D21F14100B5EB43 /* CodePushUtils.m in Sources */,
239
239
  810D4E6D1B96935000B397E9 /* CodePushPackage.m in Sources */,
@@ -245,7 +245,7 @@
245
245
  buildActionMask = 2147483647;
246
246
  files = (
247
247
  6463C82D1EBA0CFB0095B8CD /* CodePushUtils.m in Sources */,
248
- 6463C82E1EBA0CFB0095B8CD /* CodePush.m in Sources */,
248
+ 6463C82E1EBA0CFB0095B8CD /* CodePush.mm in Sources */,
249
249
  6463C82F1EBA0CFB0095B8CD /* CodePushConfig.m in Sources */,
250
250
  6463C8301EBA0CFB0095B8CD /* CodePushDownloadHandler.m in Sources */,
251
251
  6463C8311EBA0CFB0095B8CD /* CodePushErrorUtils.m in Sources */,
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.CodePushEventEmitter = void 0;
7
+ var _reactNative = require("react-native");
8
+ var _NativeRNAppZungCodePushModule = require("./NativeRNAppZungCodePushModule.js");
9
+ const CodePushEventEmitter = exports.CodePushEventEmitter = new _reactNative.NativeEventEmitter(_NativeRNAppZungCodePushModule.NativeRNAppZungCodePushModule);
10
+ //# sourceMappingURL=CodePushEventEmitter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","_NativeRNAppZungCodePushModule","CodePushEventEmitter","exports","NativeEventEmitter","NativeRNAppZungCodePushModule"],"sourceRoot":"../../../src","sources":["internals/CodePushEventEmitter.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,8BAAA,GAAAD,OAAA;AAEO,MAAME,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,GAAG,IAAIE,+BAAkB,CAACC,4DAA6B,CAAC","ignoreList":[]}
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.RemotePackageImpl = void 0;
7
- var _reactNative = require("react-native");
8
7
  var _LogLevelEnum = require("../enums/LogLevel.enum.js");
8
+ var _CodePushEventEmitter = require("./CodePushEventEmitter.js");
9
9
  var _LocalPackageImplementation = require("./LocalPackageImplementation.js");
10
10
  var _NativeRNAppZungCodePushModule = require("./NativeRNAppZungCodePushModule.js");
11
11
  var _log = require("./utils/log.js");
@@ -18,9 +18,8 @@ class RemotePackageImpl {
18
18
  }
19
19
  let downloadProgressSubscription;
20
20
  if (downloadProgressCallback) {
21
- const codePushEventEmitter = new _reactNative.NativeEventEmitter(_NativeRNAppZungCodePushModule.NativeRNAppZungCodePushModule);
22
21
  // Use event subscription to obtain download progress.
23
- downloadProgressSubscription = codePushEventEmitter.addListener('CodePushDownloadProgress', downloadProgressCallback);
22
+ downloadProgressSubscription = _CodePushEventEmitter.CodePushEventEmitter.addListener('CodePushDownloadProgress', downloadProgressCallback);
24
23
  }
25
24
 
26
25
  // Use the downloaded package info. Native code will save the package info
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_LogLevelEnum","_LocalPackageImplementation","_NativeRNAppZungCodePushModule","_log","RemotePackageImpl","constructor","remotePackageData","reportStatusDownload","Object","assign","download","downloadProgressCallback","downloadUrl","Error","downloadProgressSubscription","codePushEventEmitter","NativeEventEmitter","NativeRNAppZungCodePushModule","addListener","updatePackageCopy","downloadedPackage","downloadUpdate","timeoutPromise","Promise","resolve","setTimeout","reportPromise","label","catch","error","log","LogLevel","ERROR","race","LocalPackageImplementation","remove","isPending","exports"],"sourceRoot":"../../../src","sources":["internals/RemotePackageImplementation.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAGA,IAAAE,2BAAA,GAAAF,OAAA;AACA,IAAAG,8BAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AAEO,MAAMK,iBAAiB,CAA0B;EACtDC,WAAWA,CACTC,iBAAkD,EAClDC,oBAA2F,EAC3F;IACAC,MAAM,CAACC,MAAM,CAAC,IAAI,EAAEH,iBAAiB,CAAC;IAEtC,IAAI,CAACI,QAAQ,GAAG,MAAOC,wBAAmD,IAAK;MAC7E,IAAI,CAAC,IAAI,CAACC,WAAW,EAAE;QACrB,MAAM,IAAIC,KAAK,CAAC,kDAAkD,CAAC;MACrE;MAEA,IAAIC,4BAA4B;MAEhC,IAAIH,wBAAwB,EAAE;QAC5B,MAAMI,oBAAoB,GAAG,IAAIC,+BAAkB,CAACC,4DAA6B,CAAC;QAClF;QACAH,4BAA4B,GAAGC,oBAAoB,CAACG,WAAW,CAC7D,0BAA0B,EAC1BP,wBACF,CAAC;MACH;;MAEA;MACA;MACA,IAAI;QACF,MAAM;UAAE,GAAGQ;QAAkB,CAAC,GAAGb,iBAAiB,CAAC,CAAC;QACpD,MAAMc,iBAAiB,GAAG,MAAMH,4DAA6B,CAACI,cAAc,CAC1EF,iBAAiB,EACjB,CAAC,CAACR,wBACJ,CAAC;QAED,IAAIJ,oBAAoB,EAAE;UACxB,MAAMe,cAAc,GAAG,IAAIC,OAAO,CAAQC,OAAO,IAAKC,UAAU,CAACD,OAAO,EAAE,GAAG,CAAC,CAAC;UAC/E,MAAME,aAAa,GAAGnB,oBAAoB,CAAC;YACzCoB,KAAK,EAAE,IAAI,CAACA;UACd,CAAC,CAAC,CAACC,KAAK,CAAEC,KAAK,IAAK;YAClB,IAAAC,QAAG,EAACC,sBAAQ,CAACC,KAAK,EAAE,kCAAkCH,KAAK,EAAE,CAAC;UAChE,CAAC,CAAC;UACF,MAAMN,OAAO,CAACU,IAAI,CAAC,CAACX,cAAc,EAAEI,aAAa,CAAC,CAAC;QACrD;QAEA,OAAO,IAAIQ,sDAA0B,CAACd,iBAAiB,CAAC;MAC1D,CAAC,SAAS;QACRN,4BAA4B,IAAIA,4BAA4B,CAACqB,MAAM,CAAC,CAAC;MACvE;IACF,CAAC;EACH;EAUAC,SAAS,GAAG,KAAK,CAAC,CAAC;AAKrB;AAACC,OAAA,CAAAjC,iBAAA,GAAAA,iBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_LogLevelEnum","require","_CodePushEventEmitter","_LocalPackageImplementation","_NativeRNAppZungCodePushModule","_log","RemotePackageImpl","constructor","remotePackageData","reportStatusDownload","Object","assign","download","downloadProgressCallback","downloadUrl","Error","downloadProgressSubscription","CodePushEventEmitter","addListener","updatePackageCopy","downloadedPackage","NativeRNAppZungCodePushModule","downloadUpdate","timeoutPromise","Promise","resolve","setTimeout","reportPromise","label","catch","error","log","LogLevel","ERROR","race","LocalPackageImplementation","remove","isPending","exports"],"sourceRoot":"../../../src","sources":["internals/RemotePackageImplementation.ts"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAGA,IAAAC,qBAAA,GAAAD,OAAA;AACA,IAAAE,2BAAA,GAAAF,OAAA;AACA,IAAAG,8BAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AAEO,MAAMK,iBAAiB,CAA0B;EACtDC,WAAWA,CACTC,iBAAkD,EAClDC,oBAA2F,EAC3F;IACAC,MAAM,CAACC,MAAM,CAAC,IAAI,EAAEH,iBAAiB,CAAC;IAEtC,IAAI,CAACI,QAAQ,GAAG,MAAOC,wBAAmD,IAAK;MAC7E,IAAI,CAAC,IAAI,CAACC,WAAW,EAAE;QACrB,MAAM,IAAIC,KAAK,CAAC,kDAAkD,CAAC;MACrE;MAEA,IAAIC,4BAA4B;MAEhC,IAAIH,wBAAwB,EAAE;QAC5B;QACAG,4BAA4B,GAAGC,0CAAoB,CAACC,WAAW,CAC7D,0BAA0B,EAC1BL,wBACF,CAAC;MACH;;MAEA;MACA;MACA,IAAI;QACF,MAAM;UAAE,GAAGM;QAAkB,CAAC,GAAGX,iBAAiB,CAAC,CAAC;QACpD,MAAMY,iBAAiB,GAAG,MAAMC,4DAA6B,CAACC,cAAc,CAC1EH,iBAAiB,EACjB,CAAC,CAACN,wBACJ,CAAC;QAED,IAAIJ,oBAAoB,EAAE;UACxB,MAAMc,cAAc,GAAG,IAAIC,OAAO,CAAQC,OAAO,IAAKC,UAAU,CAACD,OAAO,EAAE,GAAG,CAAC,CAAC;UAC/E,MAAME,aAAa,GAAGlB,oBAAoB,CAAC;YACzCmB,KAAK,EAAE,IAAI,CAACA;UACd,CAAC,CAAC,CAACC,KAAK,CAAEC,KAAK,IAAK;YAClB,IAAAC,QAAG,EAACC,sBAAQ,CAACC,KAAK,EAAE,kCAAkCH,KAAK,EAAE,CAAC;UAChE,CAAC,CAAC;UACF,MAAMN,OAAO,CAACU,IAAI,CAAC,CAACX,cAAc,EAAEI,aAAa,CAAC,CAAC;QACrD;QAEA,OAAO,IAAIQ,sDAA0B,CAACf,iBAAiB,CAAC;MAC1D,CAAC,SAAS;QACRJ,4BAA4B,IAAIA,4BAA4B,CAACoB,MAAM,CAAC,CAAC;MACvE;IACF,CAAC;EACH;EAUAC,SAAS,GAAG,KAAK,CAAC,CAAC;AAKrB;AAACC,OAAA,CAAAhC,iBAAA,GAAAA,iBAAA","ignoreList":[]}
@@ -5,5 +5,5 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = void 0;
7
7
  // Generated by genversion.
8
- const version = exports.version = '10.2.4';
8
+ const version = exports.version = '11.0.0-rc10';
9
9
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["version","exports"],"sourceRoot":"../../../src","sources":["internals/version.ts"],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAAC,OAAA,CAAAD,OAAA,GAAG,QAAQ","ignoreList":[]}
1
+ {"version":3,"names":["version","exports"],"sourceRoot":"../../../src","sources":["internals/version.ts"],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAAC,OAAA,CAAAD,OAAA,GAAG,aAAa","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ import { NativeEventEmitter } from 'react-native';
4
+ import { NativeRNAppZungCodePushModule } from "./NativeRNAppZungCodePushModule.js";
5
+ export const CodePushEventEmitter = new NativeEventEmitter(NativeRNAppZungCodePushModule);
6
+ //# sourceMappingURL=CodePushEventEmitter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativeEventEmitter","NativeRNAppZungCodePushModule","CodePushEventEmitter"],"sourceRoot":"../../../src","sources":["internals/CodePushEventEmitter.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,cAAc;AACjD,SAASC,6BAA6B,QAAQ,oCAAiC;AAE/E,OAAO,MAAMC,oBAAoB,GAAG,IAAIF,kBAAkB,CAACC,6BAA6B,CAAC","ignoreList":[]}