Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 87e15c7

Browse files
committed
Re-organizing methods
1 parent ba24d9a commit 87e15c7

File tree

1 file changed

+30
-28
lines changed

1 file changed

+30
-28
lines changed

ios/CodePush/CodePush.m

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ - (void)applicationWillResignActive
438438
_lastResignedDate = [NSDate date];
439439
}
440440

441-
#pragma mark - JavaScript-exported module methods
441+
#pragma mark - JavaScript-exported module methods (Public)
442442

443443
/*
444444
* This is native-side of the RemotePackage.download method
@@ -485,7 +485,7 @@ - (void)applicationWillResignActive
485485
// The download failed
486486
failCallback:^(NSError *err) {
487487
dispatch_async(_methodQueue, ^{
488-
if ([CodePushPackage isCodePushError:err]) {
488+
if ([CodePushErrorUtils isCodePushError:err]) {
489489
[self saveFailedUpdate:mutableUpdatePackage];
490490
}
491491

@@ -648,6 +648,33 @@ - (void)applicationWillResignActive
648648
resolve(nil);
649649
}
650650

651+
/*
652+
* This method is the native side of the CodePush.restartApp() method.
653+
*/
654+
RCT_EXPORT_METHOD(restartApp:(BOOL)onlyIfUpdateIsPending)
655+
{
656+
// If this is an unconditional restart request, or there
657+
// is current pending update, then reload the app.
658+
if (!onlyIfUpdateIsPending || [self isPendingUpdate:nil]) {
659+
[self loadBundle];
660+
}
661+
}
662+
663+
#pragma mark - JavaScript-exported module methods (Private)
664+
665+
/*
666+
* This method is the native side of the CodePush.downloadAndReplaceCurrentBundle()
667+
* method, which replaces the current bundle with the one downloaded from
668+
* removeBundleUrl. It is only to be used during tests and no-ops if the test
669+
* configuration flag is not set.
670+
*/
671+
RCT_EXPORT_METHOD(downloadAndReplaceCurrentBundle:(NSString *)remoteBundleUrl)
672+
{
673+
if ([CodePush isUsingTestConfiguration]) {
674+
[CodePushPackage downloadAndReplaceCurrentBundle:remoteBundleUrl];
675+
}
676+
}
677+
651678
/*
652679
* This method is checks if a new status update exists (new version was installed,
653680
* or an update failed) and return its details (version label, status).
@@ -682,29 +709,4 @@ - (void)applicationWillResignActive
682709
resolve(nil);
683710
}
684711

685-
/*
686-
* This method is the native side of the CodePush.restartApp() method.
687-
*/
688-
RCT_EXPORT_METHOD(restartApp:(BOOL)onlyIfUpdateIsPending)
689-
{
690-
// If this is an unconditional restart request, or there
691-
// is current pending update, then reload the app.
692-
if (!onlyIfUpdateIsPending || [self isPendingUpdate:nil]) {
693-
[self loadBundle];
694-
}
695-
}
696-
697-
/*
698-
* This method is the native side of the CodePush.downloadAndReplaceCurrentBundle()
699-
* method, which replaces the current bundle with the one downloaded from
700-
* removeBundleUrl. It is only to be used during tests and no-ops if the test
701-
* configuration flag is not set.
702-
*/
703-
RCT_EXPORT_METHOD(downloadAndReplaceCurrentBundle:(NSString *)remoteBundleUrl)
704-
{
705-
if ([CodePush isUsingTestConfiguration]) {
706-
[CodePushPackage downloadAndReplaceCurrentBundle:remoteBundleUrl];
707-
}
708-
}
709-
710-
@end
712+
@end

0 commit comments

Comments
 (0)