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

Commit 8958b96

Browse files
author
dbeard
committed
Make isFailedHash and isPendingUpdate class methods
1 parent 050e433 commit 8958b96

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

ios/CodePush/CodePush.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@
5252
* This method checks to see whether a specific package hash
5353
* has previously failed installation.
5454
*/
55-
- (BOOL)isFailedHash:(NSString*)packageHash;
55+
+ (BOOL)isFailedHash:(NSString*)packageHash;
5656

5757
/*
5858
* This method checks to see whether a specific package hash
5959
* represents a downloaded and installed update, that hasn't
6060
* been applied yet via an app restart.
6161
*/
62-
- (BOOL)isPendingUpdate:(NSString*)packageHash;
62+
+ (BOOL)isPendingUpdate:(NSString*)packageHash;
6363

6464
// The below methods are only used during tests.
6565
+ (BOOL)isUsingTestConfiguration;

ios/CodePush/CodePush.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ - (void)initializeUpdateAfterRestart
378378
* This method checks to see whether a specific package hash
379379
* has previously failed installation.
380380
*/
381-
- (BOOL)isFailedHash:(NSString*)packageHash
381+
+ (BOOL)isFailedHash:(NSString*)packageHash
382382
{
383383
NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults];
384384
NSMutableArray *failedUpdates = [preferences objectForKey:FailedUpdatesKey];
@@ -408,7 +408,7 @@ - (BOOL)isFailedHash:(NSString*)packageHash
408408
* represents a downloaded and installed update, that hasn't
409409
* been applied yet via an app restart.
410410
*/
411-
- (BOOL)isPendingUpdate:(NSString*)packageHash
411+
+ (BOOL)isPendingUpdate:(NSString*)packageHash
412412
{
413413
NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults];
414414
NSDictionary *pendingUpdate = [preferences objectForKey:PendingUpdateKey];
@@ -676,7 +676,7 @@ - (void)applicationWillResignActive
676676
}
677677

678678
// We have a CodePush update, so let's see if it's currently in a pending state.
679-
BOOL currentUpdateIsPending = [self isPendingUpdate:[package objectForKey:PackageHashKey]];
679+
BOOL currentUpdateIsPending = [[self class] isPendingUpdate:[package objectForKey:PackageHashKey]];
680680

681681
if (updateState == CodePushUpdateStatePending && !currentUpdateIsPending) {
682682
// The caller wanted a pending update
@@ -715,7 +715,7 @@ - (void)applicationWillResignActive
715715
{
716716
NSError *error;
717717
[CodePushPackage installPackage:updatePackage
718-
removePendingUpdate:[self isPendingUpdate:nil]
718+
removePendingUpdate:[[self class] isPendingUpdate:nil]
719719
error:&error];
720720

721721
if (error) {
@@ -758,7 +758,7 @@ - (void)applicationWillResignActive
758758
resolve:(RCTPromiseResolveBlock)resolve
759759
reject:(RCTPromiseRejectBlock)reject)
760760
{
761-
BOOL isFailedHash = [self isFailedHash:packageHash];
761+
BOOL isFailedHash = [[self class] isFailedHash:packageHash];
762762
resolve(@(isFailedHash));
763763
}
764764

@@ -798,7 +798,7 @@ - (void)applicationWillResignActive
798798
{
799799
// If this is an unconditional restart request, or there
800800
// is current pending update, then reload the app.
801-
if (!onlyIfUpdateIsPending || [self isPendingUpdate:nil]) {
801+
if (!onlyIfUpdateIsPending || [[self class] isPendingUpdate:nil]) {
802802
[self loadBundle];
803803
resolve(@(YES));
804804
return;

0 commit comments

Comments
 (0)