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

Commit 153f6bf

Browse files
committed
conforming to coding guidelines 2
1 parent 2984125 commit 153f6bf

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

Examples/HybridMobileDeployCompanion/index.ios.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ var HybridMobileDeployCompanion = React.createClass({
2222
this.fetchData();
2323
},
2424
fetchData: function() {
25-
HybridMobileDeploy.queryUpdate((err, update) => {
26-
this.setState({ update: update, updateString: JSON.stringify(update) });
27-
});
25+
HybridMobileDeploy.queryUpdate((err, update) => {
26+
this.setState({ update: update, updateString: JSON.stringify(update) });
27+
});
2828
},
2929
getInitialState: function() {
3030
return { update: false, updateString: "" };

HybridMobileDeploy.ios.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,26 @@ function queryUpdate(callback) {
4545
getSdk(function(err, sdk) {
4646
if (err) callback(err);
4747
NativeHybridMobileDeploy.getLocalPackage(function(err, localPackage) {
48+
var defaultPackage = {appVersion: configuration.appVersion};
4849
if (err) {
4950
console.log(err);
50-
var pkg = {appVersion: configuration.appVersion};
51-
sdk.queryUpdateWithCurrentPackage(pkg, callback);
51+
sdk.queryUpdateWithCurrentPackage(defaultPackage, callback);
5252
} else if (localPackage == null) {
53-
var pkg = {appVersion: configuration.appVersion};
54-
sdk.queryUpdateWithCurrentPackage(pkg, callback);
53+
sdk.queryUpdateWithCurrentPackage(defaultPackage, callback);
5554
} else {
56-
sdk.queryUpdateWithCurrentPackage(localPackage, callback);
55+
if (localPackage.appVersion !== configuration.appVersion) {
56+
sdk.queryUpdateWithCurrentPackage(defaultPackage, callback)
57+
} else {
58+
sdk.queryUpdateWithCurrentPackage(localPackage, callback);
59+
}
5760
}
5861
});
5962
});
6063
});
6164
}
6265

6366
function installUpdate(update) {
64-
// use the downloaded package info. native code will save the package info
67+
// Use the downloaded package info. Native code will save the package info
6568
// so that the client knows what the current package version is.
6669
NativeHybridMobileDeploy.installUpdate(update, JSON.stringify(update), (err) => console.log(err));
6770
}

HybridMobileDeploy.m

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ + (void) loadBundle:(NSString*)rootComponent
8787
NSString *updateContents = [[NSString alloc] initWithContentsOfURL:url
8888
encoding:NSUTF8StringEncoding
8989
error:&err];
90-
9190
if (err) {
9291
// TODO send download url
9392
callback(@[RCTMakeError(@"Error downloading url", err, [[NSDictionary alloc] initWithObjectsAndKeys:[url absoluteString],@"updateUrl", nil])]);
@@ -139,7 +138,6 @@ + (void) loadBundle:(NSString*)rootComponent
139138
dispatch_async(dispatch_get_main_queue(), ^{
140139

141140
NSError* readError;
142-
143141
NSString *content = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&readError];
144142
if (readError) {
145143
callback(@[RCTMakeError(@"Error finding local package ", readError, [[NSDictionary alloc] initWithObjectsAndKeys:path,@"packagePath", nil]), [NSNull null]]);
@@ -155,7 +153,6 @@ + (void) loadBundle:(NSString*)rootComponent
155153
callback(@[[NSNull null], json]);
156154
}
157155
}
158-
159156
});
160157

161158
}

0 commit comments

Comments
 (0)