mirror of
https://github.com/zhigang1992/react-native-code-push.git
synced 2026-05-14 02:14:52 +08:00
@@ -1,17 +1,15 @@
|
||||
"use strict";
|
||||
|
||||
import React from "react-native";
|
||||
|
||||
let {
|
||||
import React, {
|
||||
AppRegistry,
|
||||
ScrollView,
|
||||
StyleSheet,
|
||||
Text,
|
||||
TouchableOpacity,
|
||||
View,
|
||||
} = React;
|
||||
} from "react-native";
|
||||
|
||||
let TESTS = [
|
||||
const TESTS = [
|
||||
require("./testcases/FirstUpdateTest"),
|
||||
require("./testcases/NewUpdateTest"),
|
||||
require("./testcases/NoRemotePackageTest"),
|
||||
@@ -38,6 +36,7 @@ let CheckForUpdateTestApp = React.createClass({
|
||||
</ScrollView>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<Text style={styles.row}>
|
||||
@@ -64,7 +63,7 @@ let CheckForUpdateTestApp = React.createClass({
|
||||
}
|
||||
});
|
||||
|
||||
let styles = StyleSheet.create({
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
backgroundColor: "white",
|
||||
marginTop: 40,
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
import React from "react-native";
|
||||
import CodePush from "react-native-code-push";
|
||||
let NativeCodePush = React.NativeModules.CodePush;
|
||||
import createTestCaseComponent from "../../utils/createTestCaseComponent";
|
||||
let PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
||||
import assert from "assert";
|
||||
import createMockAcquisitionSdk from "../../utils/mockAcquisitionSdk";
|
||||
|
||||
import { serverPackage } from "../resources/testPackages";
|
||||
|
||||
const NativeCodePush = React.NativeModules.CodePush;
|
||||
const PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
||||
const localPackage = {};
|
||||
|
||||
let FirstUpdateTest = createTestCaseComponent(
|
||||
@@ -18,20 +18,13 @@ let FirstUpdateTest = createTestCaseComponent(
|
||||
let mockAcquisitionSdk = createMockAcquisitionSdk(serverPackage, localPackage);
|
||||
let mockConfiguration = { appVersion : "1.5.0" };
|
||||
CodePush.setUpTestDependencies(mockAcquisitionSdk, mockConfiguration, NativeCodePush);
|
||||
CodePush.getCurrentPackage = () => {
|
||||
return Promise.resolve(localPackage);
|
||||
}
|
||||
return Promise.resolve();
|
||||
CodePush.getCurrentPackage = async () => {
|
||||
return localPackage;
|
||||
};
|
||||
},
|
||||
() => {
|
||||
return CodePush.checkForUpdate()
|
||||
.then((update) => {
|
||||
if (update) {
|
||||
assert.deepEqual(update, Object.assign(serverPackage, PackageMixins.remote));
|
||||
} else {
|
||||
throw new Error("checkForUpdate did not return the update from the server");
|
||||
}
|
||||
});
|
||||
async () => {
|
||||
let update = await CodePush.checkForUpdate();
|
||||
assert.equal(JSON.stringify(update), JSON.stringify({ ...serverPackage, ...PackageMixins.remote, failedInstall: false }), "checkForUpdate did not return the update from the server");
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
|
||||
import React from "react-native";
|
||||
import CodePush from "react-native-code-push";
|
||||
let NativeCodePush = React.NativeModules.CodePush;
|
||||
import createTestCaseComponent from "../../utils/createTestCaseComponent";
|
||||
let PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
||||
import assert from "assert";
|
||||
import createMockAcquisitionSdk from "../../utils/mockAcquisitionSdk";
|
||||
|
||||
import { serverPackage, localPackage } from "../resources/testPackages";
|
||||
|
||||
const NativeCodePush = React.NativeModules.CodePush;
|
||||
const PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
||||
|
||||
let NewUpdateTest = createTestCaseComponent(
|
||||
"NewUpdateTest",
|
||||
"should return an update when server has a package that is newer than the current one",
|
||||
@@ -17,21 +17,14 @@ let NewUpdateTest = createTestCaseComponent(
|
||||
let mockAcquisitionSdk = createMockAcquisitionSdk(serverPackage, localPackage);
|
||||
let mockConfiguration = { appVersion : "1.5.0" };
|
||||
CodePush.setUpTestDependencies(mockAcquisitionSdk, mockConfiguration, NativeCodePush);
|
||||
CodePush.getCurrentPackage = () => {
|
||||
return Promise.resolve(localPackage);
|
||||
}
|
||||
return Promise.resolve();
|
||||
CodePush.getCurrentPackage = async () => {
|
||||
return localPackage;
|
||||
};
|
||||
},
|
||||
() => {
|
||||
return CodePush.checkForUpdate()
|
||||
.then((update) => {
|
||||
if (update) {
|
||||
assert.deepEqual(update, Object.assign(serverPackage, PackageMixins.remote));
|
||||
} else {
|
||||
throw new Error("checkForUpdate did not return the update from the server");
|
||||
}
|
||||
});
|
||||
async () => {
|
||||
let update = await CodePush.checkForUpdate();
|
||||
assert.equal(JSON.stringify(update), JSON.stringify({ ...serverPackage, ...PackageMixins.remote, failedInstall: false }), "checkForUpdate did not return the update from the server");
|
||||
}
|
||||
);
|
||||
|
||||
module.exports = NewUpdateTest;
|
||||
export default NewUpdateTest;
|
||||
@@ -2,14 +2,14 @@
|
||||
|
||||
import React from "react-native";
|
||||
import CodePush from "react-native-code-push";
|
||||
let NativeCodePush = React.NativeModules.CodePush;
|
||||
import createTestCaseComponent from "../../utils/createTestCaseComponent";
|
||||
let PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
||||
import assert from "assert";
|
||||
import createMockAcquisitionSdk from "../../utils/mockAcquisitionSdk";
|
||||
|
||||
let serverPackage = null;
|
||||
let localPackage = {};
|
||||
const NativeCodePush = React.NativeModules.CodePush;
|
||||
const PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
||||
const serverPackage = null;
|
||||
const localPackage = {};
|
||||
|
||||
let NoRemotePackageTest = createTestCaseComponent(
|
||||
"NoRemotePackageTest",
|
||||
@@ -18,19 +18,14 @@ let NoRemotePackageTest = createTestCaseComponent(
|
||||
let mockAcquisitionSdk = createMockAcquisitionSdk(serverPackage, localPackage);
|
||||
let mockConfiguration = { appVersion : "1.5.0" };
|
||||
CodePush.setUpTestDependencies(mockAcquisitionSdk, mockConfiguration, NativeCodePush);
|
||||
CodePush.getCurrentPackage = () => {
|
||||
return Promise.resolve(localPackage);
|
||||
}
|
||||
return Promise.resolve();
|
||||
CodePush.getCurrentPackage = async () => {
|
||||
return localPackage;
|
||||
};
|
||||
},
|
||||
() => {
|
||||
return CodePush.checkForUpdate()
|
||||
.then((update) => {
|
||||
if (update) {
|
||||
throw new Error("checkForUpdate should not return an update if there is none on the server");
|
||||
}
|
||||
});
|
||||
async () => {
|
||||
let update = await CodePush.checkForUpdate();
|
||||
assert(!update, "checkForUpdate should not return an update if there is none on the server");
|
||||
}
|
||||
);
|
||||
|
||||
module.exports = NoRemotePackageTest;
|
||||
export default NoRemotePackageTest;
|
||||
@@ -2,37 +2,30 @@
|
||||
|
||||
import React from "react-native";
|
||||
import CodePush from "react-native-code-push";
|
||||
let NativeCodePush = React.NativeModules.CodePush;
|
||||
import createTestCaseComponent from "../../utils/createTestCaseComponent";
|
||||
let PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
||||
import assert from "assert";
|
||||
import createMockAcquisitionSdk from "../../utils/mockAcquisitionSdk";
|
||||
|
||||
import { updateAppVersionPackage as serverPackage } from "../resources/testPackages";
|
||||
let localPackage = {};
|
||||
|
||||
const NativeCodePush = React.NativeModules.CodePush;
|
||||
const PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
||||
const localPackage = {};
|
||||
|
||||
let RemotePackageAppVersionNewerTest = createTestCaseComponent(
|
||||
"RemotePackageAppVersionNewerTest",
|
||||
"should drop the update when the server reports one with a newer binary version",
|
||||
() => {
|
||||
return new Promise((resolve, reject) => {
|
||||
let mockAcquisitionSdk = createMockAcquisitionSdk(serverPackage, localPackage);
|
||||
let mockConfiguration = { appVersion : "1.0.0" };
|
||||
CodePush.setUpTestDependencies(mockAcquisitionSdk, mockConfiguration, NativeCodePush);
|
||||
CodePush.getCurrentPackage = () => {
|
||||
return Promise.resolve(localPackage);
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
let mockAcquisitionSdk = createMockAcquisitionSdk(serverPackage, localPackage);
|
||||
let mockConfiguration = { appVersion : "1.0.0" };
|
||||
CodePush.setUpTestDependencies(mockAcquisitionSdk, mockConfiguration, NativeCodePush);
|
||||
CodePush.getCurrentPackage = async () => {
|
||||
return localPackage;
|
||||
};
|
||||
},
|
||||
() => {
|
||||
return CodePush.checkForUpdate()
|
||||
.then((update) => {
|
||||
if (update) {
|
||||
throw new Error("checkForUpdate should not return an update if remote package is of a different binary version");
|
||||
}
|
||||
});
|
||||
async () => {
|
||||
let update = await CodePush.checkForUpdate();
|
||||
assert(!update, "checkForUpdate should not return an update if remote package is of a different binary version");
|
||||
}
|
||||
);
|
||||
|
||||
module.exports = RemotePackageAppVersionNewerTest;
|
||||
export default RemotePackageAppVersionNewerTest;
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
import React from "react-native";
|
||||
import CodePush from "react-native-code-push";
|
||||
let NativeCodePush = React.NativeModules.CodePush;
|
||||
import createTestCaseComponent from "../../utils/createTestCaseComponent";
|
||||
let PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
||||
import assert from "assert";
|
||||
import createMockAcquisitionSdk from "../../utils/mockAcquisitionSdk";
|
||||
|
||||
import { serverPackage } from "../resources/testPackages";
|
||||
|
||||
const NativeCodePush = React.NativeModules.CodePush;
|
||||
const PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
||||
const localPackage = serverPackage;
|
||||
|
||||
let SamePackageTest = createTestCaseComponent(
|
||||
@@ -18,19 +18,14 @@ let SamePackageTest = createTestCaseComponent(
|
||||
let mockAcquisitionSdk = createMockAcquisitionSdk(serverPackage, localPackage);
|
||||
let mockConfiguration = { appVersion : "1.5.0" };
|
||||
CodePush.setUpTestDependencies(mockAcquisitionSdk, mockConfiguration, NativeCodePush);
|
||||
CodePush.getCurrentPackage = () => {
|
||||
return Promise.resolve(localPackage);
|
||||
}
|
||||
return Promise.resolve();
|
||||
CodePush.getCurrentPackage = async () => {
|
||||
return localPackage;
|
||||
};
|
||||
},
|
||||
() => {
|
||||
return CodePush.checkForUpdate()
|
||||
.then((update) => {
|
||||
if (update) {
|
||||
throw new Error("checkForUpdate should not return a package when local package is identical");
|
||||
}
|
||||
});
|
||||
async () => {
|
||||
let update = await CodePush.checkForUpdate();
|
||||
assert(!update, "checkForUpdate should not return a package when local package is identical");
|
||||
}
|
||||
);
|
||||
|
||||
module.exports = SamePackageTest;
|
||||
export default SamePackageTest;
|
||||
@@ -2,16 +2,15 @@
|
||||
|
||||
import React from "react-native";
|
||||
import CodePush from "react-native-code-push";
|
||||
let NativeCodePush = React.NativeModules.CodePush;
|
||||
import createTestCaseComponent from "../../utils/createTestCaseComponent";
|
||||
let PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
||||
import assert from "assert";
|
||||
import createMockAcquisitionSdk from "../../utils/mockAcquisitionSdk";
|
||||
|
||||
import { serverPackage } from "../resources/testPackages";
|
||||
const localPackage = {};
|
||||
|
||||
let deploymentKey = "myKey123";
|
||||
const NativeCodePush = React.NativeModules.CodePush;
|
||||
const PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
||||
const localPackage = {};
|
||||
const deploymentKey = "myKey123";
|
||||
|
||||
let SwitchDeploymentKeyTest = createTestCaseComponent(
|
||||
"SwitchDeploymentKeyTest",
|
||||
@@ -20,21 +19,14 @@ let SwitchDeploymentKeyTest = createTestCaseComponent(
|
||||
let mockAcquisitionSdk = createMockAcquisitionSdk(serverPackage, localPackage, deploymentKey);
|
||||
let mockConfiguration = { appVersion : "1.5.0" };
|
||||
CodePush.setUpTestDependencies(mockAcquisitionSdk, mockConfiguration, NativeCodePush);
|
||||
CodePush.getCurrentPackage = () => {
|
||||
return Promise.resolve(localPackage);
|
||||
}
|
||||
return Promise.resolve();
|
||||
CodePush.getCurrentPackage = async () => {
|
||||
return localPackage;
|
||||
};
|
||||
},
|
||||
() => {
|
||||
return CodePush.checkForUpdate(deploymentKey)
|
||||
.then((update) => {
|
||||
if (update) {
|
||||
assert.deepEqual(update, Object.assign(serverPackage, PackageMixins.remote));
|
||||
} else {
|
||||
throw new Error("checkForUpdate did not return the update from the server");
|
||||
}
|
||||
});
|
||||
async () => {
|
||||
let update = await CodePush.checkForUpdate(deploymentKey);
|
||||
assert.equal(JSON.stringify(update), JSON.stringify({ ...serverPackage, ...PackageMixins.remote, failedInstall: false }), "checkForUpdate did not return the update from the server");
|
||||
}
|
||||
);
|
||||
|
||||
module.exports = SwitchDeploymentKeyTest;
|
||||
export default SwitchDeploymentKeyTest;
|
||||
@@ -1,15 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
import React from "react-native";
|
||||
|
||||
let {
|
||||
import React, {
|
||||
AppRegistry,
|
||||
ScrollView,
|
||||
StyleSheet,
|
||||
Text,
|
||||
TouchableOpacity,
|
||||
View,
|
||||
} = React;
|
||||
} from "react-native";
|
||||
|
||||
let TESTS = [
|
||||
require("./testcases/DownloadProgressTest")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
let { Platform } = require("react-native");
|
||||
import { Platform } from "react-native";
|
||||
|
||||
let packages = [
|
||||
const packages = [
|
||||
{
|
||||
downloadUrl: "smallFile",
|
||||
description: "Angry flappy birds",
|
||||
|
||||
@@ -2,13 +2,14 @@
|
||||
|
||||
import React from "react-native";
|
||||
import CodePush from "react-native-code-push";
|
||||
let NativeCodePush = React.NativeModules.CodePush;
|
||||
import createTestCaseComponent from "../../utils/createTestCaseComponent";
|
||||
let PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
||||
import assert from "assert";
|
||||
|
||||
import testPackages from "../resources/TestPackages";
|
||||
let localPackage = {};
|
||||
|
||||
const NativeCodePush = React.NativeModules.CodePush;
|
||||
const PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
||||
const localPackage = {};
|
||||
|
||||
let saveProgress;
|
||||
|
||||
function checkReceivedAndExpectedBytesEqual() {
|
||||
@@ -49,4 +50,4 @@ let DownloadProgressTest = createTestCaseComponent(
|
||||
}
|
||||
);
|
||||
|
||||
module.exports = DownloadProgressTest;
|
||||
export default DownloadProgressTest;
|
||||
@@ -1,27 +1,23 @@
|
||||
"use strict";
|
||||
|
||||
import React from "react-native";
|
||||
import CodePush from "react-native-code-push";
|
||||
|
||||
let {
|
||||
import React, {
|
||||
AppRegistry,
|
||||
Text,
|
||||
View,
|
||||
} = React;
|
||||
} from "react-native";
|
||||
import CodePush from "react-native-code-push";
|
||||
|
||||
let IsFirstRunTest = React.createClass({
|
||||
getInitialState() {
|
||||
return {};
|
||||
},
|
||||
componentDidMount() {
|
||||
CodePush.getCurrentPackage()
|
||||
.then((localPackage) => {
|
||||
if (localPackage.isFirstRun) {
|
||||
this.setState({ passed: true });
|
||||
} else {
|
||||
this.setState({ passed: false });
|
||||
}
|
||||
});
|
||||
async componentDidMount() {
|
||||
let localPackage = await CodePush.getCurrentPackage();
|
||||
if (localPackage.isFirstRun) {
|
||||
this.setState({ passed: true });
|
||||
} else {
|
||||
this.setState({ passed: false });
|
||||
}
|
||||
},
|
||||
render() {
|
||||
let text = "Testing...";
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
"use strict";
|
||||
|
||||
import React from "react-native";
|
||||
import CodePush from "react-native-code-push";
|
||||
let NativeCodePush = React.NativeModules.CodePush;
|
||||
let PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
||||
import createMockAcquisitionSdk from "../../utils/mockAcquisitionSdk";
|
||||
|
||||
let {
|
||||
import React, {
|
||||
AppRegistry,
|
||||
Platform,
|
||||
Text,
|
||||
View,
|
||||
} = React;
|
||||
} from "react-native";
|
||||
import CodePush from "react-native-code-push";
|
||||
import createMockAcquisitionSdk from "../../utils/mockAcquisitionSdk";
|
||||
|
||||
const NativeCodePush = React.NativeModules.CodePush;
|
||||
const PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
||||
|
||||
let IsFailedUpdateTest = React.createClass({
|
||||
getInitialState() {
|
||||
return {};
|
||||
},
|
||||
componentDidMount() {
|
||||
async componentDidMount() {
|
||||
let serverPackage = {
|
||||
description: "Angry flappy birds",
|
||||
appVersion: "1.5.0",
|
||||
@@ -39,20 +38,14 @@ let IsFailedUpdateTest = React.createClass({
|
||||
let mockConfiguration = { appVersion : "1.5.0" };
|
||||
CodePush.setUpTestDependencies(mockAcquisitionSdk, mockConfiguration, NativeCodePush);
|
||||
|
||||
CodePush.notifyApplicationReady()
|
||||
.then(() => {
|
||||
return CodePush.checkForUpdate();
|
||||
})
|
||||
.then((remotePackage) => {
|
||||
if (remotePackage.failedInstall) {
|
||||
this.setState({ passed: true });
|
||||
} else {
|
||||
return remotePackage.download();
|
||||
}
|
||||
})
|
||||
.then((localPackage) => {
|
||||
return localPackage && localPackage.install(NativeCodePush.codePushInstallModeImmediate);
|
||||
});
|
||||
await CodePush.notifyApplicationReady()
|
||||
let remotePackage = await CodePush.checkForUpdate();
|
||||
if (remotePackage.failedInstall) {
|
||||
this.setState({ passed: true });
|
||||
} else {
|
||||
let localPackage = await remotePackage.download();
|
||||
return localPackage && await localPackage.install(NativeCodePush.codePushInstallModeImmediate);
|
||||
}
|
||||
},
|
||||
render() {
|
||||
let text = "Testing...";
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
"use strict";
|
||||
|
||||
import React from "react-native";
|
||||
import CodePush from "react-native-code-push";
|
||||
|
||||
let {
|
||||
import React, {
|
||||
AppRegistry,
|
||||
Text,
|
||||
View,
|
||||
} = React;
|
||||
} from "react-native";
|
||||
import CodePush from "react-native-code-push";
|
||||
|
||||
let IsFailedUpdateTest = React.createClass({
|
||||
componentDidMount() {
|
||||
// Should trigger a rollback.
|
||||
CodePush.restartApp();
|
||||
},
|
||||
render() {
|
||||
|
||||
@@ -3,25 +3,23 @@
|
||||
import React from "react-native";
|
||||
import { Platform, AppRegistry, Text, View } from "react-native";
|
||||
import CodePush from "react-native-code-push";
|
||||
let NativeCodePush = React.NativeModules.CodePush;
|
||||
let RCTTestModule = React.NativeModules.TestModule;
|
||||
|
||||
const NativeCodePush = React.NativeModules.CodePush;
|
||||
const RCTTestModule = React.NativeModules.TestModule;
|
||||
|
||||
let NotifyApplicationReadyTest = React.createClass({
|
||||
getInitialState() {
|
||||
return {};
|
||||
},
|
||||
componentDidMount() {
|
||||
CodePush.notifyApplicationReady()
|
||||
.then(() => {
|
||||
if (Platform.OS === "android") {
|
||||
return NativeCodePush.downloadAndReplaceCurrentBundle("http://10.0.3.2:8081/CodePushDemoAppTests/InstallUpdateTests/resources/PassNotifyApplicationReadyTest.includeRequire.runModule.bundle?platform=android&dev=true");
|
||||
} else if (Platform.OS === "ios") {
|
||||
return NativeCodePush.downloadAndReplaceCurrentBundle("http://localhost:8081/CodePushDemoAppTests/InstallUpdateTests/resources/PassNotifyApplicationReadyTest.includeRequire.runModule.bundle?platform=ios&dev=true");
|
||||
}
|
||||
})
|
||||
.then(() => {
|
||||
CodePush.restartApp();
|
||||
});
|
||||
async componentDidMount() {
|
||||
await CodePush.notifyApplicationReady();
|
||||
if (Platform.OS === "android") {
|
||||
await NativeCodePush.downloadAndReplaceCurrentBundle("http://10.0.3.2:8081/CodePushDemoAppTests/InstallUpdateTests/resources/PassNotifyApplicationReadyTest.includeRequire.runModule.bundle?platform=android&dev=true");
|
||||
} else if (Platform.OS === "ios") {
|
||||
await NativeCodePush.downloadAndReplaceCurrentBundle("http://localhost:8081/CodePushDemoAppTests/InstallUpdateTests/resources/PassNotifyApplicationReadyTest.includeRequire.runModule.bundle?platform=ios&dev=true");
|
||||
}
|
||||
|
||||
CodePush.restartApp();
|
||||
},
|
||||
render() {
|
||||
return (
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
import React from "react-native";
|
||||
|
||||
let {
|
||||
import React, {
|
||||
AppRegistry,
|
||||
Text,
|
||||
View,
|
||||
} = React;
|
||||
} from "react-native";
|
||||
|
||||
let InstallModeImmediateTest = React.createClass({
|
||||
render() {
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
import React from "react-native";
|
||||
|
||||
let {
|
||||
import React, {
|
||||
AppRegistry,
|
||||
Text,
|
||||
View,
|
||||
} = React;
|
||||
} from "react-native";
|
||||
|
||||
let InstallModeOnNextRestartTest = React.createClass({
|
||||
render() {
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
import React from "react-native";
|
||||
|
||||
let {
|
||||
import React, {
|
||||
AppRegistry,
|
||||
Text,
|
||||
View,
|
||||
} = React;
|
||||
} from "react-native";
|
||||
|
||||
let InstallModeOnNextResumeTest = React.createClass({
|
||||
render() {
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
import React from "react-native";
|
||||
|
||||
let {
|
||||
import React, {
|
||||
AppRegistry,
|
||||
Text,
|
||||
View,
|
||||
} = React;
|
||||
} from "react-native";
|
||||
|
||||
let NotifyApplicationReadyTest = React.createClass({
|
||||
render() {
|
||||
|
||||
@@ -1,51 +1,36 @@
|
||||
"use strict";
|
||||
|
||||
import React from "react-native";
|
||||
import CodePush from "react-native-code-push";
|
||||
let RCTTestModule = React.NativeModules.TestModule;
|
||||
let NativeCodePush = React.NativeModules.CodePush;
|
||||
let PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
||||
|
||||
let {
|
||||
import React, {
|
||||
AppRegistry,
|
||||
Platform,
|
||||
Text,
|
||||
View,
|
||||
} = React;
|
||||
} from "react-native";
|
||||
import CodePush from "react-native-code-push";
|
||||
|
||||
const RCTTestModule = React.NativeModules.TestModule;
|
||||
const NativeCodePush = React.NativeModules.CodePush;
|
||||
const PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
||||
|
||||
let RollbackTest = React.createClass({
|
||||
componentDidMount() {
|
||||
let remotePackage = {
|
||||
description: "Angry flappy birds",
|
||||
appVersion: "1.5.0",
|
||||
label: "2.4.0",
|
||||
isMandatory: false,
|
||||
isAvailable: true,
|
||||
updateAppVersion: false,
|
||||
packageHash: "hash241",
|
||||
packageSize: 1024
|
||||
};
|
||||
async componentDidMount() {
|
||||
let remotePackage = require("./remotePackage");
|
||||
remotePackage.packageHash = "hash241";
|
||||
|
||||
if (Platform.OS === "android") {
|
||||
remotePackage.downloadUrl = "http://10.0.3.2:8081/CodePushDemoAppTests/InstallUpdateTests/resources/RollbackTestBundleV2.includeRequire.runModule.bundle?platform=android&dev=true"
|
||||
CodePush.notifyApplicationReady()
|
||||
.then(() => {
|
||||
NativeCodePush.downloadAndReplaceCurrentBundle("http://10.0.3.2:8081/CodePushDemoAppTests/InstallUpdateTests/resources/RollbackTestBundleV1Pass.includeRequire.runModule.bundle?platform=android&dev=true");
|
||||
});
|
||||
await CodePush.notifyApplicationReady();
|
||||
await NativeCodePush.downloadAndReplaceCurrentBundle("http://10.0.3.2:8081/CodePushDemoAppTests/InstallUpdateTests/resources/RollbackTestBundleV1Pass.includeRequire.runModule.bundle?platform=android&dev=true");
|
||||
} else if (Platform.OS === "ios") {
|
||||
remotePackage.downloadUrl = "http://localhost:8081/CodePushDemoAppTests/InstallUpdateTests/resources/RollbackTestBundleV2.includeRequire.runModule.bundle?platform=ios&dev=true"
|
||||
CodePush.notifyApplicationReady()
|
||||
.then(() => {
|
||||
NativeCodePush.downloadAndReplaceCurrentBundle("http://localhost:8081/CodePushDemoAppTests/InstallUpdateTests/resources/RollbackTestBundleV1Pass.includeRequire.runModule.bundle?platform=ios&dev=true");
|
||||
});
|
||||
await CodePush.notifyApplicationReady()
|
||||
await NativeCodePush.downloadAndReplaceCurrentBundle("http://localhost:8081/CodePushDemoAppTests/InstallUpdateTests/resources/RollbackTestBundleV1Pass.includeRequire.runModule.bundle?platform=ios&dev=true");
|
||||
}
|
||||
|
||||
remotePackage = Object.assign(remotePackage, PackageMixins.remote);
|
||||
|
||||
remotePackage.download()
|
||||
.then((localPackage) => {
|
||||
return localPackage.install(NativeCodePush.codePushInstallModeImmediate);
|
||||
});
|
||||
let localPackage = await remotePackage.download();
|
||||
return await localPackage.install(NativeCodePush.codePushInstallModeImmediate);
|
||||
},
|
||||
render() {
|
||||
return (
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
import React from "react-native";
|
||||
|
||||
let {
|
||||
import React, {
|
||||
AppRegistry,
|
||||
Text,
|
||||
View,
|
||||
} = React;
|
||||
} from "react-native";
|
||||
|
||||
let RollbackTest = React.createClass({
|
||||
render() {
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
import React from "react-native";
|
||||
import CodePush from "react-native-code-push";
|
||||
|
||||
let {
|
||||
import React, {
|
||||
AppRegistry,
|
||||
Text,
|
||||
View,
|
||||
} = React;
|
||||
} from "react-native";
|
||||
import CodePush from "react-native-code-push";
|
||||
|
||||
let RollbackTest = React.createClass({
|
||||
componentDidMount() {
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
import React from "react-native";
|
||||
import { DeviceEventEmitter, Platform, AppRegistry } from "react-native";
|
||||
import CodePush from "react-native-code-push";
|
||||
let NativeCodePush = React.NativeModules.CodePush;
|
||||
import createTestCaseComponent from "../../utils/createTestCaseComponent";
|
||||
let PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
||||
import assert from "assert";
|
||||
|
||||
const NativeCodePush = React.NativeModules.CodePush;
|
||||
const PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
||||
|
||||
let remotePackage = require("../resources/remotePackage");
|
||||
|
||||
let InstallModeImmediateTest = createTestCaseComponent(
|
||||
@@ -21,13 +22,10 @@ let InstallModeImmediateTest = createTestCaseComponent(
|
||||
}
|
||||
|
||||
remotePackage = Object.assign(remotePackage, PackageMixins.remote);
|
||||
return Promise.resolve();
|
||||
},
|
||||
() => {
|
||||
remotePackage.download()
|
||||
.then((localPackage) => {
|
||||
return localPackage.install(NativeCodePush.codePushInstallModeImmediate);
|
||||
});
|
||||
async () => {
|
||||
let localPackage = await remotePackage.download();
|
||||
return await localPackage.install(NativeCodePush.codePushInstallModeImmediate);
|
||||
},
|
||||
/*passAfterRun*/ false
|
||||
);
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
import React from "react-native";
|
||||
import { DeviceEventEmitter, Platform, AppRegistry } from "react-native";
|
||||
import CodePush from "react-native-code-push";
|
||||
let NativeCodePush = React.NativeModules.CodePush;
|
||||
import createTestCaseComponent from "../../utils/createTestCaseComponent";
|
||||
let PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
||||
import assert from "assert";
|
||||
|
||||
const NativeCodePush = React.NativeModules.CodePush;
|
||||
const PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
||||
|
||||
let remotePackage = require("../resources/remotePackage");
|
||||
|
||||
let InstallModeOnNextRestartTest = createTestCaseComponent(
|
||||
@@ -22,16 +23,11 @@ let InstallModeOnNextRestartTest = createTestCaseComponent(
|
||||
}
|
||||
|
||||
remotePackage = Object.assign(remotePackage, PackageMixins.remote);
|
||||
return Promise.resolve();
|
||||
},
|
||||
() => {
|
||||
remotePackage.download()
|
||||
.then((localPackage) => {
|
||||
return localPackage.install(NativeCodePush.codePushInstallModeOnNextRestart);
|
||||
})
|
||||
.then(() => {
|
||||
CodePush.restartApp();
|
||||
});
|
||||
async () => {
|
||||
let localPackage = await remotePackage.download();
|
||||
await localPackage.install(NativeCodePush.codePushInstallModeOnNextRestart);
|
||||
CodePush.restartApp();
|
||||
},
|
||||
/*passAfterRun*/ false
|
||||
);
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
import React from "react-native";
|
||||
import { DeviceEventEmitter, Platform, AppRegistry } from "react-native";
|
||||
import CodePush from "react-native-code-push";
|
||||
let NativeCodePush = React.NativeModules.CodePush;
|
||||
import createTestCaseComponent from "../../utils/createTestCaseComponent";
|
||||
let PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
||||
import assert from "assert";
|
||||
|
||||
const NativeCodePush = React.NativeModules.CodePush;
|
||||
const PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
||||
|
||||
let remotePackage = require("../resources/remotePackage");
|
||||
|
||||
let InstallModeOnNextResumeTest = createTestCaseComponent(
|
||||
@@ -21,16 +22,11 @@ let InstallModeOnNextResumeTest = createTestCaseComponent(
|
||||
}
|
||||
|
||||
remotePackage = Object.assign(remotePackage, PackageMixins.remote);
|
||||
return Promise.resolve();
|
||||
},
|
||||
() => {
|
||||
remotePackage.download()
|
||||
.then((localPackage) => {
|
||||
return localPackage.install(NativeCodePush.codePushInstallModeOnNextResume);
|
||||
})
|
||||
.then(() => {
|
||||
CodePush.restartApp();
|
||||
});
|
||||
async () => {
|
||||
let localPackage = await remotePackage.download()
|
||||
await localPackage.install(NativeCodePush.codePushInstallModeOnNextResume);
|
||||
CodePush.restartApp();
|
||||
},
|
||||
/*passAfterRun*/ false
|
||||
);
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
import React from "react-native";
|
||||
import { DeviceEventEmitter, Platform, AppRegistry } from "react-native";
|
||||
import CodePush from "react-native-code-push";
|
||||
let NativeCodePush = React.NativeModules.CodePush;
|
||||
import createTestCaseComponent from "../../utils/createTestCaseComponent";
|
||||
let PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
||||
import assert from "assert";
|
||||
|
||||
const NativeCodePush = React.NativeModules.CodePush;
|
||||
const PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
||||
|
||||
let remotePackage = require("../resources/remotePackage");
|
||||
|
||||
let IsFailedUpdateTest = createTestCaseComponent(
|
||||
@@ -21,13 +22,10 @@ let IsFailedUpdateTest = createTestCaseComponent(
|
||||
}
|
||||
|
||||
remotePackage = Object.assign(remotePackage, PackageMixins.remote);
|
||||
return Promise.resolve();
|
||||
},
|
||||
() => {
|
||||
remotePackage.download()
|
||||
.then((localPackage) => {
|
||||
return localPackage.install(NativeCodePush.codePushInstallModeImmediate);
|
||||
});
|
||||
async () => {
|
||||
let localPackage = await remotePackage.download();
|
||||
return await localPackage.install(NativeCodePush.codePushInstallModeImmediate);
|
||||
},
|
||||
/*passAfterRun*/ false
|
||||
);
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
import React from "react-native";
|
||||
import { DeviceEventEmitter, Platform, AppRegistry } from "react-native";
|
||||
import CodePush from "react-native-code-push";
|
||||
let NativeCodePush = React.NativeModules.CodePush;
|
||||
import createTestCaseComponent from "../../utils/createTestCaseComponent";
|
||||
let PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
||||
import assert from "assert";
|
||||
|
||||
const NativeCodePush = React.NativeModules.CodePush;
|
||||
const PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
||||
let remotePackage = require("../resources/remotePackage");
|
||||
|
||||
let IsFirstRunTest = createTestCaseComponent(
|
||||
@@ -21,13 +21,10 @@ let IsFirstRunTest = createTestCaseComponent(
|
||||
}
|
||||
|
||||
remotePackage = Object.assign(remotePackage, PackageMixins.remote);
|
||||
return Promise.resolve();
|
||||
},
|
||||
() => {
|
||||
remotePackage.download()
|
||||
.then((localPackage) => {
|
||||
return localPackage.install(NativeCodePush.codePushInstallModeImmediate);
|
||||
});
|
||||
async () => {
|
||||
let localPackage = await remotePackage.download();
|
||||
return await localPackage.install(NativeCodePush.codePushInstallModeImmediate);
|
||||
},
|
||||
/*passAfterRun*/ false
|
||||
);
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
import React from "react-native";
|
||||
import { DeviceEventEmitter, Platform, AppRegistry } from "react-native";
|
||||
import CodePush from "react-native-code-push";
|
||||
let NativeCodePush = React.NativeModules.CodePush;
|
||||
import createTestCaseComponent from "../../utils/createTestCaseComponent";
|
||||
let PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
||||
import assert from "assert";
|
||||
|
||||
const NativeCodePush = React.NativeModules.CodePush;
|
||||
const PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
||||
|
||||
let remotePackage = require("../resources/remotePackage");
|
||||
|
||||
let IsPendingTest = createTestCaseComponent(
|
||||
@@ -21,20 +22,13 @@ let IsPendingTest = createTestCaseComponent(
|
||||
}
|
||||
|
||||
remotePackage = Object.assign(remotePackage, PackageMixins.remote);
|
||||
return Promise.resolve();
|
||||
},
|
||||
() => {
|
||||
remotePackage.download()
|
||||
.then((localPackage) => {
|
||||
return localPackage.install(NativeCodePush.codePushInstallModeOnNextRestart);
|
||||
})
|
||||
.then((localPackage) => {
|
||||
assert(localPackage.isPending, "isPending should be set to \"true\" after an install");
|
||||
return CodePush.getCurrentPackage();
|
||||
})
|
||||
.then((localPackage) => {
|
||||
assert(localPackage.isPending, "isPending should be set to \"true\" after an install");
|
||||
});
|
||||
async () => {
|
||||
let localPackage = await remotePackage.download();
|
||||
await localPackage.install(NativeCodePush.codePushInstallModeOnNextRestart);
|
||||
assert(localPackage.isPending, "isPending should be set to \"true\" after an install");
|
||||
localPackage = await CodePush.getCurrentPackage();
|
||||
assert(localPackage.isPending, "isPending should be set to \"true\" after an install");
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
import React from "react-native";
|
||||
import { DeviceEventEmitter, Platform, AppRegistry } from "react-native";
|
||||
import CodePush from "react-native-code-push";
|
||||
let NativeCodePush = React.NativeModules.CodePush;
|
||||
import createTestCaseComponent from "../../utils/createTestCaseComponent";
|
||||
let PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
||||
import assert from "assert";
|
||||
|
||||
const NativeCodePush = React.NativeModules.CodePush;
|
||||
const PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
||||
|
||||
let remotePackage = require("../resources/remotePackage");
|
||||
|
||||
let NotifyApplicationReadyTest = createTestCaseComponent(
|
||||
@@ -21,13 +22,10 @@ let NotifyApplicationReadyTest = createTestCaseComponent(
|
||||
}
|
||||
|
||||
remotePackage = Object.assign(remotePackage, PackageMixins.remote);
|
||||
return Promise.resolve();
|
||||
},
|
||||
() => {
|
||||
remotePackage.download()
|
||||
.then((localPackage) => {
|
||||
return localPackage.install(NativeCodePush.codePushInstallModeImmediate);
|
||||
});
|
||||
async () => {
|
||||
let localPackage = await remotePackage.download()
|
||||
return await localPackage.install(NativeCodePush.codePushInstallModeImmediate);
|
||||
},
|
||||
/*passAfterRun*/ false
|
||||
);
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
import React from "react-native";
|
||||
import { DeviceEventEmitter, Platform, AppRegistry } from "react-native";
|
||||
import CodePush from "react-native-code-push";
|
||||
let NativeCodePush = React.NativeModules.CodePush;
|
||||
import createTestCaseComponent from "../../utils/createTestCaseComponent";
|
||||
let PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
||||
import assert from "assert";
|
||||
|
||||
const NativeCodePush = React.NativeModules.CodePush;
|
||||
const PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
||||
|
||||
let remotePackage = require("../resources/remotePackage");
|
||||
|
||||
let RollbackTest = createTestCaseComponent(
|
||||
@@ -21,13 +22,10 @@ let RollbackTest = createTestCaseComponent(
|
||||
}
|
||||
|
||||
remotePackage = Object.assign(remotePackage, PackageMixins.remote);
|
||||
return Promise.resolve();
|
||||
},
|
||||
() => {
|
||||
remotePackage.download()
|
||||
.then((localPackage) => {
|
||||
return localPackage.install(NativeCodePush.codePushInstallModeImmediate);
|
||||
});
|
||||
async () => {
|
||||
let localPackage = await remotePackage.download()
|
||||
return await localPackage.install(NativeCodePush.codePushInstallModeImmediate);
|
||||
},
|
||||
/*passAfterRun*/ false
|
||||
);
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
import React from "react-native";
|
||||
import { DeviceEventEmitter, Text, View } from "react-native";
|
||||
let NativeCodePush = React.NativeModules.CodePush;
|
||||
|
||||
const NativeCodePush = React.NativeModules.CodePush;
|
||||
// RCTTestModule is not implemented yet for RN Android.
|
||||
let RCTTestModule = React.NativeModules.TestModule || {};
|
||||
const RCTTestModule = React.NativeModules.TestModule || {};
|
||||
|
||||
function createTestCaseComponent(displayName, description, setUp, runTest, passAfterRun = true) {
|
||||
let TestCaseComponent = React.createClass({
|
||||
@@ -18,18 +18,17 @@ function createTestCaseComponent(displayName, description, setUp, runTest, passA
|
||||
done: false,
|
||||
};
|
||||
},
|
||||
componentDidMount() {
|
||||
setUp()
|
||||
.then(runTest)
|
||||
.then(() => {
|
||||
if (passAfterRun) {
|
||||
this.setState({done: true}, RCTTestModule.markTestCompleted);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
throw err;
|
||||
});
|
||||
async componentDidMount() {
|
||||
try {
|
||||
await setUp();
|
||||
await runTest();
|
||||
if (passAfterRun) {
|
||||
this.setState({done: true}, RCTTestModule.markTestCompleted);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
throw err;
|
||||
}
|
||||
},
|
||||
render() {
|
||||
return (
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
var React = require('react-native');
|
||||
var {
|
||||
import React, {
|
||||
AppRegistry,
|
||||
Dimensions,
|
||||
Image,
|
||||
@@ -9,84 +8,85 @@ var {
|
||||
Text,
|
||||
TouchableOpacity,
|
||||
View,
|
||||
} = React;
|
||||
} from "react-native";
|
||||
|
||||
var Button = require("react-native-button");
|
||||
import Button from "react-native-button";
|
||||
import CodePush from "react-native-code-push";
|
||||
|
||||
var CodePush = require('react-native-code-push');
|
||||
|
||||
var CodePushDemoApp = React.createClass({
|
||||
sync() {
|
||||
var self = this;
|
||||
CodePush.sync(
|
||||
{
|
||||
updateDialog: true,
|
||||
installMode: CodePush.InstallMode.ON_NEXT_RESUME
|
||||
},
|
||||
function(syncStatus) {
|
||||
switch(syncStatus) {
|
||||
case CodePush.SyncStatus.CHECKING_FOR_UPDATE:
|
||||
self.setState({
|
||||
syncMessage: "Checking for update."
|
||||
});
|
||||
break;
|
||||
case CodePush.SyncStatus.DOWNLOADING_PACKAGE:
|
||||
self.setState({
|
||||
syncMessage: "Downloading package."
|
||||
});
|
||||
break;
|
||||
case CodePush.SyncStatus.AWAITING_USER_ACTION:
|
||||
self.setState({
|
||||
syncMessage: "Awaiting user action."
|
||||
});
|
||||
break;
|
||||
case CodePush.SyncStatus.INSTALLING_UPDATE:
|
||||
self.setState({
|
||||
syncMessage: "Installing update."
|
||||
});
|
||||
break;
|
||||
case CodePush.SyncStatus.UP_TO_DATE:
|
||||
self.setState({
|
||||
syncMessage: "App up to date.",
|
||||
progress: false
|
||||
});
|
||||
break;
|
||||
case CodePush.SyncStatus.UPDATE_IGNORED:
|
||||
self.setState({
|
||||
syncMessage: "Update cancelled by user.",
|
||||
progress: false
|
||||
});
|
||||
break;
|
||||
case CodePush.SyncStatus.UPDATE_INSTALLED:
|
||||
self.setState({
|
||||
syncMessage: "Update installed and will be run when the app next resumes.",
|
||||
progress: false
|
||||
});
|
||||
break;
|
||||
case CodePush.SyncStatus.UNKNOWN_ERROR:
|
||||
self.setState({
|
||||
syncMessage: "An unknown error occurred.",
|
||||
progress: false
|
||||
});
|
||||
break;
|
||||
let CodePushDemoApp = React.createClass({
|
||||
async sync() {
|
||||
let self = this;
|
||||
try {
|
||||
return await CodePush.sync(
|
||||
{
|
||||
updateDialog: true,
|
||||
installMode: CodePush.InstallMode.ON_NEXT_RESUME
|
||||
},
|
||||
(syncStatus) => {
|
||||
switch(syncStatus) {
|
||||
case CodePush.SyncStatus.CHECKING_FOR_UPDATE:
|
||||
self.setState({
|
||||
syncMessage: "Checking for update."
|
||||
});
|
||||
break;
|
||||
case CodePush.SyncStatus.DOWNLOADING_PACKAGE:
|
||||
self.setState({
|
||||
syncMessage: "Downloading package."
|
||||
});
|
||||
break;
|
||||
case CodePush.SyncStatus.AWAITING_USER_ACTION:
|
||||
self.setState({
|
||||
syncMessage: "Awaiting user action."
|
||||
});
|
||||
break;
|
||||
case CodePush.SyncStatus.INSTALLING_UPDATE:
|
||||
self.setState({
|
||||
syncMessage: "Installing update."
|
||||
});
|
||||
break;
|
||||
case CodePush.SyncStatus.UP_TO_DATE:
|
||||
self.setState({
|
||||
syncMessage: "App up to date.",
|
||||
progress: false
|
||||
});
|
||||
break;
|
||||
case CodePush.SyncStatus.UPDATE_IGNORED:
|
||||
self.setState({
|
||||
syncMessage: "Update cancelled by user.",
|
||||
progress: false
|
||||
});
|
||||
break;
|
||||
case CodePush.SyncStatus.UPDATE_INSTALLED:
|
||||
self.setState({
|
||||
syncMessage: "Update installed and will be run when the app next resumes.",
|
||||
progress: false
|
||||
});
|
||||
break;
|
||||
case CodePush.SyncStatus.UNKNOWN_ERROR:
|
||||
self.setState({
|
||||
syncMessage: "An unknown error occurred.",
|
||||
progress: false
|
||||
});
|
||||
break;
|
||||
}
|
||||
},
|
||||
(progress) => {
|
||||
self.setState({
|
||||
progress: progress
|
||||
});
|
||||
}
|
||||
},
|
||||
function(progress) {
|
||||
self.setState({
|
||||
progress: progress
|
||||
});
|
||||
}
|
||||
).catch(function(error) {
|
||||
);
|
||||
} catch (error) {
|
||||
CodePush.log(error);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
getInitialState() {
|
||||
return { };
|
||||
},
|
||||
|
||||
render() {
|
||||
var syncView;
|
||||
var syncButton;
|
||||
var progressView;
|
||||
let syncView, syncButton, progressView;
|
||||
|
||||
if (this.state.syncMessage) {
|
||||
syncView = (
|
||||
@@ -120,7 +120,7 @@ var CodePushDemoApp = React.createClass({
|
||||
}
|
||||
});
|
||||
|
||||
var styles = StyleSheet.create({
|
||||
let styles = StyleSheet.create({
|
||||
image: {
|
||||
marginTop: 50,
|
||||
width: Dimensions.get('window').width - 100,
|
||||
|
||||
@@ -1 +1 @@
|
||||
require("./crossplatformdemo.js");
|
||||
import "./crossplatformdemo.js";
|
||||
@@ -1 +1 @@
|
||||
require("./crossplatformdemo.js");
|
||||
import "./crossplatformdemo.js";
|
||||
Reference in New Issue
Block a user