Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b5caa38

Browse files
committedMay 11, 2019
Allow an arbitrary server URL #5
1 parent 90e2691 commit b5caa38

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed
 

‎README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,13 @@ CodePush.sync({
114114
If you have an iOS and Android app, and want some feedback during the sync, you can use this more elaborate version instead:
115115

116116
```typescript
117-
import { CodePush, SyncStatus } from "nativescript-code-push";
118-
import { isIOS } from "platform";
117+
import { CodePush, InstallMode, SyncStatus } from "nativescript-code-push";
118+
import { isIOS } from "tns-core-modules/platform";
119119

120120
CodePush.sync({
121-
deploymentKey: isIOS ? "your-ios-deployment-key" : "your-android-deployment-key"
121+
deploymentKey: isIOS ? "your-ios-deployment-key" : "your-android-deployment-key",
122+
installMode: InstallMode.ON_NEXT_RESTART, // this is the default, and at this moment the only option
123+
serverUrl: "https://your-backend.server" // by default this is our shared cloud hosted backend server
122124
}, (syncStatus: SyncStatus): void => {
123125
console.log("CodePush syncStatus: " + syncStatus);
124126
if (syncStatus === SyncStatus.UP_TO_DATE) {

‎demo/demoapp/main-view-model.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ export class HelloWorldModel extends Observable {
3535
CodePush.sync({
3636
deploymentKey: isIOS ? HelloWorldModel.CODEPUSH_IOS_STAGING_KEY : HelloWorldModel.CODEPUSH_ANDROID_STAGING_KEY,
3737
installMode: InstallMode.ON_NEXT_RESTART, // has not effect currently, always using ON_NEXT_RESTART
38-
mandatoryInstallMode: InstallMode.IMMEDIATE, // has not effect currently, always using ON_NEXT_RESTART
39-
// serverUrl: "https://www.nu.nl"
38+
mandatoryInstallMode: InstallMode.IMMEDIATE // has not effect currently, always using ON_NEXT_RESTART
4039
}, (syncStatus: SyncStatus): void => {
4140
console.log("syncStatus: " + syncStatus);
4241
if (syncStatus === SyncStatus.UP_TO_DATE) {

‎src/code-push.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ export class CodePush {
9999
}
100100
CodePush.syncInProgress = true;
101101

102+
// by default, use our Cloud server
103+
options.serverUrl = options.serverUrl || "https://nativescript-codepush-server.herokuapp.com/";
104+
102105
CodePush.cleanPackagesIfNeeded();
103106

104107
CodePush.notifyApplicationReady(options.deploymentKey, options.serverUrl);

0 commit comments

Comments
 (0)
Please sign in to comment.