aliyun-oss-react-native
Advanced tools
Comparing version 1.0.0-alpha.5 to 1.0.0-alpha.6
{ | ||
"name": "aliyun-oss-react-native", | ||
"version": "1.0.0-alpha.5", | ||
"version": "1.0.0-alpha.6", | ||
"description": "React Native SDK for aliyun object storage service", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -142,3 +142,3 @@ # Aliyun OSS SDK for React Native | ||
2. 修改config中accessKeyId 和 accessKeySecret | ||
3. node index.js,端口默认9000,鉴权服务地址为:(http|https)://ip.com:9000/ | ||
3. node index.js,端口默认9000,鉴权服务地址为:(http|https)://ip:9000/ | ||
@@ -148,12 +148,12 @@ * step-5: | ||
```javascript | ||
<!-- 备注:目前接口仅暴漏filePath,上传路径为file:/// --> | ||
AliyunOSS.asyncUpload(bucketname, objectkey, filePath).then( (res) => { | ||
<!-- log的查看可以通过React Native自带的调试工具也可通过XCode Log控制台进行查看 --> | ||
console.log(res) | ||
}).catch((error)=>{ | ||
console.log(error) | ||
}) | ||
<!-- 监听上传事件和上传进度--> | ||
const downloadProgress = p => console.log(p.currentSize / p.totalSize); | ||
AliyunOSS.addEventListener('uploadProgress', downloadProgress); | ||
<!-- 备注:目前接口仅暴漏filePath,上传路径为file:/// --> | ||
AliyunOSS.asyncUpload(bucketname, objectkey, filePath).then( (res) => { | ||
<!-- log的查看可以通过React Native自带的调试工具也可通过XCode Log控制台进行查看 --> | ||
console.log(res) | ||
}).catch((error)=>{ | ||
console.log(error) | ||
}) | ||
<!-- 监听上传事件和上传进度--> | ||
const downloadProgress = p => console.log(p.currentSize / p.totalSize); | ||
AliyunOSS.addEventListener('uploadProgress', downloadProgress); | ||
``` | ||
@@ -172,5 +172,3 @@ | ||
initWithServerSTS | 支持| 支持 | ||
asyncUpload | 支持| 支持 | ||
asyncAppendObject || | ||
asyncResumableUpload || | ||
asyncUpload | 支持| 支持 | | ||
initMultipartUpload | 支持| 支持 | ||
@@ -199,5 +197,5 @@ multipartUpload | 支持| 支持 | ||
### initWithPlainTextAccessKey | ||
### initWithPlainTextAccessKey(不建议) | ||
该接口需要通过明文授权acckeyId和accekeySecret,使用可查看 | ||
该接口需要通过明文授权acckeyId和accekeySecret,开发者这可以使用,但是我们不建议 | ||
@@ -383,3 +381,3 @@ ```javascript | ||
仓库Example中提供了React Native android和iOS端运行demo,Android为Example下的android工程,iOS为Example下的NativeAddRN工程,目前Example提供了所有已开发的API DEMO,还在完善中,欢迎参与共建。如何运行Example呢? | ||
仓库Example中提供了React Native android和iOS端运行demo,Android为Example下的android工程,iOS为Example下的iOS工程,目前Example提供了所有已开发的API DEMO,还在完善中,欢迎参与共建。如何运行Example呢? | ||
@@ -386,0 +384,0 @@ * step-1:克隆项目并安装依赖包 |
@@ -74,34 +74,35 @@ # Alibaba Cloud OSS SDK for React Native | ||
1. Add the following lines to `android/settings.gradle`: | ||
```gradle | ||
include ':react-native-rn-sdk' | ||
project(':react-native-rn-sdk').projectDir = new File(rootProject.projectDir, '../node_modules/aliyun-oss-rn-sdk/android') | ||
``` | ||
```gradle | ||
include ':react-native-rn-sdk' | ||
project(':react-native-rn-sdk').projectDir = new File(rootProject.projectDir, '../node_modules/aliyun-oss-rn-sdk/android') | ||
``` | ||
2. Add the compile line to the dependencies in `android/app/build.gradle`: | ||
```gradle | ||
dependencies { | ||
compile project(':aliyun-oss-react-native') | ||
} | ||
``` | ||
```gradle | ||
dependencies { | ||
compile project(':aliyun-oss-react-native') | ||
} | ||
``` | ||
3. Add the required permissions in `AndroidManifest.xml`: | ||
3. Add the required permissions in `AndroidManifest.xml`: | ||
```xml | ||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> | ||
<uses-permission android:name="android.permission.CAMERA" /> | ||
``` | ||
```xml | ||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> | ||
<uses-permission android:name="android.permission.CAMERA" /> | ||
``` | ||
4. Add the import and link the package in `MainApplication.java`: | ||
```java | ||
import com.reactlibrary.RNAliyunOssPackage; | ||
```java | ||
import com.reactlibrary.RNAliyunOssPackage; | ||
public class MainApplication extends Application implements ReactApplication { | ||
@Override | ||
protected List<ReactPackage> getPackages() { | ||
return Arrays.<ReactPackage>asList( | ||
new MainReactPackage(), | ||
new RNAliyunOssPackage() | ||
); | ||
} | ||
} | ||
``` | ||
public class MainApplication extends Application implements ReactApplication { | ||
@Override | ||
protected List<ReactPackage> getPackages() { | ||
return Arrays.<ReactPackage>asList( | ||
new MainReactPackage(), | ||
new RNAliyunOssPackage() | ||
); | ||
} | ||
} | ||
``` | ||
@@ -174,4 +175,2 @@ ## Usage | ||
asyncUpload |Y| Y | ||
asyncAppendObject || | ||
asyncResumableUpload || | ||
initMultipartUpload |Y|Y | ||
@@ -203,3 +202,3 @@ multipartUpload | Y | Y | ||
init auth client with accessKeyId and accessKeySecret,please refer to the code. | ||
init auth client with accessKeyId and accessKeySecret,please refer to the code.you can use ,but we do not suggest use it。 | ||
@@ -353,7 +352,7 @@ ```javascript | ||
``` | ||
AliyunOSS.doesObjectExist('luozhang001','xx.png').then((e)=>{ | ||
```javascript | ||
AliyunOSS.doesObjectExist('luozhang001','xx.png').then( (e) => { | ||
console.log(e) | ||
}).catch((e)=>{ | ||
console.log(e) | ||
}).catch((e) => { | ||
console.log(e) | ||
}) | ||
@@ -364,15 +363,15 @@ ``` | ||
```javascript | ||
AliyunOSS.asyncCopyObject('luozhang001',"2.png","luozhang002","sbsbsb").then( (e) => { | ||
console.log(e) | ||
}).catch((e)=>{ | ||
console.log("xxxx") | ||
console.log(e) | ||
}) | ||
``` | ||
AliyunOSS.asyncCopyObject('luozhang001',"2.png","luozhang002","sbsbsb").then((e)=>{ | ||
console.log(e) | ||
}).catch((e)=>{ | ||
console.log("xxxx") | ||
console.log(e) | ||
}) | ||
``` | ||
### asyncDeleteObject | ||
``` | ||
```javascript | ||
AliyunOSS.asyncDeleteObject('luozhang001','2.png').then((e)=>{ | ||
Alert.alert(e) | ||
Alert.alert(e) | ||
}).catch((e)=>{ | ||
@@ -385,3 +384,3 @@ console.log(e) | ||
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 ? | ||
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 ? | ||
@@ -388,0 +387,0 @@ * step-1:clone the project and install some dependencies |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13006263
441