@appzung/react-native-code-push 5.7.1 → 6.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +17 -19
- package/CodePush.js +7 -4
- package/CodePush.podspec +2 -2
- package/README.md +62 -19
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java +44 -7
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushInvalidPublicKeyException.java +0 -0
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java +77 -22
- package/android/app/src/main/java/com/microsoft/codepush/react/FileUtils.java +15 -1
- package/android/codepush.gradle +1 -1
- package/docs/api-android.md +21 -3
- package/docs/api-js.md +3 -3
- package/docs/multi-deployment-testing-android.md +63 -22
- package/docs/multi-deployment-testing-ios.md +16 -10
- package/docs/setup-android.md +76 -17
- package/docs/setup-ios.md +55 -5
- package/ios/CodePush/Base64/Base64/MF_Base64Additions.m +0 -0
- package/ios/CodePush/CodePush.m +82 -17
- package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithm.h +0 -0
- package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.h +0 -0
- package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.m +0 -0
- package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.h +0 -0
- package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.m +0 -0
- package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.h +0 -0
- package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.m +0 -0
- package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.h +0 -0
- package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.m +0 -0
- package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.h +0 -0
- package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.m +0 -0
- package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.h +0 -0
- package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.m +0 -0
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.h +0 -0
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.m +0 -0
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTRSAlgorithm.h +0 -0
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.h +0 -0
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.m +0 -0
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.h +0 -0
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.m +0 -0
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.h +0 -0
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.m +0 -0
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.h +0 -0
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.m +0 -0
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.h +0 -0
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.m +0 -0
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.h +0 -0
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.m +0 -0
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.h +0 -0
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.m +0 -0
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.h +0 -0
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.m +0 -0
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.h +0 -0
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.m +0 -0
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.h +0 -0
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.m +0 -0
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.h +0 -0
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.m +0 -0
- package/ios/CodePush/JWT/Core/Coding/JWTCoding.h +0 -0
- package/ios/CodePush/JWT/Core/Coding/JWTCoding.m +0 -0
- package/ios/CodePush/JWT/Core/FrameworkSupplement/JWT.h +0 -0
- package/ios/CodePush/JWT/Core/FrameworkSupplement/Map.modulemap +0 -0
- package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.h +0 -0
- package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.m +0 -0
- package/ios/CodePush/JWT/Core/Supplement/JWTDeprecations.h +0 -0
- package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.h +0 -0
- package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.m +0 -0
- package/ios/CodePush/SSZipArchive/Common.h +0 -0
- package/ios/CodePush/SSZipArchive/SSZipArchive.h +0 -0
- package/ios/CodePush/SSZipArchive/SSZipArchive.m +0 -0
- package/ios/CodePush/SSZipArchive/aes/aes.h +0 -0
- package/ios/CodePush/SSZipArchive/aes/aes_via_ace.h +0 -0
- package/ios/CodePush/SSZipArchive/aes/aescrypt.c +0 -0
- package/ios/CodePush/SSZipArchive/aes/aeskey.c +0 -0
- package/ios/CodePush/SSZipArchive/aes/aesopt.h +0 -0
- package/ios/CodePush/SSZipArchive/aes/aestab.c +0 -0
- package/ios/CodePush/SSZipArchive/aes/aestab.h +0 -0
- package/ios/CodePush/SSZipArchive/aes/brg_endian.h +0 -0
- package/ios/CodePush/SSZipArchive/aes/brg_types.h +0 -0
- package/ios/CodePush/SSZipArchive/aes/entropy.c +0 -0
- package/ios/CodePush/SSZipArchive/aes/entropy.h +0 -0
- package/ios/CodePush/SSZipArchive/aes/fileenc.c +0 -0
- package/ios/CodePush/SSZipArchive/aes/fileenc.h +0 -0
- package/ios/CodePush/SSZipArchive/aes/hmac.c +0 -0
- package/ios/CodePush/SSZipArchive/aes/hmac.h +0 -0
- package/ios/CodePush/SSZipArchive/aes/prng.c +0 -0
- package/ios/CodePush/SSZipArchive/aes/prng.h +0 -0
- package/ios/CodePush/SSZipArchive/aes/pwd2key.c +0 -0
- package/ios/CodePush/SSZipArchive/aes/pwd2key.h +0 -0
- package/ios/CodePush/SSZipArchive/aes/sha1.c +0 -0
- package/ios/CodePush/SSZipArchive/aes/sha1.h +0 -0
- package/ios/CodePush/SSZipArchive/minizip/crypt.h +0 -0
- package/ios/CodePush/SSZipArchive/minizip/ioapi.c +0 -0
- package/ios/CodePush/SSZipArchive/minizip/ioapi.h +0 -0
- package/ios/CodePush/SSZipArchive/minizip/mztools.c +0 -0
- package/ios/CodePush/SSZipArchive/minizip/mztools.h +0 -0
- package/ios/CodePush/SSZipArchive/minizip/unzip.c +0 -0
- package/ios/CodePush/SSZipArchive/minizip/unzip.h +0 -0
- package/ios/CodePush/SSZipArchive/minizip/zip.c +0 -0
- package/ios/CodePush/SSZipArchive/minizip/zip.h +0 -0
- package/package-mixins.js +2 -3
- package/package.json +36 -13
- package/react-native.config.js +10 -0
- package/request-fetch-adapter.js +1 -1
- package/scripts/generateBundledResourcesHash.js +1 -1
- package/scripts/postlink/android/postlink.js +2 -2
- package/scripts/postunlink/android/postunlink.js +3 -3
- package/scripts/tools/linkToolsAndroid.js +1 -1
- package/scripts/tools/linkToolsIos.js +2 -2
- package/tsconfig.json +14 -0
- package/tslint.json +32 -0
- package/typings/react-native-code-push.d.ts +14 -5
- package/RestartManager.js +0 -59
- package/gulpfile.js +0 -302
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/package-mixins.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { NativeEventEmitter } from "react-native";
|
|
2
|
-
import RestartManager from "./RestartManager";
|
|
3
2
|
import log from "./logging";
|
|
4
3
|
|
|
5
4
|
// This function is used to augment remote and local
|
|
@@ -55,9 +54,9 @@ module.exports = (NativeCodePush) => {
|
|
|
55
54
|
await NativeCodePush.installUpdate(localPackageCopy, installMode, minimumBackgroundDuration);
|
|
56
55
|
updateInstalledCallback && updateInstalledCallback();
|
|
57
56
|
if (installMode == NativeCodePush.codePushInstallModeImmediate) {
|
|
58
|
-
|
|
57
|
+
NativeCodePush.restartApp(false);
|
|
59
58
|
} else {
|
|
60
|
-
|
|
59
|
+
NativeCodePush.clearPendingRestart();
|
|
61
60
|
localPackage.isPending = true; // Mark the package as pending since it hasn't been applied yet
|
|
62
61
|
}
|
|
63
62
|
},
|
package/package.json
CHANGED
|
@@ -1,38 +1,61 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appzung/react-native-code-push",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.3.1",
|
|
4
4
|
"description": "React Native plugin for the CodePush service",
|
|
5
5
|
"main": "CodePush.js",
|
|
6
6
|
"typings": "typings/react-native-code-push.d.ts",
|
|
7
7
|
"author": "Louis Lagrange <lagrange.louis@gmail.com> (https://github.com/Minishlink)",
|
|
8
8
|
"license": "MIT",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"clean": "shx rm -rf bin",
|
|
11
|
+
"setup": "npm install --quiet --no-progress",
|
|
12
|
+
"prebuild:tests": "npm run clean && npm run tslint",
|
|
13
|
+
"build:tests": "tsc",
|
|
14
|
+
"test": "npm run build:tests && npm run test:setup && npm run test:fast",
|
|
15
|
+
"test:android": "npm run build:tests && npm run test:setup:android && npm run test:fast:android",
|
|
16
|
+
"test:ios": "npm run build:tests && npm run test:setup:ios && npm run test:fast:ios",
|
|
17
|
+
"test:setup": "mocha --recursive bin/test --android --ios --setup",
|
|
18
|
+
"test:setup:android": "mocha --recursive bin/test --android --setup",
|
|
19
|
+
"test:setup:ios": "mocha --recursive bin/test --ios --setup",
|
|
20
|
+
"test:fast": "mocha --recursive bin/test --android --ios",
|
|
21
|
+
"test:fast:android": "mocha --recursive bin/test --android",
|
|
22
|
+
"test:fast:ios": "mocha --recursive bin/test --ios",
|
|
23
|
+
"test:debugger:android": "mocha --recursive --inspect-brk=0.0.0.0 bin/test --android",
|
|
24
|
+
"test:debugger:ios": "mocha --recursive --inspect-brk=0.0.0.0 bin/test --ios",
|
|
25
|
+
"tslint": "tslint -c tslint.json test/**/*.ts"
|
|
26
|
+
},
|
|
9
27
|
"dependencies": {
|
|
10
|
-
"code-push": "^3.0
|
|
11
|
-
"glob": "^
|
|
12
|
-
"hoist-non-react-statics": "^
|
|
13
|
-
"inquirer": "^
|
|
28
|
+
"code-push": "^3.1.0",
|
|
29
|
+
"glob": "^7.1.6",
|
|
30
|
+
"hoist-non-react-statics": "^3.3.2",
|
|
31
|
+
"inquirer": "^7.2.0",
|
|
14
32
|
"plist": "3.0.1",
|
|
15
|
-
"semver": "^
|
|
16
|
-
"xcode": "
|
|
33
|
+
"semver": "^7.3.2",
|
|
34
|
+
"xcode": "3.0.1"
|
|
17
35
|
},
|
|
18
36
|
"devDependencies": {
|
|
37
|
+
"@types/assert": "^1.4.3",
|
|
38
|
+
"@types/mkdirp": "^1.0.0",
|
|
39
|
+
"@types/mocha": "^7.0.2",
|
|
40
|
+
"@types/node": "^14.0.13",
|
|
41
|
+
"@types/q": "^1.5.2",
|
|
19
42
|
"archiver": "latest",
|
|
20
43
|
"body-parser": "latest",
|
|
21
44
|
"code-push-plugin-testing-framework": "file:./code-push-plugin-testing-framework",
|
|
22
45
|
"del": "latest",
|
|
23
46
|
"express": "latest",
|
|
24
|
-
"gulp-insert": "latest",
|
|
25
|
-
"gulp-tslint": "latest",
|
|
26
|
-
"gulp-typescript": "^5.0.1",
|
|
27
47
|
"mkdirp": "latest",
|
|
48
|
+
"mocha": "^8.0.1",
|
|
28
49
|
"q": "^1.5.1",
|
|
29
50
|
"run-sequence": "latest",
|
|
30
|
-
"
|
|
31
|
-
"
|
|
51
|
+
"shx": "^0.3.2",
|
|
52
|
+
"slash": "^3.0.0",
|
|
53
|
+
"tslint": "^6.1.1",
|
|
54
|
+
"typescript": "^3.9.5"
|
|
32
55
|
},
|
|
33
56
|
"rnpm": {
|
|
34
57
|
"android": {
|
|
35
|
-
"packageInstance": "new CodePush(getResources().getString(R.string.
|
|
58
|
+
"packageInstance": "new CodePush(getResources().getString(R.string.CodePushDeploymentKey), getApplicationContext(), BuildConfig.DEBUG)"
|
|
36
59
|
},
|
|
37
60
|
"ios": {
|
|
38
61
|
"sharedLibraries": [
|
package/request-fetch-adapter.js
CHANGED
|
@@ -37,7 +37,7 @@ module.exports = {
|
|
|
37
37
|
|
|
38
38
|
function getHttpMethodName(verb) {
|
|
39
39
|
// Note: This should stay in sync with the enum definition in
|
|
40
|
-
// https://github.com/
|
|
40
|
+
// https://github.com/microsoft/code-push/blob/master/sdk/script/acquisition-sdk.ts#L6
|
|
41
41
|
return [
|
|
42
42
|
"GET",
|
|
43
43
|
"HEAD",
|
|
@@ -83,7 +83,7 @@ function addJsBundleAndMetaToManifest() {
|
|
|
83
83
|
// "CodePushHash.json" file name breaks flow type checking.
|
|
84
84
|
// To fix the issue we need to delete "CodePushHash.json" file and
|
|
85
85
|
// use "CodePushHash" file name instead to store the hash value.
|
|
86
|
-
// Relates to https://github.com/
|
|
86
|
+
// Relates to https://github.com/microsoft/react-native-code-push/issues/577
|
|
87
87
|
var oldSavedResourcesManifestPath = assetsDir + "/" + CODE_PUSH_HASH_OLD_FILE_NAME;
|
|
88
88
|
if (fs.existsSync(oldSavedResourcesManifestPath)) {
|
|
89
89
|
fs.unlinkSync(oldSavedResourcesManifestPath);
|
|
@@ -37,14 +37,14 @@ module.exports = () => {
|
|
|
37
37
|
} else {
|
|
38
38
|
return Promise.reject(`Couldn't find Android application entry point. You might need to update it manually. \
|
|
39
39
|
Please refer to plugin configuration section for Android at \
|
|
40
|
-
https://github.com/microsoft/react-native-code-push#plugin-configuration-android for more details`);
|
|
40
|
+
https://github.com/microsoft/react-native-code-push/blob/master/docs/setup-android.md#plugin-configuration-for-react-native-lower-than-060-android for more details`);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
if (!fs.existsSync(buildGradlePath)) {
|
|
45
45
|
return Promise.reject(`Couldn't find build.gradle file. You might need to update it manually. \
|
|
46
46
|
Please refer to plugin installation section for Android at \
|
|
47
|
-
https://github.com/microsoft/react-native-code-push#plugin-installation-android---manual`);
|
|
47
|
+
https://github.com/microsoft/react-native-code-push/blob/master/docs/setup-android.md#plugin-installation-android---manual`);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
// 2. Add the codepush.gradle build task definitions
|
|
@@ -31,7 +31,7 @@ module.exports = () => {
|
|
|
31
31
|
} else {
|
|
32
32
|
console.log(`Couldn't find Android application entry point. You might need to update it manually. \
|
|
33
33
|
Please refer to plugin configuration section for Android at \
|
|
34
|
-
https://github.com/microsoft/react-native-code-push#plugin-configuration-android for more details`);
|
|
34
|
+
https://github.com/microsoft/react-native-code-push/blob/master/docs/setup-android.md#plugin-configuration-for-react-native-lower-than-060-android for more details`);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -41,7 +41,7 @@ module.exports = () => {
|
|
|
41
41
|
if (!fs.existsSync(buildGradlePath)) {
|
|
42
42
|
console.log(`Couldn't find build.gradle file. You might need to update it manually. \
|
|
43
43
|
Please refer to plugin installation section for Android at \
|
|
44
|
-
https://github.com/microsoft/react-native-code-push#plugin-installation-android---manual`);
|
|
44
|
+
https://github.com/microsoft/react-native-code-push/blob/master/docs/setup-android.md#plugin-installation-android---manual`);
|
|
45
45
|
} else {
|
|
46
46
|
var buildGradleContents = fs.readFileSync(buildGradlePath, "utf8");
|
|
47
47
|
var codePushGradleLink = linkTools.codePushGradleLink;
|
|
@@ -63,7 +63,7 @@ module.exports = () => {
|
|
|
63
63
|
if (!~stringsResourcesContent.indexOf(deploymentKeyName)) {
|
|
64
64
|
console.log(`${deploymentKeyName} already removed from the strings.xml`);
|
|
65
65
|
} else {
|
|
66
|
-
var AndroidDeploymentKey = stringsResourcesContent.match(/(<string moduleConfig="true" name="
|
|
66
|
+
var AndroidDeploymentKey = stringsResourcesContent.match(/(<string moduleConfig="true" name="CodePushDeploymentKey">.*<\/string>)/);
|
|
67
67
|
if (AndroidDeploymentKey) {
|
|
68
68
|
stringsResourcesContent = stringsResourcesContent.replace(`\n\t${AndroidDeploymentKey[0]}`,"");
|
|
69
69
|
fs.writeFileSync(stringsResourcesPath, stringsResourcesContent);
|
|
@@ -14,7 +14,7 @@ exports.getJSBundleFileOverride = `
|
|
|
14
14
|
exports.reactNativeHostInstantiation = "new ReactNativeHost(this) {";
|
|
15
15
|
exports.mainActivityClassDeclaration = "public class MainActivity extends ReactActivity {";
|
|
16
16
|
exports.codePushGradleLink = `\napply from: "../../node_modules/react-native-code-push/android/codepush.gradle"`;
|
|
17
|
-
exports.deploymentKeyName = "
|
|
17
|
+
exports.deploymentKeyName = "CodePushDeploymentKey";
|
|
18
18
|
|
|
19
19
|
exports.getMainApplicationLocation = function () {
|
|
20
20
|
return findMainApplication() || glob.sync("**/MainApplication.java", ignoreFolders)[0];
|
|
@@ -22,7 +22,7 @@ exports.getJsCodeLocationPatch = function(defaultJsCodeLocationAssignmentStateme
|
|
|
22
22
|
#endif`;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
// Fix for https://github.com/
|
|
25
|
+
// Fix for https://github.com/microsoft/react-native-code-push/issues/477
|
|
26
26
|
// Typical location of AppDelegate.m for newer RN versions: $PROJECT_ROOT/ios/<project_name>/AppDelegate.m
|
|
27
27
|
// Let's try to find that path by filtering the whole array for any path containing <project_name>
|
|
28
28
|
// If we can't find it there, play dumb and pray it is the first path we find.
|
|
@@ -71,7 +71,7 @@ exports.getPlistPath = function() {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
//also remove surrounding quotes from plistPathValue to get correct path resolved
|
|
74
|
-
//(see https://github.com/
|
|
74
|
+
//(see https://github.com/microsoft/react-native-code-push/issues/534#issuecomment-302069326 for details)
|
|
75
75
|
return path.resolve(path.dirname(xcodeProjectPath), '..', plistPathValue.replace(/^"(.*)"$/, '$1'));
|
|
76
76
|
}
|
|
77
77
|
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES5",
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"lib": ["es6"],
|
|
6
|
+
"noImplicitAny": true,
|
|
7
|
+
"noEmitOnError": true,
|
|
8
|
+
"moduleResolution": "node",
|
|
9
|
+
"sourceMap": true,
|
|
10
|
+
"rootDir": "test",
|
|
11
|
+
"outDir": "bin",
|
|
12
|
+
"removeComments": true
|
|
13
|
+
}
|
|
14
|
+
}
|
package/tslint.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"defaultSeverity": "error",
|
|
3
|
+
"rules": {
|
|
4
|
+
"class-name": true,
|
|
5
|
+
"comment-format": [true,
|
|
6
|
+
"check-space"
|
|
7
|
+
],
|
|
8
|
+
"indent": [true,
|
|
9
|
+
"spaces"
|
|
10
|
+
],
|
|
11
|
+
"one-line": [true,
|
|
12
|
+
"check-open-brace"
|
|
13
|
+
],
|
|
14
|
+
"quotemark": [true,
|
|
15
|
+
"double"
|
|
16
|
+
],
|
|
17
|
+
"semicolon": true,
|
|
18
|
+
"whitespace": [true,
|
|
19
|
+
"check-branch",
|
|
20
|
+
"check-operator",
|
|
21
|
+
"check-separator",
|
|
22
|
+
"check-type"
|
|
23
|
+
],
|
|
24
|
+
"typedef-whitespace": [true, {
|
|
25
|
+
"call-signature": "nospace",
|
|
26
|
+
"index-signature": "nospace",
|
|
27
|
+
"parameter": "nospace",
|
|
28
|
+
"property-declaration": "nospace",
|
|
29
|
+
"variable-declaration": "nospace"
|
|
30
|
+
}]
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -122,9 +122,9 @@ export interface SyncOptions {
|
|
|
122
122
|
|
|
123
123
|
/**
|
|
124
124
|
* Specifies the minimum number of seconds that the app needs to have been in the background before restarting the app. This property
|
|
125
|
-
* only applies to updates which are installed using `InstallMode.ON_NEXT_RESUME`, and can be useful
|
|
126
|
-
* of end users sooner, without being too obtrusive. Defaults to `0`, which has the effect of applying
|
|
127
|
-
* resume, regardless how long it was in the background.
|
|
125
|
+
* only applies to updates which are installed using `InstallMode.ON_NEXT_RESUME` or `InstallMode.ON_NEXT_SUSPEND`, and can be useful
|
|
126
|
+
* for getting your update in front of end users sooner, without being too obtrusive. Defaults to `0`, which has the effect of applying
|
|
127
|
+
* the update immediately after a resume or unless the app suspension is long enough to not matter, regardless how long it was in the background.
|
|
128
128
|
*/
|
|
129
129
|
minimumBackgroundDuration?: number;
|
|
130
130
|
|
|
@@ -239,6 +239,13 @@ export interface StatusReport {
|
|
|
239
239
|
*/
|
|
240
240
|
declare function CodePush(options?: CodePushOptions): (x: any) => any;
|
|
241
241
|
|
|
242
|
+
/**
|
|
243
|
+
* Decorates a React Component configuring it to sync for updates with the CodePush server.
|
|
244
|
+
*
|
|
245
|
+
* @param x the React Component that will decorated
|
|
246
|
+
*/
|
|
247
|
+
declare function CodePush(x: any): any
|
|
248
|
+
|
|
242
249
|
declare namespace CodePush {
|
|
243
250
|
/**
|
|
244
251
|
* Represents the default settings that will be used by the sync method if
|
|
@@ -317,8 +324,10 @@ declare namespace CodePush {
|
|
|
317
324
|
ON_NEXT_RESTART,
|
|
318
325
|
|
|
319
326
|
/**
|
|
320
|
-
* Indicates that you want to install the update, but don't want to restart the
|
|
321
|
-
*
|
|
327
|
+
* Indicates that you want to install the update, but don't want to restart the app until the next time
|
|
328
|
+
* the end user resumes it from the background. This way, you don't disrupt their current session,
|
|
329
|
+
* but you can get the update in front of them sooner then having to wait for the next natural restart.
|
|
330
|
+
* This value is appropriate for silent installs that can be applied on resume in a non-invasive way.
|
|
322
331
|
*/
|
|
323
332
|
ON_NEXT_RESUME,
|
|
324
333
|
|
package/RestartManager.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
const log = require("./logging");
|
|
2
|
-
const NativeCodePush = require("react-native").NativeModules.CodePush;
|
|
3
|
-
|
|
4
|
-
const RestartManager = (() => {
|
|
5
|
-
let _allowed = true;
|
|
6
|
-
let _restartInProgress = false;
|
|
7
|
-
let _restartQueue = [];
|
|
8
|
-
|
|
9
|
-
function allow() {
|
|
10
|
-
log("Re-allowing restarts");
|
|
11
|
-
_allowed = true;
|
|
12
|
-
|
|
13
|
-
if (_restartQueue.length) {
|
|
14
|
-
log("Executing pending restart");
|
|
15
|
-
restartApp(_restartQueue.shift(1));
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function clearPendingRestart() {
|
|
20
|
-
_restartQueue = [];
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function disallow() {
|
|
24
|
-
log("Disallowing restarts");
|
|
25
|
-
_allowed = false;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
async function restartApp(onlyIfUpdateIsPending = false) {
|
|
29
|
-
if (_restartInProgress) {
|
|
30
|
-
log("Restart request queued until the current restart is completed");
|
|
31
|
-
_restartQueue.push(onlyIfUpdateIsPending);
|
|
32
|
-
} else if (!_allowed) {
|
|
33
|
-
log("Restart request queued until restarts are re-allowed");
|
|
34
|
-
_restartQueue.push(onlyIfUpdateIsPending);
|
|
35
|
-
} else {
|
|
36
|
-
_restartInProgress = true;
|
|
37
|
-
if (await NativeCodePush.restartApp(onlyIfUpdateIsPending)) {
|
|
38
|
-
// The app has already restarted, so there is no need to
|
|
39
|
-
// process the remaining queued restarts.
|
|
40
|
-
log("Restarting app");
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
_restartInProgress = false;
|
|
45
|
-
if (_restartQueue.length) {
|
|
46
|
-
restartApp(_restartQueue.shift(1));
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return {
|
|
52
|
-
allow,
|
|
53
|
-
clearPendingRestart,
|
|
54
|
-
disallow,
|
|
55
|
-
restartApp
|
|
56
|
-
};
|
|
57
|
-
})();
|
|
58
|
-
|
|
59
|
-
module.exports = RestartManager;
|