|
@@ -71,38 +71,39 @@ pod 'aliyun-oss-react-native', :path => '../node_modules/aliyun-oss-react-native
|
71
|
71
|
|
72
|
72
|
#### Android
|
73
|
73
|
1. Add the following lines to `android/settings.gradle`:
|
74
|
|
- ```gradle
|
75
|
|
- include ':react-native-rn-sdk'
|
76
|
|
- project(':react-native-rn-sdk').projectDir = new File(rootProject.projectDir, '../node_modules/aliyun-oss-rn-sdk/android')
|
77
|
|
- ```
|
78
|
74
|
|
79
|
|
-2. Add the compile line to the dependencies in `android/app/build.gradle`:
|
80
|
|
- ```gradle
|
81
|
|
- dependencies {
|
82
|
|
- compile project(':aliyun-oss-react-native')
|
83
|
|
- }
|
84
|
|
- ```
|
|
75
|
+```gradle
|
|
76
|
+include ':react-native-rn-sdk'
|
|
77
|
+project(':react-native-rn-sdk').projectDir = new File(rootProject.projectDir, '../node_modules/aliyun-oss-rn-sdk/android')
|
|
78
|
+```
|
85
|
79
|
|
|
80
|
+2. Add the compile line to the dependencies in `android/app/build.gradle`:
|
|
81
|
+```gradle
|
|
82
|
+dependencies {
|
|
83
|
+ compile project(':aliyun-oss-react-native')
|
|
84
|
+}
|
|
85
|
+```
|
86
|
86
|
3. Add the required permissions in `AndroidManifest.xml`:
|
87
|
|
- ```xml
|
88
|
|
- <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
|
89
|
|
- <uses-permission android:name="android.permission.CAMERA" />
|
90
|
|
- ```
|
|
87
|
+
|
|
88
|
+ ```xml
|
|
89
|
+ <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
|
|
90
|
+ <uses-permission android:name="android.permission.CAMERA" />
|
|
91
|
+ ```
|
91
|
92
|
4. Add the import and link the package in `MainApplication.java`:
|
92
|
93
|
|
93
|
|
- ```java
|
94
|
|
- import com.reactlibrary.RNAliyunOssPackage;
|
|
94
|
+```java
|
|
95
|
+import com.reactlibrary.RNAliyunOssPackage;
|
95
|
96
|
|
96
|
|
- public class MainApplication extends Application implements ReactApplication {
|
97
|
|
- @Override
|
98
|
|
- protected List<ReactPackage> getPackages() {
|
99
|
|
- return Arrays.<ReactPackage>asList(
|
100
|
|
- new MainReactPackage(),
|
101
|
|
- new RNAliyunOssPackage()
|
102
|
|
- );
|
103
|
|
- }
|
104
|
|
- }
|
105
|
|
- ```
|
|
97
|
+ public class MainApplication extends Application implements ReactApplication {
|
|
98
|
+ @Override
|
|
99
|
+ protected List<ReactPackage> getPackages() {
|
|
100
|
+ return Arrays.<ReactPackage>asList(
|
|
101
|
+ new MainReactPackage(),
|
|
102
|
+ new RNAliyunOssPackage()
|
|
103
|
+ );
|
|
104
|
+ }
|
|
105
|
+}
|
|
106
|
+```
|
106
|
107
|
|
107
|
108
|
## Usage
|
108
|
109
|
|
|
@@ -170,8 +171,6 @@ initWithSigner |Y|Y
|
170
|
171
|
initWithSecurityToken |Y|Y
|
171
|
172
|
initWithServerSTS |Y|Y
|
172
|
173
|
asyncUpload |Y| Y
|
173
|
|
-asyncAppendObject ||
|
174
|
|
-asyncResumableUpload ||
|
175
|
174
|
initMultipartUpload |Y|Y
|
176
|
175
|
multipartUpload | Y | Y
|
177
|
176
|
listParts |Y|Y
|
|
@@ -347,29 +346,29 @@ AliyunOSS.asyncListBuckets().then((e) => {
|
347
|
346
|
```
|
348
|
347
|
### doesObjectExist
|
349
|
348
|
|
350
|
|
-```
|
351
|
|
- AliyunOSS.doesObjectExist('luozhang001','xx.png').then((e)=>{
|
|
349
|
+```javascript
|
|
350
|
+ AliyunOSS.doesObjectExist('luozhang001','xx.png').then( (e) => {
|
|
351
|
+ console.log(e)
|
|
352
|
+ }).catch((e) => {
|
352
|
353
|
console.log(e)
|
353
|
|
- }).catch((e)=>{
|
354
|
|
- console.log(e)
|
355
|
354
|
})
|
356
|
355
|
```
|
357
|
356
|
|
358
|
357
|
### asyncCopyObject
|
359
|
358
|
|
360
|
|
-```
|
361
|
|
- AliyunOSS.asyncCopyObject('luozhang001',"2.png","luozhang002","sbsbsb").then((e)=>{
|
362
|
|
- console.log(e)
|
363
|
|
- }).catch((e)=>{
|
364
|
|
- console.log("xxxx")
|
365
|
|
- console.log(e)
|
366
|
|
- })
|
|
359
|
+```javascript
|
|
360
|
+ AliyunOSS.asyncCopyObject('luozhang001',"2.png","luozhang002","sbsbsb").then( (e) => {
|
|
361
|
+ console.log(e)
|
|
362
|
+ }).catch((e)=>{
|
|
363
|
+ console.log("xxxx")
|
|
364
|
+ console.log(e)
|
|
365
|
+ })
|
367
|
366
|
```
|
368
|
367
|
### asyncDeleteObject
|
369
|
368
|
|
370
|
|
-```
|
|
369
|
+```javascript
|
371
|
370
|
AliyunOSS.asyncDeleteObject('luozhang001','2.png').then((e)=>{
|
372
|
|
- Alert.alert(e)
|
|
371
|
+ Alert.alert(e)
|
373
|
372
|
}).catch((e)=>{
|
374
|
373
|
console.log(e)
|
375
|
374
|
})
|
|
@@ -377,7 +376,7 @@ AliyunOSS.asyncListBuckets().then((e) => {
|
377
|
376
|
|
378
|
377
|
## DEMO
|
379
|
378
|
|
380
|
|
-In the repository, we prodive RN SDK DEMO in the Example folder including andriod and ios,`Example/android` provide the android demo;`Example/NativeAddRN` provide the ios demo.Welcome to join us, how to run the Example ?
|
|
379
|
+In the repository, we prodive RN SDK DEMO in the Example folder including andriod and ios,`Example/android` provide the android demo;`Example/iOS` provide the ios demo.Welcome to join us, how to run the Example ?
|
381
|
380
|
|
382
|
381
|
* step-1:clone the project and install some dependencies
|
383
|
382
|
|