Skip to content

Commit 0ec3580

Browse files
committed
Merge pull request #225 from Microsoft/remove-semver-use
Remove semver use
2 parents 3b0d459 + 89d0ffa commit 0ec3580

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed

CodePush.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { AcquisitionManager as Sdk } from "code-push/script/acquisition-sdk";
22
import { Alert } from "./AlertAdapter";
33
import requestFetchAdapter from "./request-fetch-adapter";
4-
import semver from "semver";
54
import { Platform } from "react-native";
65

76
let NativeCodePush = require("react-native").NativeModules.CodePush;
@@ -41,7 +40,7 @@ async function checkForUpdate(deploymentKey = null) {
4140
* in any updates for current app store version, regardless of hash.
4241
*/
4342
let queryPackage;
44-
if (localPackage && localPackage.appVersion && semver.compare(localPackage.appVersion, config.appVersion) === 0) {
43+
if (localPackage) {
4544
queryPackage = localPackage;
4645
} else {
4746
queryPackage = { appVersion: config.appVersion };

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ To let the CodePush runtime know which deployment it should query for updates ag
193193

194194
![Deployment list](https://cloud.githubusercontent.com/assets/116461/11601733/13011d5e-9a8a-11e5-9ce2-b100498ffb34.png)
195195

196-
2. In your app's `Info.plist` make sure your `Bundle versions string, short` (aka `CFBundleShortVersionString`) value is a valid [semver](http://semver.org/) version (e.g. 1.0.0 not 1.0)
196+
2. In your app's `Info.plist` make sure your `Bundle versions string, short` (aka `CFBundleShortVersionString`) value is a valid [semver](http://semver.org/) version. Note that if the value provided is missing a patch version, the CodePush server will assume it is `0`, i.e. `1.0` will be treated as `1.0.0`.
197197
198198
![Bundle version](https://cloud.githubusercontent.com/assets/116461/12307416/f9b82688-b9f3-11e5-839a-f1c6b4acd093.png)
199199
@@ -269,7 +269,7 @@ After installing the plugin and syncing your Android Studio project with Gradle,
269269
}
270270
```
271271

272-
2. Ensure that the `android.defaultConfig.versionName` property in your `android/app/build.gradle` file is set to a semver compliant value (i.e. "1.0.0" not "1.0")
272+
2. Ensure that the `android.defaultConfig.versionName` property in your `android/app/build.gradle` file is set to a semver compliant value. Note that if the value provided is missing a patch version, the CodePush server will assume it is `0`, i.e. `1.0` will be treated as `1.0.0`.
273273

274274
```gradle
275275
android {
@@ -325,7 +325,7 @@ After installing the plugin and syncing your Android Studio project with Gradle,
325325
}
326326
```
327327

328-
2. Ensure that the `android.defaultConfig.versionName` property in your `android/app/build.gradle` file is set to a semver compliant value (i.e. "1.0.0" not "1.0")
328+
2. Ensure that the `android.defaultConfig.versionName` property in your `android/app/build.gradle` file is set to a semver compliant value. Note that if the value provided is missing a patch version, the CodePush server will assume it is `0`, i.e. `1.0` will be treated as `1.0.0`.
329329

330330
```gradle
331331
android {

android/app/src/main/java/com/microsoft/codepush/react/CodePush.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public String getBundleUrl(String assetsBundleFileName) {
162162
} else {
163163
// The binary version is newer.
164164
didUpdate = false;
165-
if (!this.isDebugMode) {
165+
if (!this.isDebugMode || !this.appVersion.equals(packageAppVersion)) {
166166
this.clearUpdates();
167167
}
168168

ios/CodePush/CodePush.m

+6-1
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,15 @@ + (NSURL *)bundleURLForResource:(NSString *)resourceName
103103
isRunningBinaryVersion = NO;
104104
return packageUrl;
105105
} else {
106+
BOOL isRelease = NO;
106107
#ifndef DEBUG
107-
[CodePush clearUpdates];
108+
isRelease = YES;
108109
#endif
109110

111+
if (isRelease || ![binaryAppVersion isEqualToString:packageAppVersion]) {
112+
[CodePush clearUpdates];
113+
}
114+
110115
NSLog(logMessageFormat, binaryBundleURL);
111116
isRunningBinaryVersion = YES;
112117
return binaryBundleURL;

package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@
1616
"url": "https://github.com/Microsoft/react-native-code-push"
1717
},
1818
"dependencies": {
19-
"code-push": "1.5.2-beta",
20-
"semver": "^5.1.0"
19+
"code-push": "1.5.2-beta"
2120
},
2221
"devDependencies": {
2322
"react-native": "0.19.0"
2423
}
25-
}
24+
}

0 commit comments

Comments
 (0)