Commit 049b74d2 authored by Trisno's avatar Trisno
parents 7856eb39 a6750ed3
......@@ -137,5 +137,8 @@
"noAddressSaved":"No address saved",
"headerInboxList":"INBOX",
"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 @@
"noAddressSaved":"Tidak ada alamat tersimpan",
"headerInboxList":"KOTAK 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 @@
"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": {
"version": "8.0.2",
"resolved": "https://registry.npmjs.org/expo-image-picker/-/expo-image-picker-8.0.2.tgz",
......@@ -6770,6 +6775,11 @@
"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=="
},
"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": {
"version": "1.0.12",
"resolved": "https://registry.npmjs.org/react-native-image-slider-box/-/react-native-image-slider-box-1.0.12.tgz",
......
......@@ -25,6 +25,7 @@
"expo-device": "^2.0.0",
"expo-file-system": "~8.0.0",
"expo-font": "^8.0.0",
"expo-image-manipulator": "^8.0.0",
"expo-image-picker": "~8.0.1",
"expo-localization": "~8.0.0",
"expo-location": "^8.0.0",
......@@ -51,6 +52,7 @@
"react-native-i18n": "^2.0.15",
"react-native-image-base64": "^0.1.4",
"react-native-image-picker": "^2.3.1",
"react-native-image-resizer": "^1.2.3",
"react-native-image-slider-box": "^1.0.12",
"react-native-loading-spinner-overlay": "^1.1.0",
"react-native-maps": "^0.26.1",
......
......@@ -363,7 +363,6 @@ class Account extends React.Component {
</View>
</Card>
</TouchableOpacity>
</View>
<View style={{ flex: 1, flexDirection: 'row', justifyContent: 'center' }}>
{this.state.premium === false ? (
......
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 Permissions from 'expo-permissions';
import * as Location from 'expo-location';
......@@ -67,23 +67,87 @@ class AddreesDetail extends React.Component {
})
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 longitude = location.coords.longitude;
this.setState({ location, latitude: latitude, longitude: longitude })
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,
street: detail[0].street,
city: detail[0].city,
// name: detail[0].name,
region: detail[0].region,
postalCode: detail[0].postalCode,
})
} 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,
})
}
}
//searchlocation (mencari lokasi)
......@@ -127,7 +191,7 @@ class AddreesDetail extends React.Component {
}
// 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(
'Berhasil',
'Berhasil menambahkan Alamat !'
......@@ -228,13 +292,13 @@ class AddreesDetail extends React.Component {
</View>
<View style={styles.field_name_addrees}>
<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 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
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 })}
numberOfLines={10}
multiline={true} />
......@@ -246,7 +310,7 @@ class AddreesDetail extends React.Component {
</View>
</TouchableOpacity>
</View>
<View style={{ height: 20}}></View>
<View style={{ height: 20 }}></View>
</View>
</View>
</ScrollView>
......@@ -322,5 +386,3 @@ const mapStateToProps = (state) => {
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';
import * as Permissions from 'expo-permissions';
import { FontAwesome, Ionicons, MaterialCommunityIcons } from '@expo/vector-icons';
import * as ImagePicker from 'expo-image-picker';
import * as FileSystem from 'expo-file-system';
import { connect } from 'react-redux';
import ActionType from '../redux/globalActionType';
class Cameras extends React.Component {
state = {
hasPermission: null,
cameraType: Camera.Constants.Type.back,
setReady: true,
setImage: null,
}
async componentDidMount() {
......@@ -34,7 +34,6 @@ class Cameras extends React.Component {
handleCameraType = () => {
const { cameraType } = this.state
this.setState({
cameraType:
cameraType === Camera.Constants.Type.back
......@@ -44,47 +43,10 @@ class Cameras extends React.Component {
}
capture() {
// console.log('IS SELFIE : ' + this.props.selfie)
// console.log('IS IDCARD : ' + this.props.idcard)
if (this.props.selfie === true) {
this.takePictureSelfie()
// console.log('ini foto selfie');
this.handleTakePictureSelfie()
} else {
this.takePictureIdCard()
// 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)
this.handleTakePictureIdcard()
}
}
......@@ -92,11 +54,9 @@ class Cameras extends React.Component {
if (this.props.setpickimageSelfie == true) {
let result = await ImagePicker.launchImageLibraryAsync({
mediaTypes: ImagePicker.MediaTypeOptions.Images,
allowsEditing: false, aspect: [4, 3],
quality: 0.1,
});
let resultImagePicker = result.uri
const base64 = await FileSystem.readAsStringAsync(resultImagePicker, { encoding: 'base64' });
// const base64 = await FileSystem.readAsStringAsync(resultImagePicker, { encoding: 'base64' });
let UriProps = {
URI: resultImagePicker,
}
......@@ -106,14 +66,14 @@ class Cameras extends React.Component {
this.props.setUriSelfi(UriProps);
this.props.setpickimageSelfieProps(setpickSelfie);
this.props.navigation.navigate("Upgrade Premium")
console.log("INI BASE 64 : "+ base64)
//false
} else {
let result = await ImagePicker.launchImageLibraryAsync({
mediaTypes: ImagePicker.MediaTypeOptions.Images
});
let resultImagePicker = result.uri
const base64 = await FileSystem.readAsStringAsync(resultImagePicker, { encoding: 'base64' });
// const base64 = await FileSystem.readAsStringAsync(resultImagePicker, { encoding: 'base64' });
let UriPropsID = {
URI_IDCARD: resultImagePicker,
}
......@@ -126,6 +86,31 @@ class Cameras extends React.Component {
}
}
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() {
const { hasPermission } = this.state
if (hasPermission === null) {
......@@ -203,7 +188,7 @@ const mapDispatchToProps = (dispacth) => {
setpickimageSelfieProps: (setpickSelfie) => dispacth({
type: ActionType.SET_PICKIMAGE,
data: {
setpickimageSelfie:setpickSelfie.setpickimageSelfie
setpickimageSelfie: setpickSelfie.setpickimageSelfie
}
}),
}
......@@ -218,8 +203,56 @@ const mapStateToProps = (state) => {
selfie: state.selfie,
idcard: state.id_card,
setpickimageSelfie: state.setpickimageSelfie
}
}
export default connect(mapStateToProps, mapDispatchToProps)(Cameras);
// 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 {
})
this.getAddreess()
});
this.setState({
indicator: true
})
this.getAddreess()
}
......@@ -241,14 +244,14 @@ class DeliveryAddrees extends React.Component {
handleDeleteAddress(id) {
Alert.alert(
"",
"Apakah Anda ingin menghapus Alamat ? ",
i18n.t('alertdeleteaddress'),
[
{
text: "Tidak",
text: i18n.t('alertno'),
onPress: () => console.log("Cancel Pressed"),
style: "cancel"
},
{ text: "Ya", onPress: () => this.deleteAddress(id) }
{ text: i18n.t('alertyes'), onPress: () => this.deleteAddress(id) }
],
{ cancelable: false }
);
......@@ -282,10 +285,10 @@ class DeliveryAddrees extends React.Component {
</View>
</TouchableOpacity>
</View>
<View style={{ flex: 0.5 }}>
<TouchableOpacity style={{ flex: 1, flexDirection: 'row', margin: 5 }} onPress={() => this.handleDeleteAddress(item.id)}>
<View style={{ justifyContent: 'center' }}>
<EvilIcons name="trash" size={40} color="black" />
<View style={{ flex:1}}>
<TouchableOpacity style={{ flex: 1, flexDirection: 'row',justifyContent:"center" }} onPress={() => this.handleDeleteAddress(item.id)}>
<View style={{ alignSelf:"center",marginTop:20}}>
<EvilIcons name="trash" size={40} color="#ccb46c" />
</View>
</TouchableOpacity>
</View>
......
......@@ -7,6 +7,7 @@ import ActionType from '../redux/globalActionType';
import * as FileSystem from 'expo-file-system';
import Spinner from 'react-native-loading-spinner-overlay';
import RNPickerSelect from 'react-native-picker-select';
import * as ImageManipulator from "expo-image-manipulator";
import {
View,
Text,
......@@ -57,7 +58,7 @@ class UpgradePremium extends React.Component {
type: Camera.Constants.Type.back,
uri_id: this.props.URI,
uri_selfie: this.props.URI_IDCARD,
spinner: false
spinner: false,
}
}
......@@ -67,7 +68,7 @@ class UpgradePremium extends React.Component {
// this.setState({ hasPermissions: status === 'granted' });
this.getProfile()
this.getProvince()
// console.log(this.props)
console.log("INI AKAKAKAK"+ JSON.stringify(this.props.URI))
}
takePictureSelfie = () => {
......@@ -129,9 +130,21 @@ class UpgradePremium extends React.Component {
this.setState({
spinner: true,
})
const URI = await FileSystem.readAsStringAsync(this.state.uri_selfie, { encoding: FileSystem.EncodingType.Base64 });
const URI_IDCARD = await FileSystem.readAsStringAsync(this.state.uri_id, { encoding: FileSystem.EncodingType.Base64 });
// const URI = await FileSystem.readAsStringAsync(this.state.uri_selfie,{encoding:'base64'});
const manipResultSelfie= await ImageManipulator.manipulateAsync(
this.props.URI,
[{ 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 = {
session_id: this.props.session_id,
first_name: this.state.nama_depan,
......@@ -149,8 +162,8 @@ class UpgradePremium extends React.Component {
id_type: this.state.id_type,
id_value: this.state.id_value,
nationality: this.state.nationality,
customer_image: URI_IDCARD,
id_card_image: URI
customer_image: URI,
id_card_image: URI_IDCARD
}
// console.log(params.customer_image);
......@@ -457,8 +470,6 @@ const mapDispatchToProps = (dispacth) => {
}
})
}
}
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