Commit 049b74d2 authored by Trisno's avatar Trisno
parents 7856eb39 a6750ed3
...@@ -137,5 +137,8 @@ ...@@ -137,5 +137,8 @@
"noAddressSaved":"No address saved", "noAddressSaved":"No address saved",
"headerInboxList":"INBOX", "headerInboxList":"INBOX",
"noInboxData":"No incoming message", "noInboxData":"No incoming message",
"headerInboxDetail":"INBOX DETAIL" "headerInboxDetail":"INBOX DETAIL",
"alertdeleteaddress":"Are you sure you want to delete the address ?",
"alertyes":"Yes",
"alertno":"No"
} }
\ No newline at end of file
...@@ -139,5 +139,8 @@ ...@@ -139,5 +139,8 @@
"noAddressSaved":"Tidak ada alamat tersimpan", "noAddressSaved":"Tidak ada alamat tersimpan",
"headerInboxList":"KOTAK MASUK", "headerInboxList":"KOTAK MASUK",
"noInboxData":"Tidak ada pesan masuk", "noInboxData":"Tidak ada pesan masuk",
"headerInboxDetail":"DETAIL KOTAK MASUK" "headerInboxDetail":"DETAIL KOTAK MASUK",
"alertdeleteaddress":"Apakah anda yakin ingin menghapus alamat ?",
"alertyes":"Ya",
"alertno":"Tidak"
} }
\ No newline at end of file
...@@ -3082,6 +3082,11 @@ ...@@ -3082,6 +3082,11 @@
"fontfaceobserver": "^2.1.0" "fontfaceobserver": "^2.1.0"
} }
}, },
"expo-image-manipulator": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/expo-image-manipulator/-/expo-image-manipulator-8.0.0.tgz",
"integrity": "sha512-7KaQca4szyNllM30ZAnyL7ww83/YJFDl4Yr/4/WglXAKas96WOBztsF7/CPrboEVh/LzfqtSFW0PtyYgrC2o9Q=="
},
"expo-image-picker": { "expo-image-picker": {
"version": "8.0.2", "version": "8.0.2",
"resolved": "https://registry.npmjs.org/expo-image-picker/-/expo-image-picker-8.0.2.tgz", "resolved": "https://registry.npmjs.org/expo-image-picker/-/expo-image-picker-8.0.2.tgz",
...@@ -6770,6 +6775,11 @@ ...@@ -6770,6 +6775,11 @@
"resolved": "https://registry.npmjs.org/react-native-image-picker/-/react-native-image-picker-2.3.1.tgz", "resolved": "https://registry.npmjs.org/react-native-image-picker/-/react-native-image-picker-2.3.1.tgz",
"integrity": "sha512-c/a2h7/T7yBo5KlNQhcSn4xf4+6Li6LfJ59+GZT1ZzzWrj/6X8DiJ/TJBOlOZMC5tJriZKuRkWSsr74k6z+brw==" "integrity": "sha512-c/a2h7/T7yBo5KlNQhcSn4xf4+6Li6LfJ59+GZT1ZzzWrj/6X8DiJ/TJBOlOZMC5tJriZKuRkWSsr74k6z+brw=="
}, },
"react-native-image-resizer": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/react-native-image-resizer/-/react-native-image-resizer-1.2.3.tgz",
"integrity": "sha512-RDPNJglRmWDZ/7hvu+CbpsKYl6AQmseL8cWX4UkLAHxQWNc5ZdYhP/9avC5xCfyiwkRw+Zmkmv78HO0kt0ewhQ=="
},
"react-native-image-slider-box": { "react-native-image-slider-box": {
"version": "1.0.12", "version": "1.0.12",
"resolved": "https://registry.npmjs.org/react-native-image-slider-box/-/react-native-image-slider-box-1.0.12.tgz", "resolved": "https://registry.npmjs.org/react-native-image-slider-box/-/react-native-image-slider-box-1.0.12.tgz",
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
"expo-device": "^2.0.0", "expo-device": "^2.0.0",
"expo-file-system": "~8.0.0", "expo-file-system": "~8.0.0",
"expo-font": "^8.0.0", "expo-font": "^8.0.0",
"expo-image-manipulator": "^8.0.0",
"expo-image-picker": "~8.0.1", "expo-image-picker": "~8.0.1",
"expo-localization": "~8.0.0", "expo-localization": "~8.0.0",
"expo-location": "^8.0.0", "expo-location": "^8.0.0",
...@@ -51,6 +52,7 @@ ...@@ -51,6 +52,7 @@
"react-native-i18n": "^2.0.15", "react-native-i18n": "^2.0.15",
"react-native-image-base64": "^0.1.4", "react-native-image-base64": "^0.1.4",
"react-native-image-picker": "^2.3.1", "react-native-image-picker": "^2.3.1",
"react-native-image-resizer": "^1.2.3",
"react-native-image-slider-box": "^1.0.12", "react-native-image-slider-box": "^1.0.12",
"react-native-loading-spinner-overlay": "^1.1.0", "react-native-loading-spinner-overlay": "^1.1.0",
"react-native-maps": "^0.26.1", "react-native-maps": "^0.26.1",
......
...@@ -363,7 +363,6 @@ class Account extends React.Component { ...@@ -363,7 +363,6 @@ class Account extends React.Component {
</View> </View>
</Card> </Card>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
<View style={{ flex: 1, flexDirection: 'row', justifyContent: 'center' }}> <View style={{ flex: 1, flexDirection: 'row', justifyContent: 'center' }}>
{this.state.premium === false ? ( {this.state.premium === false ? (
......
import React from 'react'; import React from 'react';
import { View, Text, TextInput, StyleSheet, Button, Platform, Dimensions, Alert, Image ,ActivityIndicator } from 'react-native'; import { View, Text, TextInput, StyleSheet, Button, Platform, Dimensions, Alert, Image, ActivityIndicator } from 'react-native';
import * as Device from 'expo-device'; import * as Device from 'expo-device';
import * as Permissions from 'expo-permissions'; import * as Permissions from 'expo-permissions';
import * as Location from 'expo-location'; import * as Location from 'expo-location';
...@@ -67,22 +67,86 @@ class AddreesDetail extends React.Component { ...@@ -67,22 +67,86 @@ class AddreesDetail extends React.Component {
}) })
let detail = await Location.reverseGeocodeAsync(location.coords) let detail = await Location.reverseGeocodeAsync(location.coords)
// console.log(" INI DETAIL "+ JSON.stringify(detail) ) //ini benerin bug ketika jalan kosong
let street = detail[0].street
let city = detail[0].city
let region = detail[0].region
let postalCode = detail[0].postalCode
let latitude = location.coords.latitude; let latitude = location.coords.latitude;
let longitude = location.coords.longitude; let longitude = location.coords.longitude;
this.setState({ location, latitude: latitude, longitude: longitude }) this.setState({ location, latitude: latitude, longitude: longitude })
this.setState({ if (street == null) {
let str_city = city.replace('null', '')
let str_region = region.replace('null', '')
let str_postalCode = postalCode.replace('null', '')
this.setState({
street: '',
city: str_city,
region: str_region,
postalCode: str_postalCode,
indicator: false,
})
} else if (city == null) {
let str_street = street.replace('null', '')
let str_region = region.replace('null', '')
let str_postalCode = postalCode.replace('null', '')
this.setState({
street: str_street,
city: '',
region: str_region,
postalCode: str_postalCode,
indicator: false,
})
} else if (region == null) {
let str_street = street.replace('null', '')
let str_city = city.replace('null', '')
let str_postalCode = postalCode.replace('null', '')
this.setState({
street: str_street,
city: str_city,
region: '',
postalCode: str_postalCode,
indicator: false,
})
} else if (postalCode == null) {
let str_street = street.replace('null', '')
let str_city = city.replace('null', '')
let str_region = region.replace('null', '')
this.setState({
street: str_street,
city: str_city,
region: str_region,
postalCode: '',
indicator: false,
})
} else {
let str_street = street.replace('null', '')
let str_city = city.replace('null', '')
let str_region = region.replace('null', '')
let str_postalCode = postalCode.replace('null', '')
this.setState({
street: str_street,
city: str_city,
region: str_region,
postalCode: str_postalCode,
indicator: false,
})
}
street: detail[0].street,
city: detail[0].city,
// name: detail[0].name,
region: detail[0].region,
postalCode: detail[0].postalCode,
indicator: false,
})
} }
...@@ -127,7 +191,7 @@ class AddreesDetail extends React.Component { ...@@ -127,7 +191,7 @@ class AddreesDetail extends React.Component {
} }
// console.log(params) // console.log(params)
Axios.post(this.props.BASE_URL+'crm/v2/member/set_address', params).then(res => { Axios.post(this.props.BASE_URL + 'crm/v2/member/set_address', params).then(res => {
Alert.alert( Alert.alert(
'Berhasil', 'Berhasil',
'Berhasil menambahkan Alamat !' 'Berhasil menambahkan Alamat !'
...@@ -228,13 +292,13 @@ class AddreesDetail extends React.Component { ...@@ -228,13 +292,13 @@ class AddreesDetail extends React.Component {
</View> </View>
<View style={styles.field_name_addrees}> <View style={styles.field_name_addrees}>
<Text style={{ fontFamily: 'Gotham-Black', color: "#ccb46c", textAlign: 'center', fontSize: 18 }}>{i18n.t('label')}</Text> <Text style={{ fontFamily: 'Gotham-Black', color: "#ccb46c", textAlign: 'center', fontSize: 18 }}>{i18n.t('label')}</Text>
<TextInput style={{ color:'grey', fontFamily:'Gotham-Black', height: 40, borderWidth: 1, padding: 5, flex: 1, margin: 10, borderRadius: 10, borderColor: 'grey',textAlign:'center' }} onChangeText={(name) => this.setState({ name })} /> <TextInput style={{ color: 'grey', fontFamily: 'Gotham-Black', height: 40, borderWidth: 1, padding: 5, flex: 1, margin: 10, borderRadius: 10, borderColor: 'grey', textAlign: 'center' }} onChangeText={(name) => this.setState({ name })} />
</View> </View>
<View style={styles.field_detail_addrees}> <View style={styles.field_detail_addrees}>
<Text style={{ fontFamily: 'Gotham-Black', color: "#ccb46c",textAlign:'center', fontSize: 18 }}>{i18n.t('detail')}</Text> <Text style={{ fontFamily: 'Gotham-Black', color: "#ccb46c", textAlign: 'center', fontSize: 18 }}>{i18n.t('detail')}</Text>
<TextInput <TextInput
style={{color:'grey', fontFamily:'Gotham-Black', textAlign:'center', height: 70, borderWidth: 1, padding: 5, flex: 1, margin: 10, borderRadius: 10, borderColor: 'grey' }} style={{ color: 'grey', fontFamily: 'Gotham-Black', textAlign: 'center', height: 70, borderWidth: 1, padding: 5, flex: 1, margin: 10, borderRadius: 10, borderColor: 'grey' }}
onChangeText={(description) => this.setState({ description })} onChangeText={(description) => this.setState({ description })}
numberOfLines={10} numberOfLines={10}
multiline={true} /> multiline={true} />
...@@ -246,7 +310,7 @@ class AddreesDetail extends React.Component { ...@@ -246,7 +310,7 @@ class AddreesDetail extends React.Component {
</View> </View>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
<View style={{ height: 20}}></View> <View style={{ height: 20 }}></View>
</View> </View>
</View> </View>
</ScrollView> </ScrollView>
...@@ -315,12 +379,10 @@ const mapStateToProps = (state) => { ...@@ -315,12 +379,10 @@ const mapStateToProps = (state) => {
session_id: state.session_id, session_id: state.session_id,
language: state.language, language: state.language,
BASE_URL: state.BASE_URL, BASE_URL: state.BASE_URL,
} }
} }
export default connect(mapStateToProps)(AddreesDetail) export default connect(mapStateToProps)(AddreesDetail)
\ No newline at end of file
// <TextInput style={{ height: 40, borderWidth: 1, padding: 5, margin: 10,borderRadius:5 }} onChangeText={(address) => this.setState({ address })} />
\ No newline at end of file
...@@ -4,15 +4,15 @@ import { Camera } from 'expo-camera'; ...@@ -4,15 +4,15 @@ import { Camera } from 'expo-camera';
import * as Permissions from 'expo-permissions'; import * as Permissions from 'expo-permissions';
import { FontAwesome, Ionicons, MaterialCommunityIcons } from '@expo/vector-icons'; import { FontAwesome, Ionicons, MaterialCommunityIcons } from '@expo/vector-icons';
import * as ImagePicker from 'expo-image-picker'; import * as ImagePicker from 'expo-image-picker';
import * as FileSystem from 'expo-file-system';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import ActionType from '../redux/globalActionType'; import ActionType from '../redux/globalActionType';
class Cameras extends React.Component { class Cameras extends React.Component {
state = { state = {
hasPermission: null, hasPermission: null,
cameraType: Camera.Constants.Type.back, cameraType: Camera.Constants.Type.back,
setReady: true,
setImage: null,
} }
async componentDidMount() { async componentDidMount() {
...@@ -34,7 +34,6 @@ class Cameras extends React.Component { ...@@ -34,7 +34,6 @@ class Cameras extends React.Component {
handleCameraType = () => { handleCameraType = () => {
const { cameraType } = this.state const { cameraType } = this.state
this.setState({ this.setState({
cameraType: cameraType:
cameraType === Camera.Constants.Type.back cameraType === Camera.Constants.Type.back
...@@ -44,47 +43,10 @@ class Cameras extends React.Component { ...@@ -44,47 +43,10 @@ class Cameras extends React.Component {
} }
capture() { capture() {
// console.log('IS SELFIE : ' + this.props.selfie)
// console.log('IS IDCARD : ' + this.props.idcard)
if (this.props.selfie === true) { if (this.props.selfie === true) {
this.takePictureSelfie() this.handleTakePictureSelfie()
// console.log('ini foto selfie');
} else { } else {
this.takePictureIdCard() this.handleTakePictureIdcard()
// console.log('ini foto ktp');
}
}
takePictureSelfie = async () => {
if (this.camera) {
let photo = await this.camera.takePictureAsync({ skipProcessing: true,quality:0.1});
let photo_img = photo.uri;
const base64 = await FileSystem.readAsStringAsync(photo_img, { encoding: 'base64' });
// var set_photo = photo.replace('uri','')
let UriProps = {
URI: photo_img,
// BASE64_SELFIE:photo
}
this.props.setUriSelfi(UriProps);
this.props.navigation.navigate("Upgrade Premium")
// console.log(photo);
// console.log("ini sudah di pencet" + photo_img)
}
}
takePictureIdCard = async () => {
if (this.camera) {
let photo = await this.camera.takePictureAsync({ skipProcessing: true,quality:0.1 });
let photo_img = photo.uri;
const base64 = await FileSystem.readAsStringAsync(photo_img, { encoding: 'base64' });
// var set_photo = photo.replace('uri','')
let UriPropsID = {
URI_IDCARD: photo_img,
// BASE64_ID: photo
}
this.props.setUriID(UriPropsID);
this.props.navigation.navigate("Upgrade Premium")
// console.log("ini sudah di pencet" + photo_img)
} }
} }
...@@ -92,40 +54,63 @@ class Cameras extends React.Component { ...@@ -92,40 +54,63 @@ class Cameras extends React.Component {
if (this.props.setpickimageSelfie == true) { if (this.props.setpickimageSelfie == true) {
let result = await ImagePicker.launchImageLibraryAsync({ let result = await ImagePicker.launchImageLibraryAsync({
mediaTypes: ImagePicker.MediaTypeOptions.Images, mediaTypes: ImagePicker.MediaTypeOptions.Images,
allowsEditing: false, aspect: [4, 3],
quality: 0.1,
}); });
let resultImagePicker = result.uri let resultImagePicker = result.uri
const base64 = await FileSystem.readAsStringAsync(resultImagePicker, { encoding: 'base64' }); // const base64 = await FileSystem.readAsStringAsync(resultImagePicker, { encoding: 'base64' });
let UriProps = { let UriProps = {
URI: resultImagePicker, URI: resultImagePicker,
} }
let setpickSelfie = { let setpickSelfie = {
setpickimageSelfie: false setpickimageSelfie: false
} }
this.props.setUriSelfi(UriProps); this.props.setUriSelfi(UriProps);
this.props.setpickimageSelfieProps(setpickSelfie); this.props.setpickimageSelfieProps(setpickSelfie);
this.props.navigation.navigate("Upgrade Premium") this.props.navigation.navigate("Upgrade Premium")
console.log("INI BASE 64 : "+ base64)
//false //false
} else { } else {
let result = await ImagePicker.launchImageLibraryAsync({ let result = await ImagePicker.launchImageLibraryAsync({
mediaTypes: ImagePicker.MediaTypeOptions.Images mediaTypes: ImagePicker.MediaTypeOptions.Images
}); });
let resultImagePicker = result.uri let resultImagePicker = result.uri
const base64 = await FileSystem.readAsStringAsync(resultImagePicker, { encoding: 'base64' }); // const base64 = await FileSystem.readAsStringAsync(resultImagePicker, { encoding: 'base64' });
let UriPropsID = { let UriPropsID = {
URI_IDCARD: resultImagePicker, URI_IDCARD: resultImagePicker,
} }
let setpickSelfie = { let setpickSelfie = {
setpickimageSelfie: true setpickimageSelfie: true
} }
this.props.setUriID(UriPropsID); this.props.setUriID(UriPropsID);
this.props.setpickimageSelfieProps(setpickSelfie); this.props.setpickimageSelfieProps(setpickSelfie);
this.props.navigation.navigate("Upgrade Premium") this.props.navigation.navigate("Upgrade Premium")
} }
} }
handleTakePictureSelfie = async () => {
if (this.camera) {
const options = { quality: 1 };
const data = await this.camera.takePictureAsync(options);
let UriProps = {
URI: data.uri,
}
this.props.setUriSelfi(UriProps);
this.props.navigation.navigate("Upgrade Premium")
}
}
handleTakePictureIdcard = async () => {
if (this.camera) {
const options = { quality: 1 };
const data = await this.camera.takePictureAsync(options);
let UriProps = {
URI_IDCARD: data.uri,
}
this.props.setUriID(UriProps);
this.props.navigation.navigate("Upgrade Premium")
}
}
render() { render() {
const { hasPermission } = this.state const { hasPermission } = this.state
if (hasPermission === null) { if (hasPermission === null) {
...@@ -203,7 +188,7 @@ const mapDispatchToProps = (dispacth) => { ...@@ -203,7 +188,7 @@ const mapDispatchToProps = (dispacth) => {
setpickimageSelfieProps: (setpickSelfie) => dispacth({ setpickimageSelfieProps: (setpickSelfie) => dispacth({
type: ActionType.SET_PICKIMAGE, type: ActionType.SET_PICKIMAGE,
data: { data: {
setpickimageSelfie:setpickSelfie.setpickimageSelfie setpickimageSelfie: setpickSelfie.setpickimageSelfie
} }
}), }),
} }
...@@ -218,8 +203,56 @@ const mapStateToProps = (state) => { ...@@ -218,8 +203,56 @@ const mapStateToProps = (state) => {
selfie: state.selfie, selfie: state.selfie,
idcard: state.id_card, idcard: state.id_card,
setpickimageSelfie: state.setpickimageSelfie setpickimageSelfie: state.setpickimageSelfie
} }
} }
export default connect(mapStateToProps, mapDispatchToProps)(Cameras); export default connect(mapStateToProps, mapDispatchToProps)(Cameras);
\ No newline at end of file
// takePictureSelfie = async () => {
// if (this.camera) {
// let photo = await this.camera.takePictureAsync({ skipProcessing: true, quality: 0 });
// const manipResult = await ImageManipulator.manipulateAsync(
// photo.uri,
// [{ resize : {width:2000,height:1000} }, { flip: ImageManipulator.FlipType.Vertical }],
// { compress: 0.7, format:'jpeg' }
// );
// this.setState({
// setImage:manipResult,
// })
// let UriProps = {
// URI: this.state.setImage,
// // BASE64_SELFIE:photo
// }
// this.props.setUriSelfi(UriProps);
// this.props.navigation.navigate("Upgrade Premium")
// }
// }
// takePictureIdCard = async () => {
// if (this.camera) {
// let photo = await this.camera.takePictureAsync({ skipProcessing: true, quality: 0 });
// const manipResult = await ImageManipulator.manipulateAsync(
// photo.uri,
// [{ resize : {width:2000,height:1000} }, { flip: ImageManipulator.FlipType.Vertical }],
// { compress: 0.7, format:'jpeg' }
// );
// this.setState({
// setImage:manipResult,
// })
// let UriProps = {
// URI_IDCARD: this.state.setImage,
// // BASE64_SELFIE:photo
// }
// this.props.setUriSelfi(UriProps);
// this.props.navigation.navigate("Upgrade Premium")
// }
// }
\ No newline at end of file
...@@ -32,6 +32,9 @@ class DeliveryAddrees extends React.Component { ...@@ -32,6 +32,9 @@ class DeliveryAddrees extends React.Component {
}) })
this.getAddreess() this.getAddreess()
}); });
this.setState({
indicator: true
})
this.getAddreess() this.getAddreess()
} }
...@@ -241,14 +244,14 @@ class DeliveryAddrees extends React.Component { ...@@ -241,14 +244,14 @@ class DeliveryAddrees extends React.Component {
handleDeleteAddress(id) { handleDeleteAddress(id) {
Alert.alert( Alert.alert(
"", "",
"Apakah Anda ingin menghapus Alamat ? ", i18n.t('alertdeleteaddress'),
[ [
{ {
text: "Tidak", text: i18n.t('alertno'),
onPress: () => console.log("Cancel Pressed"), onPress: () => console.log("Cancel Pressed"),
style: "cancel" style: "cancel"
}, },
{ text: "Ya", onPress: () => this.deleteAddress(id) } { text: i18n.t('alertyes'), onPress: () => this.deleteAddress(id) }
], ],
{ cancelable: false } { cancelable: false }
); );
...@@ -282,10 +285,10 @@ class DeliveryAddrees extends React.Component { ...@@ -282,10 +285,10 @@ class DeliveryAddrees extends React.Component {
</View> </View>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
<View style={{ flex: 0.5 }}> <View style={{ flex:1}}>
<TouchableOpacity style={{ flex: 1, flexDirection: 'row', margin: 5 }} onPress={() => this.handleDeleteAddress(item.id)}> <TouchableOpacity style={{ flex: 1, flexDirection: 'row',justifyContent:"center" }} onPress={() => this.handleDeleteAddress(item.id)}>
<View style={{ justifyContent: 'center' }}> <View style={{ alignSelf:"center",marginTop:20}}>
<EvilIcons name="trash" size={40} color="black" /> <EvilIcons name="trash" size={40} color="#ccb46c" />
</View> </View>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
......
...@@ -7,6 +7,7 @@ import ActionType from '../redux/globalActionType'; ...@@ -7,6 +7,7 @@ import ActionType from '../redux/globalActionType';
import * as FileSystem from 'expo-file-system'; import * as FileSystem from 'expo-file-system';
import Spinner from 'react-native-loading-spinner-overlay'; import Spinner from 'react-native-loading-spinner-overlay';
import RNPickerSelect from 'react-native-picker-select'; import RNPickerSelect from 'react-native-picker-select';
import * as ImageManipulator from "expo-image-manipulator";
import { import {
View, View,
Text, Text,
...@@ -57,7 +58,7 @@ class UpgradePremium extends React.Component { ...@@ -57,7 +58,7 @@ class UpgradePremium extends React.Component {
type: Camera.Constants.Type.back, type: Camera.Constants.Type.back,
uri_id: this.props.URI, uri_id: this.props.URI,
uri_selfie: this.props.URI_IDCARD, uri_selfie: this.props.URI_IDCARD,
spinner: false spinner: false,
} }
} }
...@@ -67,7 +68,7 @@ class UpgradePremium extends React.Component { ...@@ -67,7 +68,7 @@ class UpgradePremium extends React.Component {
// this.setState({ hasPermissions: status === 'granted' }); // this.setState({ hasPermissions: status === 'granted' });
this.getProfile() this.getProfile()
this.getProvince() this.getProvince()
// console.log(this.props) console.log("INI AKAKAKAK"+ JSON.stringify(this.props.URI))
} }
takePictureSelfie = () => { takePictureSelfie = () => {
...@@ -129,9 +130,21 @@ class UpgradePremium extends React.Component { ...@@ -129,9 +130,21 @@ class UpgradePremium extends React.Component {
this.setState({ this.setState({
spinner: true, spinner: true,
}) })
const URI = await FileSystem.readAsStringAsync(this.state.uri_selfie, { encoding: FileSystem.EncodingType.Base64 }); const manipResultSelfie= await ImageManipulator.manipulateAsync(
const URI_IDCARD = await FileSystem.readAsStringAsync(this.state.uri_id, { encoding: FileSystem.EncodingType.Base64 }); this.props.URI,
// const URI = await FileSystem.readAsStringAsync(this.state.uri_selfie,{encoding:'base64'}); [{ resize: { width: 1000, height: 1000 } }], // resize to width of 300 and preserve aspect ratio
{ compress: 0.4, format: 'jpeg', },
);
const manipResultidCard= await ImageManipulator.manipulateAsync(
this.props.URI_IDCARD,
[{ resize: { width: 1000, height: 1000 } }], // resize to width of 300 and preserve aspect ratio
{ compress: 0.4, format: 'jpeg', },
);
const URI_IDCARD = await FileSystem.readAsStringAsync(manipResultidCard.uri, { encoding: 'base64' });
const URI = await FileSystem.readAsStringAsync(manipResultSelfie.uri,{encoding:'base64'});
let params = { let params = {
session_id: this.props.session_id, session_id: this.props.session_id,
first_name: this.state.nama_depan, first_name: this.state.nama_depan,
...@@ -149,8 +162,8 @@ class UpgradePremium extends React.Component { ...@@ -149,8 +162,8 @@ class UpgradePremium extends React.Component {
id_type: this.state.id_type, id_type: this.state.id_type,
id_value: this.state.id_value, id_value: this.state.id_value,
nationality: this.state.nationality, nationality: this.state.nationality,
customer_image: URI_IDCARD, customer_image: URI,
id_card_image: URI id_card_image: URI_IDCARD
} }
// console.log(params.customer_image); // console.log(params.customer_image);
...@@ -457,8 +470,6 @@ const mapDispatchToProps = (dispacth) => { ...@@ -457,8 +470,6 @@ const mapDispatchToProps = (dispacth) => {
} }
}) })
} }
} }
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment