Commit ca55e122 authored by Wahyu Adjie Prasetyo's avatar Wahyu Adjie Prasetyo
parents 7ebf6ad8 e6ff26ce
......@@ -12,11 +12,14 @@ import i18n from 'i18n-js';
import en from './lib/en';
import id from './lib/id';
import React, { useState, useEffect } from 'react';
import { Text, View } from 'react-native';
import { AppLoading } from 'expo';
import { Alert, Vibration } from 'react-native';
import { AppLoading, Notifications } from 'expo';
import * as Font from 'expo-font';
import * as Sentry from 'sentry-expo';
import Constants from 'expo-constants';
import { navigationRef } from './helper/RootNavigation';
import * as RootNavigation from './helper/RootNavigation';
Sentry.init({
dsn: 'https://ae2449ac801244d99f170140c7cd6d0a@o392471.ingest.sentry.io/5239999',
......@@ -58,8 +61,58 @@ export default function App() {
await Font.loadAsync(customFonts);
};
const routing = (data) => {
if (data.action_type == 'Rewards') {
RootNavigation.navigate('Reward Detail', { rewardId: data.data_id });
} else if (data.action_type == 'Inbox') {
} else if (data.action_type == 'Transaction') {
RootNavigation.navigate('Transaction Detail', {idTrans:data.data_id});
} else if (data.action_type == 'Review') {
} else if (data.action_type == 'WebView') {
} else if (data.action_type == 'Transfer Receive') {
} else if (data.action_type == 'Cashback') {
}
}
const handleNotification = notification => {
// console.log('Notification Origin : ' + JSON.stringify(notification.origin))
// console.log('Notification Payload Data : ' + JSON.stringify(notification.data))
const origin = notification.origin;
const data = notification.data;
if (origin == 'selected') {
routing(data)
} else {
Vibration.vibrate();
Alert.alert(
data.title,
data.body,
[
{
text: 'Close',
style: 'cancel',
},
{
text: 'View', onPress: () => {
routing(data)
}
},
],
{ cancelable: false },
)
}
}
useEffect(() => {
console.log('===> Did Mount');
this._notificationSubscription = Notifications.addListener(handleNotification);
loadFont().then(_ => {
setfontsLoaded(true);
})
......@@ -71,7 +124,7 @@ export default function App() {
return (
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
<NavigationContainer>
<NavigationContainer ref={navigationRef}>
<Auth />
</NavigationContainer>
</PersistGate>
......
......@@ -30,7 +30,7 @@
},
"android": {
"package": "local.ravExcelso",
"versionCode": 20200327
"versionCode": 2005151310
},
"description": "",
"hooks": {
......@@ -45,6 +45,9 @@
}
}
]
},
"notification": {
"icon": "./assets/icon/notification.png"
}
}
}
}
\ No newline at end of file
import * as React from 'react';
export const navigationRef = React.createRef();
export function navigate(name, params) {
navigationRef.current?.navigate(name, params);
}
\ No newline at end of file
......@@ -367,7 +367,7 @@ class Home extends React.Component {
<View style={{ flexDirection: 'row', flex: 1 }}>
<TouchableOpacity
// style={styles.submitUpgradePemium}
activeOpacity={.5} onPress={this.onPress}>
activeOpacity={.5} onPress={() => this.props.navigation.navigate('TopUpInfo')}>
<View style={styles.topUseBalance}>
<Text style={{ textAlign: 'center', bottom: 5, color: 'white', fontFamily: 'Gotham-Black' }}>TOP BALANCE </Text>
</View>
......
This diff is collapsed.
......@@ -126,6 +126,17 @@ class ShoppingCart extends React.Component {
this.props.navigation.navigate('Reward Select')
}
handleAddVoucher() {
this.setState({
checkedBalance: false,
checkedPoint: false,
checkedBalancePoint: false,
pointsused: 0,
balanceused: 0
})
this.props.navigation.navigate('Reward Select')
}
handleMin(item, index) {
this.setState({
checkedBalance: false,
......@@ -437,7 +448,7 @@ class ShoppingCart extends React.Component {
</Card>
) : (
<Card style={{ margin: 5, padding: 10 }}>
<Text style={{ textAlign: 'center', fontFamily: 'Gotham-Black', fontSize: 12 }}>OUR DRIVER WILL DELIVER YOU ORDER TO</Text>
<Text style={{ textAlign: 'center', fontFamily: 'Gotham-Black', fontSize: 12 }}>OUR DRIVER WILL DELIVER YOUR ORDER TO</Text>
<Text style={{ textAlign: 'center', fontSize: 12, top: 5, fontFamily: 'Gotham-Light' }}>{this.props.address}</Text>
</Card>
)
......@@ -466,7 +477,7 @@ class ShoppingCart extends React.Component {
<View style={styles.voucher}>
{
this.props.value_voucher == '' ? (
<TouchableOpacity onPress={() => this.props.navigation.navigate('Reward Select')}>
<TouchableOpacity onPress={() => this.handleAddVoucher()}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: '#CFB368' }}>+ ADD VOUCHER</Text>
</TouchableOpacity>
) : (
......@@ -611,7 +622,7 @@ class ShoppingCart extends React.Component {
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light' }}>Your Balance</Text>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light' }}>Your Points</Text>
</View>
<View style={{ paddingRight: 30, alignItems: 'flex-end' }}>
<View style={{ alignItems: 'flex-end' }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light' }}>{this.state.kasproBalance}</Text>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light' }}>{this.state.kasproPoint}</Text>
</View>
......@@ -621,7 +632,7 @@ class ShoppingCart extends React.Component {
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light' }}>Your Balance Used</Text>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light' }}>Your Points Used</Text>
</View>
<View style={{ paddingRight: 30, marginTop: 5, alignItems: 'flex-end' }}>
<View style={{ marginTop: 5, alignItems: 'flex-end' }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light' }}>- {this.state.balanceused}</Text>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light' }}>- {this.state.pointsused}</Text>
</View>
......@@ -660,23 +671,22 @@ class ShoppingCart extends React.Component {
</View>)}
<View style={{ flexDirection: 'row', marginTop: 10, justifyContent: 'space-between' }}>
<View style={{ paddingLeft: 20, paddingTop: 10, }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'gray' }}>Diskon</Text>
</View>
{
this.props.value_voucher == '' ? (
<View style={{ paddingRight: 30, paddingTop: 10, alignItems: 'flex-end' }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'gray' }}>{this.state.diskon}</Text>
</View>
) : (
{
this.props.value_voucher == '' ? (
null
) : (
<View style={{ flexDirection: 'row', marginTop: 10, justifyContent: 'space-between' }}>
<View style={{ paddingLeft: 20, paddingTop: 10, }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'gray' }}>Diskon</Text>
</View>
<View style={{ paddingRight: 30, paddingTop: 10, alignItems: 'flex-end' }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'gray' }}>{this.props.voucher.reward.value}</Text>
</View>
)
}
</View>
)
}
</View>
<View style={{ flexDirection: 'row', marginTop: 10, justifyContent: 'space-between' }}>
<View style={{ marginTop: 15, paddingLeft: 20, paddingTop: 10 }}>
<Text style={{ fontSize: 25, color: '#CFB368', fontFamily: 'Gotham-Black', }}>TOTAL</Text>
......
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