| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 | 
							- 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 (
 -       <View style={styles.item}>
 -         <Text style={styles.description}>Client初始化</Text>
 -         <View style={styles.detailitem}>
 -           
 -           <View style={styles.button}>
 -             <Button
 -               onPress={this.handClick.bind(this,"AKSK")}
 -               title="AKSK明文"
 -               color="#841584"
 -             />
 -           </View> 
 -         
 -           <View style={styles.button}>
 -             <Button  style={styles.button}
 -               onPress={this.handClick.bind(this,"Singer")}
 -               title="自签"
 -               color="#841584"
 -             />
 -           </View>
 - 
 -           <View style={styles.button}>
 -             <Button  style={styles.button}
 -               onPress={this.handClick.bind(this,"STS")}
 -               title="STS"
 -               color="#841584"
 -             />
 -           </View>
 - 
 -           <View style={styles.button}>
 -             <Button  style={styles.button}
 -               onPress={this.handClick.bind(this,"ServerSTS")}
 -               title="Server STS"
 -               color="#841584"
 -             />
 -           </View>
 -         </View>
 -       </View>
 -     )
 -   }
 - 
 -   handClick(e) {
 -     switch(e) {
 - 
 -       case 'AKSK' : {
 -         Alert.alert(Platform.OS);
 -         if (Platform.OS == 'ios') {
 -           AliyunOSS.initWithPlainTextAccessKey(config.AccessKey,config.SecretKey,endPoint,configuration);
 -           Alert.alert("initAKSK success!")
 -         } else {
 -           Alert.alert('android do not support AK SK ,please use initWithSTS')
 -         }
 -       } break;
 - 
 -       case 'Singer' : {
 -         Alert.alert('initAKSK')
 -       } break;
 - 
 -       case "STS": {
 -         AliyunOSS.initWithSecurityToken(STSConfig.SecurityToken,STSConfig.AccessKeyId,STSConfig.SecretKeyId,endPoint,configuration)
 -         Alert.alert('STS success!')
 -       } break;
 - 
 -       case "ServerSTS" : {
 -         AliyunOSS.initWithServerSTS(familyserver,endPoint, configuration)
 -         Alert.alert('initServerSTS Success!')
 -       } break;
 - 
 -       default: break;
 -      }
 -   }
 - }
 
 
  |