@appzung/react-native-code-push 8.3.2 → 10.0.0-rc1
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/CodePush.js +22 -19
- package/CodePush.podspec +3 -3
- package/LICENSE.md +1 -1
- package/README.md +159 -296
- package/android/app/.gradle/config.properties +2 -0
- package/android/app/build.gradle +2 -0
- package/android/app/local.properties +8 -0
- package/android/app/src/main/AndroidManifest.xml +1 -2
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java +27 -21
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushBuilder.java +5 -5
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushConstants.java +1 -1
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushDialog.java +1 -1
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushInstallMode.java +2 -2
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushInvalidPublicKeyException.java +2 -2
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushInvalidUpdateException.java +1 -1
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushMalformedDataException.java +2 -2
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java +5 -5
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushNotInitializedException.java +2 -2
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushTelemetryManager.java +14 -14
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUnknownException.java +2 -2
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateManager.java +1 -1
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateState.java +2 -2
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateUtils.java +16 -9
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUtils.java +1 -1
- package/android/app/src/main/java/com/microsoft/codepush/react/DownloadProgress.java +1 -1
- package/android/app/src/main/java/com/microsoft/codepush/react/DownloadProgressCallback.java +1 -1
- package/android/app/src/main/java/com/microsoft/codepush/react/FileUtils.java +1 -1
- package/android/app/src/main/java/com/microsoft/codepush/react/ReactInstanceHolder.java +1 -1
- package/android/app/src/main/java/com/microsoft/codepush/react/SettingsManager.java +1 -1
- package/android/app/src/main/java/com/microsoft/codepush/react/TLSSocketFactory.java +1 -1
- package/android/build.gradle +3 -0
- package/android/codepush.gradle +3 -3
- package/docs/advanced-usage.md +56 -0
- package/docs/api-android.md +12 -75
- package/docs/api-ios.md +5 -17
- package/docs/api-js.md +18 -55
- package/docs/setup-android.md +15 -397
- package/docs/setup-ios.md +24 -198
- package/docs/setup-windows.md +7 -74
- package/ios/CodePush/CodePush.h +4 -4
- package/ios/CodePush/CodePush.m +10 -9
- package/ios/CodePush/CodePushConfig.m +14 -11
- package/ios/CodePush/CodePushPackage.m +60 -60
- package/ios/CodePush/CodePushTelemetryManager.m +13 -13
- package/ios/CodePush.xcodeproj/project.pbxproj +24 -470
- package/ios/PrivacyInfo.xcprivacy +31 -0
- package/package.json +27 -24
- package/react-native.config.js +1 -1
- package/scripts/generateBundledResourcesHash.js +1 -1
- package/scripts/getFilesInFolder.js +1 -1
- package/scripts/recordFilesBeforeBundleCommand.js +1 -1
- package/typings/react-native-code-push.d.ts +22 -22
- package/windows/CodePush/CodePushConfig.cpp +3 -3
- package/windows/CodePush/CodePushConfig.h +3 -3
- package/windows/CodePush/CodePushNativeModule.cpp +27 -27
- package/windows/CodePush/CodePushNativeModule.h +4 -4
- package/windows/CodePush/CodePushTelemetryManager.cpp +12 -12
- package/windows/CodePush/CodePushTelemetryManager.h +1 -1
- package/.azurepipelines/build-rn-code-push-1es.yml +0 -104
- package/.azurepipelines/test-rn-code-push.yml +0 -94
- package/.config/CredScanSuppressions.json +0 -14
- package/SECURITY.md +0 -41
- package/docs/multi-deployment-testing-android.md +0 -148
- package/docs/multi-deployment-testing-ios.md +0 -59
- package/ios/CodePush/Base64/Base64/MF_Base64Additions.h +0 -34
- package/ios/CodePush/Base64/Base64/MF_Base64Additions.m +0 -252
- package/ios/CodePush/Base64/README.md +0 -47
- package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithm.h +0 -69
- package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.h +0 -16
- package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.m +0 -51
- package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.h +0 -15
- package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.m +0 -55
- package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.h +0 -24
- package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.m +0 -41
- package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.h +0 -28
- package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.m +0 -205
- package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.h +0 -103
- package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.m +0 -322
- package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.h +0 -37
- package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.m +0 -145
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.h +0 -35
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.m +0 -551
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTRSAlgorithm.h +0 -23
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.h +0 -43
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.m +0 -230
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.h +0 -31
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.m +0 -113
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.h +0 -38
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.m +0 -500
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.h +0 -18
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.m +0 -214
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.h +0 -23
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.m +0 -29
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.h +0 -19
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.m +0 -68
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.h +0 -18
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.m +0 -72
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.h +0 -67
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.m +0 -111
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.h +0 -119
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.m +0 -307
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.h +0 -94
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.m +0 -619
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.h +0 -164
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.m +0 -514
- package/ios/CodePush/JWT/Core/Coding/JWTCoding.h +0 -24
- package/ios/CodePush/JWT/Core/Coding/JWTCoding.m +0 -11
- package/ios/CodePush/JWT/Core/FrameworkSupplement/JWT.h +0 -52
- package/ios/CodePush/JWT/Core/FrameworkSupplement/Map.modulemap +0 -5
- package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.h +0 -28
- package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.m +0 -70
- package/ios/CodePush/JWT/Core/Supplement/JWTDeprecations.h +0 -22
- package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.h +0 -34
- package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.m +0 -73
- package/ios/CodePush/JWT/LICENSE +0 -19
- package/ios/CodePush/JWT/README.md +0 -489
- package/ios/CodePush/SSZipArchive/Common.h +0 -81
- package/ios/CodePush/SSZipArchive/README.md +0 -1
- package/ios/CodePush/SSZipArchive/SSZipArchive.h +0 -76
- package/ios/CodePush/SSZipArchive/SSZipArchive.m +0 -691
- 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/scripts/postlink/android/postlink.js +0 -87
- package/scripts/postlink/ios/postlink.js +0 -116
- package/scripts/postlink/run.js +0 -11
- package/scripts/postunlink/android/postunlink.js +0 -74
- package/scripts/postunlink/ios/postunlink.js +0 -87
- package/scripts/postunlink/run.js +0 -11
- package/scripts/tools/linkToolsAndroid.js +0 -57
- package/scripts/tools/linkToolsIos.js +0 -130
- package/windows-legacy/CodePush/CodePush.csproj +0 -128
- package/windows-legacy/CodePush/CodePushUtils.cs +0 -47
- package/windows-legacy/CodePush/FileUtils.cs +0 -40
- package/windows-legacy/CodePush/Properties/AssemblyInfo.cs +0 -29
- package/windows-legacy/CodePush/Properties/CodePush.rd.xml +0 -33
- package/windows-legacy/CodePush/UpdateManager.cs +0 -305
- package/windows-legacy/CodePush/UpdateUtils.cs +0 -46
- package/windows-legacy/CodePush.Net46/Adapters/Http/HttpProgress.cs +0 -28
- package/windows-legacy/CodePush.Net46/Adapters/Storage/ApplicationDataContainer.cs +0 -106
- package/windows-legacy/CodePush.Net46/CodePush.Net46.csproj +0 -103
- package/windows-legacy/CodePush.Net46/CodePushUtils.cs +0 -158
- package/windows-legacy/CodePush.Net46/FileUtils.cs +0 -55
- package/windows-legacy/CodePush.Net46/Properties/AssemblyInfo.cs +0 -36
- package/windows-legacy/CodePush.Net46/UpdateManager.cs +0 -330
- package/windows-legacy/CodePush.Net46/UpdateUtils.cs +0 -70
- package/windows-legacy/CodePush.Net46/packages.config +0 -5
- package/windows-legacy/CodePush.Net46.Test/ApplicationDataContainerTest.cs +0 -105
- package/windows-legacy/CodePush.Net46.Test/CodePush.Net46.Test.csproj +0 -137
- package/windows-legacy/CodePush.Net46.Test/Properties/AssemblyInfo.cs +0 -36
- package/windows-legacy/CodePush.Net46.Test/TelemetryManagerTest.cs +0 -117
- package/windows-legacy/CodePush.Net46.Test/app.config +0 -11
- package/windows-legacy/CodePush.Net46.Test/packages.config +0 -4
- package/windows-legacy/CodePush.Shared/CodePush.Shared.projitems +0 -22
- package/windows-legacy/CodePush.Shared/CodePush.Shared.shproj +0 -13
- package/windows-legacy/CodePush.Shared/CodePushConstants.cs +0 -35
- package/windows-legacy/CodePush.Shared/CodePushNativeModule.cs +0 -329
- package/windows-legacy/CodePush.Shared/CodePushReactPackage.cs +0 -235
- package/windows-legacy/CodePush.Shared/CodePushUtils.cs +0 -70
- package/windows-legacy/CodePush.Shared/InstallMode.cs +0 -9
- package/windows-legacy/CodePush.Shared/MinimumBackgroundListener.cs +0 -44
- package/windows-legacy/CodePush.Shared/SettingsManager.cs +0 -148
- package/windows-legacy/CodePush.Shared/TelemetryManager.cs +0 -250
- package/windows-legacy/CodePush.Shared/UpdateState.cs +0 -9
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
/* zip.h -- IO on .zip files using zlib
|
|
2
|
-
Version 1.1, February 14h, 2010
|
|
3
|
-
part of the MiniZip project
|
|
4
|
-
|
|
5
|
-
Copyright (C) 1998-2010 Gilles Vollant
|
|
6
|
-
http://www.winimage.com/zLibDll/minizip.html
|
|
7
|
-
Modifications for Zip64 support
|
|
8
|
-
Copyright (C) 2009-2010 Mathias Svensson
|
|
9
|
-
http://result42.com
|
|
10
|
-
|
|
11
|
-
This program is distributed under the terms of the same license as zlib.
|
|
12
|
-
See the accompanying LICENSE file for the full text of the license.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
#ifndef _ZIP_H
|
|
16
|
-
#define _ZIP_H
|
|
17
|
-
|
|
18
|
-
#define HAVE_AES
|
|
19
|
-
|
|
20
|
-
#ifdef __cplusplus
|
|
21
|
-
extern "C" {
|
|
22
|
-
#endif
|
|
23
|
-
|
|
24
|
-
#ifndef _ZLIB_H
|
|
25
|
-
# include "zlib.h"
|
|
26
|
-
#endif
|
|
27
|
-
|
|
28
|
-
#ifndef _ZLIBIOAPI_H
|
|
29
|
-
# include "ioapi.h"
|
|
30
|
-
#endif
|
|
31
|
-
|
|
32
|
-
#ifdef HAVE_BZIP2
|
|
33
|
-
# include "bzlib.h"
|
|
34
|
-
#endif
|
|
35
|
-
|
|
36
|
-
#define Z_BZIP2ED 12
|
|
37
|
-
|
|
38
|
-
#if defined(STRICTZIP) || defined(STRICTZIPUNZIP)
|
|
39
|
-
/* like the STRICT of WIN32, we define a pointer that cannot be converted
|
|
40
|
-
from (void*) without cast */
|
|
41
|
-
typedef struct TagzipFile__ { int unused; } zipFile__;
|
|
42
|
-
typedef zipFile__ *zipFile;
|
|
43
|
-
#else
|
|
44
|
-
typedef voidp zipFile;
|
|
45
|
-
#endif
|
|
46
|
-
|
|
47
|
-
#define ZIP_OK (0)
|
|
48
|
-
#define ZIP_EOF (0)
|
|
49
|
-
#define ZIP_ERRNO (Z_ERRNO)
|
|
50
|
-
#define ZIP_PARAMERROR (-102)
|
|
51
|
-
#define ZIP_BADZIPFILE (-103)
|
|
52
|
-
#define ZIP_INTERNALERROR (-104)
|
|
53
|
-
|
|
54
|
-
#ifndef DEF_MEM_LEVEL
|
|
55
|
-
# if MAX_MEM_LEVEL >= 8
|
|
56
|
-
# define DEF_MEM_LEVEL 8
|
|
57
|
-
# else
|
|
58
|
-
# define DEF_MEM_LEVEL MAX_MEM_LEVEL
|
|
59
|
-
# endif
|
|
60
|
-
#endif
|
|
61
|
-
/* default memLevel */
|
|
62
|
-
|
|
63
|
-
/* tm_zip contain date/time info */
|
|
64
|
-
typedef struct tm_zip_s
|
|
65
|
-
{
|
|
66
|
-
uInt tm_sec; /* seconds after the minute - [0,59] */
|
|
67
|
-
uInt tm_min; /* minutes after the hour - [0,59] */
|
|
68
|
-
uInt tm_hour; /* hours since midnight - [0,23] */
|
|
69
|
-
uInt tm_mday; /* day of the month - [1,31] */
|
|
70
|
-
uInt tm_mon; /* months since January - [0,11] */
|
|
71
|
-
uInt tm_year; /* years - [1980..2044] */
|
|
72
|
-
} tm_zip;
|
|
73
|
-
|
|
74
|
-
typedef struct
|
|
75
|
-
{
|
|
76
|
-
tm_zip tmz_date; /* date in understandable format */
|
|
77
|
-
uLong dosDate; /* if dos_date == 0, tmu_date is used */
|
|
78
|
-
uLong internal_fa; /* internal file attributes 2 bytes */
|
|
79
|
-
uLong external_fa; /* external file attributes 4 bytes */
|
|
80
|
-
} zip_fileinfo;
|
|
81
|
-
|
|
82
|
-
typedef const char* zipcharpc;
|
|
83
|
-
|
|
84
|
-
#define APPEND_STATUS_CREATE (0)
|
|
85
|
-
#define APPEND_STATUS_CREATEAFTER (1)
|
|
86
|
-
#define APPEND_STATUS_ADDINZIP (2)
|
|
87
|
-
|
|
88
|
-
/***************************************************************************/
|
|
89
|
-
/* Writing a zip file */
|
|
90
|
-
|
|
91
|
-
extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append));
|
|
92
|
-
extern zipFile ZEXPORT zipOpen64 OF((const void *pathname, int append));
|
|
93
|
-
/* Create a zipfile.
|
|
94
|
-
|
|
95
|
-
pathname should contain the full pathname (by example, on a Windows XP computer
|
|
96
|
-
"c:\\zlib\\zlib113.zip" or on an Unix computer "zlib/zlib113.zip".
|
|
97
|
-
|
|
98
|
-
return NULL if zipfile cannot be opened
|
|
99
|
-
return zipFile handle if no error
|
|
100
|
-
|
|
101
|
-
If the file pathname exist and append == APPEND_STATUS_CREATEAFTER, the zip
|
|
102
|
-
will be created at the end of the file. (useful if the file contain a self extractor code)
|
|
103
|
-
If the file pathname exist and append == APPEND_STATUS_ADDINZIP, we will add files in existing
|
|
104
|
-
zip (be sure you don't add file that doesn't exist)
|
|
105
|
-
|
|
106
|
-
NOTE: There is no delete function into a zipfile. If you want delete file into a zipfile,
|
|
107
|
-
you must open a zipfile, and create another. Of course, you can use RAW reading and writing to copy
|
|
108
|
-
the file you did not want delete. */
|
|
109
|
-
|
|
110
|
-
extern zipFile ZEXPORT zipOpen2 OF((const char *pathname, int append, zipcharpc* globalcomment,
|
|
111
|
-
zlib_filefunc_def* pzlib_filefunc_def));
|
|
112
|
-
|
|
113
|
-
extern zipFile ZEXPORT zipOpen2_64 OF((const void *pathname, int append, zipcharpc* globalcomment,
|
|
114
|
-
zlib_filefunc64_def* pzlib_filefunc_def));
|
|
115
|
-
|
|
116
|
-
extern zipFile ZEXPORT zipOpen3 OF((const char *pathname, int append, ZPOS64_T disk_size,
|
|
117
|
-
zipcharpc* globalcomment, zlib_filefunc_def* pzlib_filefunc_def));
|
|
118
|
-
/* Same as zipOpen2 but allows specification of spanned zip size */
|
|
119
|
-
|
|
120
|
-
extern zipFile ZEXPORT zipOpen3_64 OF((const void *pathname, int append, ZPOS64_T disk_size,
|
|
121
|
-
zipcharpc* globalcomment, zlib_filefunc64_def* pzlib_filefunc_def));
|
|
122
|
-
|
|
123
|
-
extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
|
124
|
-
const void* extrafield_local, uInt size_extrafield_local, const void* extrafield_global,
|
|
125
|
-
uInt size_extrafield_global, const char* comment, int method, int level));
|
|
126
|
-
/* Open a file in the ZIP for writing.
|
|
127
|
-
|
|
128
|
-
filename : the filename in zip (if NULL, '-' without quote will be used
|
|
129
|
-
*zipfi contain supplemental information
|
|
130
|
-
extrafield_local buffer to store the local header extra field data, can be NULL
|
|
131
|
-
size_extrafield_local size of extrafield_local buffer
|
|
132
|
-
extrafield_global buffer to store the global header extra field data, can be NULL
|
|
133
|
-
size_extrafield_global size of extrafield_local buffer
|
|
134
|
-
comment buffer for comment string
|
|
135
|
-
method contain the compression method (0 for store, Z_DEFLATED for deflate)
|
|
136
|
-
level contain the level of compression (can be Z_DEFAULT_COMPRESSION)
|
|
137
|
-
zip64 is set to 1 if a zip64 extended information block should be added to the local file header.
|
|
138
|
-
this MUST be '1' if the uncompressed size is >= 0xffffffff. */
|
|
139
|
-
|
|
140
|
-
extern int ZEXPORT zipOpenNewFileInZip64 OF((zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
|
141
|
-
const void* extrafield_local, uInt size_extrafield_local, const void* extrafield_global,
|
|
142
|
-
uInt size_extrafield_global, const char* comment, int method, int level, int zip64));
|
|
143
|
-
/* Same as zipOpenNewFileInZip with zip64 support */
|
|
144
|
-
|
|
145
|
-
extern int ZEXPORT zipOpenNewFileInZip2 OF((zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
|
146
|
-
const void* extrafield_local, uInt size_extrafield_local, const void* extrafield_global,
|
|
147
|
-
uInt size_extrafield_global, const char* comment, int method, int level, int raw));
|
|
148
|
-
/* Same as zipOpenNewFileInZip, except if raw=1, we write raw file */
|
|
149
|
-
|
|
150
|
-
extern int ZEXPORT zipOpenNewFileInZip2_64 OF((zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
|
151
|
-
const void* extrafield_local, uInt size_extrafield_local, const void* extrafield_global,
|
|
152
|
-
uInt size_extrafield_global, const char* comment, int method, int level, int raw, int zip64));
|
|
153
|
-
/* Same as zipOpenNewFileInZip3 with zip64 support */
|
|
154
|
-
|
|
155
|
-
extern int ZEXPORT zipOpenNewFileInZip3 OF((zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
|
156
|
-
const void* extrafield_local, uInt size_extrafield_local, const void* extrafield_global,
|
|
157
|
-
uInt size_extrafield_global, const char* comment, int method, int level, int raw, int windowBits, int memLevel,
|
|
158
|
-
int strategy, const char* password, uLong crcForCrypting));
|
|
159
|
-
/* Same as zipOpenNewFileInZip2, except
|
|
160
|
-
windowBits, memLevel, strategy : see parameter strategy in deflateInit2
|
|
161
|
-
password : crypting password (NULL for no crypting)
|
|
162
|
-
crcForCrypting : crc of file to compress (needed for crypting) */
|
|
163
|
-
|
|
164
|
-
extern int ZEXPORT zipOpenNewFileInZip3_64 OF((zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
|
165
|
-
const void* extrafield_local, uInt size_extrafield_local, const void* extrafield_global,
|
|
166
|
-
uInt size_extrafield_global, const char* comment, int method, int level, int raw, int windowBits, int memLevel,
|
|
167
|
-
int strategy, const char* password, uLong crcForCrypting, int zip64));
|
|
168
|
-
/* Same as zipOpenNewFileInZip3 with zip64 support */
|
|
169
|
-
|
|
170
|
-
extern int ZEXPORT zipOpenNewFileInZip4 OF((zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
|
171
|
-
const void* extrafield_local, uInt size_extrafield_local, const void* extrafield_global,
|
|
172
|
-
uInt size_extrafield_global, const char* comment, int method, int level, int raw, int windowBits, int memLevel,
|
|
173
|
-
int strategy, const char* password, uLong crcForCrypting, uLong versionMadeBy, uLong flagBase));
|
|
174
|
-
/* Same as zipOpenNewFileInZip3 except versionMadeBy & flag fields */
|
|
175
|
-
|
|
176
|
-
extern int ZEXPORT zipOpenNewFileInZip4_64 OF((zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
|
177
|
-
const void* extrafield_local, uInt size_extrafield_local, const void* extrafield_global,
|
|
178
|
-
uInt size_extrafield_global, const char* comment, int method, int level, int raw, int windowBits, int memLevel,
|
|
179
|
-
int strategy, const char* password, uLong crcForCrypting, uLong versionMadeBy, uLong flagBase, int zip64));
|
|
180
|
-
/* Same as zipOpenNewFileInZip4 with zip64 support */
|
|
181
|
-
|
|
182
|
-
extern int ZEXPORT zipWriteInFileInZip OF((zipFile file, const void* buf, unsigned len));
|
|
183
|
-
/* Write data in the zipfile */
|
|
184
|
-
|
|
185
|
-
extern int ZEXPORT zipCloseFileInZip OF((zipFile file));
|
|
186
|
-
/* Close the current file in the zipfile */
|
|
187
|
-
|
|
188
|
-
extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file, uLong uncompressed_size, uLong crc32));
|
|
189
|
-
extern int ZEXPORT zipCloseFileInZipRaw64 OF((zipFile file, ZPOS64_T uncompressed_size, uLong crc32));
|
|
190
|
-
/* Close the current file in the zipfile, for file opened with parameter raw=1 in zipOpenNewFileInZip2
|
|
191
|
-
uncompressed_size and crc32 are value for the uncompressed size */
|
|
192
|
-
|
|
193
|
-
extern int ZEXPORT zipClose OF((zipFile file, const char* global_comment));
|
|
194
|
-
/* Close the zipfile */
|
|
195
|
-
|
|
196
|
-
/***************************************************************************/
|
|
197
|
-
|
|
198
|
-
#ifdef __cplusplus
|
|
199
|
-
}
|
|
200
|
-
#endif
|
|
201
|
-
|
|
202
|
-
#endif /* _ZIP_H */
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
var linkTools = require('../../tools/linkToolsAndroid');
|
|
2
|
-
var fs = require("fs");
|
|
3
|
-
var inquirer = require('inquirer');
|
|
4
|
-
|
|
5
|
-
module.exports = () => {
|
|
6
|
-
|
|
7
|
-
console.log("Running android postlink script");
|
|
8
|
-
|
|
9
|
-
var buildGradlePath = linkTools.getBuildGradlePath();
|
|
10
|
-
var mainApplicationPath = linkTools.getMainApplicationLocation();
|
|
11
|
-
|
|
12
|
-
// 1. Add the getJSBundleFile override
|
|
13
|
-
var getJSBundleFileOverride = linkTools.getJSBundleFileOverride;
|
|
14
|
-
|
|
15
|
-
if (mainApplicationPath) {
|
|
16
|
-
var mainApplicationContents = fs.readFileSync(mainApplicationPath, "utf8");
|
|
17
|
-
if (linkTools.isJsBundleOverridden(mainApplicationContents)) {
|
|
18
|
-
console.log(`"getJSBundleFile" is already overridden`);
|
|
19
|
-
} else {
|
|
20
|
-
var reactNativeHostInstantiation = linkTools.reactNativeHostInstantiation;
|
|
21
|
-
mainApplicationContents = mainApplicationContents.replace(reactNativeHostInstantiation,
|
|
22
|
-
`${reactNativeHostInstantiation}${getJSBundleFileOverride}`);
|
|
23
|
-
fs.writeFileSync(mainApplicationPath, mainApplicationContents);
|
|
24
|
-
}
|
|
25
|
-
} else {
|
|
26
|
-
var mainActivityPath = linkTools.getMainActivityPath();
|
|
27
|
-
if (mainActivityPath) {
|
|
28
|
-
var mainActivityContents = fs.readFileSync(mainActivityPath, "utf8");
|
|
29
|
-
if (linkTools.isJsBundleOverridden(mainActivityContents)) {
|
|
30
|
-
console.log(`"getJSBundleFile" is already overridden`);
|
|
31
|
-
} else {
|
|
32
|
-
var mainActivityClassDeclaration = linkTools.mainActivityClassDeclaration;
|
|
33
|
-
mainActivityContents = mainActivityContents.replace(mainActivityClassDeclaration,
|
|
34
|
-
`${mainActivityClassDeclaration}${getJSBundleFileOverride}`);
|
|
35
|
-
fs.writeFileSync(mainActivityPath, mainActivityContents);
|
|
36
|
-
}
|
|
37
|
-
} else {
|
|
38
|
-
return Promise.reject(`Couldn't find Android application entry point. You might need to update it manually. \
|
|
39
|
-
Please refer to plugin configuration section for Android at \
|
|
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
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (!fs.existsSync(buildGradlePath)) {
|
|
45
|
-
return Promise.reject(`Couldn't find build.gradle file. You might need to update it manually. \
|
|
46
|
-
Please refer to plugin installation section for Android at \
|
|
47
|
-
https://github.com/microsoft/react-native-code-push/blob/master/docs/setup-android.md#plugin-installation-android---manual`);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// 2. Add the codepush.gradle build task definitions
|
|
51
|
-
var buildGradleContents = fs.readFileSync(buildGradlePath, "utf8");
|
|
52
|
-
var reactGradleLink = buildGradleContents.match(/\napply from: ["'].*?react\.gradle["']/)[0];
|
|
53
|
-
var codePushGradleLink = linkTools.codePushGradleLink;
|
|
54
|
-
if (~buildGradleContents.indexOf(codePushGradleLink)) {
|
|
55
|
-
console.log(`"codepush.gradle" is already linked in the build definition`);
|
|
56
|
-
} else {
|
|
57
|
-
buildGradleContents = buildGradleContents.replace(reactGradleLink,
|
|
58
|
-
`${reactGradleLink}${codePushGradleLink}`);
|
|
59
|
-
fs.writeFileSync(buildGradlePath, buildGradleContents);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
//3. Add deployment key
|
|
63
|
-
var stringsResourcesPath = linkTools.getStringsResourcesPath();
|
|
64
|
-
if (!stringsResourcesPath) {
|
|
65
|
-
return Promise.reject(new Error(`Couldn't find strings.xml. You might need to update it manually.`));
|
|
66
|
-
} else {
|
|
67
|
-
var stringsResourcesContent = fs.readFileSync(stringsResourcesPath, "utf8");
|
|
68
|
-
var deploymentKeyName = linkTools.deploymentKeyName;
|
|
69
|
-
if (~stringsResourcesContent.indexOf(deploymentKeyName)) {
|
|
70
|
-
console.log(`${deploymentKeyName} already specified in the strings.xml`);
|
|
71
|
-
} else {
|
|
72
|
-
return inquirer.prompt({
|
|
73
|
-
"type": "input",
|
|
74
|
-
"name": "androidDeploymentKey",
|
|
75
|
-
"message": "What is your CodePush deployment key for Android (hit <ENTER> to ignore)"
|
|
76
|
-
}).then(function(answer) {
|
|
77
|
-
var insertAfterString = "<resources>";
|
|
78
|
-
var deploymentKeyString = `\t<string moduleConfig="true" name="${deploymentKeyName}">${answer.androidDeploymentKey || "deployment-key-here"}</string>`;
|
|
79
|
-
stringsResourcesContent = stringsResourcesContent.replace(insertAfterString,`${insertAfterString}\n${deploymentKeyString}`);
|
|
80
|
-
fs.writeFileSync(stringsResourcesPath, stringsResourcesContent);
|
|
81
|
-
return Promise.resolve();
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return Promise.resolve();
|
|
87
|
-
}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
var linkTools = require('../../tools/linkToolsIos');
|
|
3
|
-
var fs = require("fs");
|
|
4
|
-
var inquirer = require('inquirer');
|
|
5
|
-
var plist = require("plist");
|
|
6
|
-
var semver = require('semver');
|
|
7
|
-
|
|
8
|
-
var package = require('../../../../../package.json');
|
|
9
|
-
|
|
10
|
-
module.exports = () => {
|
|
11
|
-
|
|
12
|
-
console.log("Running ios postlink script");
|
|
13
|
-
|
|
14
|
-
var appDelegatePath = linkTools.getAppDeletePath();
|
|
15
|
-
|
|
16
|
-
if (!appDelegatePath) {
|
|
17
|
-
return Promise.reject(`Couldn't find AppDelegate. You might need to update it manually \
|
|
18
|
-
Please refer to plugin configuration section for iOS at \
|
|
19
|
-
https://github.com/microsoft/react-native-code-push#plugin-configuration-ios`);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
var appDelegateContents = fs.readFileSync(appDelegatePath, "utf8");
|
|
23
|
-
|
|
24
|
-
// 1. Add the header import statement
|
|
25
|
-
if (~appDelegateContents.indexOf(linkTools.codePushHeaderImportStatement)) {
|
|
26
|
-
console.log(`"CodePush.h" header already imported.`);
|
|
27
|
-
} else {
|
|
28
|
-
var appDelegateHeaderImportStatement = `#import "AppDelegate.h"`;
|
|
29
|
-
appDelegateContents = appDelegateContents.replace(appDelegateHeaderImportStatement,
|
|
30
|
-
`${appDelegateHeaderImportStatement}${linkTools.codePushHeaderImportStatementFormatted}`);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// 2. Modify jsCodeLocation value assignment
|
|
34
|
-
var reactNativeVersion = package && package.dependencies && package.dependencies["react-native"];
|
|
35
|
-
|
|
36
|
-
if (!reactNativeVersion) {
|
|
37
|
-
console.log(`Can't take react-native version from package.json`);
|
|
38
|
-
} else if (semver.gte(semver.coerce(reactNativeVersion), "0.59.0")) {
|
|
39
|
-
var oldBundleUrl = linkTools.oldBundleUrl;
|
|
40
|
-
var codePushBundleUrl = linkTools.codePushBundleUrl;
|
|
41
|
-
|
|
42
|
-
if (~appDelegateContents.indexOf(codePushBundleUrl)) {
|
|
43
|
-
console.log(`"BundleUrl" already pointing to "[CodePush bundleURL]".`);
|
|
44
|
-
} else {
|
|
45
|
-
if (~appDelegateContents.indexOf(oldBundleUrl)) {
|
|
46
|
-
appDelegateContents = appDelegateContents.replace(oldBundleUrl, codePushBundleUrl);
|
|
47
|
-
} else {
|
|
48
|
-
console.log(`AppDelegate isn't compatible for linking`);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
} else {
|
|
52
|
-
var jsCodeLocations = appDelegateContents.match(/(jsCodeLocation = .*)/g);
|
|
53
|
-
|
|
54
|
-
if (!jsCodeLocations) {
|
|
55
|
-
console.log('Couldn\'t find jsCodeLocation setting in AppDelegate.');
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
var newJsCodeLocationAssignmentStatement = linkTools.codePushGradleLink;
|
|
59
|
-
if (~appDelegateContents.indexOf(newJsCodeLocationAssignmentStatement)) {
|
|
60
|
-
console.log(`"jsCodeLocation" already pointing to "[CodePush bundleURL]".`);
|
|
61
|
-
} else {
|
|
62
|
-
if (jsCodeLocations.length === 1) {
|
|
63
|
-
// If there is one `jsCodeLocation` it means that react-native app version is not the 0.57.8 or 0.57.0 and lower than 0.59
|
|
64
|
-
// and we should replace this line with DEBUG ifdef statement and add CodePush call for Release case
|
|
65
|
-
|
|
66
|
-
var oldJsCodeLocationAssignmentStatement = jsCodeLocations[0];
|
|
67
|
-
var jsCodeLocationPatch = linkTools.getJsCodeLocationPatch(oldJsCodeLocationAssignmentStatement);
|
|
68
|
-
appDelegateContents = appDelegateContents.replace(oldJsCodeLocationAssignmentStatement,
|
|
69
|
-
jsCodeLocationPatch);
|
|
70
|
-
} else if (jsCodeLocations.length === 2) {
|
|
71
|
-
// If there are two `jsCodeLocation` it means that react-native app version is higher than 0.57.8 or equal
|
|
72
|
-
// and we should replace the second one(Release case) with CodePush call
|
|
73
|
-
|
|
74
|
-
appDelegateContents = appDelegateContents.replace(jsCodeLocations[1],
|
|
75
|
-
newJsCodeLocationAssignmentStatement);
|
|
76
|
-
} else {
|
|
77
|
-
console.log(`AppDelegate isn't compatible for linking`);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
var plistPath = linkTools.getPlistPath();
|
|
83
|
-
|
|
84
|
-
if (!plistPath) {
|
|
85
|
-
return Promise.reject(`Couldn't find .plist file. You might need to update it manually \
|
|
86
|
-
Please refer to plugin configuration section for iOS at \
|
|
87
|
-
https://github.com/microsoft/react-native-code-push#plugin-configuration-ios`);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
var plistContents = fs.readFileSync(plistPath, "utf8");
|
|
91
|
-
|
|
92
|
-
// 3. Add CodePushDeploymentKey to plist file
|
|
93
|
-
var parsedInfoPlist = plist.parse(plistContents);
|
|
94
|
-
if (parsedInfoPlist.CodePushDeploymentKey) {
|
|
95
|
-
console.log(`"CodePushDeploymentKey" already specified in the plist file.`);
|
|
96
|
-
writePatches();
|
|
97
|
-
return Promise.resolve();
|
|
98
|
-
} else {
|
|
99
|
-
return inquirer.prompt({
|
|
100
|
-
"type": "input",
|
|
101
|
-
"name": "iosDeploymentKey",
|
|
102
|
-
"message": "What is your CodePush deployment key for iOS (hit <ENTER> to ignore)"
|
|
103
|
-
}).then(function(answer) {
|
|
104
|
-
parsedInfoPlist.CodePushDeploymentKey = answer.iosDeploymentKey || "deployment-key-here";
|
|
105
|
-
plistContents = plist.build(parsedInfoPlist);
|
|
106
|
-
|
|
107
|
-
writePatches();
|
|
108
|
-
return Promise.resolve();
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function writePatches() {
|
|
113
|
-
fs.writeFileSync(appDelegatePath, appDelegateContents);
|
|
114
|
-
fs.writeFileSync(plistPath, plistContents);
|
|
115
|
-
}
|
|
116
|
-
}
|
package/scripts/postlink/run.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
var linkTools = require('../../tools/linkToolsAndroid');
|
|
2
|
-
var fs = require("fs");
|
|
3
|
-
|
|
4
|
-
module.exports = () => {
|
|
5
|
-
|
|
6
|
-
console.log("Running android postunlink script");
|
|
7
|
-
|
|
8
|
-
var mainApplicationPath = linkTools.getMainApplicationLocation();
|
|
9
|
-
|
|
10
|
-
// 1. Remove the getJSBundleFile override
|
|
11
|
-
var getJSBundleFileOverride = linkTools.getJSBundleFileOverride;
|
|
12
|
-
|
|
13
|
-
if (mainApplicationPath) {
|
|
14
|
-
var mainApplicationContents = fs.readFileSync(mainApplicationPath, "utf8");
|
|
15
|
-
if (!linkTools.isJsBundleOverridden(mainApplicationContents)) {
|
|
16
|
-
console.log(`"getJSBundleFile" is already removed`);
|
|
17
|
-
} else {
|
|
18
|
-
mainApplicationContents = mainApplicationContents.replace(`${getJSBundleFileOverride}`, "");
|
|
19
|
-
fs.writeFileSync(mainApplicationPath, mainApplicationContents);
|
|
20
|
-
}
|
|
21
|
-
} else {
|
|
22
|
-
var mainActivityPath = linkTools.getMainActivityPath();
|
|
23
|
-
if (mainActivityPath) {
|
|
24
|
-
var mainActivityContents = fs.readFileSync(mainActivityPath, "utf8");
|
|
25
|
-
if (!linkTools.isJsBundleOverridden(mainActivityContents)) {
|
|
26
|
-
console.log(`"getJSBundleFile" is already removed`);
|
|
27
|
-
} else {
|
|
28
|
-
mainActivityContents = mainActivityContents.replace(getJSBundleFileOverride, "");
|
|
29
|
-
fs.writeFileSync(mainActivityPath, mainActivityContents);
|
|
30
|
-
}
|
|
31
|
-
} else {
|
|
32
|
-
console.log(`Couldn't find Android application entry point. You might need to update it manually. \
|
|
33
|
-
Please refer to plugin configuration section for Android at \
|
|
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
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// 2. Remove the codepush.gradle build task definitions
|
|
39
|
-
var buildGradlePath = linkTools.getBuildGradlePath();
|
|
40
|
-
|
|
41
|
-
if (!fs.existsSync(buildGradlePath)) {
|
|
42
|
-
console.log(`Couldn't find build.gradle file. You might need to update it manually. \
|
|
43
|
-
Please refer to plugin installation section for Android at \
|
|
44
|
-
https://github.com/microsoft/react-native-code-push/blob/master/docs/setup-android.md#plugin-installation-android---manual`);
|
|
45
|
-
} else {
|
|
46
|
-
var buildGradleContents = fs.readFileSync(buildGradlePath, "utf8");
|
|
47
|
-
var codePushGradleLink = linkTools.codePushGradleLink;
|
|
48
|
-
if (!~buildGradleContents.indexOf(codePushGradleLink)) {
|
|
49
|
-
console.log(`"codepush.gradle" is already unlinked in the build definition`);
|
|
50
|
-
} else {
|
|
51
|
-
buildGradleContents = buildGradleContents.replace(`${codePushGradleLink}`,"");
|
|
52
|
-
fs.writeFileSync(buildGradlePath, buildGradleContents);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// 3. Remove deployment key
|
|
57
|
-
var stringsResourcesPath = linkTools.getStringsResourcesPath();
|
|
58
|
-
if (!stringsResourcesPath) {
|
|
59
|
-
return Promise.reject(new Error("Couldn't find strings.xml. You might need to update it manually."));
|
|
60
|
-
} else {
|
|
61
|
-
var stringsResourcesContent = fs.readFileSync(stringsResourcesPath, "utf8");
|
|
62
|
-
var deploymentKeyName = linkTools.deploymentKeyName;
|
|
63
|
-
if (!~stringsResourcesContent.indexOf(deploymentKeyName)) {
|
|
64
|
-
console.log(`${deploymentKeyName} already removed from the strings.xml`);
|
|
65
|
-
} else {
|
|
66
|
-
var AndroidDeploymentKey = stringsResourcesContent.match(/(<string moduleConfig="true" name="CodePushDeploymentKey">.*<\/string>)/);
|
|
67
|
-
if (AndroidDeploymentKey) {
|
|
68
|
-
stringsResourcesContent = stringsResourcesContent.replace(`\n\t${AndroidDeploymentKey[0]}`,"");
|
|
69
|
-
fs.writeFileSync(stringsResourcesPath, stringsResourcesContent);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return Promise.resolve();
|
|
74
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
var linkTools = require('../../tools/linkToolsIos');
|
|
3
|
-
var fs = require("fs");
|
|
4
|
-
var plist = require("plist");
|
|
5
|
-
var semver = require('semver');
|
|
6
|
-
var packageFile = require('../../../../../package.json');
|
|
7
|
-
|
|
8
|
-
module.exports = () => {
|
|
9
|
-
|
|
10
|
-
console.log("Running ios postunlink script");
|
|
11
|
-
|
|
12
|
-
var appDelegatePath = linkTools.getAppDeletePath();
|
|
13
|
-
|
|
14
|
-
if (!appDelegatePath) {
|
|
15
|
-
console.log(`Couldn't find AppDelegate. You might need to update it manually \
|
|
16
|
-
Please refer to plugin configuration section for iOS at \
|
|
17
|
-
https://github.com/microsoft/react-native-code-push#plugin-configuration-ios`);
|
|
18
|
-
} else {
|
|
19
|
-
var appDelegateContents = fs.readFileSync(appDelegatePath, "utf8");
|
|
20
|
-
|
|
21
|
-
// 1. Remove the header import statement
|
|
22
|
-
if (!~appDelegateContents.indexOf(linkTools.codePushHeaderImportStatement)) {
|
|
23
|
-
console.log(`"CodePush.h" header already removed.`);
|
|
24
|
-
} else {
|
|
25
|
-
appDelegateContents = appDelegateContents.replace(linkTools.codePushHeaderImportStatementFormatted, "");
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// 2. Modify jsCodeLocation value assignment
|
|
29
|
-
var codePushBundleUrl = linkTools.codePushBundleUrl;
|
|
30
|
-
if (!~appDelegateContents.indexOf(codePushBundleUrl)) {
|
|
31
|
-
console.log(`"jsCodeLocation" already not pointing to "[CodePush bundleURL]".`);
|
|
32
|
-
} else {
|
|
33
|
-
var reactNativeVersion = packageFile && packageFile.dependencies && packageFile.dependencies["react-native"];
|
|
34
|
-
if (!reactNativeVersion) {
|
|
35
|
-
console.log(`Can't take react-native version from package.json`);
|
|
36
|
-
} else if (semver.gte(semver.coerce(reactNativeVersion), "0.59.0")) {
|
|
37
|
-
var oldBundleUrl = linkTools.oldBundleUrl;
|
|
38
|
-
appDelegateContents = appDelegateContents.replace(codePushBundleUrl, oldBundleUrl);
|
|
39
|
-
fs.writeFileSync(appDelegatePath, appDelegateContents);
|
|
40
|
-
} else {
|
|
41
|
-
var linkedJsCodeLocationAssignmentStatement = linkTools.linkedJsCodeLocationAssignmentStatement;
|
|
42
|
-
var jsCodeLocations = appDelegateContents.match(/(jsCodeLocation = .*)/g);
|
|
43
|
-
if (!jsCodeLocations || jsCodeLocations.length !== 2 || !~appDelegateContents.indexOf(linkedJsCodeLocationAssignmentStatement)) {
|
|
44
|
-
console.log(`AppDelegate isn't compatible for unlinking`);
|
|
45
|
-
} else {
|
|
46
|
-
if (semver.eq(semver.coerce(reactNativeVersion), "0.57.8") || semver.eq(semver.coerce(reactNativeVersion), "0.57.0")) {
|
|
47
|
-
// If version of react-native application is 0.57.8 or 0.57 then by default there are two different
|
|
48
|
-
// jsCodeLocation for debug and release and we should replace only release
|
|
49
|
-
var unlinkedJsCodeLocations = `jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];`;
|
|
50
|
-
appDelegateContents = appDelegateContents.replace(linkedJsCodeLocationAssignmentStatement,
|
|
51
|
-
unlinkedJsCodeLocations);
|
|
52
|
-
} else {
|
|
53
|
-
// If version of react-native application is not 0.57.8 or 0.57 and lower than 0.59.0 then by default there is only one
|
|
54
|
-
// jsCodeLocation and we should stay on only it
|
|
55
|
-
var defaultJsCodeLocationAssignmentStatement = jsCodeLocations[0];
|
|
56
|
-
var linkedCodeLocationPatch = linkTools.getJsCodeLocationPatch(defaultJsCodeLocationAssignmentStatement);
|
|
57
|
-
appDelegateContents = appDelegateContents.replace(linkedCodeLocationPatch,
|
|
58
|
-
defaultJsCodeLocationAssignmentStatement);
|
|
59
|
-
}
|
|
60
|
-
fs.writeFileSync(appDelegatePath, appDelegateContents);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
var plistPath = linkTools.getPlistPath();
|
|
67
|
-
|
|
68
|
-
if (!plistPath) {
|
|
69
|
-
return Promise.reject(`Couldn't find .plist file. You might need to update it manually \
|
|
70
|
-
Please refer to plugin configuration section for iOS at \
|
|
71
|
-
https://github.com/microsoft/react-native-code-push#plugin-configuration-ios`);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
var plistContents = fs.readFileSync(plistPath, "utf8");
|
|
75
|
-
|
|
76
|
-
// 3. Remove CodePushDeploymentKey from plist file
|
|
77
|
-
var parsedInfoPlist = plist.parse(plistContents);
|
|
78
|
-
if (!parsedInfoPlist.CodePushDeploymentKey) {
|
|
79
|
-
console.log(`"CodePushDeploymentKey" already removed from the plist file.`);
|
|
80
|
-
} else {
|
|
81
|
-
delete parsedInfoPlist.CodePushDeploymentKey;
|
|
82
|
-
plistContents = plist.build(parsedInfoPlist);
|
|
83
|
-
fs.writeFileSync(plistPath, plistContents);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return Promise.resolve();
|
|
87
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
var fs = require("fs");
|
|
2
|
-
var glob = require("glob");
|
|
3
|
-
var path = require("path");
|
|
4
|
-
|
|
5
|
-
var ignoreFolders = { ignore: ["node_modules/**", "**/build/**"] };
|
|
6
|
-
var manifestPath = glob.sync("**/AndroidManifest.xml", ignoreFolders)[0];
|
|
7
|
-
|
|
8
|
-
exports.getJSBundleFileOverride = `
|
|
9
|
-
@Override
|
|
10
|
-
protected String getJSBundleFile(){
|
|
11
|
-
return CodePush.getJSBundleFile();
|
|
12
|
-
}
|
|
13
|
-
`;
|
|
14
|
-
exports.reactNativeHostInstantiation = "new ReactNativeHost(this) {";
|
|
15
|
-
exports.mainActivityClassDeclaration = "public class MainActivity extends ReactActivity {";
|
|
16
|
-
exports.codePushGradleLink = `\napply from: "../../node_modules/react-native-code-push/android/codepush.gradle"`;
|
|
17
|
-
exports.deploymentKeyName = "CodePushDeploymentKey";
|
|
18
|
-
|
|
19
|
-
exports.getMainApplicationLocation = function () {
|
|
20
|
-
return findMainApplication() || glob.sync("**/MainApplication.java", ignoreFolders)[0];
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
exports.getMainActivityPath = function () {
|
|
24
|
-
return glob.sync("**/MainActivity.java", ignoreFolders)[0]
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
exports.getStringsResourcesPath = function () {
|
|
28
|
-
return glob.sync("**/strings.xml", ignoreFolders)[0];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
exports.getBuildGradlePath = function () {
|
|
32
|
-
return path.join("android", "app", "build.gradle");
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
exports.isJsBundleOverridden = function (codeContents) {
|
|
36
|
-
return /@Override\s*\n\s*protected String getJSBundleFile\(\)\s*\{[\s\S]*?\}/.test(codeContents);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function findMainApplication() {
|
|
40
|
-
if (!manifestPath) {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
var manifest = fs.readFileSync(manifestPath, "utf8");
|
|
45
|
-
|
|
46
|
-
// Android manifest must include single 'application' element
|
|
47
|
-
var matchResult = manifest.match(/application\s+android:name\s*=\s*"(.*?)"/);
|
|
48
|
-
if (matchResult) {
|
|
49
|
-
var appName = matchResult[1];
|
|
50
|
-
} else {
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
var nameParts = appName.split('.');
|
|
55
|
-
var searchPath = glob.sync("**/" + nameParts[nameParts.length - 1] + ".java", ignoreFolders)[0];
|
|
56
|
-
return searchPath;
|
|
57
|
-
}
|