@onekeyfe/react-native-cloud-fs 3.0.9 → 3.0.11
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/ios/CloudFs.mm
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
#import "CloudFs.h"
|
|
2
2
|
#import <UIKit/UIKit.h>
|
|
3
|
-
#import <AssetsLibrary/AssetsLibrary.h>
|
|
4
3
|
|
|
5
4
|
@implementation CloudFs
|
|
6
5
|
|
|
@@ -237,25 +236,7 @@
|
|
|
237
236
|
sourceUri = [source objectForKey:@"path"];
|
|
238
237
|
}
|
|
239
238
|
|
|
240
|
-
if ([sourceUri hasPrefix:@"
|
|
241
|
-
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
|
|
242
|
-
[library assetForURL:[NSURL URLWithString:sourceUri] resultBlock:^(ALAsset *asset) {
|
|
243
|
-
ALAssetRepresentation *rep = [asset defaultRepresentation];
|
|
244
|
-
Byte *buffer = (Byte *)malloc(rep.size);
|
|
245
|
-
NSUInteger buffered = [rep getBytes:buffer fromOffset:0.0 length:rep.size error:nil];
|
|
246
|
-
NSData *data = [NSData dataWithBytesNoCopy:buffer length:buffered freeWhenDone:YES];
|
|
247
|
-
if (data) {
|
|
248
|
-
NSString *filename = [sourceUri lastPathComponent];
|
|
249
|
-
NSString *tempFile = [NSTemporaryDirectory() stringByAppendingPathComponent:filename];
|
|
250
|
-
[data writeToFile:tempFile atomically:YES];
|
|
251
|
-
[self moveToICloudDirectory:documentsFolder tempFile:tempFile destinationPath:destinationPath resolve:resolve reject:reject];
|
|
252
|
-
} else {
|
|
253
|
-
return reject(@"error", [NSString stringWithFormat:@"failed to copy asset '%@'", sourceUri], nil);
|
|
254
|
-
}
|
|
255
|
-
} failureBlock:^(NSError *error) {
|
|
256
|
-
return reject(@"error", error.description, nil);
|
|
257
|
-
}];
|
|
258
|
-
} else if ([sourceUri hasPrefix:@"file:/"] || [sourceUri hasPrefix:@"/"]) {
|
|
239
|
+
if ([sourceUri hasPrefix:@"file:/"] || [sourceUri hasPrefix:@"/"]) {
|
|
259
240
|
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"^file:/+" options:NSRegularExpressionCaseInsensitive error:nil];
|
|
260
241
|
NSString *modifiedSourceUri = [regex stringByReplacingMatchesInString:sourceUri options:0 range:NSMakeRange(0, [sourceUri length]) withTemplate:@"/"];
|
|
261
242
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/react-native-cloud-fs",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.11",
|
|
4
4
|
"description": "react-native-cloud-fs TurboModule for OneKey",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
"!**/__fixtures__",
|
|
23
23
|
"!**/__mocks__",
|
|
24
24
|
"!**/.*",
|
|
25
|
-
"android"
|
|
25
|
+
"android",
|
|
26
|
+
"!**/*.map"
|
|
26
27
|
],
|
|
27
28
|
"scripts": {
|
|
28
29
|
"prepare": "bob build",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeCloudFs.ts"],"mappings":";;AAAA,SAASA,mBAAmB,QAAQ,cAAc;AAclD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,WAAW,CAAC","ignoreList":[]}
|
package/lib/module/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["NativeCloudFs","CloudFs"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,aAAa,MAAM,oBAAiB;AAE3C,OAAO,MAAMC,OAAO,GAAGD,aAAa","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NativeCloudFs.d.ts","sourceRoot":"","sources":["../../../src/NativeCloudFs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAChC,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7C,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9C,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5C,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACrD,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/C,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9C,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;;AAED,wBAAmE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,gCAAgB,CAAC;AACrC,YAAY,EAAE,IAAI,IAAI,WAAW,EAAE,MAAM,iBAAiB,CAAC"}
|