react-native-cloud-storage 0.1.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/LICENSE +20 -0
- package/README.md +33 -0
- package/app.plugin.js +1 -0
- package/ios/CloudStorage-Bridging-Header.h +2 -0
- package/ios/CloudStorage.m +19 -0
- package/ios/CloudStorage.swift +98 -0
- package/ios/CloudStorage.xcodeproj/project.pbxproj +283 -0
- package/lib/commonjs/RNCloudStorage.js +53 -0
- package/lib/commonjs/RNCloudStorage.js.map +1 -0
- package/lib/commonjs/createRNCloudStorage.js +27 -0
- package/lib/commonjs/createRNCloudStorage.js.map +1 -0
- package/lib/commonjs/expo-plugin/withRNCloudStorage.js +14 -0
- package/lib/commonjs/expo-plugin/withRNCloudStorage.js.map +1 -0
- package/lib/commonjs/expo-plugin/withRNCloudStorageIos.js +39 -0
- package/lib/commonjs/expo-plugin/withRNCloudStorageIos.js.map +1 -0
- package/lib/commonjs/google-drive/index.js +150 -0
- package/lib/commonjs/google-drive/index.js.map +1 -0
- package/lib/commonjs/google-drive/types.js +2 -0
- package/lib/commonjs/google-drive/types.js.map +1 -0
- package/lib/commonjs/hooks/useCloudFile.js +39 -0
- package/lib/commonjs/hooks/useCloudFile.js.map +1 -0
- package/lib/commonjs/index.js +36 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/types/main.js +13 -0
- package/lib/commonjs/types/main.js.map +1 -0
- package/lib/commonjs/types/native.js +2 -0
- package/lib/commonjs/types/native.js.map +1 -0
- package/lib/module/RNCloudStorage.js +45 -0
- package/lib/module/RNCloudStorage.js.map +1 -0
- package/lib/module/createRNCloudStorage.js +20 -0
- package/lib/module/createRNCloudStorage.js.map +1 -0
- package/lib/module/expo-plugin/withRNCloudStorage.js +7 -0
- package/lib/module/expo-plugin/withRNCloudStorage.js.map +1 -0
- package/lib/module/expo-plugin/withRNCloudStorageIos.js +32 -0
- package/lib/module/expo-plugin/withRNCloudStorageIos.js.map +1 -0
- package/lib/module/google-drive/index.js +143 -0
- package/lib/module/google-drive/index.js.map +1 -0
- package/lib/module/google-drive/types.js +2 -0
- package/lib/module/google-drive/types.js.map +1 -0
- package/lib/module/hooks/useCloudFile.js +31 -0
- package/lib/module/hooks/useCloudFile.js.map +1 -0
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/types/main.js +6 -0
- package/lib/module/types/main.js.map +1 -0
- package/lib/module/types/native.js +2 -0
- package/lib/module/types/native.js.map +1 -0
- package/lib/typescript/RNCloudStorage.d.ts +35 -0
- package/lib/typescript/RNCloudStorage.d.ts.map +1 -0
- package/lib/typescript/createRNCloudStorage.d.ts +3 -0
- package/lib/typescript/createRNCloudStorage.d.ts.map +1 -0
- package/lib/typescript/expo-plugin/withRNCloudStorage.d.ts +10 -0
- package/lib/typescript/expo-plugin/withRNCloudStorage.d.ts.map +1 -0
- package/lib/typescript/expo-plugin/withRNCloudStorageIos.d.ts +4 -0
- package/lib/typescript/expo-plugin/withRNCloudStorageIos.d.ts.map +1 -0
- package/lib/typescript/google-drive/index.d.ts +19 -0
- package/lib/typescript/google-drive/index.d.ts.map +1 -0
- package/lib/typescript/google-drive/types.d.ts +54 -0
- package/lib/typescript/google-drive/types.d.ts.map +1 -0
- package/lib/typescript/hooks/useCloudFile.d.ts +8 -0
- package/lib/typescript/hooks/useCloudFile.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +5 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/types/main.d.ts +5 -0
- package/lib/typescript/types/main.d.ts.map +1 -0
- package/lib/typescript/types/native.d.ts +8 -0
- package/lib/typescript/types/native.d.ts.map +1 -0
- package/package.json +186 -0
- package/react-native-cloud-storage.podspec +35 -0
- package/src/RNCloudStorage.ts +50 -0
- package/src/createRNCloudStorage.ts +31 -0
- package/src/expo-plugin/withRNCloudStorage.ts +15 -0
- package/src/expo-plugin/withRNCloudStorageIos.ts +44 -0
- package/src/google-drive/index.ts +163 -0
- package/src/google-drive/types.ts +61 -0
- package/src/hooks/useCloudFile.ts +40 -0
- package/src/index.ts +5 -0
- package/src/types/main.ts +4 -0
- package/src/types/native.ts +8 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Kuatsu Digital Agency
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# ☁️ react-native-cloud-storage
|
|
2
|
+
|
|
3
|
+
Save & read from iCloud and Google Drive using React Native
|
|
4
|
+
|
|
5
|
+
**⚠️ WARNING**: This project is still considered unstable. Please proceed with caution and report any issues you're encountering.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install react-native-cloud-storage
|
|
11
|
+
# or
|
|
12
|
+
yarn add react-native-cloud-storage
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Documentation
|
|
16
|
+
|
|
17
|
+
The documentation is located [here](https://react-native-cloud-storage.vercel.app/docs/intro).
|
|
18
|
+
|
|
19
|
+
## Contributing
|
|
20
|
+
|
|
21
|
+
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
|
|
22
|
+
|
|
23
|
+
## Example Project
|
|
24
|
+
|
|
25
|
+
There's a demo application available within the `example` directory. To use it under Android, you'll need to provide a valid access token for the Google Drive API. You can create one using the [Google OAuth 2.0 Playground](https://developers.google.com/oauthplayground). If you're using an Android emulator, you can make your life easier by feeding the token into the emulator using `adb shell input text '{some_token}'`.
|
|
26
|
+
|
|
27
|
+
## License
|
|
28
|
+
|
|
29
|
+
MIT
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
|
package/app.plugin.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./lib/commonjs/expo-plugin/withRNCloudStorage.js');
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#import <React/RCTBridgeModule.h>
|
|
2
|
+
|
|
3
|
+
@interface RCT_EXTERN_MODULE(CloudStorage, NSObject)
|
|
4
|
+
|
|
5
|
+
RCT_EXTERN_METHOD(multiply:(float)a withB:(float)b
|
|
6
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
|
7
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
8
|
+
|
|
9
|
+
RCT_EXTERN_METHOD(fileExists:(NSString *)path withScope:(NSString *)scope withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject)
|
|
10
|
+
RCT_EXTERN_METHOD(createFile:(NSString *)path withData:(NSString *)data withScope:(NSString *)scope withOverwrite:(BOOL)overwrite withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject)
|
|
11
|
+
RCT_EXTERN_METHOD(readFile:(NSString *)path withScope:(NSString *)scope withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject)
|
|
12
|
+
RCT_EXTERN_METHOD(deleteFile:(NSString *)path withScope:(NSString *)scope withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject)
|
|
13
|
+
|
|
14
|
+
+ (BOOL)requiresMainQueueSetup
|
|
15
|
+
{
|
|
16
|
+
return NO;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@end
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
|
|
3
|
+
@objc(CloudStorage)
|
|
4
|
+
class CloudStorage: NSObject {
|
|
5
|
+
@objc(fileExists:withScope:withResolver:withRejecter:)
|
|
6
|
+
func fileExists(path: String, scope: String, resolve:RCTPromiseResolveBlock,reject:RCTPromiseRejectBlock) -> Void {
|
|
7
|
+
let fileManager = FileManager.default
|
|
8
|
+
let directory = getDirectory(scope)
|
|
9
|
+
if (directory == nil) {
|
|
10
|
+
reject("ERR_NO_DIRECTORY_FOUND", "No directory found for scope \(scope)", nil)
|
|
11
|
+
return
|
|
12
|
+
}
|
|
13
|
+
let filePath = directory?.appendingPathComponent(path)
|
|
14
|
+
let fileExists = fileManager.fileExists(atPath: filePath!.path)
|
|
15
|
+
resolve(fileExists)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@objc(createFile:withData:withScope:withOverwrite:withResolver:withRejecter:)
|
|
19
|
+
func createFile(path: String, data: String, scope: String, overwrite: Bool, resolve:RCTPromiseResolveBlock,reject:RCTPromiseRejectBlock) -> Void {
|
|
20
|
+
let fileManager = FileManager.default
|
|
21
|
+
let directory = getDirectory(scope)
|
|
22
|
+
if (directory == nil) {
|
|
23
|
+
reject("ERR_NO_DIRECTORY_FOUND", "No directory found for scope \(scope)", nil)
|
|
24
|
+
return
|
|
25
|
+
}
|
|
26
|
+
let filePath = directory?.appendingPathComponent(path)
|
|
27
|
+
let fileExists = fileManager.fileExists(atPath: filePath!.path)
|
|
28
|
+
if (fileExists && !overwrite) {
|
|
29
|
+
reject("ERR_FILE_EXISTS", "File \(path) already exists", nil)
|
|
30
|
+
return
|
|
31
|
+
}
|
|
32
|
+
do {
|
|
33
|
+
try data.write(to: filePath!, atomically: true, encoding: .utf8)
|
|
34
|
+
resolve(true)
|
|
35
|
+
} catch {
|
|
36
|
+
reject("ERR_WRITE_ERROR", "Error writing file \(path)", error)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@objc(readFile:withScope:withResolver:withRejecter:)
|
|
41
|
+
func readFile(path: String, scope: String, resolve:RCTPromiseResolveBlock,reject:RCTPromiseRejectBlock) -> Void {
|
|
42
|
+
let fileManager = FileManager.default
|
|
43
|
+
let directory = getDirectory(scope)
|
|
44
|
+
if (directory == nil) {
|
|
45
|
+
reject("ERR_NO_DIRECTORY_FOUND", "No directory found for scope \(scope)", nil)
|
|
46
|
+
return
|
|
47
|
+
}
|
|
48
|
+
let filePath = directory?.appendingPathComponent(path)
|
|
49
|
+
let fileExists = fileManager.fileExists(atPath: filePath!.path)
|
|
50
|
+
if (!fileExists) {
|
|
51
|
+
reject("ERR_FILE_NOT_FOUND", "File \(path) not found", nil)
|
|
52
|
+
return
|
|
53
|
+
}
|
|
54
|
+
do {
|
|
55
|
+
let fileContents = try String(contentsOf: filePath!, encoding: .utf8)
|
|
56
|
+
resolve(fileContents)
|
|
57
|
+
} catch {
|
|
58
|
+
reject("ERR_READ_ERROR", "Error reading file \(path)", error)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@objc(deleteFile:withScope:withResolver:withRejecter:)
|
|
63
|
+
func deleteFile(path: String, scope: String, resolve:RCTPromiseResolveBlock,reject:RCTPromiseRejectBlock) -> Void {
|
|
64
|
+
let fileManager = FileManager.default
|
|
65
|
+
let directory = getDirectory(scope)
|
|
66
|
+
if (directory == nil) {
|
|
67
|
+
reject("ERR_NO_DIRECTORY_FOUND", "No directory found for scope \(scope)", nil)
|
|
68
|
+
return
|
|
69
|
+
}
|
|
70
|
+
let filePath = directory?.appendingPathComponent(path)
|
|
71
|
+
let fileExists = fileManager.fileExists(atPath: filePath!.path)
|
|
72
|
+
if (!fileExists) {
|
|
73
|
+
reject("ERR_FILE_NOT_FOUND", "File \(path) not found", nil)
|
|
74
|
+
return
|
|
75
|
+
}
|
|
76
|
+
do {
|
|
77
|
+
try fileManager.removeItem(at: filePath!)
|
|
78
|
+
resolve(true)
|
|
79
|
+
} catch {
|
|
80
|
+
reject("ERR_DELETE_ERROR", "Error deleting file \(path)", error)
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/// Returns the iCloud directory URL for the given scope.
|
|
85
|
+
///
|
|
86
|
+
/// - Parameter scope: The scope of the directory. Can be either "documents" or "hidden".
|
|
87
|
+
/// - Returns: The URL of the iCloud directory.
|
|
88
|
+
private func getDirectory(_ scope: String) -> URL? {
|
|
89
|
+
let fileManager = FileManager.default
|
|
90
|
+
let isDocumentDirectory = scope.caseInsensitiveCompare("documents") == .orderedSame
|
|
91
|
+
let ubiquityURL = fileManager.url(forUbiquityContainerIdentifier: nil)
|
|
92
|
+
if (isDocumentDirectory) {
|
|
93
|
+
return fileManager.urls(for: .documentDirectory, in: .userDomainMask).first
|
|
94
|
+
} else {
|
|
95
|
+
return ubiquityURL
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
// !$*UTF8*$!
|
|
2
|
+
{
|
|
3
|
+
archiveVersion = 1;
|
|
4
|
+
classes = {
|
|
5
|
+
};
|
|
6
|
+
objectVersion = 46;
|
|
7
|
+
objects = {
|
|
8
|
+
|
|
9
|
+
/* Begin PBXBuildFile section */
|
|
10
|
+
5E555C0D2413F4C50049A1A2 /* CloudStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* CloudStorage.m */; };
|
|
11
|
+
F4FF95D7245B92E800C19C63 /* CloudStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FF95D6245B92E800C19C63 /* CloudStorage.swift */; };
|
|
12
|
+
/* End PBXBuildFile section */
|
|
13
|
+
|
|
14
|
+
/* Begin PBXCopyFilesBuildPhase section */
|
|
15
|
+
58B511D91A9E6C8500147676 /* CopyFiles */ = {
|
|
16
|
+
isa = PBXCopyFilesBuildPhase;
|
|
17
|
+
buildActionMask = 2147483647;
|
|
18
|
+
dstPath = "include/$(PRODUCT_NAME)";
|
|
19
|
+
dstSubfolderSpec = 16;
|
|
20
|
+
files = (
|
|
21
|
+
);
|
|
22
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
23
|
+
};
|
|
24
|
+
/* End PBXCopyFilesBuildPhase section */
|
|
25
|
+
|
|
26
|
+
/* Begin PBXFileReference section */
|
|
27
|
+
134814201AA4EA6300B7C361 /* libCloudStorage.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libCloudStorage.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
28
|
+
B3E7B5891CC2AC0600A0062D /* CloudStorage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CloudStorage.m; sourceTree = "<group>"; };
|
|
29
|
+
F4FF95D5245B92E700C19C63 /* CloudStorage-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CloudStorage-Bridging-Header.h"; sourceTree = "<group>"; };
|
|
30
|
+
F4FF95D6245B92E800C19C63 /* CloudStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CloudStorage.swift; sourceTree = "<group>"; };
|
|
31
|
+
/* End PBXFileReference section */
|
|
32
|
+
|
|
33
|
+
/* Begin PBXFrameworksBuildPhase section */
|
|
34
|
+
58B511D81A9E6C8500147676 /* Frameworks */ = {
|
|
35
|
+
isa = PBXFrameworksBuildPhase;
|
|
36
|
+
buildActionMask = 2147483647;
|
|
37
|
+
files = (
|
|
38
|
+
);
|
|
39
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
40
|
+
};
|
|
41
|
+
/* End PBXFrameworksBuildPhase section */
|
|
42
|
+
|
|
43
|
+
/* Begin PBXGroup section */
|
|
44
|
+
134814211AA4EA7D00B7C361 /* Products */ = {
|
|
45
|
+
isa = PBXGroup;
|
|
46
|
+
children = (
|
|
47
|
+
134814201AA4EA6300B7C361 /* libCloudStorage.a */,
|
|
48
|
+
);
|
|
49
|
+
name = Products;
|
|
50
|
+
sourceTree = "<group>";
|
|
51
|
+
};
|
|
52
|
+
58B511D21A9E6C8500147676 = {
|
|
53
|
+
isa = PBXGroup;
|
|
54
|
+
children = (
|
|
55
|
+
F4FF95D6245B92E800C19C63 /* CloudStorage.swift */,
|
|
56
|
+
B3E7B5891CC2AC0600A0062D /* CloudStorage.m */,
|
|
57
|
+
F4FF95D5245B92E700C19C63 /* CloudStorage-Bridging-Header.h */,
|
|
58
|
+
134814211AA4EA7D00B7C361 /* Products */,
|
|
59
|
+
);
|
|
60
|
+
sourceTree = "<group>";
|
|
61
|
+
};
|
|
62
|
+
/* End PBXGroup section */
|
|
63
|
+
|
|
64
|
+
/* Begin PBXNativeTarget section */
|
|
65
|
+
58B511DA1A9E6C8500147676 /* CloudStorage */ = {
|
|
66
|
+
isa = PBXNativeTarget;
|
|
67
|
+
buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "CloudStorage" */;
|
|
68
|
+
buildPhases = (
|
|
69
|
+
58B511D71A9E6C8500147676 /* Sources */,
|
|
70
|
+
58B511D81A9E6C8500147676 /* Frameworks */,
|
|
71
|
+
58B511D91A9E6C8500147676 /* CopyFiles */,
|
|
72
|
+
);
|
|
73
|
+
buildRules = (
|
|
74
|
+
);
|
|
75
|
+
dependencies = (
|
|
76
|
+
);
|
|
77
|
+
name = CloudStorage;
|
|
78
|
+
productName = RCTDataManager;
|
|
79
|
+
productReference = 134814201AA4EA6300B7C361 /* libCloudStorage.a */;
|
|
80
|
+
productType = "com.apple.product-type.library.static";
|
|
81
|
+
};
|
|
82
|
+
/* End PBXNativeTarget section */
|
|
83
|
+
|
|
84
|
+
/* Begin PBXProject section */
|
|
85
|
+
58B511D31A9E6C8500147676 /* Project object */ = {
|
|
86
|
+
isa = PBXProject;
|
|
87
|
+
attributes = {
|
|
88
|
+
LastUpgradeCheck = 0920;
|
|
89
|
+
ORGANIZATIONNAME = Facebook;
|
|
90
|
+
TargetAttributes = {
|
|
91
|
+
58B511DA1A9E6C8500147676 = {
|
|
92
|
+
CreatedOnToolsVersion = 6.1.1;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "CloudStorage" */;
|
|
97
|
+
compatibilityVersion = "Xcode 3.2";
|
|
98
|
+
developmentRegion = English;
|
|
99
|
+
hasScannedForEncodings = 0;
|
|
100
|
+
knownRegions = (
|
|
101
|
+
English,
|
|
102
|
+
en,
|
|
103
|
+
);
|
|
104
|
+
mainGroup = 58B511D21A9E6C8500147676;
|
|
105
|
+
productRefGroup = 58B511D21A9E6C8500147676;
|
|
106
|
+
projectDirPath = "";
|
|
107
|
+
projectRoot = "";
|
|
108
|
+
targets = (
|
|
109
|
+
58B511DA1A9E6C8500147676 /* CloudStorage */,
|
|
110
|
+
);
|
|
111
|
+
};
|
|
112
|
+
/* End PBXProject section */
|
|
113
|
+
|
|
114
|
+
/* Begin PBXSourcesBuildPhase section */
|
|
115
|
+
58B511D71A9E6C8500147676 /* Sources */ = {
|
|
116
|
+
isa = PBXSourcesBuildPhase;
|
|
117
|
+
buildActionMask = 2147483647;
|
|
118
|
+
files = (
|
|
119
|
+
F4FF95D7245B92E800C19C63 /* CloudStorage.swift in Sources */,
|
|
120
|
+
B3E7B58A1CC2AC0600A0062D /* CloudStorage.m in Sources */,
|
|
121
|
+
);
|
|
122
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
123
|
+
};
|
|
124
|
+
/* End PBXSourcesBuildPhase section */
|
|
125
|
+
|
|
126
|
+
/* Begin XCBuildConfiguration section */
|
|
127
|
+
58B511ED1A9E6C8500147676 /* Debug */ = {
|
|
128
|
+
isa = XCBuildConfiguration;
|
|
129
|
+
buildSettings = {
|
|
130
|
+
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
131
|
+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
|
132
|
+
CLANG_CXX_LIBRARY = "libc++";
|
|
133
|
+
CLANG_ENABLE_MODULES = YES;
|
|
134
|
+
CLANG_ENABLE_OBJC_ARC = YES;
|
|
135
|
+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
|
136
|
+
CLANG_WARN_BOOL_CONVERSION = YES;
|
|
137
|
+
CLANG_WARN_COMMA = YES;
|
|
138
|
+
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
|
139
|
+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
|
140
|
+
CLANG_WARN_EMPTY_BODY = YES;
|
|
141
|
+
CLANG_WARN_ENUM_CONVERSION = YES;
|
|
142
|
+
CLANG_WARN_INFINITE_RECURSION = YES;
|
|
143
|
+
CLANG_WARN_INT_CONVERSION = YES;
|
|
144
|
+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
|
145
|
+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
|
146
|
+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
|
147
|
+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
|
148
|
+
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
|
149
|
+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
|
150
|
+
CLANG_WARN_UNREACHABLE_CODE = YES;
|
|
151
|
+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
|
152
|
+
COPY_PHASE_STRIP = NO;
|
|
153
|
+
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
154
|
+
ENABLE_TESTABILITY = YES;
|
|
155
|
+
"EXCLUDED_ARCHS[sdk=*]" = arm64;
|
|
156
|
+
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
157
|
+
GCC_DYNAMIC_NO_PIC = NO;
|
|
158
|
+
GCC_NO_COMMON_BLOCKS = YES;
|
|
159
|
+
GCC_OPTIMIZATION_LEVEL = 0;
|
|
160
|
+
GCC_PREPROCESSOR_DEFINITIONS = (
|
|
161
|
+
"DEBUG=1",
|
|
162
|
+
"$(inherited)",
|
|
163
|
+
);
|
|
164
|
+
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
|
165
|
+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
166
|
+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
|
167
|
+
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
168
|
+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
169
|
+
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
170
|
+
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
171
|
+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
|
172
|
+
MTL_ENABLE_DEBUG_INFO = YES;
|
|
173
|
+
ONLY_ACTIVE_ARCH = YES;
|
|
174
|
+
SDKROOT = iphoneos;
|
|
175
|
+
};
|
|
176
|
+
name = Debug;
|
|
177
|
+
};
|
|
178
|
+
58B511EE1A9E6C8500147676 /* Release */ = {
|
|
179
|
+
isa = XCBuildConfiguration;
|
|
180
|
+
buildSettings = {
|
|
181
|
+
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
182
|
+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
|
183
|
+
CLANG_CXX_LIBRARY = "libc++";
|
|
184
|
+
CLANG_ENABLE_MODULES = YES;
|
|
185
|
+
CLANG_ENABLE_OBJC_ARC = YES;
|
|
186
|
+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
|
187
|
+
CLANG_WARN_BOOL_CONVERSION = YES;
|
|
188
|
+
CLANG_WARN_COMMA = YES;
|
|
189
|
+
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
|
190
|
+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
|
191
|
+
CLANG_WARN_EMPTY_BODY = YES;
|
|
192
|
+
CLANG_WARN_ENUM_CONVERSION = YES;
|
|
193
|
+
CLANG_WARN_INFINITE_RECURSION = YES;
|
|
194
|
+
CLANG_WARN_INT_CONVERSION = YES;
|
|
195
|
+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
|
196
|
+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
|
197
|
+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
|
198
|
+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
|
199
|
+
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
|
200
|
+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
|
201
|
+
CLANG_WARN_UNREACHABLE_CODE = YES;
|
|
202
|
+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
|
203
|
+
COPY_PHASE_STRIP = YES;
|
|
204
|
+
ENABLE_NS_ASSERTIONS = NO;
|
|
205
|
+
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
206
|
+
"EXCLUDED_ARCHS[sdk=*]" = arm64;
|
|
207
|
+
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
208
|
+
GCC_NO_COMMON_BLOCKS = YES;
|
|
209
|
+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
210
|
+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
|
211
|
+
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
212
|
+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
213
|
+
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
214
|
+
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
215
|
+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
|
216
|
+
MTL_ENABLE_DEBUG_INFO = NO;
|
|
217
|
+
SDKROOT = iphoneos;
|
|
218
|
+
VALIDATE_PRODUCT = YES;
|
|
219
|
+
};
|
|
220
|
+
name = Release;
|
|
221
|
+
};
|
|
222
|
+
58B511F01A9E6C8500147676 /* Debug */ = {
|
|
223
|
+
isa = XCBuildConfiguration;
|
|
224
|
+
buildSettings = {
|
|
225
|
+
HEADER_SEARCH_PATHS = (
|
|
226
|
+
"$(inherited)",
|
|
227
|
+
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
|
228
|
+
"$(SRCROOT)/../../../React/**",
|
|
229
|
+
"$(SRCROOT)/../../react-native/React/**",
|
|
230
|
+
);
|
|
231
|
+
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
|
232
|
+
OTHER_LDFLAGS = "-ObjC";
|
|
233
|
+
PRODUCT_NAME = CloudStorage;
|
|
234
|
+
SKIP_INSTALL = YES;
|
|
235
|
+
SWIFT_OBJC_BRIDGING_HEADER = "CloudStorage-Bridging-Header.h";
|
|
236
|
+
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
|
237
|
+
SWIFT_VERSION = 5.0;
|
|
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 = CloudStorage;
|
|
253
|
+
SKIP_INSTALL = YES;
|
|
254
|
+
SWIFT_OBJC_BRIDGING_HEADER = "CloudStorage-Bridging-Header.h";
|
|
255
|
+
SWIFT_VERSION = 5.0;
|
|
256
|
+
};
|
|
257
|
+
name = Release;
|
|
258
|
+
};
|
|
259
|
+
/* End XCBuildConfiguration section */
|
|
260
|
+
|
|
261
|
+
/* Begin XCConfigurationList section */
|
|
262
|
+
58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "CloudStorage" */ = {
|
|
263
|
+
isa = XCConfigurationList;
|
|
264
|
+
buildConfigurations = (
|
|
265
|
+
58B511ED1A9E6C8500147676 /* Debug */,
|
|
266
|
+
58B511EE1A9E6C8500147676 /* Release */,
|
|
267
|
+
);
|
|
268
|
+
defaultConfigurationIsVisible = 0;
|
|
269
|
+
defaultConfigurationName = Release;
|
|
270
|
+
};
|
|
271
|
+
58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "CloudStorage" */ = {
|
|
272
|
+
isa = XCConfigurationList;
|
|
273
|
+
buildConfigurations = (
|
|
274
|
+
58B511F01A9E6C8500147676 /* Debug */,
|
|
275
|
+
58B511F11A9E6C8500147676 /* Release */,
|
|
276
|
+
);
|
|
277
|
+
defaultConfigurationIsVisible = 0;
|
|
278
|
+
defaultConfigurationName = Release;
|
|
279
|
+
};
|
|
280
|
+
/* End XCConfigurationList section */
|
|
281
|
+
};
|
|
282
|
+
rootObject = 58B511D31A9E6C8500147676 /* Project object */;
|
|
283
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _createRNCloudStorage = _interopRequireDefault(require("./createRNCloudStorage"));
|
|
8
|
+
var _googleDrive = _interopRequireDefault(require("./google-drive"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
const nativeInstance = (0, _createRNCloudStorage.default)();
|
|
11
|
+
const RNCloudStorage = {
|
|
12
|
+
setGoogleDriveAccessToken: accessToken => _googleDrive.default.accessToken = accessToken,
|
|
13
|
+
/**
|
|
14
|
+
* Tests whether or not the file at the given path exists.
|
|
15
|
+
* @param path The path to test.
|
|
16
|
+
* @param scope The directory scope the path is in.
|
|
17
|
+
* @returns A promise that resolves to true if the path exists, false otherwise.
|
|
18
|
+
*/
|
|
19
|
+
exists: (path, scope) => {
|
|
20
|
+
return nativeInstance.fileExists(path, scope);
|
|
21
|
+
},
|
|
22
|
+
/**
|
|
23
|
+
* Writes to the file at the given path, creating it if it doesn't exist or overwriting it if it does.
|
|
24
|
+
* @param path The file to write to.
|
|
25
|
+
* @param data The data to write.
|
|
26
|
+
* @param scope The directory scope the path is in.
|
|
27
|
+
* @returns A promise that resolves when the file has been written.
|
|
28
|
+
*/
|
|
29
|
+
writeFile: (path, data, scope) => {
|
|
30
|
+
return nativeInstance.createFile(path, data, scope, true);
|
|
31
|
+
},
|
|
32
|
+
/**
|
|
33
|
+
* Reads the contents of the file at the given path.
|
|
34
|
+
* @param path The file to read.
|
|
35
|
+
* @param scope The directory scope the path is in.
|
|
36
|
+
* @returns A promise that resolves to the contents of the file.
|
|
37
|
+
*/
|
|
38
|
+
readFile: (path, scope) => {
|
|
39
|
+
return nativeInstance.readFile(path, scope);
|
|
40
|
+
},
|
|
41
|
+
/**
|
|
42
|
+
* Deletes the file at the given path.
|
|
43
|
+
* @param path The file to delete.
|
|
44
|
+
* @param scope The directory scope the path is in.
|
|
45
|
+
* @returns A promise that resolves when the file has been deleted.
|
|
46
|
+
*/
|
|
47
|
+
unlink: (path, scope) => {
|
|
48
|
+
return nativeInstance.deleteFile(path, scope);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
var _default = RNCloudStorage;
|
|
52
|
+
exports.default = _default;
|
|
53
|
+
//# sourceMappingURL=RNCloudStorage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_createRNCloudStorage","_interopRequireDefault","require","_googleDrive","obj","__esModule","default","nativeInstance","createRNCloudStorage","RNCloudStorage","setGoogleDriveAccessToken","accessToken","GoogleDriveApiClient","exists","path","scope","fileExists","writeFile","data","createFile","readFile","unlink","deleteFile","_default","exports"],"sourceRoot":"../../src","sources":["RNCloudStorage.ts"],"mappings":";;;;;;AAAA,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAF,sBAAA,CAAAC,OAAA;AAAkD,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAGlD,MAAMG,cAAc,GAAG,IAAAC,6BAAoB,GAAE;AAC7C,MAAMC,cAAc,GAAG;EACrBC,yBAAyB,EAAGC,WAAmB,IAAMC,oBAAoB,CAACD,WAAW,GAAGA,WAAY;EACpG;AACF;AACA;AACA;AACA;AACA;EACEE,MAAM,EAAEA,CAACC,IAAY,EAAEC,KAAmB,KAAuB;IAC/D,OAAOR,cAAc,CAACS,UAAU,CAACF,IAAI,EAAEC,KAAK,CAAC;EAC/C,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;EACEE,SAAS,EAAEA,CAACH,IAAY,EAAEI,IAAY,EAAEH,KAAmB,KAAoB;IAC7E,OAAOR,cAAc,CAACY,UAAU,CAACL,IAAI,EAAEI,IAAI,EAAEH,KAAK,EAAE,IAAI,CAAC;EAC3D,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;EACEK,QAAQ,EAAEA,CAACN,IAAY,EAAEC,KAAmB,KAAsB;IAChE,OAAOR,cAAc,CAACa,QAAQ,CAACN,IAAI,EAAEC,KAAK,CAAC;EAC7C,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;EACEM,MAAM,EAAEA,CAACP,IAAY,EAAEC,KAAmB,KAAoB;IAC5D,OAAOR,cAAc,CAACe,UAAU,CAACR,IAAI,EAAEC,KAAK,CAAC;EAC/C;AACF,CAAC;AAAC,IAAAQ,QAAA,GAEad,cAAc;AAAAe,OAAA,CAAAlB,OAAA,GAAAiB,QAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = createRNCloudStorage;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _googleDrive = _interopRequireDefault(require("./google-drive"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
const LINKING_ERROR = `The package 'react-native-cloud-storage' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
|
|
11
|
+
ios: "- You have run 'pod install'\n",
|
|
12
|
+
default: ''
|
|
13
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
14
|
+
function createRNCloudStorage() {
|
|
15
|
+
if (_reactNative.Platform.OS === 'ios') {
|
|
16
|
+
return _reactNative.NativeModules.CloudStorage ?? new Proxy({}, {
|
|
17
|
+
get() {
|
|
18
|
+
throw new Error(LINKING_ERROR);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
if (_reactNative.Platform.OS === 'android') {
|
|
23
|
+
return new _googleDrive.default();
|
|
24
|
+
}
|
|
25
|
+
throw new Error('Unsupported platform');
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=createRNCloudStorage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_googleDrive","_interopRequireDefault","obj","__esModule","default","LINKING_ERROR","Platform","select","ios","createRNCloudStorage","OS","NativeModules","CloudStorage","Proxy","get","Error","GoogleDriveApiClient"],"sourceRoot":"../../src","sources":["createRNCloudStorage.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAkD,SAAAE,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAElD,MAAMG,aAAa,GAChB,qFAAoF,GACrFC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEJ,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAElB,SAASK,oBAAoBA,CAAA,EAAyB;EACnE,IAAIH,qBAAQ,CAACI,EAAE,KAAK,KAAK,EAAE;IACzB,OACGC,0BAAa,CAACC,YAAY,IAC3B,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;MACEC,GAAGA,CAAA,EAAG;QACJ,MAAM,IAAIC,KAAK,CAACV,aAAa,CAAC;MAChC;IACF,CAAC,CACF;EAEL;EAEA,IAAIC,qBAAQ,CAACI,EAAE,KAAK,SAAS,EAAE;IAC7B,OAAO,IAAIM,oBAAoB,EAAE;EACnC;EAEA,MAAM,IAAID,KAAK,CAAC,sBAAsB,CAAC;AACzC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _withRNCloudStorageIos = _interopRequireDefault(require("./withRNCloudStorageIos"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
// Android config plugin not needed as there's no native code to configure.
|
|
10
|
+
|
|
11
|
+
const withRNCloudStorage = (config, options) => (0, _withRNCloudStorageIos.default)(config, (options === null || options === void 0 ? void 0 : options.iCloudContainerEnvironment) ?? 'Production');
|
|
12
|
+
var _default = withRNCloudStorage;
|
|
13
|
+
exports.default = _default;
|
|
14
|
+
//# sourceMappingURL=withRNCloudStorage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_withRNCloudStorageIos","_interopRequireDefault","require","obj","__esModule","default","withRNCloudStorage","config","options","withRNCloudStorageIos","iCloudContainerEnvironment","_default","exports"],"sourceRoot":"../../../src","sources":["expo-plugin/withRNCloudStorage.ts"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA4D,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAG5D;;AAQA,MAAMG,kBAAmE,GAAGA,CAACC,MAAM,EAAEC,OAAO,KAC1F,IAAAC,8BAAqB,EAACF,MAAM,EAAE,CAAAC,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEE,0BAA0B,KAAI,YAAY,CAAC;AAAC,IAAAC,QAAA,GAEtEL,kBAAkB;AAAAM,OAAA,CAAAP,OAAA,GAAAM,QAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _configPlugins = require("@expo/config-plugins");
|
|
8
|
+
const withRNCloudStorageInfoPlist = config => (0, _configPlugins.withInfoPlist)(config, async newConfig => {
|
|
9
|
+
var _config$ios;
|
|
10
|
+
if (!((_config$ios = config.ios) !== null && _config$ios !== void 0 && _config$ios.bundleIdentifier)) {
|
|
11
|
+
throw new Error('Missing iOS bundle identifier');
|
|
12
|
+
}
|
|
13
|
+
const infoPlist = newConfig.modResults;
|
|
14
|
+
infoPlist.NSUbiquitousContainers = {
|
|
15
|
+
[`iCloud.${config.ios.bundleIdentifier}`]: {
|
|
16
|
+
NSUbiquitousContainerIsDocumentScopePublic: true,
|
|
17
|
+
NSUbiquitousContainerSupportedFolderLevels: 'Any',
|
|
18
|
+
NSUbiquitousContainerName: config.slug
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
return newConfig;
|
|
22
|
+
});
|
|
23
|
+
const withRNCloudStorageEntitlementsPlist = (config, iCloudContainerEnvironment) => (0, _configPlugins.withEntitlementsPlist)(config, async newConfig => {
|
|
24
|
+
var _config$ios2;
|
|
25
|
+
if (!((_config$ios2 = config.ios) !== null && _config$ios2 !== void 0 && _config$ios2.bundleIdentifier)) {
|
|
26
|
+
throw new Error('Missing iOS bundle identifier');
|
|
27
|
+
}
|
|
28
|
+
const entitlementsPlist = newConfig.modResults;
|
|
29
|
+
entitlementsPlist['com.apple.developer.icloud-container-identifiers'] = [`iCloud.${config.ios.bundleIdentifier}`];
|
|
30
|
+
entitlementsPlist['com.apple.developer.icloud-services'] = ['CloudDocuments'];
|
|
31
|
+
entitlementsPlist['com.apple.developer.icloud-container-environment'] = iCloudContainerEnvironment;
|
|
32
|
+
entitlementsPlist['com.apple.developer.ubiquity-container-identifiers'] = [`iCloud.${config.ios.bundleIdentifier}`];
|
|
33
|
+
entitlementsPlist['com.apple.developer.ubiquity-kvstore-identifier'] = `$(TeamIdentifierPrefix)${config.ios.bundleIdentifier}`;
|
|
34
|
+
return newConfig;
|
|
35
|
+
});
|
|
36
|
+
const withRNCloudStorageIos = (config, iCloudContainerEnvironment) => (0, _configPlugins.withPlugins)(config, [withRNCloudStorageInfoPlist, [withRNCloudStorageEntitlementsPlist, iCloudContainerEnvironment]]);
|
|
37
|
+
var _default = withRNCloudStorageIos;
|
|
38
|
+
exports.default = _default;
|
|
39
|
+
//# sourceMappingURL=withRNCloudStorageIos.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_configPlugins","require","withRNCloudStorageInfoPlist","config","withInfoPlist","newConfig","_config$ios","ios","bundleIdentifier","Error","infoPlist","modResults","NSUbiquitousContainers","NSUbiquitousContainerIsDocumentScopePublic","NSUbiquitousContainerSupportedFolderLevels","NSUbiquitousContainerName","slug","withRNCloudStorageEntitlementsPlist","iCloudContainerEnvironment","withEntitlementsPlist","_config$ios2","entitlementsPlist","withRNCloudStorageIos","withPlugins","_default","exports","default"],"sourceRoot":"../../../src","sources":["expo-plugin/withRNCloudStorageIos.ts"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAGA,MAAMC,2BAA2B,GAAIC,MAAkB,IACrD,IAAAC,4BAAa,EAACD,MAAM,EAAE,MAAOE,SAAS,IAAK;EAAA,IAAAC,WAAA;EACzC,IAAI,GAAAA,WAAA,GAACH,MAAM,CAACI,GAAG,cAAAD,WAAA,eAAVA,WAAA,CAAYE,gBAAgB,GAAE;IACjC,MAAM,IAAIC,KAAK,CAAC,+BAA+B,CAAC;EAClD;EACA,MAAMC,SAAS,GAAGL,SAAS,CAACM,UAAU;EACtCD,SAAS,CAACE,sBAAsB,GAAG;IACjC,CAAE,UAAST,MAAM,CAACI,GAAG,CAACC,gBAAiB,EAAC,GAAG;MACzCK,0CAA0C,EAAE,IAAI;MAChDC,0CAA0C,EAAE,KAAK;MACjDC,yBAAyB,EAAEZ,MAAM,CAACa;IACpC;EACF,CAAC;EAED,OAAOX,SAAS;AAClB,CAAC,CAAC;AAEJ,MAAMY,mCAAmC,GAAGA,CAC1Cd,MAAkB,EAClBe,0BAAwD,KAExD,IAAAC,oCAAqB,EAAChB,MAAM,EAAE,MAAOE,SAAS,IAAK;EAAA,IAAAe,YAAA;EACjD,IAAI,GAAAA,YAAA,GAACjB,MAAM,CAACI,GAAG,cAAAa,YAAA,eAAVA,YAAA,CAAYZ,gBAAgB,GAAE;IACjC,MAAM,IAAIC,KAAK,CAAC,+BAA+B,CAAC;EAClD;EACA,MAAMY,iBAAiB,GAAGhB,SAAS,CAACM,UAAU;EAC9CU,iBAAiB,CAAC,kDAAkD,CAAC,GAAG,CAAE,UAASlB,MAAM,CAACI,GAAG,CAACC,gBAAiB,EAAC,CAAC;EACjHa,iBAAiB,CAAC,qCAAqC,CAAC,GAAG,CAAC,gBAAgB,CAAC;EAC7EA,iBAAiB,CAAC,kDAAkD,CAAC,GAAGH,0BAA0B;EAClGG,iBAAiB,CAAC,oDAAoD,CAAC,GAAG,CAAE,UAASlB,MAAM,CAACI,GAAG,CAACC,gBAAiB,EAAC,CAAC;EACnHa,iBAAiB,CACf,iDAAiD,CAClD,GAAI,0BAAyBlB,MAAM,CAACI,GAAG,CAACC,gBAAiB,EAAC;EAE3D,OAAOH,SAAS;AAClB,CAAC,CAAC;AAEJ,MAAMiB,qBAAqB,GAAGA,CAACnB,MAAkB,EAAEe,0BAAwD,KACzG,IAAAK,0BAAW,EAACpB,MAAM,EAAE,CAACD,2BAA2B,EAAE,CAACe,mCAAmC,EAAEC,0BAA0B,CAAC,CAAC,CAAC;AAAC,IAAAM,QAAA,GAEzGF,qBAAqB;AAAAG,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
|