@appzung/react-native-code-push 7.1.1 → 9.0.2
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/.azurepipelines/build-rn-code-push-1es.yml +104 -0
- package/.azurepipelines/test-rn-code-push.yml +94 -0
- package/.config/CredScanSuppressions.json +14 -0
- package/CONTRIBUTING.md +3 -3
- package/CodePush.js +20 -21
- package/CodePush.podspec +3 -3
- package/README.md +7 -5
- package/android/app/build.gradle +3 -1
- package/android/app/src/main/AndroidManifest.xml +2 -7
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java +14 -5
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushConstants.java +1 -0
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java +9 -1
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateUtils.java +18 -10
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUtils.java +3 -1
- package/android/build.gradle +6 -2
- package/android/codepush.gradle +72 -26
- package/docs/api-js.md +1 -1
- package/docs/setup-android.md +27 -3
- package/docs/setup-ios.md +1 -1
- package/docs/setup-windows.md +23 -0
- package/ios/CodePush/CodePush.m +2 -1
- package/ios/CodePush/CodePushPackage.m +4 -0
- package/ios/CodePush/SSZipArchive/Info.plist +26 -0
- package/ios/CodePush/SSZipArchive/README.md +1 -1
- package/ios/CodePush/SSZipArchive/SSZipArchive.h +129 -27
- package/ios/CodePush/SSZipArchive/SSZipArchive.m +1119 -314
- package/ios/CodePush/SSZipArchive/SSZipCommon.h +71 -0
- package/ios/CodePush/SSZipArchive/Supporting Files/PrivacyInfo.xcprivacy +23 -0
- package/ios/CodePush/SSZipArchive/include/ZipArchive.h +25 -0
- package/ios/CodePush/SSZipArchive/minizip/LICENSE +17 -0
- package/ios/CodePush/SSZipArchive/minizip/mz.h +273 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_compat.c +1306 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_compat.h +346 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_crypt.c +187 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_crypt.h +65 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_crypt_apple.c +526 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_os.c +348 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_os.h +176 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_os_posix.c +350 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_strm.c +556 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_strm.h +132 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_buf.c +383 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_buf.h +42 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_mem.c +269 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_mem.h +48 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_os.h +40 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_os_posix.c +203 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.c +334 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.h +46 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_split.c +429 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_split.h +43 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.c +360 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.h +46 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.c +389 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.h +43 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_zip.c +2782 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_zip.h +262 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_zip_rw.c +1942 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_zip_rw.h +285 -0
- package/ios/CodePush.xcodeproj/project.pbxproj +245 -130
- package/ios/PrivacyInfo.xcprivacy +31 -0
- package/package.json +2 -2
- package/typings/react-native-code-push.d.ts +1 -1
- package/windows/CodePush/CodePush.vcxproj +2 -3
- package/windows-legacy/CodePush.Net46/CodePush.Net46.csproj +2 -2
- package/windows-legacy/CodePush.Net46.Test/CodePush.Net46.Test.csproj +2 -2
- package/ios/CodePush/SSZipArchive/Common.h +0 -81
- package/ios/CodePush/SSZipArchive/aes/aes.h +0 -198
- package/ios/CodePush/SSZipArchive/aes/aes_via_ace.h +0 -541
- package/ios/CodePush/SSZipArchive/aes/aescrypt.c +0 -294
- package/ios/CodePush/SSZipArchive/aes/aeskey.c +0 -548
- package/ios/CodePush/SSZipArchive/aes/aesopt.h +0 -739
- package/ios/CodePush/SSZipArchive/aes/aestab.c +0 -391
- package/ios/CodePush/SSZipArchive/aes/aestab.h +0 -173
- package/ios/CodePush/SSZipArchive/aes/brg_endian.h +0 -126
- package/ios/CodePush/SSZipArchive/aes/brg_types.h +0 -219
- package/ios/CodePush/SSZipArchive/aes/entropy.c +0 -54
- package/ios/CodePush/SSZipArchive/aes/entropy.h +0 -16
- package/ios/CodePush/SSZipArchive/aes/fileenc.c +0 -144
- package/ios/CodePush/SSZipArchive/aes/fileenc.h +0 -121
- package/ios/CodePush/SSZipArchive/aes/hmac.c +0 -145
- package/ios/CodePush/SSZipArchive/aes/hmac.h +0 -103
- package/ios/CodePush/SSZipArchive/aes/prng.c +0 -155
- package/ios/CodePush/SSZipArchive/aes/prng.h +0 -82
- package/ios/CodePush/SSZipArchive/aes/pwd2key.c +0 -103
- package/ios/CodePush/SSZipArchive/aes/pwd2key.h +0 -57
- package/ios/CodePush/SSZipArchive/aes/sha1.c +0 -258
- package/ios/CodePush/SSZipArchive/aes/sha1.h +0 -73
- package/ios/CodePush/SSZipArchive/minizip/crypt.h +0 -130
- package/ios/CodePush/SSZipArchive/minizip/ioapi.c +0 -369
- package/ios/CodePush/SSZipArchive/minizip/ioapi.h +0 -175
- package/ios/CodePush/SSZipArchive/minizip/mztools.c +0 -284
- package/ios/CodePush/SSZipArchive/minizip/mztools.h +0 -31
- package/ios/CodePush/SSZipArchive/minizip/unzip.c +0 -1839
- package/ios/CodePush/SSZipArchive/minizip/unzip.h +0 -248
- package/ios/CodePush/SSZipArchive/minizip/zip.c +0 -1910
- package/ios/CodePush/SSZipArchive/minizip/zip.h +0 -202
package/android/codepush.gradle
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import java.nio.file.Paths;
|
|
4
4
|
|
|
5
|
-
def config = project.
|
|
6
|
-
def bundleAssetName = config.bundleAssetName
|
|
5
|
+
def config = project.extensions.findByName("react") ?: [:]
|
|
6
|
+
def bundleAssetName = config.bundleAssetName ? config.bundleAssetName.get() : "index.android.bundle"
|
|
7
7
|
|
|
8
8
|
// because elvis operator
|
|
9
9
|
def elvisFile(thing) {
|
|
@@ -17,21 +17,61 @@ void runBefore(String dependentTaskName, Task task) {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Finds the path of the installed npm package with the given name using Node's
|
|
22
|
+
* module resolution algorithm, which searches "node_modules" directories up to
|
|
23
|
+
* the file system root. This handles various cases, including:
|
|
24
|
+
*
|
|
25
|
+
* - Working in the open-source RN repo:
|
|
26
|
+
* Gradle: /path/to/react-native/ReactAndroid
|
|
27
|
+
* Node module: /path/to/react-native/node_modules/[package]
|
|
28
|
+
*
|
|
29
|
+
* - Installing RN as a dependency of an app and searching for hoisted
|
|
30
|
+
* dependencies:
|
|
31
|
+
* Gradle: /path/to/app/node_modules/react-native/ReactAndroid
|
|
32
|
+
* Node module: /path/to/app/node_modules/[package]
|
|
33
|
+
*
|
|
34
|
+
* - Working in a larger repo (e.g., Facebook) that contains RN:
|
|
35
|
+
* Gradle: /path/to/repo/path/to/react-native/ReactAndroid
|
|
36
|
+
* Node module: /path/to/repo/node_modules/[package]
|
|
37
|
+
*
|
|
38
|
+
* The search begins at the given base directory (a File object). The returned
|
|
39
|
+
* path is a string.
|
|
40
|
+
*/
|
|
41
|
+
static def findNodeModulePath(baseDir, packageName) {
|
|
42
|
+
def basePath = baseDir.toPath().normalize()
|
|
43
|
+
// Node's module resolution algorithm searches up to the root directory,
|
|
44
|
+
// after which the base path will be null
|
|
45
|
+
while (basePath) {
|
|
46
|
+
def candidatePath = Paths.get(basePath.toString(), "node_modules", packageName)
|
|
47
|
+
if (candidatePath.toFile().exists()) {
|
|
48
|
+
return candidatePath.toString()
|
|
49
|
+
}
|
|
50
|
+
basePath = basePath.getParent()
|
|
51
|
+
}
|
|
52
|
+
return null
|
|
53
|
+
}
|
|
54
|
+
|
|
20
55
|
android.buildTypes.each { buildType ->
|
|
21
56
|
// to prevent incorrect long value restoration from strings.xml we need to wrap it with double quotes
|
|
22
57
|
// https://github.com/microsoft/cordova-plugin-code-push/issues/264
|
|
23
58
|
buildType.resValue 'string', "CODE_PUSH_APK_BUILD_TIME", String.format("\"%d\"", System.currentTimeMillis())
|
|
24
59
|
}
|
|
25
60
|
|
|
26
|
-
gradle.projectsEvaluated {
|
|
61
|
+
gradle.projectsEvaluated {
|
|
62
|
+
def debuggableVariants = config.debuggableVariants ? config.debuggableVariants.get() : ['debug']
|
|
63
|
+
|
|
27
64
|
android.applicationVariants.all { variant ->
|
|
65
|
+
// No code push for debuggable variants
|
|
66
|
+
if (debuggableVariants.contains(variant.name)) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
28
70
|
def nodeModulesPath;
|
|
29
|
-
if (
|
|
30
|
-
nodeModulesPath =
|
|
31
|
-
} else if (project.hasProperty('nodeModulesPath')) {
|
|
32
|
-
nodeModulesPath = project.nodeModulesPath
|
|
71
|
+
if (project.hasProperty('nodeModulesPath')) {
|
|
72
|
+
nodeModulesPath = "${project.nodeModulesPath}/react-native-code-push"
|
|
33
73
|
} else {
|
|
34
|
-
nodeModulesPath = "
|
|
74
|
+
nodeModulesPath = findNodeModulePath(projectDir, "react-native-code-push")
|
|
35
75
|
}
|
|
36
76
|
|
|
37
77
|
def targetName = variant.name.capitalize()
|
|
@@ -42,40 +82,45 @@ gradle.projectsEvaluated {
|
|
|
42
82
|
def jsBundleFile;
|
|
43
83
|
|
|
44
84
|
// Additional node commandline arguments
|
|
45
|
-
def nodeExecutableAndArgs = config.nodeExecutableAndArgs
|
|
46
|
-
def extraPackagerArgs = config.extraPackagerArgs
|
|
85
|
+
def nodeExecutableAndArgs = config.nodeExecutableAndArgs ? config.nodeExecutableAndArgs.get(): ["node"]
|
|
86
|
+
def extraPackagerArgs = config.extraPackagerArgs ? config.extraPackagerArgs.get() : []
|
|
47
87
|
|
|
48
88
|
// Make this task run right after the bundle task
|
|
49
89
|
def generateBundledResourcesHash;
|
|
50
90
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
jsBundleDir = reactBundleTask.
|
|
54
|
-
resourcesDir = reactBundleTask.
|
|
91
|
+
def reactBundleTask = tasks.findByName("createBundle${targetName}JsAndAssets")
|
|
92
|
+
if (reactBundleTask) {
|
|
93
|
+
jsBundleDir = reactBundleTask.property('jsBundleDir').asFile.get()
|
|
94
|
+
resourcesDir = reactBundleTask.property('resourcesDir').asFile.get()
|
|
95
|
+
|
|
96
|
+
// mitigates Resource and asset merger: Duplicate resources error
|
|
97
|
+
project.delete(files("${jsBundleDir}"))
|
|
98
|
+
|
|
99
|
+
jsBundleDir.mkdirs()
|
|
100
|
+
resourcesDir.mkdirs()
|
|
101
|
+
|
|
55
102
|
jsBundleFile = file("$jsBundleDir/$bundleAssetName")
|
|
56
103
|
|
|
57
104
|
generateBundledResourcesHash = tasks.create(
|
|
58
105
|
name: "generateBundledResourcesHash${targetName}",
|
|
59
106
|
type: Exec) {
|
|
60
|
-
commandLine (*nodeExecutableAndArgs, "${nodeModulesPath}/
|
|
107
|
+
commandLine (*nodeExecutableAndArgs, "${nodeModulesPath}/scripts/generateBundledResourcesHash.js", resourcesDir, jsBundleFile, jsBundleDir)
|
|
61
108
|
|
|
62
|
-
enabled
|
|
63
|
-
config."bundleIn${variant.buildType.name.capitalize()}" ?:
|
|
64
|
-
targetName.toLowerCase().contains("release")
|
|
109
|
+
enabled !debuggableVariants.contains(variant.name) ?: targetName.toLowerCase().contains("release")
|
|
65
110
|
}
|
|
66
|
-
|
|
111
|
+
|
|
67
112
|
runBefore("merge${targetName}Resources", generateBundledResourcesHash)
|
|
68
|
-
runBefore("merge${targetName}Assets", generateBundledResourcesHash)
|
|
113
|
+
runBefore("merge${targetName}Assets", generateBundledResourcesHash)
|
|
69
114
|
} else {
|
|
70
115
|
def jsBundleDirConfigName = "jsBundleDir${targetName}"
|
|
71
|
-
jsBundleDir = elvisFile(config."$jsBundleDirConfigName")
|
|
116
|
+
jsBundleDir = elvisFile(config."$jsBundleDirConfigName") ? elvisFile(config."$jsBundleDirConfigName").get():
|
|
72
117
|
file("$buildDir/intermediates/assets/${targetPath}")
|
|
73
118
|
|
|
74
119
|
def resourcesDirConfigName = "resourcesDir${targetName}"
|
|
75
|
-
resourcesDir = elvisFile(config."${resourcesDirConfigName}")
|
|
120
|
+
resourcesDir = elvisFile(config."${resourcesDirConfigName}") ? elvisFile(config."${resourcesDirConfigName}").get():
|
|
76
121
|
file("$buildDir/intermediates/res/merged/${targetPath}")
|
|
77
122
|
|
|
78
|
-
// In case version of 'Android Plugin for Gradle'' is lower than 1.3.0
|
|
123
|
+
// In case version of 'Android Plugin for Gradle'' is lower than 1.3.0
|
|
79
124
|
// '$buildDir' has slightly different structure - 'merged' folder
|
|
80
125
|
// does not exists so '${targetPath}' folder contains directly in 'res' folder.
|
|
81
126
|
if (!resourcesDir.exists() && file("$buildDir/intermediates/res/${targetPath}").exists()) {
|
|
@@ -89,14 +134,14 @@ gradle.projectsEvaluated {
|
|
|
89
134
|
generateBundledResourcesHash = tasks.create(
|
|
90
135
|
name: "generateBundledResourcesHash${targetName}",
|
|
91
136
|
type: Exec) {
|
|
92
|
-
commandLine (*nodeExecutableAndArgs, "${nodeModulesPath}/
|
|
137
|
+
commandLine (*nodeExecutableAndArgs, "${nodeModulesPath}/scripts/generateBundledResourcesHash.js", resourcesDir, jsBundleFile, jsBundleDir, resourcesMapTempFileName)
|
|
93
138
|
}
|
|
94
139
|
|
|
95
140
|
// Make this task run right before the bundle task
|
|
96
141
|
def recordFilesBeforeBundleCommand = tasks.create(
|
|
97
142
|
name: "recordFilesBeforeBundleCommand${targetName}",
|
|
98
143
|
type: Exec) {
|
|
99
|
-
commandLine (*nodeExecutableAndArgs, "${nodeModulesPath}/
|
|
144
|
+
commandLine (*nodeExecutableAndArgs, "${nodeModulesPath}/scripts/recordFilesBeforeBundleCommand.js", resourcesDir, resourcesMapTempFileName)
|
|
100
145
|
}
|
|
101
146
|
|
|
102
147
|
recordFilesBeforeBundleCommand.dependsOn("merge${targetName}Resources")
|
|
@@ -107,7 +152,8 @@ gradle.projectsEvaluated {
|
|
|
107
152
|
generateBundledResourcesHash.dependsOn("recordFilesBeforeBundleCommand${targetName}")
|
|
108
153
|
}
|
|
109
154
|
|
|
110
|
-
generateBundledResourcesHash.dependsOn("
|
|
155
|
+
generateBundledResourcesHash.dependsOn("createBundle${targetName}JsAndAssets")
|
|
156
|
+
|
|
111
157
|
runBefore("processArmeabi-v7a${targetName}Resources", generateBundledResourcesHash)
|
|
112
158
|
runBefore("processX86${targetName}Resources", generateBundledResourcesHash)
|
|
113
159
|
runBefore("processUniversal${targetName}Resources", generateBundledResourcesHash)
|
package/docs/api-js.md
CHANGED
|
@@ -128,7 +128,7 @@ The `codePush` decorator accepts an "options" object that allows you to customiz
|
|
|
128
128
|
|
|
129
129
|
* __minimumBackgroundDuration__ *(Number)* - Specifies the minimum number of seconds that the app needs to have been in the background before restarting the app. This property only applies to updates which are installed using `InstallMode.ON_NEXT_RESUME` or `InstallMode.ON_NEXT_SUSPEND`, and can be useful for getting your update in front of end users sooner, without being too obtrusive. Defaults to `0`, which has the effect of applying 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.
|
|
130
130
|
|
|
131
|
-
* __updateDialog__ *(UpdateDialogOptions)* - An "options" object used to determine whether a confirmation dialog should be displayed to the end user when an update is available, and if so, what strings to use. Defaults to `null`, which has the effect of disabling the dialog completely. Setting this to any truthy value will enable the dialog with the default strings, and passing an object to this parameter allows enabling the dialog as well as overriding one or more of the default strings. Before enabling this option within an App Store-distributed app, please refer to [this note](https://github.com/microsoft/react-native-code-push#
|
|
131
|
+
* __updateDialog__ *(UpdateDialogOptions)* - An "options" object used to determine whether a confirmation dialog should be displayed to the end user when an update is available, and if so, what strings to use. Defaults to `null`, which has the effect of disabling the dialog completely. Setting this to any truthy value will enable the dialog with the default strings, and passing an object to this parameter allows enabling the dialog as well as overriding one or more of the default strings. Before enabling this option within an App Store-distributed app, please refer to [this note](https://github.com/microsoft/react-native-code-push#app-store).
|
|
132
132
|
|
|
133
133
|
The following list represents the available options and their defaults:
|
|
134
134
|
|
package/docs/setup-android.md
CHANGED
|
@@ -27,16 +27,40 @@ In order to integrate CodePush into your Android project, please perform the fol
|
|
|
27
27
|
project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
2. In your `android/app/build.gradle` file, add the `codepush.gradle` file as an additional build task definition
|
|
30
|
+
2. In your `android/app/build.gradle` file, add the `codepush.gradle` file as an additional build task definition to the end of the file:
|
|
31
31
|
|
|
32
32
|
```gradle
|
|
33
33
|
...
|
|
34
|
-
apply from: "../../node_modules/react-native/react.gradle"
|
|
35
34
|
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
|
|
36
35
|
...
|
|
37
36
|
```
|
|
38
37
|
|
|
39
|
-
3. Update the `MainApplication
|
|
38
|
+
3. Update the `MainApplication` file to use CodePush via the following changes:
|
|
39
|
+
|
|
40
|
+
For React Native 0.73 and above: update the `MainApplication.kt`
|
|
41
|
+
|
|
42
|
+
```kotlin
|
|
43
|
+
...
|
|
44
|
+
// 1. Import the plugin class.
|
|
45
|
+
import com.microsoft.codepush.react.CodePush
|
|
46
|
+
|
|
47
|
+
class MainApplication : Application(), ReactApplication {
|
|
48
|
+
|
|
49
|
+
override val reactNativeHost: ReactNativeHost =
|
|
50
|
+
object : DefaultReactNativeHost(this) {
|
|
51
|
+
...
|
|
52
|
+
|
|
53
|
+
// 2. Override the getJSBundleFile method in order to let
|
|
54
|
+
// the CodePush runtime determine where to get the JS
|
|
55
|
+
// bundle location from on each app start
|
|
56
|
+
override fun getJSBundleFile(): String {
|
|
57
|
+
return CodePush.getJSBundleFile()
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
For React Native 0.72 and below: update the `MainApplication.java`
|
|
40
64
|
|
|
41
65
|
```java
|
|
42
66
|
...
|
package/docs/setup-ios.md
CHANGED
|
@@ -35,7 +35,7 @@ Once you've acquired the CodePush plugin, you need to integrate it into the Xcod
|
|
|
35
35
|
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
|
|
36
36
|
{
|
|
37
37
|
#if DEBUG
|
|
38
|
-
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"
|
|
38
|
+
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
|
|
39
39
|
#else
|
|
40
40
|
return [CodePush bundleURL];
|
|
41
41
|
#endif
|
package/docs/setup-windows.md
CHANGED
|
@@ -33,6 +33,29 @@ void App::OnLaunched(activation::LaunchActivatedEventArgs const& e)
|
|
|
33
33
|
...
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
+
#### Plugin Configuration (Windows) C#
|
|
37
|
+
|
|
38
|
+
1. add name space `Microsoft.CodePush` to `App.xaml.cs`
|
|
39
|
+
|
|
40
|
+
2. add app version and deployment key to `configMap` at the start of your app's `OnLaunched` method in `App.xaml.cs`.
|
|
41
|
+
|
|
42
|
+
```c#
|
|
43
|
+
using Microsoft.CodePush;
|
|
44
|
+
|
|
45
|
+
...
|
|
46
|
+
protected override void OnLaunched(LaunchActivatedEventArgs e)
|
|
47
|
+
{
|
|
48
|
+
Microsoft.CodePush.ReactNative.CodePushConfig.SetHost(Host);
|
|
49
|
+
IDictionary<string, string> configMap = new Dictionary<string, string>();
|
|
50
|
+
configMap.Add("appVersion", "1.0.0");
|
|
51
|
+
configMap.Add("deploymentKey", "deployment key");
|
|
52
|
+
Microsoft.CodePush.ReactNative.CodePushConfig.Init(configMap);
|
|
53
|
+
...
|
|
54
|
+
}
|
|
55
|
+
...
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
|
|
36
59
|
### Plugin Installation and Configuration for React Native Windows lower than 0.60
|
|
37
60
|
|
|
38
61
|
#### Plugin Installation (Windows)
|
package/ios/CodePush/CodePush.m
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
#import <React/RCTEventDispatcher.h>
|
|
6
6
|
#import <React/RCTRootView.h>
|
|
7
7
|
#import <React/RCTUtils.h>
|
|
8
|
+
#import <React/RCTReloadCommand.h>
|
|
8
9
|
#else // back compatibility for RN version < 0.40
|
|
9
10
|
#import "RCTAssert.h"
|
|
10
11
|
#import "RCTBridgeModule.h"
|
|
@@ -540,7 +541,7 @@ static NSString *const LatestRollbackCountKey = @"count";
|
|
|
540
541
|
[super.bridge setValue:[CodePush bundleURL] forKey:@"bundleURL"];
|
|
541
542
|
}
|
|
542
543
|
|
|
543
|
-
|
|
544
|
+
RCTTriggerReloadCommandListeners(@"react-native-code-push: Restart");
|
|
544
545
|
});
|
|
545
546
|
}
|
|
546
547
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleDevelopmentRegion</key>
|
|
6
|
+
<string>en</string>
|
|
7
|
+
<key>CFBundleExecutable</key>
|
|
8
|
+
<string>$(EXECUTABLE_NAME)</string>
|
|
9
|
+
<key>CFBundleIdentifier</key>
|
|
10
|
+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
|
11
|
+
<key>CFBundleInfoDictionaryVersion</key>
|
|
12
|
+
<string>6.0</string>
|
|
13
|
+
<key>CFBundleName</key>
|
|
14
|
+
<string>$(PRODUCT_NAME)</string>
|
|
15
|
+
<key>CFBundlePackageType</key>
|
|
16
|
+
<string>FMWK</string>
|
|
17
|
+
<key>CFBundleShortVersionString</key>
|
|
18
|
+
<string>1.0</string>
|
|
19
|
+
<key>CFBundleSignature</key>
|
|
20
|
+
<string>????</string>
|
|
21
|
+
<key>CFBundleVersion</key>
|
|
22
|
+
<string>$(CURRENT_PROJECT_VERSION)</string>
|
|
23
|
+
<key>NSPrincipalClass</key>
|
|
24
|
+
<string></string>
|
|
25
|
+
</dict>
|
|
26
|
+
</plist>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
The source code in this folder is taken from [https://github.com/ZipArchive/ZipArchive/tree/
|
|
1
|
+
The source code in this folder is taken from [https://github.com/ZipArchive/ZipArchive/tree/2.5.5/SSZipArchive](https://github.com/ZipArchive/ZipArchive/tree/2.5.5/SSZipArchive) which is [MIT licensed](https://github.com/ZipArchive/ZipArchive/blob/2.5.5/LICENSE.txt).
|
|
@@ -3,56 +3,157 @@
|
|
|
3
3
|
// SSZipArchive
|
|
4
4
|
//
|
|
5
5
|
// Created by Sam Soffes on 7/21/10.
|
|
6
|
-
// Copyright (c) Sam Soffes 2010-2015. All rights reserved.
|
|
7
6
|
//
|
|
8
7
|
|
|
9
8
|
#ifndef _SSZIPARCHIVE_H
|
|
10
9
|
#define _SSZIPARCHIVE_H
|
|
11
10
|
|
|
12
11
|
#import <Foundation/Foundation.h>
|
|
13
|
-
|
|
12
|
+
|
|
13
|
+
#import "SSZipCommon.h"
|
|
14
|
+
|
|
15
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
16
|
+
|
|
17
|
+
extern NSString *const SSZipArchiveErrorDomain;
|
|
18
|
+
typedef NS_ENUM(NSInteger, SSZipArchiveErrorCode) {
|
|
19
|
+
SSZipArchiveErrorCodeFailedOpenZipFile = -1,
|
|
20
|
+
SSZipArchiveErrorCodeFailedOpenFileInZip = -2,
|
|
21
|
+
SSZipArchiveErrorCodeFileInfoNotLoadable = -3,
|
|
22
|
+
SSZipArchiveErrorCodeFileContentNotReadable = -4,
|
|
23
|
+
SSZipArchiveErrorCodeFailedToWriteFile = -5,
|
|
24
|
+
SSZipArchiveErrorCodeInvalidArguments = -6,
|
|
25
|
+
SSZipArchiveErrorCodeSymlinkEscapesTargetDirectory = -7,
|
|
26
|
+
};
|
|
14
27
|
|
|
15
28
|
@protocol SSZipArchiveDelegate;
|
|
16
29
|
|
|
17
30
|
@interface SSZipArchive : NSObject
|
|
18
31
|
|
|
32
|
+
// Password check
|
|
33
|
+
+ (BOOL)isFilePasswordProtectedAtPath:(NSString *)path;
|
|
34
|
+
+ (BOOL)isPasswordValidForArchiveAtPath:(NSString *)path password:(NSString *)pw error:(NSError * _Nullable * _Nullable)error NS_SWIFT_NOTHROW;
|
|
35
|
+
|
|
36
|
+
// Total payload size
|
|
37
|
+
+ (NSNumber *)payloadSizeForArchiveAtPath:(NSString *)path error:(NSError **)error;
|
|
38
|
+
|
|
19
39
|
// Unzip
|
|
20
40
|
+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination;
|
|
21
|
-
+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination delegate:(id<SSZipArchiveDelegate>)delegate;
|
|
41
|
+
+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination delegate:(nullable id<SSZipArchiveDelegate>)delegate;
|
|
42
|
+
|
|
43
|
+
+ (BOOL)unzipFileAtPath:(NSString *)path
|
|
44
|
+
toDestination:(NSString *)destination
|
|
45
|
+
overwrite:(BOOL)overwrite
|
|
46
|
+
password:(nullable NSString *)password
|
|
47
|
+
error:(NSError * *)error;
|
|
48
|
+
|
|
49
|
+
+ (BOOL)unzipFileAtPath:(NSString *)path
|
|
50
|
+
toDestination:(NSString *)destination
|
|
51
|
+
overwrite:(BOOL)overwrite
|
|
52
|
+
password:(nullable NSString *)password
|
|
53
|
+
error:(NSError * *)error
|
|
54
|
+
delegate:(nullable id<SSZipArchiveDelegate>)delegate NS_REFINED_FOR_SWIFT;
|
|
55
|
+
|
|
56
|
+
+ (BOOL)unzipFileAtPath:(NSString *)path
|
|
57
|
+
toDestination:(NSString *)destination
|
|
58
|
+
preserveAttributes:(BOOL)preserveAttributes
|
|
59
|
+
overwrite:(BOOL)overwrite
|
|
60
|
+
password:(nullable NSString *)password
|
|
61
|
+
error:(NSError * *)error
|
|
62
|
+
delegate:(nullable id<SSZipArchiveDelegate>)delegate;
|
|
63
|
+
|
|
64
|
+
+ (BOOL)unzipFileAtPath:(NSString *)path
|
|
65
|
+
toDestination:(NSString *)destination
|
|
66
|
+
progressHandler:(void (^_Nullable)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
|
|
67
|
+
completionHandler:(void (^_Nullable)(NSString *path, BOOL succeeded, NSError * _Nullable error))completionHandler;
|
|
22
68
|
|
|
23
|
-
+ (BOOL)unzipFileAtPath:(NSString *)path
|
|
24
|
-
|
|
69
|
+
+ (BOOL)unzipFileAtPath:(NSString *)path
|
|
70
|
+
toDestination:(NSString *)destination
|
|
71
|
+
overwrite:(BOOL)overwrite
|
|
72
|
+
password:(nullable NSString *)password
|
|
73
|
+
progressHandler:(void (^_Nullable)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
|
|
74
|
+
completionHandler:(void (^_Nullable)(NSString *path, BOOL succeeded, NSError * _Nullable error))completionHandler;
|
|
25
75
|
|
|
26
76
|
+ (BOOL)unzipFileAtPath:(NSString *)path
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
77
|
+
toDestination:(NSString *)destination
|
|
78
|
+
preserveAttributes:(BOOL)preserveAttributes
|
|
79
|
+
overwrite:(BOOL)overwrite
|
|
80
|
+
nestedZipLevel:(NSInteger)nestedZipLevel
|
|
81
|
+
password:(nullable NSString *)password
|
|
82
|
+
error:(NSError **)error
|
|
83
|
+
delegate:(nullable id<SSZipArchiveDelegate>)delegate
|
|
84
|
+
progressHandler:(void (^_Nullable)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
|
|
85
|
+
completionHandler:(void (^_Nullable)(NSString *path, BOOL succeeded, NSError * _Nullable error))completionHandler;
|
|
30
86
|
|
|
31
87
|
+ (BOOL)unzipFileAtPath:(NSString *)path
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
88
|
+
toDestination:(NSString *)destination
|
|
89
|
+
preserveAttributes:(BOOL)preserveAttributes
|
|
90
|
+
overwrite:(BOOL)overwrite
|
|
91
|
+
symlinksValidWithin:(nullable NSString *)symlinksValidWithin
|
|
92
|
+
nestedZipLevel:(NSInteger)nestedZipLevel
|
|
93
|
+
password:(nullable NSString *)password
|
|
94
|
+
error:(NSError **)error
|
|
95
|
+
delegate:(nullable id<SSZipArchiveDelegate>)delegate
|
|
96
|
+
progressHandler:(void (^_Nullable)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
|
|
97
|
+
completionHandler:(void (^_Nullable)(NSString *path, BOOL succeeded, NSError * _Nullable error))completionHandler;
|
|
37
98
|
|
|
38
99
|
// Zip
|
|
100
|
+
// default compression level is Z_DEFAULT_COMPRESSION (from "zlib.h")
|
|
101
|
+
// keepParentDirectory: if YES, then unzipping will give `directoryName/fileName`. If NO, then unzipping will just give `fileName`. Default is NO.
|
|
39
102
|
|
|
40
103
|
// without password
|
|
41
|
-
+ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray *)paths;
|
|
104
|
+
+ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray<NSString *> *)paths;
|
|
42
105
|
+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath;
|
|
43
|
-
+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath keepParentDirectory:(BOOL)keepParentDirector;
|
|
44
106
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
107
|
+
+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath keepParentDirectory:(BOOL)keepParentDirectory;
|
|
108
|
+
|
|
109
|
+
// with optional password, default encryption is AES
|
|
110
|
+
// don't use AES if you need compatibility with native macOS unzip and Archive Utility
|
|
111
|
+
+ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray<NSString *> *)paths withPassword:(nullable NSString *)password;
|
|
112
|
+
+ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray<NSString *> *)paths withPassword:(nullable NSString *)password progressHandler:(void(^ _Nullable)(NSUInteger entryNumber, NSUInteger total))progressHandler;
|
|
113
|
+
+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath withPassword:(nullable NSString *)password;
|
|
114
|
+
+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath keepParentDirectory:(BOOL)keepParentDirectory withPassword:(nullable NSString *)password;
|
|
115
|
+
+ (BOOL)createZipFileAtPath:(NSString *)path
|
|
116
|
+
withContentsOfDirectory:(NSString *)directoryPath
|
|
117
|
+
keepParentDirectory:(BOOL)keepParentDirectory
|
|
118
|
+
withPassword:(nullable NSString *)password
|
|
119
|
+
andProgressHandler:(void(^ _Nullable)(NSUInteger entryNumber, NSUInteger total))progressHandler;
|
|
120
|
+
+ (BOOL)createZipFileAtPath:(NSString *)path
|
|
121
|
+
withContentsOfDirectory:(NSString *)directoryPath
|
|
122
|
+
keepParentDirectory:(BOOL)keepParentDirectory
|
|
123
|
+
compressionLevel:(int)compressionLevel
|
|
124
|
+
password:(nullable NSString *)password
|
|
125
|
+
AES:(BOOL)aes
|
|
126
|
+
progressHandler:(void(^ _Nullable)(NSUInteger entryNumber, NSUInteger total))progressHandler;
|
|
127
|
+
//suport symlink compress --file
|
|
128
|
+
+ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray<NSString *> *)paths withPassword:(nullable NSString *)password keepSymlinks:(BOOL)keeplinks;
|
|
129
|
+
//suport symlink compress --directory
|
|
130
|
+
+ (BOOL)createZipFileAtPath:(NSString *)path
|
|
131
|
+
withContentsOfDirectory:(NSString *)directoryPath
|
|
132
|
+
keepParentDirectory:(BOOL)keepParentDirectory
|
|
133
|
+
compressionLevel:(int)compressionLevel
|
|
134
|
+
password:(nullable NSString *)password
|
|
135
|
+
AES:(BOOL)aes
|
|
136
|
+
progressHandler:(void(^ _Nullable)(NSUInteger entryNumber, NSUInteger total))progressHandler
|
|
137
|
+
keepSymlinks:(BOOL)keeplinks;
|
|
138
|
+
|
|
139
|
+
- (instancetype)init NS_UNAVAILABLE;
|
|
140
|
+
- (instancetype)initWithPath:(NSString *)path NS_DESIGNATED_INITIALIZER;
|
|
141
|
+
- (BOOL)open;
|
|
142
|
+
- (BOOL)openForAppending;
|
|
143
|
+
|
|
144
|
+
/// write empty folder
|
|
145
|
+
- (BOOL)writeFolderAtPath:(NSString *)path withFolderName:(NSString *)folderName withPassword:(nullable NSString *)password;
|
|
146
|
+
/// write file
|
|
147
|
+
- (BOOL)writeFile:(NSString *)path withPassword:(nullable NSString *)password;
|
|
148
|
+
- (BOOL)writeFileAtPath:(NSString *)path withFileName:(nullable NSString *)fileName withPassword:(nullable NSString *)password;
|
|
149
|
+
- (BOOL)writeFileAtPath:(NSString *)path withFileName:(nullable NSString *)fileName compressionLevel:(int)compressionLevel password:(nullable NSString *)password AES:(BOOL)aes;
|
|
150
|
+
///write symlink files
|
|
151
|
+
- (BOOL)writeSymlinkFileAtPath:(NSString *)path withFileName:(nullable NSString *)fileName compressionLevel:(int)compressionLevel password:(nullable NSString *)password AES:(BOOL)aes;
|
|
152
|
+
/// write data
|
|
153
|
+
- (BOOL)writeData:(NSData *)data filename:(nullable NSString *)filename withPassword:(nullable NSString *)password;
|
|
154
|
+
- (BOOL)writeData:(NSData *)data filename:(nullable NSString *)filename compressionLevel:(int)compressionLevel password:(nullable NSString *)password AES:(BOOL)aes;
|
|
155
|
+
|
|
156
|
+
- (BOOL)close;
|
|
56
157
|
|
|
57
158
|
@end
|
|
58
159
|
|
|
@@ -69,8 +170,9 @@
|
|
|
69
170
|
- (void)zipArchiveDidUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath unzippedFilePath:(NSString *)unzippedFilePath;
|
|
70
171
|
|
|
71
172
|
- (void)zipArchiveProgressEvent:(unsigned long long)loaded total:(unsigned long long)total;
|
|
72
|
-
- (void)zipArchiveDidUnzipArchiveFile:(NSString *)zipFile entryPath:(NSString *)entryPath destPath:(NSString *)destPath;
|
|
73
173
|
|
|
74
174
|
@end
|
|
75
175
|
|
|
176
|
+
NS_ASSUME_NONNULL_END
|
|
177
|
+
|
|
76
178
|
#endif /* _SSZIPARCHIVE_H */
|