react-native-blob-util 0.16.4 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +29 -3
- package/Migration.md +41 -0
- package/README.md +13 -6
- package/android/build.gradle +19 -1
- package/android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtilBody.java +6 -6
- package/android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtilFS.java +12 -8
- package/android/src/main/java/com/ReactNativeBlobUtil/{ReactNativeBlobUtil.java → ReactNativeBlobUtilImpl.java} +19 -78
- package/android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtilMediaCollection.java +5 -5
- package/android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtilPackage.java +31 -21
- package/android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtilReq.java +22 -21
- package/android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtilStream.java +6 -6
- package/android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtilUtils.java +2 -2
- package/android/src/main/java/com/ReactNativeBlobUtil/Utils/MimeType.java +1 -1
- package/android/src/newarch/java/com/ReactNativeBlobUtil/ReactNativeBlobUtil.java +281 -0
- package/android/src/oldarch/java/com/ReactNativeBlobUtil/ReactNativeBlobUtil.java +242 -0
- package/android.js +2 -3
- package/class/ReactNativeBlobUtilFile.js +1 -13
- package/class/ReactNativeBlobUtilReadStream.js +1 -2
- package/class/ReactNativeBlobUtilSession.js +1 -2
- package/class/ReactNativeBlobUtilWriteStream.js +1 -3
- package/codegenSpecs/NativeBlobUtils.js +77 -0
- package/fetch.js +2 -2
- package/fs.js +22 -22
- package/index.d.ts +6 -0
- package/index.js +2 -2
- package/index.web.js +1 -0
- package/ios/ReactNativeBlobUtil/ReactNativeBlobUtil.h +10 -1
- package/ios/ReactNativeBlobUtil/{ReactNativeBlobUtil.m → ReactNativeBlobUtil.mm} +334 -41
- package/ios/{ReactNativeBlobUtilConst.m → ReactNativeBlobUtilConst.mm} +0 -0
- package/ios/ReactNativeBlobUtilFS.h +5 -5
- package/ios/{ReactNativeBlobUtilFS.m → ReactNativeBlobUtilFS.mm} +32 -26
- package/ios/{ReactNativeBlobUtilFileTransformer.m → ReactNativeBlobUtilFileTransformer.mm} +0 -0
- package/ios/ReactNativeBlobUtilNetwork.h +2 -2
- package/ios/{ReactNativeBlobUtilNetwork.m → ReactNativeBlobUtilNetwork.mm} +15 -17
- package/ios/{ReactNativeBlobUtilProgress.m → ReactNativeBlobUtilProgress.mm} +4 -4
- package/ios/{ReactNativeBlobUtilReqBuilder.m → ReactNativeBlobUtilReqBuilder.mm} +4 -4
- package/ios/ReactNativeBlobUtilRequest.h +4 -2
- package/ios/{ReactNativeBlobUtilRequest.m → ReactNativeBlobUtilRequest.mm} +16 -11
- package/ios.js +2 -3
- package/mediacollection.js +2 -4
- package/package.json +7 -2
- package/react-native-blob-util.podspec +21 -1
- package/examples/ReactNativeBlobUtil/.buckconfig +0 -6
- package/examples/ReactNativeBlobUtil/.eslintrc.js +0 -4
- package/examples/ReactNativeBlobUtil/.prettierrc.js +0 -6
- package/examples/ReactNativeBlobUtil/App.js +0 -698
- package/examples/ReactNativeBlobUtil/index.js +0 -9
- package/examples/ReactNativeBlobUtil/metro.config.js +0 -27
- package/examples/ReactNativeBlobUtil/package.json +0 -31
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/App.cpp +0 -80
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/App.h +0 -20
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/App.idl +0 -3
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/App.xaml +0 -10
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/Assets/LockScreenLogo.scale-200.png +0 -0
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/Assets/SplashScreen.scale-200.png +0 -0
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/Assets/Square150x150Logo.scale-200.png +0 -0
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/Assets/Square44x44Logo.scale-200.png +0 -0
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/Assets/Square44x44Logo.targetsize-24_altform-unplated.png +0 -0
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/Assets/StoreLogo.png +0 -0
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/Assets/Wide310x150Logo.scale-200.png +0 -0
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/AutolinkedNativeModules.g.cpp +0 -18
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/AutolinkedNativeModules.g.h +0 -10
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/AutolinkedNativeModules.g.targets +0 -11
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/MainPage.cpp +0 -24
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/MainPage.h +0 -21
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/MainPage.idl +0 -8
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/MainPage.xaml +0 -16
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/Package.appxmanifest +0 -50
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/PropertySheet.props +0 -16
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/ReactNativeBlobUtilWin.vcxproj +0 -196
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/ReactNativeBlobUtilWin.vcxproj.filters +0 -65
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/ReactNativeBlobUtilWin_TemporaryKey.pfx +0 -0
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/ReactPackageProvider.cpp +0 -18
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/ReactPackageProvider.h +0 -15
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/packages.config +0 -5
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/pch.cpp +0 -1
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/pch.h +0 -26
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin.sln +0 -207
|
@@ -11,8 +11,11 @@
|
|
|
11
11
|
#import "ReactNativeBlobUtilReqBuilder.h"
|
|
12
12
|
#import "ReactNativeBlobUtilProgress.h"
|
|
13
13
|
|
|
14
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
15
|
+
#import "ReactNativeBlobUtilSpec.h"
|
|
16
|
+
#endif
|
|
14
17
|
|
|
15
|
-
__strong
|
|
18
|
+
__strong RCTEventDispatcher * eventDispatcherRef;
|
|
16
19
|
dispatch_queue_t commonTaskQueue;
|
|
17
20
|
dispatch_queue_t fsQueue;
|
|
18
21
|
|
|
@@ -28,7 +31,6 @@ dispatch_queue_t fsQueue;
|
|
|
28
31
|
|
|
29
32
|
@synthesize filePathPrefix;
|
|
30
33
|
@synthesize documentController;
|
|
31
|
-
@synthesize bridge = _bridge;
|
|
32
34
|
|
|
33
35
|
- (dispatch_queue_t) methodQueue {
|
|
34
36
|
if(commonTaskQueue == nil)
|
|
@@ -36,10 +38,14 @@ dispatch_queue_t fsQueue;
|
|
|
36
38
|
return commonTaskQueue;
|
|
37
39
|
}
|
|
38
40
|
|
|
39
|
-
+ (
|
|
41
|
+
+ (RCTEventDispatcher *)getRCTEventDispatcher
|
|
40
42
|
{
|
|
41
43
|
RCTRootView * rootView = (RCTRootView*) [[UIApplication sharedApplication] keyWindow].rootViewController.view;
|
|
42
|
-
|
|
44
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
45
|
+
return (RCTEventDispatcher *)[rootView.moduleRegistry moduleForName:"EventDispatcher"];
|
|
46
|
+
#else
|
|
47
|
+
return rootView.bridge.eventDispatcher;
|
|
48
|
+
#endif
|
|
43
49
|
}
|
|
44
50
|
|
|
45
51
|
+ (BOOL)requiresMainQueueSetup {
|
|
@@ -60,11 +66,18 @@ RCT_EXPORT_MODULE();
|
|
|
60
66
|
if(![[NSFileManager defaultManager] fileExistsAtPath: [ReactNativeBlobUtilFS getTempPath] isDirectory:&isDir]) {
|
|
61
67
|
[[NSFileManager defaultManager] createDirectoryAtPath:[ReactNativeBlobUtilFS getTempPath] withIntermediateDirectories:YES attributes:nil error:NULL];
|
|
62
68
|
}
|
|
63
|
-
|
|
64
|
-
|
|
69
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
70
|
+
eventDispatcherRef = [ReactNativeBlobUtil getRCTEventDispatcher];
|
|
71
|
+
[ReactNativeBlobUtilNetwork emitExpiredTasks: eventDispatcherRef];
|
|
72
|
+
});
|
|
73
|
+
|
|
65
74
|
return self;
|
|
66
75
|
}
|
|
67
76
|
|
|
77
|
+
- (NSDictionary *)getConstants {
|
|
78
|
+
return self.constantsToExport;
|
|
79
|
+
}
|
|
80
|
+
|
|
68
81
|
- (NSDictionary *)constantsToExport
|
|
69
82
|
{
|
|
70
83
|
return @{
|
|
@@ -77,6 +90,11 @@ RCT_EXPORT_MODULE();
|
|
|
77
90
|
@"MusicDir" : [ReactNativeBlobUtilFS getMusicDir],
|
|
78
91
|
@"PictureDir" : [ReactNativeBlobUtilFS getPictureDir],
|
|
79
92
|
@"ApplicationSupportDir" : [ReactNativeBlobUtilFS getApplicationSupportDir],
|
|
93
|
+
// Android only. For the new architecture, we have a single spec for both platforms.
|
|
94
|
+
@"RingtoneDir": @"",
|
|
95
|
+
@"SDCardDir": @"",
|
|
96
|
+
@"SDCardApplicationDir": @"",
|
|
97
|
+
@"DCIMDir": @"",
|
|
80
98
|
};
|
|
81
99
|
}
|
|
82
100
|
|
|
@@ -108,7 +126,7 @@ RCT_EXPORT_METHOD(fetchBlobForm:(NSDictionary *)options
|
|
|
108
126
|
{
|
|
109
127
|
[[ReactNativeBlobUtilNetwork sharedInstance] sendRequest:options
|
|
110
128
|
contentLength:bodyLength
|
|
111
|
-
|
|
129
|
+
eventDispatcher:eventDispatcherRef
|
|
112
130
|
taskId:taskId
|
|
113
131
|
withRequest:req
|
|
114
132
|
callback:callback];
|
|
@@ -124,7 +142,8 @@ RCT_EXPORT_METHOD(fetchBlob:(NSDictionary *)options
|
|
|
124
142
|
method:(NSString *)method
|
|
125
143
|
url:(NSString *)url
|
|
126
144
|
headers:(NSDictionary *)headers
|
|
127
|
-
body:(NSString *)body
|
|
145
|
+
body:(NSString *)body
|
|
146
|
+
callback:(RCTResponseSenderBlock)callback)
|
|
128
147
|
{
|
|
129
148
|
[ReactNativeBlobUtilReqBuilder buildOctetRequest:options
|
|
130
149
|
taskId:taskId
|
|
@@ -144,7 +163,7 @@ RCT_EXPORT_METHOD(fetchBlob:(NSDictionary *)options
|
|
|
144
163
|
{
|
|
145
164
|
[[ReactNativeBlobUtilNetwork sharedInstance] sendRequest:options
|
|
146
165
|
contentLength:bodyLength
|
|
147
|
-
|
|
166
|
+
eventDispatcher:eventDispatcherRef
|
|
148
167
|
taskId:taskId
|
|
149
168
|
withRequest:req
|
|
150
169
|
callback:callback];
|
|
@@ -153,11 +172,23 @@ RCT_EXPORT_METHOD(fetchBlob:(NSDictionary *)options
|
|
|
153
172
|
}
|
|
154
173
|
|
|
155
174
|
#pragma mark - fs.createFile
|
|
175
|
+
// Signature for the Old Architecture
|
|
156
176
|
RCT_EXPORT_METHOD(createFile:(NSString *)path
|
|
157
177
|
data:(NSString *)data
|
|
158
178
|
encoding:(NSString *)encoding
|
|
159
179
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
160
180
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
181
|
+
{
|
|
182
|
+
[self createFile:path data:data encoding:encoding resolve:resolve reject:reject];
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Signature for the New Architecture. Codegen can't change the resolve/reject param names and
|
|
186
|
+
// If we change the RCT_EXPORT_METHOD we are going to introduce braking changes we may avoid.
|
|
187
|
+
- (void)createFile:(NSString *)path
|
|
188
|
+
data:(NSString *)data
|
|
189
|
+
encoding:(NSString *)encoding
|
|
190
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
191
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
161
192
|
{
|
|
162
193
|
NSFileManager * fm = [NSFileManager defaultManager];
|
|
163
194
|
NSData * fileContent = nil;
|
|
@@ -166,7 +197,7 @@ RCT_EXPORT_METHOD(createFile:(NSString *)path
|
|
|
166
197
|
fileContent = [[NSData alloc] initWithData:[data dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES]];
|
|
167
198
|
}
|
|
168
199
|
else if([[encoding lowercaseString] isEqualToString:@"base64"]) {
|
|
169
|
-
fileContent = [[NSData alloc]
|
|
200
|
+
fileContent = [[NSData alloc] initWithBase64EncodedString:data options:0];
|
|
170
201
|
}
|
|
171
202
|
else if([[encoding lowercaseString] isEqualToString:@"uri"]) {
|
|
172
203
|
NSString * orgPath = [data stringByReplacingOccurrencesOfString:FILE_PREFIX withString:@""];
|
|
@@ -190,21 +221,32 @@ RCT_EXPORT_METHOD(createFile:(NSString *)path
|
|
|
190
221
|
|
|
191
222
|
#pragma mark - fs.createFileASCII
|
|
192
223
|
// method for create file with ASCII content
|
|
224
|
+
// Signature for the Old Architecture
|
|
193
225
|
RCT_EXPORT_METHOD(createFileASCII:(NSString *)path
|
|
194
226
|
data:(NSArray *)dataArray
|
|
195
227
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
196
228
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
229
|
+
{
|
|
230
|
+
[self createFileASCII:path data:dataArray resolve:resolve reject:reject];
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// Signature for the New Architecture. Codegen can't change the resolve/reject param names and
|
|
234
|
+
// If we change the RCT_EXPORT_METHOD we are going to introduce braking changes we may avoid.
|
|
235
|
+
- (void)createFileASCII:(NSString *)path
|
|
236
|
+
data:(NSArray *)data
|
|
237
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
238
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
197
239
|
{
|
|
198
240
|
NSFileManager * fm = [NSFileManager defaultManager];
|
|
199
241
|
NSMutableData * fileContent = [NSMutableData alloc];
|
|
200
242
|
// prevent stack overflow, alloc on heap
|
|
201
|
-
char * bytes = (char*) malloc([
|
|
243
|
+
char * bytes = (char*) malloc([data count]);
|
|
202
244
|
|
|
203
|
-
for(int i = 0; i <
|
|
204
|
-
bytes[i] = [[
|
|
245
|
+
for(int i = 0; i < data.count; i++) {
|
|
246
|
+
bytes[i] = [[data objectAtIndex:i] charValue];
|
|
205
247
|
}
|
|
206
248
|
|
|
207
|
-
[fileContent appendBytes:bytes length:
|
|
249
|
+
[fileContent appendBytes:bytes length:data.count];
|
|
208
250
|
|
|
209
251
|
if ([fm fileExistsAtPath:path]) {
|
|
210
252
|
reject(@"EEXIST", [NSString stringWithFormat:@"File '%@' already exists", path], nil);
|
|
@@ -221,9 +263,19 @@ RCT_EXPORT_METHOD(createFileASCII:(NSString *)path
|
|
|
221
263
|
}
|
|
222
264
|
|
|
223
265
|
#pragma mark - fs.pathForAppGroup
|
|
266
|
+
// Signature for the Old Architecture
|
|
224
267
|
RCT_EXPORT_METHOD(pathForAppGroup:(NSString *)groupName
|
|
225
268
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
226
269
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
270
|
+
{
|
|
271
|
+
[self pathForAppGroup:groupName resolve:resolve reject:reject];
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// Signature for the New Architecture. Codegen can't change the resolve/reject param names and
|
|
275
|
+
// If we change the RCT_EXPORT_METHOD we are going to introduce braking changes we may avoid.
|
|
276
|
+
- (void)pathForAppGroup:(NSString *)groupName
|
|
277
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
278
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
227
279
|
{
|
|
228
280
|
NSString * path = [ReactNativeBlobUtilFS getPathForAppGroup:groupName];
|
|
229
281
|
|
|
@@ -252,21 +304,60 @@ RCT_EXPORT_METHOD(exists:(NSString *)path callback:(RCTResponseSenderBlock)callb
|
|
|
252
304
|
}
|
|
253
305
|
|
|
254
306
|
#pragma mark - fs.writeFile
|
|
255
|
-
|
|
307
|
+
// Signature for the Old Architecture
|
|
308
|
+
RCT_EXPORT_METHOD(writeFile:(NSString *)path
|
|
309
|
+
encoding:(NSString *)encoding
|
|
310
|
+
data:(NSString *)data
|
|
311
|
+
transformFile:(BOOL)transformFile
|
|
312
|
+
append:(BOOL)append
|
|
313
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
314
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
315
|
+
{
|
|
316
|
+
[self writeFile:path encoding:encoding data:data transformFile:transformFile append:append resolve:resolve reject:reject];
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// Signature for the New Architecture. Codegen can't change the resolve/reject param names and
|
|
320
|
+
// If we change the RCT_EXPORT_METHOD we are going to introduce braking changes we may avoid.
|
|
321
|
+
- (void)writeFile:(NSString *)path
|
|
322
|
+
encoding:(NSString *)encoding
|
|
323
|
+
data:(NSString *)data
|
|
324
|
+
transformFile:(BOOL)transformFile
|
|
325
|
+
append:(BOOL)append
|
|
326
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
327
|
+
reject:(RCTPromiseRejectBlock)reject;
|
|
256
328
|
{
|
|
257
329
|
[ReactNativeBlobUtilFS writeFile:path encoding:[NSString stringWithString:encoding] data:data transformFile:transformFile append:append resolver:resolve rejecter:reject];
|
|
258
330
|
}
|
|
259
331
|
|
|
260
332
|
#pragma mark - fs.writeArray
|
|
261
|
-
|
|
333
|
+
// Signature for the Old Architecture
|
|
334
|
+
RCT_EXPORT_METHOD(writeFileArray:(NSString *)path
|
|
335
|
+
data:(NSArray *)data
|
|
336
|
+
append:(BOOL)append
|
|
337
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
338
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
339
|
+
{
|
|
340
|
+
[self writeFileArray:path data:data append:append resolve:resolve reject:reject];
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
// Signature for the New Architecture. Codegen can't change the resolve/reject param names and
|
|
344
|
+
// If we change the RCT_EXPORT_METHOD we are going to introduce braking changes we may avoid.
|
|
345
|
+
- (void)writeFileArray:(NSString *)path
|
|
346
|
+
data:(NSArray *)data
|
|
347
|
+
append:(BOOL)append
|
|
348
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
349
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
262
350
|
{
|
|
263
351
|
[ReactNativeBlobUtilFS writeFileArray:path data:data append:append resolver:resolve rejecter:reject];
|
|
264
352
|
}
|
|
265
353
|
|
|
266
354
|
#pragma mark - fs.writeStream
|
|
267
|
-
RCT_EXPORT_METHOD(writeStream:(NSString *)path
|
|
355
|
+
RCT_EXPORT_METHOD(writeStream:(NSString *)path
|
|
356
|
+
withEncoding:(NSString *)encoding
|
|
357
|
+
appendData:(BOOL)append
|
|
358
|
+
callback:(RCTResponseSenderBlock)callback)
|
|
268
359
|
{
|
|
269
|
-
ReactNativeBlobUtilFS * fileStream = [[ReactNativeBlobUtilFS alloc]
|
|
360
|
+
ReactNativeBlobUtilFS * fileStream = [[ReactNativeBlobUtilFS alloc] initWithEventDispatcherRef:eventDispatcherRef];
|
|
270
361
|
NSFileManager * fm = [NSFileManager defaultManager];
|
|
271
362
|
NSString * folder = [path stringByDeletingLastPathComponent];
|
|
272
363
|
NSError* err = nil;
|
|
@@ -291,7 +382,9 @@ RCT_EXPORT_METHOD(writeStream:(NSString *)path withEncoding:(NSString *)encoding
|
|
|
291
382
|
}
|
|
292
383
|
|
|
293
384
|
#pragma mark - fs.writeArrayChunk
|
|
294
|
-
RCT_EXPORT_METHOD(writeArrayChunk:(NSString *)streamId
|
|
385
|
+
RCT_EXPORT_METHOD(writeArrayChunk:(NSString *)streamId
|
|
386
|
+
withArray:(NSArray *)dataArray
|
|
387
|
+
callback:(RCTResponseSenderBlock) callback)
|
|
295
388
|
{
|
|
296
389
|
ReactNativeBlobUtilFS *fs = [[ReactNativeBlobUtilFS getFileStreams] valueForKey:streamId];
|
|
297
390
|
char * bytes = (char *) malloc([dataArray count]);
|
|
@@ -306,7 +399,9 @@ RCT_EXPORT_METHOD(writeArrayChunk:(NSString *)streamId withArray:(NSArray *)data
|
|
|
306
399
|
}
|
|
307
400
|
|
|
308
401
|
#pragma mark - fs.writeChunk
|
|
309
|
-
RCT_EXPORT_METHOD(writeChunk:(NSString *)streamId
|
|
402
|
+
RCT_EXPORT_METHOD(writeChunk:(NSString *)streamId
|
|
403
|
+
withData:(NSString *)data
|
|
404
|
+
callback:(RCTResponseSenderBlock) callback)
|
|
310
405
|
{
|
|
311
406
|
ReactNativeBlobUtilFS *fs = [[ReactNativeBlobUtilFS getFileStreams] valueForKey:streamId];
|
|
312
407
|
[fs writeEncodeChunk:data];
|
|
@@ -325,7 +420,6 @@ RCT_EXPORT_METHOD(closeStream:(NSString *)streamId callback:(RCTResponseSenderBl
|
|
|
325
420
|
RCT_EXPORT_METHOD(unlink:(NSString *)path callback:(RCTResponseSenderBlock) callback)
|
|
326
421
|
{
|
|
327
422
|
NSError * error = nil;
|
|
328
|
-
NSString * tmpPath = nil;
|
|
329
423
|
[[NSFileManager defaultManager] removeItemAtPath:path error:&error];
|
|
330
424
|
if(error == nil || [[NSFileManager defaultManager] fileExistsAtPath:path] == NO)
|
|
331
425
|
callback(@[[NSNull null]]);
|
|
@@ -337,7 +431,6 @@ RCT_EXPORT_METHOD(unlink:(NSString *)path callback:(RCTResponseSenderBlock) call
|
|
|
337
431
|
RCT_EXPORT_METHOD(removeSession:(NSArray *)paths callback:(RCTResponseSenderBlock) callback)
|
|
338
432
|
{
|
|
339
433
|
NSError * error = nil;
|
|
340
|
-
NSString * tmpPath = nil;
|
|
341
434
|
|
|
342
435
|
for(NSString * path in paths) {
|
|
343
436
|
[[NSFileManager defaultManager] removeItemAtPath:path error:&error];
|
|
@@ -351,11 +444,21 @@ RCT_EXPORT_METHOD(removeSession:(NSArray *)paths callback:(RCTResponseSenderBloc
|
|
|
351
444
|
}
|
|
352
445
|
|
|
353
446
|
#pragma mark - fs.ls
|
|
447
|
+
// Signature for the Old Architecture
|
|
354
448
|
RCT_EXPORT_METHOD(ls:(NSString *)path resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
|
|
449
|
+
{
|
|
450
|
+
[self ls:path resolve:resolve reject:reject];
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
// Signature for the New Architecture. Codegen can't change the resolve/reject param names and
|
|
454
|
+
// If we change the RCT_EXPORT_METHOD we are going to introduce braking changes we may avoid.
|
|
455
|
+
- (void)ls:(NSString *)path
|
|
456
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
457
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
355
458
|
{
|
|
356
459
|
NSFileManager* fm = [NSFileManager defaultManager];
|
|
357
|
-
BOOL exist =
|
|
358
|
-
BOOL isDir =
|
|
460
|
+
BOOL exist = NO;
|
|
461
|
+
BOOL isDir = NO;
|
|
359
462
|
exist = [fm fileExistsAtPath:path isDirectory:&isDir];
|
|
360
463
|
if(exist == NO) {
|
|
361
464
|
return reject(@"ENOENT", [NSString stringWithFormat:@"No such file '%@'", path], nil);
|
|
@@ -377,12 +480,12 @@ RCT_EXPORT_METHOD(stat:(NSString *)target callback:(RCTResponseSenderBlock) call
|
|
|
377
480
|
{
|
|
378
481
|
|
|
379
482
|
[ReactNativeBlobUtilFS getPathFromUri:target completionHandler:^(NSString *path, ALAssetRepresentation *asset) {
|
|
380
|
-
__block
|
|
483
|
+
__block NSMutableDictionary * result;
|
|
381
484
|
if(path != nil)
|
|
382
485
|
{
|
|
383
486
|
NSFileManager* fm = [NSFileManager defaultManager];
|
|
384
|
-
BOOL exist =
|
|
385
|
-
BOOL isDir =
|
|
487
|
+
BOOL exist = NO;
|
|
488
|
+
BOOL isDir = NO;
|
|
386
489
|
NSError * error = nil;
|
|
387
490
|
|
|
388
491
|
exist = [fm fileExistsAtPath:path isDirectory:&isDir];
|
|
@@ -390,7 +493,7 @@ RCT_EXPORT_METHOD(stat:(NSString *)target callback:(RCTResponseSenderBlock) call
|
|
|
390
493
|
callback(@[[NSString stringWithFormat:@"failed to stat path `%@` because it does not exist or it is not a folder", path]]);
|
|
391
494
|
return ;
|
|
392
495
|
}
|
|
393
|
-
result = [ReactNativeBlobUtilFS stat:path error:&error];
|
|
496
|
+
result = [ReactNativeBlobUtilFS stat:path error:&error].mutableCopy;
|
|
394
497
|
|
|
395
498
|
if(error == nil)
|
|
396
499
|
callback(@[[NSNull null], result]);
|
|
@@ -416,8 +519,8 @@ RCT_EXPORT_METHOD(stat:(NSString *)target callback:(RCTResponseSenderBlock) call
|
|
|
416
519
|
RCT_EXPORT_METHOD(lstat:(NSString *)path callback:(RCTResponseSenderBlock) callback)
|
|
417
520
|
{
|
|
418
521
|
NSFileManager* fm = [NSFileManager defaultManager];
|
|
419
|
-
BOOL exist =
|
|
420
|
-
BOOL isDir =
|
|
522
|
+
BOOL exist = NO;
|
|
523
|
+
BOOL isDir = NO;
|
|
421
524
|
|
|
422
525
|
path = [ReactNativeBlobUtilFS getPathOfAsset:path];
|
|
423
526
|
|
|
@@ -448,7 +551,17 @@ RCT_EXPORT_METHOD(lstat:(NSString *)path callback:(RCTResponseSenderBlock) callb
|
|
|
448
551
|
}
|
|
449
552
|
|
|
450
553
|
#pragma mark - fs.cp
|
|
554
|
+
// Signature for the Old Architecture
|
|
451
555
|
RCT_EXPORT_METHOD(cp:(NSString*)src toPath:(NSString *)dest callback:(RCTResponseSenderBlock) callback)
|
|
556
|
+
{
|
|
557
|
+
[self cp:src dest:dest callback:callback];
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
// Signature for the New Architecture. Codegen can't change the resolve/reject param names and
|
|
561
|
+
// If we change the RCT_EXPORT_METHOD we are going to introduce braking changes we may avoid.
|
|
562
|
+
- (void)cp:(NSString *)src
|
|
563
|
+
dest:(NSString *)dest
|
|
564
|
+
callback:(RCTResponseSenderBlock)callback
|
|
452
565
|
{
|
|
453
566
|
// path = [ReactNativeBlobUtilFS getPathOfAsset:path];
|
|
454
567
|
[ReactNativeBlobUtilFS getPathFromUri:src completionHandler:^(NSString *path, ALAssetRepresentation *asset) {
|
|
@@ -471,9 +584,18 @@ RCT_EXPORT_METHOD(cp:(NSString*)src toPath:(NSString *)dest callback:(RCTRespons
|
|
|
471
584
|
}];
|
|
472
585
|
}
|
|
473
586
|
|
|
474
|
-
|
|
475
587
|
#pragma mark - fs.mv
|
|
588
|
+
// Signature for the Old Architecture
|
|
476
589
|
RCT_EXPORT_METHOD(mv:(NSString *)path toPath:(NSString *)dest callback:(RCTResponseSenderBlock) callback)
|
|
590
|
+
{
|
|
591
|
+
[self mv:path dest:dest callback:callback];
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
// Signature for the New Architecture. Codegen can't change the resolve/reject param names and
|
|
595
|
+
// If we change the RCT_EXPORT_METHOD we are going to introduce braking changes we may avoid.
|
|
596
|
+
- (void)mv:(NSString *)path
|
|
597
|
+
dest:(NSString *)dest
|
|
598
|
+
callback:(RCTResponseSenderBlock)callback
|
|
477
599
|
{
|
|
478
600
|
NSError * error = nil;
|
|
479
601
|
BOOL result = [[NSFileManager defaultManager] moveItemAtURL:[NSURL fileURLWithPath:path] toURL:[NSURL fileURLWithPath:dest] error:&error];
|
|
@@ -487,37 +609,69 @@ RCT_EXPORT_METHOD(mv:(NSString *)path toPath:(NSString *)dest callback:(RCTRespo
|
|
|
487
609
|
|
|
488
610
|
#pragma mark - fs.mkdir
|
|
489
611
|
RCT_EXPORT_METHOD(mkdir:(NSString *)path resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
|
|
612
|
+
{
|
|
613
|
+
[self mkdir:path resolve:resolve reject:reject];
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
- (void)mkdir:(NSString *)path
|
|
617
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
618
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
490
619
|
{
|
|
491
620
|
[ReactNativeBlobUtilFS mkdir:path resolver:resolve rejecter:reject];
|
|
492
621
|
}
|
|
493
622
|
|
|
494
623
|
#pragma mark - fs.readFile
|
|
624
|
+
// Signature for the Old Architecture
|
|
495
625
|
RCT_EXPORT_METHOD(readFile:(NSString *)path
|
|
496
626
|
encoding:(NSString *)encoding
|
|
497
627
|
transformFile:(BOOL) transformFile
|
|
498
628
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
499
629
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
500
630
|
{
|
|
501
|
-
|
|
631
|
+
[self readFile:path encoding:encoding transformFile:transformFile resolve:resolve reject:reject];
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
// Signature for the New Architecture. Codegen can't change the resolve/reject param names and
|
|
635
|
+
// If we change the RCT_EXPORT_METHOD we are going to introduce braking changes we may avoid.
|
|
636
|
+
- (void)readFile:(NSString *)path
|
|
637
|
+
encoding:(NSString *)encoding
|
|
638
|
+
transformFile:(BOOL)transformFile
|
|
639
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
640
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
641
|
+
{
|
|
642
|
+
|
|
502
643
|
[ReactNativeBlobUtilFS readFile:path encoding:encoding transformFile:transformFile onComplete:^(NSData * content, NSString * code, NSString * err) {
|
|
503
644
|
if(err != nil) {
|
|
504
645
|
reject(code, err, nil);
|
|
505
646
|
return;
|
|
506
647
|
}
|
|
507
|
-
if(encoding
|
|
648
|
+
if([encoding isEqualToString:@"ascii"]) {
|
|
508
649
|
resolve((NSMutableArray *)content);
|
|
509
650
|
}
|
|
510
|
-
|
|
511
|
-
resolve(
|
|
651
|
+
if([encoding isEqualToString:@"base64"]) {
|
|
652
|
+
resolve([content base64EncodedStringWithOptions:0]);
|
|
653
|
+
} else {
|
|
654
|
+
resolve([[NSString alloc] initWithData:content encoding:NSUTF8StringEncoding]);
|
|
512
655
|
}
|
|
513
656
|
}];
|
|
514
657
|
}
|
|
515
658
|
|
|
516
659
|
#pragma mark - fs.hash
|
|
660
|
+
// Signature for the Old Architecture
|
|
517
661
|
RCT_EXPORT_METHOD(hash:(NSString *)path
|
|
518
662
|
algorithm:(NSString *)algorithm
|
|
519
663
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
520
664
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
665
|
+
{
|
|
666
|
+
[self hash:path algorithm:algorithm resolve:resolve reject:reject];
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
// Signature for the New Architecture. Codegen can't change the resolve/reject param names and
|
|
670
|
+
// If we change the RCT_EXPORT_METHOD we are going to introduce braking changes we may avoid.
|
|
671
|
+
- (void)hash:(NSString *)path
|
|
672
|
+
algorithm:(NSString *)algorithm
|
|
673
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
674
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
521
675
|
{
|
|
522
676
|
[ReactNativeBlobUtilFS hash:path algorithm:[NSString stringWithString:algorithm] resolver:resolve rejecter:reject];
|
|
523
677
|
}
|
|
@@ -525,7 +679,7 @@ RCT_EXPORT_METHOD(hash:(NSString *)path
|
|
|
525
679
|
#pragma mark - fs.readStream
|
|
526
680
|
RCT_EXPORT_METHOD(readStream:(NSString *)path withEncoding:(NSString *)encoding bufferSize:(int)bufferSize tick:(int)tick streamId:(NSString *)streamId)
|
|
527
681
|
{
|
|
528
|
-
if(bufferSize ==
|
|
682
|
+
if(bufferSize == 0) {
|
|
529
683
|
if([[encoding lowercaseString] isEqualToString:@"base64"])
|
|
530
684
|
bufferSize = 4095;
|
|
531
685
|
else
|
|
@@ -533,7 +687,7 @@ RCT_EXPORT_METHOD(readStream:(NSString *)path withEncoding:(NSString *)encoding
|
|
|
533
687
|
}
|
|
534
688
|
|
|
535
689
|
dispatch_async(fsQueue, ^{
|
|
536
|
-
[ReactNativeBlobUtilFS readStream:path encoding:encoding bufferSize:bufferSize tick:tick streamId:streamId
|
|
690
|
+
[ReactNativeBlobUtilFS readStream:path encoding:encoding bufferSize:bufferSize tick:tick streamId:streamId eventDispatcherRef:eventDispatcherRef];
|
|
537
691
|
});
|
|
538
692
|
}
|
|
539
693
|
|
|
@@ -570,12 +724,36 @@ RCT_EXPORT_METHOD(enableUploadProgressReport:(NSString *)taskId interval:(nonnul
|
|
|
570
724
|
}
|
|
571
725
|
|
|
572
726
|
#pragma mark - fs.slice
|
|
727
|
+
// Signature for the Old Architecture
|
|
573
728
|
RCT_EXPORT_METHOD(slice:(NSString *)src dest:(NSString *)dest start:(nonnull NSNumber *)start end:(nonnull NSNumber *)end resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
|
|
574
729
|
{
|
|
575
|
-
[
|
|
730
|
+
[self slice:src dest:dest start:start.doubleValue end:end.doubleValue resolve:resolve reject:reject];
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
// Signature for the New Architecture. Codegen can't change the resolve/reject param names and
|
|
734
|
+
// If we change the RCT_EXPORT_METHOD we are going to introduce braking changes we may avoid.
|
|
735
|
+
- (void)slice:(NSString *)src
|
|
736
|
+
dest:(NSString *)dest
|
|
737
|
+
start:(double)start
|
|
738
|
+
end:(double)end
|
|
739
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
740
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
741
|
+
{
|
|
742
|
+
[ReactNativeBlobUtilFS slice:src dest:dest start:@(start) end:@(end) encode:@"" resolver:resolve rejecter:reject];
|
|
576
743
|
}
|
|
577
744
|
|
|
745
|
+
// Signature for the Old Architecture
|
|
578
746
|
RCT_EXPORT_METHOD(presentOptionsMenu:(NSString*)uri scheme:(NSString *)scheme resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
|
|
747
|
+
{
|
|
748
|
+
[self presentOptionsMenu:uri scheme:scheme resolve:resolve reject:reject];
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
// Signature for the New Architecture. Codegen can't change the resolve/reject param names and
|
|
752
|
+
// If we change the RCT_EXPORT_METHOD we are going to introduce braking changes we may avoid.
|
|
753
|
+
- (void)presentOptionsMenu:(NSString *)uri
|
|
754
|
+
scheme:(NSString *)scheme
|
|
755
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
756
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
579
757
|
{
|
|
580
758
|
NSString * utf8uri = [uri stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
|
581
759
|
NSURL * url = [[NSURL alloc] initWithString:utf8uri];
|
|
@@ -594,7 +772,18 @@ RCT_EXPORT_METHOD(presentOptionsMenu:(NSString*)uri scheme:(NSString *)scheme re
|
|
|
594
772
|
}
|
|
595
773
|
}
|
|
596
774
|
|
|
775
|
+
// Signature for the Old Architecture
|
|
597
776
|
RCT_EXPORT_METHOD(presentOpenInMenu:(NSString*)uri scheme:(NSString *)scheme resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
|
|
777
|
+
{
|
|
778
|
+
[self presentOpenInMenu:uri scheme:scheme resolve:resolve reject:reject];
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
// Signature for the New Architecture. Codegen can't change the resolve/reject param names and
|
|
782
|
+
// If we change the RCT_EXPORT_METHOD we are going to introduce braking changes we may avoid.
|
|
783
|
+
- (void)presentOpenInMenu:(NSString *)uri
|
|
784
|
+
scheme:(NSString *)scheme
|
|
785
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
786
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
598
787
|
{
|
|
599
788
|
NSString * utf8uri = [uri stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
|
600
789
|
NSURL * url = [[NSURL alloc] initWithString:utf8uri];
|
|
@@ -613,8 +802,18 @@ RCT_EXPORT_METHOD(presentOpenInMenu:(NSString*)uri scheme:(NSString *)scheme res
|
|
|
613
802
|
}
|
|
614
803
|
|
|
615
804
|
# pragma mark - open file with UIDocumentInteractionController and delegate
|
|
616
|
-
|
|
805
|
+
// Signature for the Old Architecture
|
|
617
806
|
RCT_EXPORT_METHOD(presentPreview:(NSString*)uri scheme:(NSString *)scheme resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
|
|
807
|
+
{
|
|
808
|
+
[self presentPreview:uri scheme:scheme resolve:resolve reject:reject];
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
// Signature for the New Architecture. Codegen can't change the resolve/reject param names and
|
|
812
|
+
// If we change the RCT_EXPORT_METHOD we are going to introduce braking changes we may avoid.
|
|
813
|
+
- (void)presentPreview:(NSString *)uri
|
|
814
|
+
scheme:(NSString *)scheme
|
|
815
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
816
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
618
817
|
{
|
|
619
818
|
NSString * utf8uri = [uri stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
|
620
819
|
NSURL * url = [[NSURL alloc] initWithString:utf8uri];
|
|
@@ -638,6 +837,13 @@ RCT_EXPORT_METHOD(presentPreview:(NSString*)uri scheme:(NSString *)scheme resolv
|
|
|
638
837
|
# pragma mark - exclude from backup key
|
|
639
838
|
|
|
640
839
|
RCT_EXPORT_METHOD(excludeFromBackupKey:(NSString *)url resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
|
|
840
|
+
{
|
|
841
|
+
[self excludeFromBackupKey:url resolve:resolve reject:reject];
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
- (void)excludeFromBackupKey:(NSString *)url
|
|
845
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
846
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
641
847
|
{
|
|
642
848
|
NSError *error = nil;
|
|
643
849
|
[ [NSURL URLWithString:url] setResourceValue:[NSNumber numberWithBool:YES] forKey:NSURLIsExcludedFromBackupKey error:&error];
|
|
@@ -656,7 +862,7 @@ RCT_EXPORT_METHOD(df:(RCTResponseSenderBlock)callback)
|
|
|
656
862
|
[ReactNativeBlobUtilFS df:callback];
|
|
657
863
|
}
|
|
658
864
|
|
|
659
|
-
- (UIViewController *)
|
|
865
|
+
- (UIViewController *)documentInteractionControllerViewControllerForPreview: (UIDocumentInteractionController *) controller
|
|
660
866
|
{
|
|
661
867
|
UIWindow *window = [UIApplication sharedApplication].keyWindow;
|
|
662
868
|
return window.rootViewController;
|
|
@@ -666,10 +872,97 @@ RCT_EXPORT_METHOD(df:(RCTResponseSenderBlock)callback)
|
|
|
666
872
|
|
|
667
873
|
RCT_EXPORT_METHOD(emitExpiredEvent:(RCTResponseSenderBlock)callback)
|
|
668
874
|
{
|
|
669
|
-
[ReactNativeBlobUtilNetwork emitExpiredTasks];
|
|
875
|
+
[ReactNativeBlobUtilNetwork emitExpiredTasks:eventDispatcherRef];
|
|
670
876
|
}
|
|
671
877
|
|
|
878
|
+
# pragma mark - Android Only methods
|
|
879
|
+
// These methods are required because in the New Arch we have a single spec for both platforms
|
|
880
|
+
- (void)actionViewIntent:(NSString *) path
|
|
881
|
+
mime:(NSString *) mime
|
|
882
|
+
chooserTitle:(NSString *) chooserTitle
|
|
883
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
884
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
885
|
+
{
|
|
886
|
+
reject(@"ENOT_SUPPORTED", @"This method is not supported on iOS", nil);
|
|
887
|
+
}
|
|
672
888
|
|
|
889
|
+
- (void)addCompleteDownload:(NSDictionary *)config
|
|
890
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
891
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
892
|
+
{
|
|
893
|
+
reject(@"ENOT_SUPPORTED", @"This method is not supported on iOS", nil);
|
|
894
|
+
}
|
|
673
895
|
|
|
896
|
+
- (void)copyToInternal:(NSString *)contentUri
|
|
897
|
+
destpath:(NSString *) destpath
|
|
898
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
899
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
900
|
+
{
|
|
901
|
+
reject(@"ENOT_SUPPORTED", @"This method is not supported on iOS", nil);
|
|
902
|
+
}
|
|
903
|
+
- (void)copyToMediaStore:(NSDictionary *)filedata
|
|
904
|
+
mt:(NSString *) mt
|
|
905
|
+
path:(NSString *)
|
|
906
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
907
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
908
|
+
{
|
|
909
|
+
reject(@"ENOT_SUPPORTED", @"This method is not supported on iOS", nil);
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
- (void)createMediaFile:(NSDictionary *)filedata
|
|
913
|
+
mt:(NSString *) mt
|
|
914
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
915
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
916
|
+
{
|
|
917
|
+
reject(@"ENOT_SUPPORTED", @"This method is not supported on iOS", nil);
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
- (void)getBlob:(NSString *)contentUri
|
|
921
|
+
encoding:(NSString *)encoding
|
|
922
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
923
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
924
|
+
{
|
|
925
|
+
reject(@"ENOT_SUPPORTED", @"This method is not supported on iOS", nil);
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
- (void)getContentIntent:(NSString *)mime
|
|
929
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
930
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
931
|
+
{
|
|
932
|
+
reject(@"ENOT_SUPPORTED", @"This method is not supported on iOS", nil);
|
|
933
|
+
}
|
|
934
|
+
- (void)getSDCardDir:(RCTPromiseResolveBlock)resolve
|
|
935
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
936
|
+
{
|
|
937
|
+
reject(@"ENOT_SUPPORTED", @"This method is not supported on iOS", nil);
|
|
938
|
+
}
|
|
939
|
+
- (void)getSDCardApplicationDir:(RCTPromiseResolveBlock)resolve
|
|
940
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
941
|
+
{
|
|
942
|
+
reject(@"ENOT_SUPPORTED", @"This method is not supported on iOS", nil);
|
|
943
|
+
}
|
|
944
|
+
- (void)scanFile:(NSArray *)pairs
|
|
945
|
+
callback:(RCTResponseSenderBlock)callback
|
|
946
|
+
{
|
|
947
|
+
callback(@[@"Scan file method not supported in iOS"]);
|
|
948
|
+
}
|
|
949
|
+
- (void)writeToMediaFile:(NSString *)fileUri
|
|
950
|
+
path:(NSString *)path
|
|
951
|
+
transformFile:(BOOL)transformFile
|
|
952
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
953
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
954
|
+
{
|
|
955
|
+
reject(@"ENOT_SUPPORTED", @"This method is not supported on iOS", nil);
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
|
|
959
|
+
# pragma mark - New Architecture
|
|
960
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
961
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
962
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
963
|
+
{
|
|
964
|
+
return std::make_shared<facebook::react::NativeBlobUtilsSpecJSI>(params);
|
|
965
|
+
}
|
|
966
|
+
#endif
|
|
674
967
|
|
|
675
968
|
@end
|
|
File without changes
|