react-native-cloud-storage 2.3.0 → 3.0.0
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 +1 -1
- package/android/build.gradle +1 -14
- package/android/src/main/java/com/voicekit/CloudStorageLocalFileSystemModule.kt +16 -20
- package/android/src/main/java/com/voicekit/CloudStoragePackage.kt +23 -8
- package/dist/commonjs/cloud-storage.js +66 -31
- package/dist/commonjs/cloud-storage.js.map +1 -1
- package/dist/commonjs/specs/NativeCloudStorageCloudKitIOS.js +9 -0
- package/dist/commonjs/specs/NativeCloudStorageCloudKitIOS.js.map +1 -0
- package/dist/commonjs/specs/NativeCloudStorageLocalFileSystem.js +9 -0
- package/dist/commonjs/specs/NativeCloudStorageLocalFileSystem.js.map +1 -0
- package/dist/commonjs/storages/cloudkit.js +5 -3
- package/dist/commonjs/storages/cloudkit.js.map +1 -1
- package/dist/commonjs/storages/google-drive/client.js +3 -2
- package/dist/commonjs/storages/google-drive/client.js.map +1 -1
- package/dist/commonjs/storages/google-drive/index.js +99 -77
- package/dist/commonjs/storages/google-drive/index.js.map +1 -1
- package/dist/commonjs/types/main.js.map +1 -1
- package/dist/commonjs/utils/constants.js +2 -1
- package/dist/commonjs/utils/constants.js.map +1 -1
- package/dist/commonjs/utils/local-fs.js +3 -2
- package/dist/commonjs/utils/local-fs.js.map +1 -1
- package/dist/commonjs/utils/native.js.map +1 -1
- package/dist/module/cloud-storage.js +68 -33
- package/dist/module/cloud-storage.js.map +1 -1
- package/dist/module/specs/NativeCloudStorageCloudKitIOS.js +5 -0
- package/dist/module/specs/NativeCloudStorageCloudKitIOS.js.map +1 -0
- package/dist/module/specs/NativeCloudStorageLocalFileSystem.js +5 -0
- package/dist/module/specs/NativeCloudStorageLocalFileSystem.js.map +1 -0
- package/dist/module/storages/cloudkit.js +3 -2
- package/dist/module/storages/cloudkit.js.map +1 -1
- package/dist/module/storages/google-drive/client.js +3 -2
- package/dist/module/storages/google-drive/client.js.map +1 -1
- package/dist/module/storages/google-drive/index.js +99 -77
- package/dist/module/storages/google-drive/index.js.map +1 -1
- package/dist/module/types/main.js.map +1 -1
- package/dist/module/utils/constants.js +2 -1
- package/dist/module/utils/constants.js.map +1 -1
- package/dist/module/utils/local-fs.js +2 -2
- package/dist/module/utils/local-fs.js.map +1 -1
- package/dist/module/utils/native.js.map +1 -1
- package/dist/typescript/cloud-storage.d.ts +7 -0
- package/dist/typescript/cloud-storage.d.ts.map +1 -1
- package/dist/typescript/specs/NativeCloudStorageCloudKitIOS.d.ts +30 -0
- package/dist/typescript/specs/NativeCloudStorageCloudKitIOS.d.ts.map +1 -0
- package/dist/typescript/specs/NativeCloudStorageLocalFileSystem.d.ts +24 -0
- package/dist/typescript/specs/NativeCloudStorageLocalFileSystem.d.ts.map +1 -0
- package/dist/typescript/storages/cloudkit.d.ts +3 -0
- package/dist/typescript/storages/cloudkit.d.ts.map +1 -1
- package/dist/typescript/storages/google-drive/client.d.ts +1 -1
- package/dist/typescript/storages/google-drive/client.d.ts.map +1 -1
- package/dist/typescript/storages/google-drive/index.d.ts +7 -1
- package/dist/typescript/storages/google-drive/index.d.ts.map +1 -1
- package/dist/typescript/types/main.d.ts +8 -0
- package/dist/typescript/types/main.d.ts.map +1 -1
- package/dist/typescript/types/native.d.ts +6 -43
- package/dist/typescript/types/native.d.ts.map +1 -1
- package/dist/typescript/utils/constants.d.ts.map +1 -1
- package/dist/typescript/utils/local-fs.d.ts +1 -2
- package/dist/typescript/utils/local-fs.d.ts.map +1 -1
- package/dist/typescript/utils/native.d.ts +1 -1
- package/dist/typescript/utils/native.d.ts.map +1 -1
- package/ios/CloudStorage-Bridging-Header.h +0 -1
- package/ios/CloudStorageCloudKit.swift +15 -14
- package/ios/CloudStorageLocalFileSystem.swift +7 -6
- package/ios/RCTCloudStorageCloudKit.mm +209 -0
- package/ios/RCTCloudStorageLocalFileSystem.mm +149 -0
- package/ios/Utils/CloudKitUtils.swift +8 -2
- package/ios/Utils/FileUtils.swift +2 -4
- package/ios/Utils/Promise.swift +1 -0
- package/ios/Utils/Types.swift +1 -0
- package/ios/react_native_cloud_storage.h +6 -0
- package/package.json +30 -17
- package/react-native-cloud-storage.podspec +2 -0
- package/src/cloud-storage.ts +90 -42
- package/src/specs/NativeCloudStorageCloudKitIOS.ts +33 -0
- package/src/specs/NativeCloudStorageLocalFileSystem.ts +28 -0
- package/src/storages/cloudkit.ts +10 -2
- package/src/storages/google-drive/client.ts +2 -1
- package/src/storages/google-drive/index.ts +126 -120
- package/src/types/main.ts +9 -0
- package/src/types/native.ts +10 -54
- package/src/utils/constants.ts +1 -0
- package/src/utils/local-fs.ts +2 -2
- package/src/utils/native.ts +1 -1
- package/ios/CloudStorageCloudKit.m +0 -24
- package/ios/CloudStorageEventEmitter.m +0 -16
- package/ios/CloudStorageEventEmitter.swift +0 -30
- package/ios/CloudStorageLocalFileSystem.m +0 -15
|
@@ -9,12 +9,18 @@ export default class GoogleDrive implements NativeStorage {
|
|
|
9
9
|
constructor(options: DeepRequired<CloudStorageProviderOptions['googledrive']>);
|
|
10
10
|
isCloudAvailable: () => Promise<boolean>;
|
|
11
11
|
private getRootDirectory;
|
|
12
|
+
private isRootPath;
|
|
12
13
|
private resolvePathToDirectories;
|
|
14
|
+
private escapeDriveQueryValue;
|
|
15
|
+
private getQueryRootParentId;
|
|
16
|
+
private findDirectoryByNameAndParent;
|
|
17
|
+
private findFilesByNameAndParent;
|
|
18
|
+
private findFilesByParent;
|
|
13
19
|
private findParentDirectoryId;
|
|
14
20
|
/**
|
|
15
21
|
* Gets the Google Drive ID of the root directory for the given scope.
|
|
16
22
|
* @param scope The scope to get the root directory for.
|
|
17
|
-
* @returns A promise that resolves to the ID of the root directory
|
|
23
|
+
* @returns A promise that resolves to the ID of the root directory.
|
|
18
24
|
*/
|
|
19
25
|
private getRootDirectoryId;
|
|
20
26
|
private checkIfMultipleFilesWithSameName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storages/google-drive/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EACb,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACxB,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAE,KAAK,2BAA2B,EAAE,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEvF;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,WAAY,YAAW,aAAa;IACvD,OAAO,CAAC,KAAK,CAAuB;IACpC,OAAO,CAAC,OAAO,CAA2D;gBAE9D,OAAO,EAAE,YAAY,CAAC,2BAA2B,CAAC,aAAa,CAAC,CAAC;IAuBtE,gBAAgB,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAG7C;IAEF,OAAO,CAAC,gBAAgB;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storages/google-drive/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EACb,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACxB,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAE,KAAK,2BAA2B,EAAE,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEvF;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,WAAY,YAAW,aAAa;IACvD,OAAO,CAAC,KAAK,CAAuB;IACpC,OAAO,CAAC,OAAO,CAA2D;gBAE9D,OAAO,EAAE,YAAY,CAAC,2BAA2B,CAAC,aAAa,CAAC,CAAC;IAuBtE,gBAAgB,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAG7C;IAEF,OAAO,CAAC,gBAAgB;IAcxB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,wBAAwB;IAWhC,OAAO,CAAC,qBAAqB;YAIf,oBAAoB;YAQpB,4BAA4B;YAW5B,wBAAwB;YAWxB,iBAAiB;YAMjB,qBAAqB;IAenC;;;;OAIG;YACW,kBAAkB;IAgBhC,OAAO,CAAC,gCAAgC;YAa1B,SAAS;IAsDjB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC;IAUrE,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAuClF,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAkDpG,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IASrE,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAiCvE,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAMlE,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAKrE,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAMlE,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAmB3F,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAajF,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAgB7F,UAAU,CACd,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,kBAAkB,EACzB,SAAS,EAAE,OAAO,GACjB,OAAO,CAAC,IAAI,CAAC;CAyDjB"}
|
|
@@ -5,6 +5,7 @@ export declare enum CloudStorageScope {
|
|
|
5
5
|
Documents = "documents",
|
|
6
6
|
AppData = "app_data"
|
|
7
7
|
}
|
|
8
|
+
export type ICloudDocumentsMode = 'icloud' | 'legacy_sandbox';
|
|
8
9
|
export interface CloudStorageFileStat {
|
|
9
10
|
size: number;
|
|
10
11
|
birthtimeMs: number;
|
|
@@ -24,6 +25,13 @@ export interface CloudStorageProviderOptions {
|
|
|
24
25
|
* The directory scope to use for iCloud operations. Defaults to 'app_data'.
|
|
25
26
|
*/
|
|
26
27
|
scope?: CloudStorageScope;
|
|
28
|
+
/**
|
|
29
|
+
* The directory mode to use for CloudStorageScope.Documents.
|
|
30
|
+
* `icloud` uses the user-facing iCloud Documents directory, while
|
|
31
|
+
* `legacy_sandbox` uses the local app sandbox Documents directory.
|
|
32
|
+
* Defaults to `icloud`.
|
|
33
|
+
*/
|
|
34
|
+
documentsMode?: ICloudDocumentsMode;
|
|
27
35
|
};
|
|
28
36
|
[CloudStorageProvider.GoogleDrive]: {
|
|
29
37
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/types/main.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI;KAC3B,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAClE,CAAC;AAEF,oBAAY,iBAAiB;IAC3B,SAAS,cAAc;IACvB,OAAO,aAAa;CACrB;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,KAAK,EAAE,IAAI,CAAC;IACZ,WAAW,EAAE,MAAM,OAAO,CAAC;IAC3B,MAAM,EAAE,MAAM,OAAO,CAAC;CACvB;AAED,oBAAY,oBAAoB;IAC9B,MAAM,WAAW;IACjB,WAAW,gBAAgB;CAC5B;AAED,MAAM,WAAW,2BAA2B;IAC1C,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE;QAC7B;;WAEG;QACH,KAAK,CAAC,EAAE,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/types/main.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI;KAC3B,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAClE,CAAC;AAEF,oBAAY,iBAAiB;IAC3B,SAAS,cAAc;IACvB,OAAO,aAAa;CACrB;AAED,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,gBAAgB,CAAC;AAE9D,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,KAAK,EAAE,IAAI,CAAC;IACZ,WAAW,EAAE,MAAM,OAAO,CAAC;IAC3B,MAAM,EAAE,MAAM,OAAO,CAAC;CACvB;AAED,oBAAY,oBAAoB;IAC9B,MAAM,WAAW;IACjB,WAAW,gBAAgB;CAC5B;AAED,MAAM,WAAW,2BAA2B;IAC1C,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE;QAC7B;;WAEG;QACH,KAAK,CAAC,EAAE,iBAAiB,CAAC;QAC1B;;;;;WAKG;QACH,aAAa,CAAC,EAAE,mBAAmB,CAAC;KACrC,CAAC;IAEF,CAAC,oBAAoB,CAAC,WAAW,CAAC,EAAE;QAClC;;WAEG;QACH,KAAK,CAAC,EAAE,iBAAiB,CAAC;QAC1B;;WAEG;QACH,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC5B;;WAEG;QACH,eAAe,CAAC,EAAE,OAAO,CAAC;QAC1B;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH"}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
mtimeMs: number;
|
|
6
|
-
isDirectory: boolean;
|
|
7
|
-
isFile: boolean;
|
|
8
|
-
}
|
|
1
|
+
import type { CloudStorageFileStat, Spec as NativeCloudStorageCloudKitSpec } from '../specs/NativeCloudStorageCloudKitIOS';
|
|
2
|
+
import type { Spec as NativeCloudStorageLocalFileSystemSpec } from '../specs/NativeCloudStorageLocalFileSystem';
|
|
3
|
+
export type NativeStorageScope = 'documents' | 'documents_legacy' | 'app_data';
|
|
4
|
+
export type NativeStorageFileStat = CloudStorageFileStat;
|
|
9
5
|
export declare enum NativeCloudStorageErrorCode {
|
|
10
6
|
INVALID_SCOPE = "ERR_INVALID_SCOPE",
|
|
11
7
|
FILE_NOT_FOUND = "ERR_FILE_NOT_FOUND",
|
|
@@ -26,39 +22,6 @@ export declare enum NativeCloudStorageErrorCode {
|
|
|
26
22
|
INVALID_URL = "ERR_INVALID_URL",
|
|
27
23
|
NETWORK_ERROR = "ERR_NETWORK_ERROR"
|
|
28
24
|
}
|
|
29
|
-
export
|
|
30
|
-
|
|
31
|
-
temporaryDirectory: string;
|
|
32
|
-
};
|
|
33
|
-
createFile: (path: string, data: string) => Promise<string>;
|
|
34
|
-
readFile: (path: string) => Promise<string>;
|
|
35
|
-
downloadFile: (remoteUri: string, localPath: string, options?: {
|
|
36
|
-
headers?: Record<string, string>;
|
|
37
|
-
}) => Promise<void>;
|
|
38
|
-
uploadFile: (localPath: string, remoteUri: string, options?: {
|
|
39
|
-
headers?: Record<string, string>;
|
|
40
|
-
method?: 'PUT' | 'POST' | 'PATCH';
|
|
41
|
-
} & ({
|
|
42
|
-
uploadType?: 'binary';
|
|
43
|
-
} | {
|
|
44
|
-
uploadType?: 'multipart';
|
|
45
|
-
fieldName?: string;
|
|
46
|
-
parameters?: Record<string, string>;
|
|
47
|
-
})) => Promise<void>;
|
|
48
|
-
}
|
|
49
|
-
export interface NativeStorage {
|
|
50
|
-
fileExists: (path: string, scope: NativeStorageScope) => Promise<boolean>;
|
|
51
|
-
appendToFile: (path: string, data: string, scope: NativeStorageScope) => Promise<void>;
|
|
52
|
-
createFile: (path: string, data: string, scope: NativeStorageScope, overwrite: boolean) => Promise<void>;
|
|
53
|
-
createDirectory: (path: string, scope: NativeStorageScope) => Promise<void>;
|
|
54
|
-
listFiles: (path: string, scope: NativeStorageScope) => Promise<string[]>;
|
|
55
|
-
readFile: (path: string, scope: NativeStorageScope) => Promise<string>;
|
|
56
|
-
deleteFile: (path: string, scope: NativeStorageScope) => Promise<void>;
|
|
57
|
-
deleteDirectory: (path: string, recursively: boolean, scope: NativeStorageScope) => Promise<void>;
|
|
58
|
-
statFile: (path: string, scope: NativeStorageScope) => Promise<NativeStorageFileStat>;
|
|
59
|
-
downloadFile: (remotePath: string, localPath: string, scope: NativeStorageScope) => Promise<void>;
|
|
60
|
-
uploadFile: (remotePath: string, localPath: string, mimeType: string, scope: NativeStorageScope, overwrite: boolean) => Promise<void>;
|
|
61
|
-
isCloudAvailable: () => Promise<boolean>;
|
|
62
|
-
triggerSync: (path: string, scope: NativeStorageScope) => Promise<void>;
|
|
63
|
-
}
|
|
25
|
+
export type NativeLocalFileSystem = NativeCloudStorageLocalFileSystemSpec;
|
|
26
|
+
export type NativeStorage = Omit<NativeCloudStorageCloudKitSpec, 'onCloudAvailabilityChanged'>;
|
|
64
27
|
//# sourceMappingURL=native.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../../../src/types/native.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../../../src/types/native.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,IAAI,IAAI,8BAA8B,EACvC,MAAM,wCAAwC,CAAC;AAChD,OAAO,KAAK,EAAE,IAAI,IAAI,qCAAqC,EAAE,MAAM,4CAA4C,CAAC;AAEhH,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,kBAAkB,GAAG,UAAU,CAAC;AAE/E,MAAM,MAAM,qBAAqB,GAAG,oBAAoB,CAAC;AAEzD,oBAAY,2BAA2B;IACrC,aAAa,sBAAsB;IACnC,cAAc,uBAAuB;IACrC,YAAY,qBAAqB;IACjC,iBAAiB,0BAA0B;IAC3C,mBAAmB,4BAA4B;IAC/C,mBAAmB,4BAA4B;IAC/C,mBAAmB,oBAAoB;IACvC,wBAAwB,iCAAiC;IACzD,qBAAqB,8BAA8B;IACnD,WAAW,oBAAoB;IAC/B,UAAU,mBAAmB;IAC7B,YAAY,qBAAqB;IACjC,UAAU,mBAAmB;IAC7B,OAAO,gBAAgB;IACvB,qBAAqB,8BAA8B;IACnD,oBAAoB,6BAA6B;IACjD,WAAW,oBAAoB;IAC/B,aAAa,sBAAsB;CACpC;AAED,MAAM,MAAM,qBAAqB,GAAG,qCAAqC,CAAC;AAE1E,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,8BAA8B,EAAE,4BAA4B,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/utils/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,2BAA2B,EAAqB,YAAY,EAAE,MAAM,eAAe,CAAC;AAEnH,eAAO,MAAM,aAAa,QAIO,CAAC;AAElC,eAAO,MAAM,wBAAwB,EAAE,YAAY,CAAC,2BAA2B,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/utils/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,2BAA2B,EAAqB,YAAY,EAAE,MAAM,eAAe,CAAC;AAEnH,eAAO,MAAM,aAAa,QAIO,CAAC;AAElC,eAAO,MAAM,wBAAwB,EAAE,YAAY,CAAC,2BAA2B,CAW9E,CAAC"}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const localFileSystem: TNativeLocalFileSystem;
|
|
1
|
+
export declare const localFileSystem: import("../specs/NativeCloudStorageLocalFileSystem").Spec;
|
|
3
2
|
//# sourceMappingURL=local-fs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-fs.d.ts","sourceRoot":"","sources":["../../../src/utils/local-fs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"local-fs.d.ts","sourceRoot":"","sources":["../../../src/utils/local-fs.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,eAAe,2DASE,CAAC"}
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* @param nativeModule The native module to proxy.
|
|
4
4
|
* @returns The proxied native module.
|
|
5
5
|
*/
|
|
6
|
-
export declare const createProxiedNativeModule: <T extends object>(nativeModule: T | undefined) => T | null;
|
|
6
|
+
export declare const createProxiedNativeModule: <T extends object>(nativeModule: T | null | undefined) => T | null;
|
|
7
7
|
//# sourceMappingURL=native.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../../../src/utils/native.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,GAAI,CAAC,SAAS,MAAM,EAAE,cAAc,CAAC,GAAG,SAAS,KAAG,CAAC,GAAG,IA+
|
|
1
|
+
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../../../src/utils/native.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,GAAI,CAAC,SAAS,MAAM,EAAE,cAAc,CAAC,GAAG,IAAI,GAAG,SAAS,KAAG,CAAC,GAAG,IA+BpG,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import Foundation
|
|
2
|
+
import React
|
|
2
3
|
|
|
3
4
|
@objc(CloudStorageCloudKit)
|
|
4
|
-
class CloudStorageCloudKit: NSObject {
|
|
5
|
+
public class CloudStorageCloudKit: NSObject {
|
|
5
6
|
@objc(fileExists:withScope:withResolver:withRejecter:)
|
|
6
|
-
func fileExists(path: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
7
|
+
public func fileExists(path: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
7
8
|
withPromise(resolve: resolve, reject: reject) {
|
|
8
9
|
let fileUrl = try CloudKitUtils.getFileURL(path: path, scope: scope)
|
|
9
10
|
return try FileUtils.checkFileExists(fileUrl: fileUrl)
|
|
@@ -11,7 +12,7 @@ class CloudStorageCloudKit: NSObject {
|
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
@objc(appendToFile:withData:withScope:withResolver:withRejecter:)
|
|
14
|
-
func appendToFile(path: String, data: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
15
|
+
public func appendToFile(path: String, data: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
15
16
|
withPromise(resolve: resolve, reject: reject) {
|
|
16
17
|
let fileUrl = try CloudKitUtils.getFileURL(path: path, scope: scope)
|
|
17
18
|
|
|
@@ -26,7 +27,7 @@ class CloudStorageCloudKit: NSObject {
|
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
@objc(createFile:withData:withScope:withOverwrite:withResolver:withRejecter:)
|
|
29
|
-
func createFile(path: String, data: String, scope: String, overwrite: Bool, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
30
|
+
public func createFile(path: String, data: String, scope: String, overwrite: Bool, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
30
31
|
withPromise(resolve: resolve, reject: reject) {
|
|
31
32
|
let fileUrl = try CloudKitUtils.getFileURL(path: path, scope: scope)
|
|
32
33
|
|
|
@@ -39,7 +40,7 @@ class CloudStorageCloudKit: NSObject {
|
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
@objc(createDirectory:withScope:withResolver:withRejecter:)
|
|
42
|
-
func createDirectory(path: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
43
|
+
public func createDirectory(path: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
43
44
|
withPromise(resolve: resolve, reject: reject) {
|
|
44
45
|
let fileUrl = try CloudKitUtils.getFileURL(path: path, scope: scope)
|
|
45
46
|
return try FileUtils.createDirectory(directoryUrl: fileUrl)
|
|
@@ -47,7 +48,7 @@ class CloudStorageCloudKit: NSObject {
|
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
@objc(listFiles:withScope:withResolver:withRejecter:)
|
|
50
|
-
func listFiles(path: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
51
|
+
public func listFiles(path: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
51
52
|
withPromise(resolve: resolve, reject: reject) {
|
|
52
53
|
let fileUrl = try CloudKitUtils.getFileURL(path: path, scope: scope)
|
|
53
54
|
return try FileUtils.listFiles(directoryUrl: fileUrl)
|
|
@@ -55,7 +56,7 @@ class CloudStorageCloudKit: NSObject {
|
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
@objc(readFile:withScope:withResolver:withRejecter:)
|
|
58
|
-
func readFile(path: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
59
|
+
public func readFile(path: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
59
60
|
withPromise(resolve: resolve, reject: reject) {
|
|
60
61
|
let fileUrl = try CloudKitUtils.getFileURL(path: path, scope: scope)
|
|
61
62
|
return try FileUtils.readFile(fileUrl: fileUrl)
|
|
@@ -63,7 +64,7 @@ class CloudStorageCloudKit: NSObject {
|
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
@objc(triggerSync:withScope:withResolver:withRejecter:)
|
|
66
|
-
func triggerSync(path: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
67
|
+
public func triggerSync(path: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
67
68
|
withPromise(resolve: resolve, reject: reject) {
|
|
68
69
|
let fileUrl = try CloudKitUtils.getFileURL(path: path, scope: scope)
|
|
69
70
|
return try CloudKitUtils.triggerSync(fileUrl: fileUrl)
|
|
@@ -71,7 +72,7 @@ class CloudStorageCloudKit: NSObject {
|
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
@objc(deleteFile:withScope:withResolver:withRejecter:)
|
|
74
|
-
func deleteFile(path: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
75
|
+
public func deleteFile(path: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
75
76
|
withPromise(resolve: resolve, reject: reject) {
|
|
76
77
|
let fileUrl = try CloudKitUtils.getFileURL(path: path, scope: scope)
|
|
77
78
|
return try FileUtils.deleteFileOrDirectory(fileUrl: fileUrl)
|
|
@@ -79,7 +80,7 @@ class CloudStorageCloudKit: NSObject {
|
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
@objc(deleteDirectory:withRecursive:withScope:withResolver:withRejecter:)
|
|
82
|
-
func deleteDirectory(path: String, recursive _: Bool, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
83
|
+
public func deleteDirectory(path: String, recursive _: Bool, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
83
84
|
withPromise(resolve: resolve, reject: reject) {
|
|
84
85
|
let fileUrl = try CloudKitUtils.getFileURL(path: path, scope: scope)
|
|
85
86
|
return try FileUtils.deleteFileOrDirectory(fileUrl: fileUrl)
|
|
@@ -87,7 +88,7 @@ class CloudStorageCloudKit: NSObject {
|
|
|
87
88
|
}
|
|
88
89
|
|
|
89
90
|
@objc(statFile:withScope:withResolver:withRejecter:)
|
|
90
|
-
func statFile(path: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
91
|
+
public func statFile(path: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
91
92
|
withPromise(resolve: resolve, reject: reject) {
|
|
92
93
|
let fileUrl = try CloudKitUtils.getFileURL(path: path, scope: scope)
|
|
93
94
|
return try FileUtils.statFile(fileUrl: fileUrl).toDictionary()
|
|
@@ -95,7 +96,7 @@ class CloudStorageCloudKit: NSObject {
|
|
|
95
96
|
}
|
|
96
97
|
|
|
97
98
|
@objc(downloadFile:withLocalPath:withScope:withResolver:withRejecter:)
|
|
98
|
-
func downloadFile(remotePath: String, localPath: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
99
|
+
public func downloadFile(remotePath: String, localPath: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
99
100
|
withPromise(resolve: resolve, reject: reject) {
|
|
100
101
|
let sourceUrl = try CloudKitUtils.getFileURL(path: remotePath, scope: scope, true)
|
|
101
102
|
|
|
@@ -125,7 +126,7 @@ class CloudStorageCloudKit: NSObject {
|
|
|
125
126
|
}
|
|
126
127
|
|
|
127
128
|
@objc(uploadFile:withLocalPath:withMimeType:withScope:withOverwrite:withResolver:withRejecter:)
|
|
128
|
-
func uploadFile(remotePath: String, localPath: String, mimeType _: String, scope: String, overwrite: Bool, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
129
|
+
public func uploadFile(remotePath: String, localPath: String, mimeType _: String, scope: String, overwrite: Bool, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
129
130
|
withPromise(resolve: resolve, reject: reject) {
|
|
130
131
|
let destinationUrl = try CloudKitUtils.getFileURL(path: remotePath, scope: scope)
|
|
131
132
|
let sourceUrl = URL(fileURLWithPath: localPath)
|
|
@@ -150,7 +151,7 @@ class CloudStorageCloudKit: NSObject {
|
|
|
150
151
|
}
|
|
151
152
|
|
|
152
153
|
@objc(isCloudAvailable:withRejecter:)
|
|
153
|
-
func isCloudAvailable(resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
154
|
+
public func isCloudAvailable(resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
154
155
|
withPromise(resolve: resolve, reject: reject) {
|
|
155
156
|
CloudKitUtils.isCloudKitAvailable()
|
|
156
157
|
}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import Foundation
|
|
2
2
|
import MobileCoreServices
|
|
3
|
+
import React
|
|
3
4
|
|
|
4
5
|
// MARK: - CloudStorageLocalFileSystem
|
|
5
6
|
|
|
6
7
|
@objc(CloudStorageLocalFileSystem)
|
|
7
|
-
class CloudStorageLocalFileSystem: NSObject {
|
|
8
|
+
public class CloudStorageLocalFileSystem: NSObject {
|
|
8
9
|
@objc
|
|
9
|
-
func constantsToExport() -> [AnyHashable: Any]! {
|
|
10
|
+
public func constantsToExport() -> [AnyHashable: Any]! {
|
|
10
11
|
[
|
|
11
12
|
"temporaryDirectory": FileUtils.temporaryDirectory.path,
|
|
12
13
|
]
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
@objc(createFile:withData:withResolver:withRejecter:)
|
|
16
|
-
func createFile(path: String, data: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
17
|
+
public func createFile(path: String, data: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
17
18
|
withPromise(resolve: resolve, reject: reject) {
|
|
18
19
|
let fileUrl = URL(fileURLWithPath: path)
|
|
19
20
|
let directoryUrl = fileUrl.deletingLastPathComponent()
|
|
@@ -33,7 +34,7 @@ class CloudStorageLocalFileSystem: NSObject {
|
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
@objc(readFile:withResolver:withRejecter:)
|
|
36
|
-
func readFile(path: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
37
|
+
public func readFile(path: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
37
38
|
withPromise(resolve: resolve, reject: reject) {
|
|
38
39
|
let fileUrl = URL(fileURLWithPath: path)
|
|
39
40
|
return try FileUtils.readFile(fileUrl: fileUrl)
|
|
@@ -41,7 +42,7 @@ class CloudStorageLocalFileSystem: NSObject {
|
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
@objc(downloadFile:withLocalPath:withOptions:withResolver:withRejecter:)
|
|
44
|
-
func downloadFile(remoteUri: String, localPath: String, options: [String: Any]?, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
45
|
+
public func downloadFile(remoteUri: String, localPath: String, options: [String: Any]?, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
45
46
|
guard let remoteUrl = URL(string: remoteUri) else {
|
|
46
47
|
let error = CloudStorageError.invalidUrl(url: remoteUri)
|
|
47
48
|
reject(error.code, error.message, nil)
|
|
@@ -92,7 +93,7 @@ class CloudStorageLocalFileSystem: NSObject {
|
|
|
92
93
|
}
|
|
93
94
|
|
|
94
95
|
@objc(uploadFile:withRemoteUri:withOptions:withResolver:withRejecter:)
|
|
95
|
-
func uploadFile(localPath: String, remoteUri: String, options: [String: Any], resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
96
|
+
public func uploadFile(localPath: String, remoteUri: String, options: [String: Any], resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
96
97
|
guard let remoteUrl = URL(string: remoteUri) else {
|
|
97
98
|
let error = CloudStorageError.invalidUrl(url: remoteUri)
|
|
98
99
|
reject(error.code, error.message, nil)
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
#import <Foundation/Foundation.h>
|
|
2
|
+
|
|
3
|
+
#import <CloudStorageSpec/CloudStorageSpec.h>
|
|
4
|
+
|
|
5
|
+
#if __has_include("react_native_cloud_storage-Swift.h")
|
|
6
|
+
#import "react_native_cloud_storage-Swift.h"
|
|
7
|
+
#elif __has_include(<react_native_cloud_storage/react_native_cloud_storage-Swift.h>)
|
|
8
|
+
#import <react_native_cloud_storage/react_native_cloud_storage-Swift.h>
|
|
9
|
+
#else
|
|
10
|
+
#error "Unable to locate Swift compatibility header for react-native-cloud-storage."
|
|
11
|
+
#endif
|
|
12
|
+
|
|
13
|
+
@interface RCTCloudStorageCloudKit : NativeCloudStorageCloudKitIOSSpecBase <NativeCloudStorageCloudKitIOSSpec>
|
|
14
|
+
@end
|
|
15
|
+
|
|
16
|
+
@implementation RCTCloudStorageCloudKit {
|
|
17
|
+
CloudStorageCloudKit *_cloudStorageCloudKit;
|
|
18
|
+
id<NSObject> _ubiquityIdentityObserver;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
+ (NSString *)moduleName
|
|
22
|
+
{
|
|
23
|
+
return @"CloudStorageCloudKit";
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
+ (BOOL)requiresMainQueueSetup
|
|
27
|
+
{
|
|
28
|
+
return NO;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
- (instancetype)init
|
|
32
|
+
{
|
|
33
|
+
if (self = [super init]) {
|
|
34
|
+
_cloudStorageCloudKit = [CloudStorageCloudKit new];
|
|
35
|
+
|
|
36
|
+
__weak __typeof__(self) weakSelf = self;
|
|
37
|
+
_ubiquityIdentityObserver = [[NSNotificationCenter defaultCenter]
|
|
38
|
+
addObserverForName:NSUbiquityIdentityDidChangeNotification
|
|
39
|
+
object:nil
|
|
40
|
+
queue:nil
|
|
41
|
+
usingBlock:^(__unused NSNotification *notification) {
|
|
42
|
+
__strong __typeof__(weakSelf) strongSelf = weakSelf;
|
|
43
|
+
[strongSelf emitCloudAvailabilityChanged];
|
|
44
|
+
}];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return self;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
- (void)dealloc
|
|
51
|
+
{
|
|
52
|
+
if (_ubiquityIdentityObserver != nil) {
|
|
53
|
+
[[NSNotificationCenter defaultCenter] removeObserver:_ubiquityIdentityObserver];
|
|
54
|
+
_ubiquityIdentityObserver = nil;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
- (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *)eventEmitterCallbackWrapper
|
|
59
|
+
{
|
|
60
|
+
[super setEventEmitterCallback:eventEmitterCallbackWrapper];
|
|
61
|
+
[self emitCloudAvailabilityChanged];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
- (void)emitCloudAvailabilityChanged
|
|
65
|
+
{
|
|
66
|
+
BOOL isCloudAvailable = [NSFileManager defaultManager].ubiquityIdentityToken != nil;
|
|
67
|
+
[self emitOnCloudAvailabilityChanged:@{ @"available" : @(isCloudAvailable) }];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
- (void)fileExists:(NSString *)path
|
|
71
|
+
scope:(NSString *)scope
|
|
72
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
73
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
74
|
+
{
|
|
75
|
+
[_cloudStorageCloudKit fileExists:path withScope:scope withResolver:resolve withRejecter:reject];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
- (void)appendToFile:(NSString *)path
|
|
79
|
+
data:(NSString *)data
|
|
80
|
+
scope:(NSString *)scope
|
|
81
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
82
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
83
|
+
{
|
|
84
|
+
[_cloudStorageCloudKit appendToFile:path withData:data withScope:scope withResolver:resolve withRejecter:reject];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
- (void)createFile:(NSString *)path
|
|
88
|
+
data:(NSString *)data
|
|
89
|
+
scope:(NSString *)scope
|
|
90
|
+
overwrite:(BOOL)overwrite
|
|
91
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
92
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
93
|
+
{
|
|
94
|
+
[_cloudStorageCloudKit
|
|
95
|
+
createFile:path
|
|
96
|
+
withData:data
|
|
97
|
+
withScope:scope
|
|
98
|
+
withOverwrite:overwrite
|
|
99
|
+
withResolver:resolve
|
|
100
|
+
withRejecter:reject];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
- (void)createDirectory:(NSString *)path
|
|
104
|
+
scope:(NSString *)scope
|
|
105
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
106
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
107
|
+
{
|
|
108
|
+
[_cloudStorageCloudKit createDirectory:path withScope:scope withResolver:resolve withRejecter:reject];
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
- (void)listFiles:(NSString *)path
|
|
112
|
+
scope:(NSString *)scope
|
|
113
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
114
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
115
|
+
{
|
|
116
|
+
[_cloudStorageCloudKit listFiles:path withScope:scope withResolver:resolve withRejecter:reject];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
- (void)readFile:(NSString *)path
|
|
120
|
+
scope:(NSString *)scope
|
|
121
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
122
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
123
|
+
{
|
|
124
|
+
[_cloudStorageCloudKit readFile:path withScope:scope withResolver:resolve withRejecter:reject];
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
- (void)triggerSync:(NSString *)path
|
|
128
|
+
scope:(NSString *)scope
|
|
129
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
130
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
131
|
+
{
|
|
132
|
+
[_cloudStorageCloudKit triggerSync:path withScope:scope withResolver:resolve withRejecter:reject];
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
- (void)deleteFile:(NSString *)path
|
|
136
|
+
scope:(NSString *)scope
|
|
137
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
138
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
139
|
+
{
|
|
140
|
+
[_cloudStorageCloudKit deleteFile:path withScope:scope withResolver:resolve withRejecter:reject];
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
- (void)deleteDirectory:(NSString *)path
|
|
144
|
+
recursive:(BOOL)recursive
|
|
145
|
+
scope:(NSString *)scope
|
|
146
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
147
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
148
|
+
{
|
|
149
|
+
[_cloudStorageCloudKit
|
|
150
|
+
deleteDirectory:path
|
|
151
|
+
withRecursive:recursive
|
|
152
|
+
withScope:scope
|
|
153
|
+
withResolver:resolve
|
|
154
|
+
withRejecter:reject];
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
- (void)statFile:(NSString *)path
|
|
158
|
+
scope:(NSString *)scope
|
|
159
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
160
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
161
|
+
{
|
|
162
|
+
[_cloudStorageCloudKit statFile:path withScope:scope withResolver:resolve withRejecter:reject];
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
- (void)downloadFile:(NSString *)remotePath
|
|
166
|
+
localPath:(NSString *)localPath
|
|
167
|
+
scope:(NSString *)scope
|
|
168
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
169
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
170
|
+
{
|
|
171
|
+
[_cloudStorageCloudKit
|
|
172
|
+
downloadFile:remotePath
|
|
173
|
+
withLocalPath:localPath
|
|
174
|
+
withScope:scope
|
|
175
|
+
withResolver:resolve
|
|
176
|
+
withRejecter:reject];
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
- (void)uploadFile:(NSString *)remotePath
|
|
180
|
+
localPath:(NSString *)localPath
|
|
181
|
+
mimeType:(NSString *)mimeType
|
|
182
|
+
scope:(NSString *)scope
|
|
183
|
+
overwrite:(BOOL)overwrite
|
|
184
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
185
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
186
|
+
{
|
|
187
|
+
[_cloudStorageCloudKit
|
|
188
|
+
uploadFile:remotePath
|
|
189
|
+
withLocalPath:localPath
|
|
190
|
+
withMimeType:mimeType
|
|
191
|
+
withScope:scope
|
|
192
|
+
withOverwrite:overwrite
|
|
193
|
+
withResolver:resolve
|
|
194
|
+
withRejecter:reject];
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
- (void)isCloudAvailable:(RCTPromiseResolveBlock)resolve
|
|
198
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
199
|
+
{
|
|
200
|
+
[_cloudStorageCloudKit isCloudAvailable:resolve withRejecter:reject];
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
204
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
205
|
+
{
|
|
206
|
+
return std::make_shared<facebook::react::NativeCloudStorageCloudKitIOSSpecJSI>(params);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
@end
|