diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d3cfdf1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +android/build/ +android/aliyun-oss-react-native.iml +node_modules/ +.idea +.DS_Store +Example/ios/Pods/ +package-lock.json \ No newline at end of file diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..785470e --- /dev/null +++ b/.npmignore @@ -0,0 +1,56 @@ +# IntelliJ project files +.idea +*.iml +out +gen + +Example/ +.gitignore + +.vscode + +# typings +# +typings +typings.json +# OSX +# +.DS_Store + +# Xcode +# +build/ +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata +*.xccheckout +*.moved-aside +DerivedData +*.hmap +*.ipa +*.xcuserstate +project.xcworkspace + +# Android/IJ +# +*.iml +.idea +.gradle +local.properties + +# node.js +# +node_modules/ +npm-debug.log + +# BUCK +buck-out/ +\.buckd/ +android/app/libs +android/keystores/debug.keystore \ No newline at end of file diff --git a/Example/.babelrc b/Example/.babelrc new file mode 100644 index 0000000..a9ce136 --- /dev/null +++ b/Example/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["react-native"] +} diff --git a/Example/.buckconfig b/Example/.buckconfig new file mode 100644 index 0000000..934256c --- /dev/null +++ b/Example/.buckconfig @@ -0,0 +1,6 @@ + +[android] + target = Google Inc.:Google APIs:23 + +[maven_repositories] + central = https://repo1.maven.org/maven2 diff --git a/Example/.flowconfig b/Example/.flowconfig new file mode 100644 index 0000000..7d5e2d3 --- /dev/null +++ b/Example/.flowconfig @@ -0,0 +1,54 @@ +[ignore] +; We fork some components by platform +.*/*[.]android.js + +; Ignore "BUCK" generated dirs +/\.buckd/ + +; Ignore unexpected extra "@providesModule" +.*/node_modules/.*/node_modules/fbjs/.* + +; Ignore duplicate module providers +; For RN Apps installed via npm, "Libraries" folder is inside +; "node_modules/react-native" but in the source repo it is in the root +.*/Libraries/react-native/React.js + +; Ignore polyfills +.*/Libraries/polyfills/.* + +; Ignore metro +.*/node_modules/metro/.* + +[include] + +[libs] +node_modules/react-native/Libraries/react-native/react-native-interface.js +node_modules/react-native/flow/ +node_modules/react-native/flow-github/ + +[options] +emoji=true + +module.system=haste + +munge_underscores=true + +module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' + +module.file_ext=.js +module.file_ext=.jsx +module.file_ext=.json +module.file_ext=.native.js + +suppress_type=$FlowIssue +suppress_type=$FlowFixMe +suppress_type=$FlowFixMeProps +suppress_type=$FlowFixMeState + +suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) +suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ +suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy +suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError + +[version] +^0.67.0 diff --git a/Example/.gitattributes b/Example/.gitattributes new file mode 100644 index 0000000..d42ff18 --- /dev/null +++ b/Example/.gitattributes @@ -0,0 +1 @@ +*.pbxproj -text diff --git a/Example/.gitignore b/Example/.gitignore new file mode 100644 index 0000000..5d64756 --- /dev/null +++ b/Example/.gitignore @@ -0,0 +1,56 @@ +# OSX +# +.DS_Store + +# Xcode +# +build/ +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata +*.xccheckout +*.moved-aside +DerivedData +*.hmap +*.ipa +*.xcuserstate +project.xcworkspace + +# Android/IntelliJ +# +build/ +.idea +.gradle +local.properties +*.iml + +# node.js +# +node_modules/ +npm-debug.log +yarn-error.log + +# BUCK +buck-out/ +\.buckd/ +*.keystore + +# fastlane +# +# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the +# screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://docs.fastlane.tools/best-practices/source-control/ + +*/fastlane/report.xml +*/fastlane/Preview.html +*/fastlane/screenshots + +# Bundle artifact +*.jsbundle diff --git a/Example/.watchmanconfig b/Example/.watchmanconfig new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/Example/.watchmanconfig @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/Example/App.js b/Example/App.js new file mode 100644 index 0000000..ab244db --- /dev/null +++ b/Example/App.js @@ -0,0 +1,60 @@ +import React, { Component } from 'react'; + +import { + StyleSheet, + View, + ScrollView, +} from 'react-native'; + +import { AuthManager } from './Component/AuthManager' +import { UploadManager } from './Component/UploadManager' +import { DownloadManager } from './Component/DownloadManager' +import { ImageProcessManager } from './Component/ImageProcessManager' +import { BucketManager } from './Component/BucketManager' +import { ObjectManager } from './Component/ObjectManager' + +import AliyunOSS from 'aliyun-oss-react-native' +//open log +AliyunOSS.enableDevMode() +// defalut configraiton +const configuration = { + maxRetryCount: 3, + timeoutIntervalForRequest: 30, + timeoutIntervalForResource: 24 * 60 * 60 +}; +const config = { + AccessKey: 'XXX', + SecretKey: 'XXX', +}; +const endPoint = 'oss-cn-zhangjiakou.aliyuncs.com'; +const companyserver = "http://XXX:PORT"; +const familyserver = "http://XXX:PORT"; + +// AliyunOSS.initWithPlainTextAccessKey(config.AccessKey, config.SecretKey, endPoint, configuration); +AliyunOSS.initWithServerSTS(familyserver,endPoint, configuration) + +type Props = {}; + +export default class App extends Component { + render() { + return ( + + + + + + + + + + + ); + } +} +const styles = StyleSheet.create({ + container: { + flexDirection:'column', + backgroundColor: '#F5FCFF', + flexWrap:'wrap' + } +}); diff --git a/Example/CSS/global.js b/Example/CSS/global.js new file mode 100644 index 0000000..dae0e49 --- /dev/null +++ b/Example/CSS/global.js @@ -0,0 +1,28 @@ + +import { StyleSheet } from 'react-native' + +export const styles = StyleSheet.create({ + container: { + flexDirection:'column', + backgroundColor: '#F5FCFF', + flexWrap:'wrap' + }, + description: { + fontSize:20, + marginTop:10, + marginLeft:10, + marginBottom:20 + }, + item: { + justifyContent:'space-around', + marginBottom:10 + }, + button:{ + margin:10 + }, + detailitem: { + flexDirection:'row', + justifyContent:'flex-start', + flexWrap:'wrap' + } +}); \ No newline at end of file diff --git a/Example/Component/AuthManager.js b/Example/Component/AuthManager.js new file mode 100644 index 0000000..fa2b159 --- /dev/null +++ b/Example/Component/AuthManager.js @@ -0,0 +1,112 @@ +import React, { Component } from 'react'; +import { + Platform, + StyleSheet, + Text, + View, + Alert, + Button, + ScrollView, + Image +} from 'react-native'; + + +const configuration = { + maxRetryCount: 3, + timeoutIntervalForRequest: 30, + timeoutIntervalForResource: 24 * 60 * 60 +}; + +const config = { + AccessKey: 'XXX', + SecretKey: 'XXX', +}; + +const STSConfig = { + AccessKeyId:'XXX', + SecretKeyId:'XXX', + SecurityToken:'XXX' +} + +const endPoint = 'oss-cn-zhangjiakou.aliyuncs.com'; +const companyserver = "http://XXX:PORT" +const familyserver = "http://XXX:PORT" + +//导入样式 +import { styles } from '../CSS/global.js' + +export class AuthManager extends Component { + + render() { + return ( + + Client初始化 + + + +