@onekeyfe/react-native-cloud-fs 3.0.8 → 3.0.10

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.
Files changed (2) hide show
  1. package/ios/CloudFs.mm +1 -20
  2. package/package.json +1 -1
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:@"assets-library"]) {
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.8",
3
+ "version": "3.0.10",
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",