react-native-ota-hot-update 1.0.0 → 1.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/README.md +7 -6
- package/ios/RNhotupdate.xcodeproj/project.pbxproj +281 -0
- package/ios/RNhotupdate.xcworkspace/contents.xcworkspacedata +7 -0
- package/package.json +1 -1
- package/rn-hotupdate.podspec +1 -1
- package/src/Utils.ts +6 -1
- package/src/index.tsx +2 -1
- /package/ios/{RNhotupdate.mm → RNhotupdate.m} +0 -0
package/README.md
CHANGED
|
@@ -88,12 +88,13 @@ The important thing: this library will control `version` by it self, need always
|
|
|
88
88
|
|
|
89
89
|
## UpdateOption
|
|
90
90
|
|
|
91
|
-
| Option | Required | Type | Description
|
|
92
|
-
|
|
93
|
-
| headers | No | Object | The header to down load your uri bundle file if need token/authentication...
|
|
94
|
-
| updateSuccess | No | Callback | Will trigger when install update success
|
|
95
|
-
| updateFail(message: string) | No | Callback
|
|
96
|
-
| restartAfterInstall | No | boolean
|
|
91
|
+
| Option | Required | Type | Description |
|
|
92
|
+
|-------------------------|----------|----------|--------------------------------------------------------------------------------------------------|
|
|
93
|
+
| headers | No | Object | The header to down load your uri bundle file if need token/authentication... |
|
|
94
|
+
| updateSuccess | No | Callback | Will trigger when install update success |
|
|
95
|
+
| updateFail(message: string) | No | Callback | Will trigger when install update failed |
|
|
96
|
+
| restartAfterInstall | No | boolean | default is `false`, if `true` will restart the app after install success to apply the new change |
|
|
97
|
+
| progress | No | void | A callback to show progress when downloading bundle |
|
|
97
98
|
|
|
98
99
|
|
|
99
100
|
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
// !$*UTF8*$!
|
|
2
|
+
{
|
|
3
|
+
archiveVersion = 1;
|
|
4
|
+
classes = {
|
|
5
|
+
};
|
|
6
|
+
objectVersion = 46;
|
|
7
|
+
objects = {
|
|
8
|
+
|
|
9
|
+
/* Begin PBXCopyFilesBuildPhase section */
|
|
10
|
+
58B511D91A9E6C8500147676 /* CopyFiles */ = {
|
|
11
|
+
isa = PBXCopyFilesBuildPhase;
|
|
12
|
+
buildActionMask = 2147483647;
|
|
13
|
+
dstPath = "include/$(PRODUCT_NAME)";
|
|
14
|
+
dstSubfolderSpec = 16;
|
|
15
|
+
files = (
|
|
16
|
+
);
|
|
17
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
18
|
+
};
|
|
19
|
+
/* End PBXCopyFilesBuildPhase section */
|
|
20
|
+
|
|
21
|
+
/* Begin PBXFileReference section */
|
|
22
|
+
134814201AA4EA6300B7C361 /* libRNhotupdate.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNhotupdate.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
23
|
+
/* End PBXFileReference section */
|
|
24
|
+
|
|
25
|
+
/* Begin PBXFrameworksBuildPhase section */
|
|
26
|
+
58B511D81A9E6C8500147676 /* Frameworks */ = {
|
|
27
|
+
isa = PBXFrameworksBuildPhase;
|
|
28
|
+
buildActionMask = 2147483647;
|
|
29
|
+
files = (
|
|
30
|
+
);
|
|
31
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
32
|
+
};
|
|
33
|
+
/* End PBXFrameworksBuildPhase section */
|
|
34
|
+
|
|
35
|
+
/* Begin PBXGroup section */
|
|
36
|
+
134814211AA4EA7D00B7C361 /* Products */ = {
|
|
37
|
+
isa = PBXGroup;
|
|
38
|
+
children = (
|
|
39
|
+
134814201AA4EA6300B7C361 /* libRNhotupdate.a */,
|
|
40
|
+
);
|
|
41
|
+
name = Products;
|
|
42
|
+
sourceTree = "<group>";
|
|
43
|
+
};
|
|
44
|
+
58B511D21A9E6C8500147676 = {
|
|
45
|
+
isa = PBXGroup;
|
|
46
|
+
children = (
|
|
47
|
+
134814211AA4EA7D00B7C361 /* Products */,
|
|
48
|
+
);
|
|
49
|
+
sourceTree = "<group>";
|
|
50
|
+
};
|
|
51
|
+
/* End PBXGroup section */
|
|
52
|
+
|
|
53
|
+
/* Begin PBXNativeTarget section */
|
|
54
|
+
58B511DA1A9E6C8500147676 /* RNhotupdate */ = {
|
|
55
|
+
isa = PBXNativeTarget;
|
|
56
|
+
buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNhotupdate" */;
|
|
57
|
+
buildPhases = (
|
|
58
|
+
58B511D71A9E6C8500147676 /* Sources */,
|
|
59
|
+
58B511D81A9E6C8500147676 /* Frameworks */,
|
|
60
|
+
58B511D91A9E6C8500147676 /* CopyFiles */,
|
|
61
|
+
);
|
|
62
|
+
buildRules = (
|
|
63
|
+
);
|
|
64
|
+
dependencies = (
|
|
65
|
+
);
|
|
66
|
+
name = RNhotupdate;
|
|
67
|
+
productName = RCTDataManager;
|
|
68
|
+
productReference = 134814201AA4EA6300B7C361 /* libRNhotupdate.a */;
|
|
69
|
+
productType = "com.apple.product-type.library.static";
|
|
70
|
+
};
|
|
71
|
+
/* End PBXNativeTarget section */
|
|
72
|
+
|
|
73
|
+
/* Begin PBXProject section */
|
|
74
|
+
58B511D31A9E6C8500147676 /* Project object */ = {
|
|
75
|
+
isa = PBXProject;
|
|
76
|
+
attributes = {
|
|
77
|
+
LastUpgradeCheck = 0920;
|
|
78
|
+
ORGANIZATIONNAME = Facebook;
|
|
79
|
+
TargetAttributes = {
|
|
80
|
+
58B511DA1A9E6C8500147676 = {
|
|
81
|
+
CreatedOnToolsVersion = 6.1.1;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNhotupdate" */;
|
|
86
|
+
compatibilityVersion = "Xcode 3.2";
|
|
87
|
+
developmentRegion = en;
|
|
88
|
+
hasScannedForEncodings = 0;
|
|
89
|
+
knownRegions = (
|
|
90
|
+
en,
|
|
91
|
+
Base,
|
|
92
|
+
);
|
|
93
|
+
mainGroup = 58B511D21A9E6C8500147676;
|
|
94
|
+
productRefGroup = 58B511D21A9E6C8500147676;
|
|
95
|
+
projectDirPath = "";
|
|
96
|
+
projectRoot = "";
|
|
97
|
+
targets = (
|
|
98
|
+
58B511DA1A9E6C8500147676 /* RNhotupdate */,
|
|
99
|
+
);
|
|
100
|
+
};
|
|
101
|
+
/* End PBXProject section */
|
|
102
|
+
|
|
103
|
+
/* Begin PBXSourcesBuildPhase section */
|
|
104
|
+
58B511D71A9E6C8500147676 /* Sources */ = {
|
|
105
|
+
isa = PBXSourcesBuildPhase;
|
|
106
|
+
buildActionMask = 2147483647;
|
|
107
|
+
files = (
|
|
108
|
+
);
|
|
109
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
110
|
+
};
|
|
111
|
+
/* End PBXSourcesBuildPhase section */
|
|
112
|
+
|
|
113
|
+
/* Begin XCBuildConfiguration section */
|
|
114
|
+
58B511ED1A9E6C8500147676 /* Debug */ = {
|
|
115
|
+
isa = XCBuildConfiguration;
|
|
116
|
+
buildSettings = {
|
|
117
|
+
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
118
|
+
CLANG_ANALYZER_NONNULL = YES;
|
|
119
|
+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
|
120
|
+
CLANG_CXX_LIBRARY = "libc++";
|
|
121
|
+
CLANG_ENABLE_MODULES = YES;
|
|
122
|
+
CLANG_ENABLE_OBJC_ARC = YES;
|
|
123
|
+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
|
124
|
+
CLANG_WARN_BOOL_CONVERSION = YES;
|
|
125
|
+
CLANG_WARN_COMMA = YES;
|
|
126
|
+
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
|
127
|
+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
|
128
|
+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
|
129
|
+
CLANG_WARN_EMPTY_BODY = YES;
|
|
130
|
+
CLANG_WARN_ENUM_CONVERSION = YES;
|
|
131
|
+
CLANG_WARN_INFINITE_RECURSION = YES;
|
|
132
|
+
CLANG_WARN_INT_CONVERSION = YES;
|
|
133
|
+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
|
134
|
+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
|
135
|
+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
|
136
|
+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
|
137
|
+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
|
138
|
+
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
|
139
|
+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
|
140
|
+
CLANG_WARN_UNREACHABLE_CODE = YES;
|
|
141
|
+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
|
142
|
+
COPY_PHASE_STRIP = NO;
|
|
143
|
+
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
144
|
+
ENABLE_TESTABILITY = YES;
|
|
145
|
+
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
146
|
+
GCC_DYNAMIC_NO_PIC = NO;
|
|
147
|
+
GCC_NO_COMMON_BLOCKS = YES;
|
|
148
|
+
GCC_OPTIMIZATION_LEVEL = 0;
|
|
149
|
+
GCC_PREPROCESSOR_DEFINITIONS = (
|
|
150
|
+
"DEBUG=1",
|
|
151
|
+
"$(inherited)",
|
|
152
|
+
);
|
|
153
|
+
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
|
154
|
+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
155
|
+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
|
156
|
+
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
157
|
+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
158
|
+
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
159
|
+
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
160
|
+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
|
161
|
+
LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)";
|
|
162
|
+
LIBRARY_SEARCH_PATHS = (
|
|
163
|
+
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
|
|
164
|
+
"\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"",
|
|
165
|
+
"\"$(inherited)\"",
|
|
166
|
+
);
|
|
167
|
+
MTL_ENABLE_DEBUG_INFO = YES;
|
|
168
|
+
ONLY_ACTIVE_ARCH = YES;
|
|
169
|
+
SDKROOT = iphoneos;
|
|
170
|
+
};
|
|
171
|
+
name = Debug;
|
|
172
|
+
};
|
|
173
|
+
58B511EE1A9E6C8500147676 /* Release */ = {
|
|
174
|
+
isa = XCBuildConfiguration;
|
|
175
|
+
buildSettings = {
|
|
176
|
+
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
177
|
+
CLANG_ANALYZER_NONNULL = YES;
|
|
178
|
+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
|
179
|
+
CLANG_CXX_LIBRARY = "libc++";
|
|
180
|
+
CLANG_ENABLE_MODULES = YES;
|
|
181
|
+
CLANG_ENABLE_OBJC_ARC = YES;
|
|
182
|
+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
|
183
|
+
CLANG_WARN_BOOL_CONVERSION = YES;
|
|
184
|
+
CLANG_WARN_COMMA = YES;
|
|
185
|
+
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
|
186
|
+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
|
187
|
+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
|
188
|
+
CLANG_WARN_EMPTY_BODY = YES;
|
|
189
|
+
CLANG_WARN_ENUM_CONVERSION = YES;
|
|
190
|
+
CLANG_WARN_INFINITE_RECURSION = YES;
|
|
191
|
+
CLANG_WARN_INT_CONVERSION = YES;
|
|
192
|
+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
|
193
|
+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
|
194
|
+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
|
195
|
+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
|
196
|
+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
|
197
|
+
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
|
198
|
+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
|
199
|
+
CLANG_WARN_UNREACHABLE_CODE = YES;
|
|
200
|
+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
|
201
|
+
COPY_PHASE_STRIP = YES;
|
|
202
|
+
ENABLE_NS_ASSERTIONS = NO;
|
|
203
|
+
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
204
|
+
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
205
|
+
GCC_NO_COMMON_BLOCKS = YES;
|
|
206
|
+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
207
|
+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
|
208
|
+
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
209
|
+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
210
|
+
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
211
|
+
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
212
|
+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
|
213
|
+
LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)";
|
|
214
|
+
LIBRARY_SEARCH_PATHS = (
|
|
215
|
+
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
|
|
216
|
+
"\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"",
|
|
217
|
+
"\"$(inherited)\"",
|
|
218
|
+
);
|
|
219
|
+
MTL_ENABLE_DEBUG_INFO = NO;
|
|
220
|
+
SDKROOT = iphoneos;
|
|
221
|
+
VALIDATE_PRODUCT = YES;
|
|
222
|
+
};
|
|
223
|
+
name = Release;
|
|
224
|
+
};
|
|
225
|
+
58B511F01A9E6C8500147676 /* Debug */ = {
|
|
226
|
+
isa = XCBuildConfiguration;
|
|
227
|
+
buildSettings = {
|
|
228
|
+
HEADER_SEARCH_PATHS = (
|
|
229
|
+
"$(inherited)",
|
|
230
|
+
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
|
231
|
+
"$(SRCROOT)/../../../React/**",
|
|
232
|
+
"$(SRCROOT)/../../react-native/React/**",
|
|
233
|
+
);
|
|
234
|
+
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
|
235
|
+
OTHER_LDFLAGS = "-ObjC";
|
|
236
|
+
PRODUCT_NAME = RNhotupdate;
|
|
237
|
+
SKIP_INSTALL = YES;
|
|
238
|
+
};
|
|
239
|
+
name = Debug;
|
|
240
|
+
};
|
|
241
|
+
58B511F11A9E6C8500147676 /* Release */ = {
|
|
242
|
+
isa = XCBuildConfiguration;
|
|
243
|
+
buildSettings = {
|
|
244
|
+
HEADER_SEARCH_PATHS = (
|
|
245
|
+
"$(inherited)",
|
|
246
|
+
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
|
247
|
+
"$(SRCROOT)/../../../React/**",
|
|
248
|
+
"$(SRCROOT)/../../react-native/React/**",
|
|
249
|
+
);
|
|
250
|
+
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
|
251
|
+
OTHER_LDFLAGS = "-ObjC";
|
|
252
|
+
PRODUCT_NAME = RNhotupdate;
|
|
253
|
+
SKIP_INSTALL = YES;
|
|
254
|
+
};
|
|
255
|
+
name = Release;
|
|
256
|
+
};
|
|
257
|
+
/* End XCBuildConfiguration section */
|
|
258
|
+
|
|
259
|
+
/* Begin XCConfigurationList section */
|
|
260
|
+
58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNhotupdate" */ = {
|
|
261
|
+
isa = XCConfigurationList;
|
|
262
|
+
buildConfigurations = (
|
|
263
|
+
58B511ED1A9E6C8500147676 /* Debug */,
|
|
264
|
+
58B511EE1A9E6C8500147676 /* Release */,
|
|
265
|
+
);
|
|
266
|
+
defaultConfigurationIsVisible = 0;
|
|
267
|
+
defaultConfigurationName = Release;
|
|
268
|
+
};
|
|
269
|
+
58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNhotupdate" */ = {
|
|
270
|
+
isa = XCConfigurationList;
|
|
271
|
+
buildConfigurations = (
|
|
272
|
+
58B511F01A9E6C8500147676 /* Debug */,
|
|
273
|
+
58B511F11A9E6C8500147676 /* Release */,
|
|
274
|
+
);
|
|
275
|
+
defaultConfigurationIsVisible = 0;
|
|
276
|
+
defaultConfigurationName = Release;
|
|
277
|
+
};
|
|
278
|
+
/* End XCConfigurationList section */
|
|
279
|
+
};
|
|
280
|
+
rootObject = 58B511D31A9E6C8500147676 /* Project object */;
|
|
281
|
+
}
|
package/package.json
CHANGED
package/rn-hotupdate.podspec
CHANGED
|
@@ -12,7 +12,7 @@ Pod::Spec.new do |s|
|
|
|
12
12
|
s.authors = package["author"]
|
|
13
13
|
|
|
14
14
|
s.platforms = { :ios => min_ios_version_supported }
|
|
15
|
-
s.source = { :git => ".git", :tag => "#{s.version}" }
|
|
15
|
+
s.source = { :git => "https://github.com/vantuan88291/react-native-ota-hot-update.git", :tag => "#{s.version}" }
|
|
16
16
|
|
|
17
17
|
s.source_files = "ios/**/*.{h,m,mm}"
|
|
18
18
|
s.dependency 'SSZipArchive', '~> 2.4.3'
|
package/src/Utils.ts
CHANGED
|
@@ -2,13 +2,18 @@ import {
|
|
|
2
2
|
Platform,
|
|
3
3
|
} from 'react-native';
|
|
4
4
|
import ReactNativeBlobUtil from 'react-native-blob-util';
|
|
5
|
-
export const downloadBundleFile = async (uri: string, headers?: object) => {
|
|
5
|
+
export const downloadBundleFile = async (uri: string, headers?: object, callback?: (received: string, total: string) => void) => {
|
|
6
6
|
const res = await ReactNativeBlobUtil
|
|
7
7
|
.config({
|
|
8
8
|
fileCache: Platform.OS === 'android',
|
|
9
9
|
})
|
|
10
10
|
.fetch('GET', uri, {
|
|
11
11
|
...headers,
|
|
12
|
+
})
|
|
13
|
+
.progress((received, total) => {
|
|
14
|
+
if (callback) {
|
|
15
|
+
callback(received, total)
|
|
16
|
+
}
|
|
12
17
|
});
|
|
13
18
|
return res.path();
|
|
14
19
|
};
|
package/src/index.tsx
CHANGED
|
@@ -8,6 +8,7 @@ const LINKING_ERROR =
|
|
|
8
8
|
|
|
9
9
|
export interface UpdateOption {
|
|
10
10
|
headers?: object
|
|
11
|
+
progress?(received: string, total: string): void
|
|
11
12
|
updateSuccess?(): void
|
|
12
13
|
updateFail?(message?: string): void
|
|
13
14
|
restartAfterInstall?: boolean
|
|
@@ -73,7 +74,7 @@ async function downloadBundleUri(uri: string, version: number, option?: UpdateOp
|
|
|
73
74
|
return;
|
|
74
75
|
}
|
|
75
76
|
try {
|
|
76
|
-
const path = await downloadBundleFile(uri, option?.headers);
|
|
77
|
+
const path = await downloadBundleFile(uri, option?.headers, option?.progress);
|
|
77
78
|
if (path) {
|
|
78
79
|
setupBundlePath(path).then(success => {
|
|
79
80
|
if (success) {
|
|
File without changes
|