@@ -34,64 +34,64 @@ @implementation CodePush {
34
34
35
35
// These keys are used to inspect/augment the metadata
36
36
// that is associated with an update's package.
37
+ static NSString *const BinaryBundleDateKey = @" binaryDate" ;
37
38
static NSString *const PackageHashKey = @" packageHash" ;
38
39
static NSString *const PackageIsPendingKey = @" isPending" ;
39
- static NSString *const BinaryBundleDateKey = @" binaryDate" ;
40
40
41
41
// These values are used to save the bundleURL and extension for the JS bundle
42
42
// in the binary.
43
- static NSString *binaryJsName = @" main" ;
44
- static NSString *binaryJsExtension = @" jsbundle" ;
43
+ static NSString *bundleResourceName = @" main" ;
44
+ static NSString *bundleResourceExtension = @" jsbundle" ;
45
45
46
46
47
47
#pragma mark - Public Obj-C API
48
48
49
- + (NSURL *)binaryJsBundleUrl
49
+ + (NSURL *)binaryBundleURL
50
50
{
51
- return [[NSBundle mainBundle ] URLForResource: binaryJsName withExtension: binaryJsExtension ];
51
+ return [[NSBundle mainBundle ] URLForResource: bundleResourceName withExtension: bundleResourceExtension ];
52
52
}
53
53
54
54
+ (NSURL *)bundleURL
55
55
{
56
- return [self bundleURLForResource: binaryJsName ];
56
+ return [self bundleURLForResource: bundleResourceName ];
57
57
}
58
58
59
59
+ (NSURL *)bundleURLForResource : (NSString *)resourceName
60
60
{
61
- binaryJsName = resourceName;
61
+ bundleResourceName = resourceName;
62
62
return [self bundleURLForResource: resourceName
63
- withExtension: binaryJsExtension ];
63
+ withExtension: bundleResourceExtension ];
64
64
}
65
65
66
66
+ (NSURL *)bundleURLForResource : (NSString *)resourceName
67
67
withExtension : (NSString *)resourceExtension
68
68
{
69
- binaryJsName = resourceName;
70
- binaryJsExtension = resourceExtension;
69
+ bundleResourceName = resourceName;
70
+ bundleResourceExtension = resourceExtension;
71
71
NSError *error;
72
72
NSString *packageFile = [CodePushPackage getCurrentPackageBundlePath: &error];
73
- NSURL *binaryJsBundleUrl = [self binaryJsBundleUrl ];
73
+ NSURL *binaryBundleURL = [self binaryBundleURL ];
74
74
75
75
NSString *logMessageFormat = @" Loading JS bundle from %@ " ;
76
76
77
77
if (error || !packageFile) {
78
- NSLog (logMessageFormat, binaryJsBundleUrl );
78
+ NSLog (logMessageFormat, binaryBundleURL );
79
79
isRunningBinaryVersion = YES ;
80
- return binaryJsBundleUrl ;
80
+ return binaryBundleURL ;
81
81
}
82
82
83
83
NSString *binaryAppVersion = [[CodePushConfig current ] appVersion ];
84
84
NSDictionary *currentPackageMetadata = [CodePushPackage getCurrentPackage: &error];
85
85
if (error || !currentPackageMetadata) {
86
- NSLog (logMessageFormat, binaryJsBundleUrl );
86
+ NSLog (logMessageFormat, binaryBundleURL );
87
87
isRunningBinaryVersion = YES ;
88
- return binaryJsBundleUrl ;
88
+ return binaryBundleURL ;
89
89
}
90
90
91
91
NSString *packageDate = [currentPackageMetadata objectForKey: BinaryBundleDateKey];
92
92
NSString *packageAppVersion = [currentPackageMetadata objectForKey: @" appVersion" ];
93
93
94
- if ([[self modifiedDateStringFromFileUrl: binaryJsBundleUrl ] isEqualToString: packageDate] && ([CodePush isUsingTestConfiguration ] ||[binaryAppVersion isEqualToString: packageAppVersion])) {
94
+ if ([[self modifiedDateStringFromFileUrl: binaryBundleURL ] isEqualToString: packageDate] && ([CodePush isUsingTestConfiguration ] ||[binaryAppVersion isEqualToString: packageAppVersion])) {
95
95
// Return package file because it is newer than the app store binary's JS bundle
96
96
NSURL *packageUrl = [[NSURL alloc ] initFileURLWithPath: packageFile];
97
97
NSLog (logMessageFormat, packageUrl);
@@ -102,9 +102,9 @@ + (NSURL *)bundleURLForResource:(NSString *)resourceName
102
102
[CodePush clearUpdates ];
103
103
#endif
104
104
105
- NSLog (logMessageFormat, binaryJsBundleUrl );
105
+ NSLog (logMessageFormat, binaryBundleURL );
106
106
isRunningBinaryVersion = YES ;
107
- return binaryJsBundleUrl ;
107
+ return binaryBundleURL ;
108
108
}
109
109
}
110
110
@@ -394,9 +394,9 @@ - (void)savePendingUpdate:(NSString *)packageHash
394
394
{
395
395
dispatch_async (dispatch_get_main_queue (), ^{
396
396
NSDictionary *mutableUpdatePackage = [updatePackage mutableCopy ];
397
- NSURL *binaryJsBundleUrl = [CodePush binaryJsBundleUrl ];
398
- if (binaryJsBundleUrl != nil ) {
399
- [mutableUpdatePackage setValue: [CodePush modifiedDateStringFromFileUrl: binaryJsBundleUrl ]
397
+ NSURL *binaryBundleURL = [CodePush binaryBundleURL ];
398
+ if (binaryBundleURL != nil ) {
399
+ [mutableUpdatePackage setValue: [CodePush modifiedDateStringFromFileUrl: binaryBundleURL ]
400
400
forKey: BinaryBundleDateKey];
401
401
}
402
402
0 commit comments