app folder

This commit is contained in:
Harley Catubag 2022-06-09 16:53:48 +08:00
parent a021eb7f6b
commit e2054ac55e
257 changed files with 29038 additions and 0 deletions

245
app/App.js Normal file
View File

@ -0,0 +1,245 @@
import 'react-native-gesture-handler';
import * as React from 'react';
import { Platform, AppState } from 'react-native';
import { Provider } from "react-redux";
import firebase from '@react-native-firebase/app';
import '@react-native-firebase/messaging';
import { NativeBaseProvider } from 'native-base';
import Router from './screens/route.js';
import store from './redux/store';
import DeviceInfo from 'react-native-device-info';
import DB from './components/storage/';
var PushNotification = require("react-native-push-notification");
export default class App extends React.Component {
constructor(props) {
super(props)
}
_isMounted = false
state = {
appState: AppState.currentState,
backgroundCaptureTime: null
}
async componentDidMount() {
this._isMounted = true
this.saveDeviceUUID()
this.notificationAuthorization()
this.createNotificationListener()
AppState.addEventListener('change', this._handleAppStateChange)
}
componentWillUnmount() {
this._isMounted = false
try {
this.messageListener()
this.notificationOpenedListener()
this.notificationListener()
AppState.removeEventListener('change', this._handleAppStateChange)
} catch (error) {}
}
_handleAppStateChange = (nextAppState) => {
if(this.state.appState.match(/inactive|background/) && nextAppState === 'active') {
} else {
}
}
saveDeviceUUID = () => {
DB.set("deviceUUID", DeviceInfo.getUniqueId(), () => {}, (e) => console.log("DEVICE INFO SAVING FAILED!", e))
}
notificationAuthorization = async () => {
const authStatus = await firebase.messaging().requestPermission();
const enabled = authStatus === firebase.messaging.AuthorizationStatus.AUTHORIZED || authStatus === firebase.messaging.AuthorizationStatus.PROVISIONAL;
if (enabled) {
try {
const token = await firebase.messaging().getToken()
if(token) {
let existingToken = await DB.get("fcmToken") || ""
if(token != existingToken){
DB.set("fcmRegistration", "new", (r) => {}, (e) => {})
DB.set("fcmToken", token, () => console.log("FCM TOKEN SAVED", token), () => console.log("FCM TOKEN SAVING FAILED"))
}
}
console.log('device_token:', token);
} catch (error) {
console.log(error);
}
}
}
createNotificationListener = () => {
this.messageListener = firebase.messaging().onMessage(message => {
const { notification } = message
PushNotification.localNotification({
title: notification.title || "Unioil Loyalty App",
message: notification.body,
playSound: false,
soundName: "default"
})
});
/*
* Triggered when a particular notification has been received in foreground
* */
this.notificationListener = firebase.messaging().onMessage(async remoteMessage => {
console.log(remoteMessage)
});
/*
* If your app is in background, you can listen for when a notification is clicked / tapped / opened as follows:
* */
this.notificationOpenedListener = firebase.messaging().onNotificationOpenedApp(remoteMessage => {
console.log(remoteMessage)
});
firebase.messaging()
.getInitialNotification()
.then(async remoteMessage => {
if (remoteMessage) {
if(Platform.OS == 'ios'){
console.log(
'Notification caused app to open from quit state:',
remoteMessage.data.notification,
);
let result = await DB.AddNotification({
messageId: remoteMessage.data.from,
title: remoteMessage.data.notification.title,
body: remoteMessage.data.notification.body,
visible: true,
delivery: false,
recieved: remoteMessage.data.from
})
console.log("Notifications rendered on background", result)
}else{
console.log(
'Notification caused app to open from quit state:',
remoteMessage.notification,
);
let result = await DB.AddNotification({
messageId: remoteMessage.messageId,
title: remoteMessage.notification.title,
body: remoteMessage.notification.body,
visible: true,
delivery: false,
recieved: remoteMessage.sentTime
})
console.log("Notifications rendered on background", result)
}
}
});
}
render() {
return (
<Provider store={store}>
<NativeBaseProvider>
<Router/>
</NativeBaseProvider>
</Provider>
)
}
}
// export default function App(){
// useEffect(() => {
// const uniqueId = DeviceInfo.getUniqueId();
// DB.set("deviceUUID", uniqueId, function(){
// }, function(e){
// console.log("DEVICE INFO SAVING FAILED!", e)
// })
// }, [])
// const GetFCMToken = () => {
// messaging().getToken().then(async fcmToken => {
// if(fcmToken){
// let existingToken = await DB.get("fcmToken") || ""
// if(fcmToken != existingToken){
// DB.set("fcmRegistration", "new", (r) => console.log(r), (e) => console.log(e))
// DB.set("fcmToken", fcmToken, () => console.log("FCM TOKEN SAVED"), () => console.log("FCM TOKEN SAVING FAILED"))
// }
// }
// })
// }
// const NotificationAuthorization = async () => {
// await messaging().registerDeviceForRemoteMessages();
// const enabled = await messaging().hasPermission()
// if (!enabled) {
// try {
// await messaging().requestPermission()
// } catch (error) {
// // permission denied
// return
// }
// }
// GetFCMToken()
// }
// useEffect(() => {
// if(Platform.OS === 'ios'){
// NotificationAuthorization()
// }else{
// GetFCMToken()
// }
// }, [])
// useEffect(() => {
// messaging()
// .getInitialNotification()
// .then(async remoteMessage => {
// if (remoteMessage) {
// if(Platform.OS == 'ios'){
// console.log(
// 'Notification caused app to open from quit state:',
// remoteMessage.data.notification,
// );
// let result = await DB.AddNotification({
// messageId: remoteMessage.data.from,
// title: remoteMessage.data.notification.title,
// body: remoteMessage.data.notification.body,
// visible: true,
// delivery: false,
// recieved: remoteMessage.data.from
// })
// console.log("Notifications rendered on background", result)
// }else{
// console.log(
// 'Notification caused app to open from quit state:',
// remoteMessage.notification,
// );
// let result = await DB.AddNotification({
// messageId: remoteMessage.messageId,
// title: remoteMessage.notification.title,
// body: remoteMessage.notification.body,
// visible: true,
// delivery: false,
// recieved: remoteMessage.sentTime
// })
// console.log("Notifications rendered on background", result)
// }
// }
// });
// }, [])
// return (
// <Provider store={store}>
// <Root>
// <Router />
// </Root>
// </Provider>
// )
// }

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 724 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 347 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 533 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 541 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 345 B

BIN
app/assets/bg_classic.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

BIN
app/assets/bg_fuel_efficiency.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 MiB

BIN
app/assets/bg_grab.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

BIN
app/assets/bg_ica.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 KiB

BIN
app/assets/bg_scheduler.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 MiB

BIN
app/assets/bg_xavier.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 KiB

BIN
app/assets/dexie.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
app/assets/empty_state_image.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

BIN
app/assets/empty_state_promo.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
app/assets/guide_card.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 291 KiB

BIN
app/assets/ic_about.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
app/assets/ic_account.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
app/assets/ic_add_white_24dp.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 B

BIN
app/assets/ic_card.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 965 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 758 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 714 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 725 B

BIN
app/assets/ic_chevron_down.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 505 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 436 B

BIN
app/assets/ic_contact.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
app/assets/ic_dashboard.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
app/assets/ic_fav_empty.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
app/assets/ic_fav_full.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
app/assets/ic_fuel.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
app/assets/ic_fuel_tab.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
app/assets/ic_history.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
app/assets/ic_home.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
app/assets/ic_info.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
app/assets/ic_km_liter.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
app/assets/ic_launcher.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

BIN
app/assets/ic_launcher_round.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
app/assets/ic_logout.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
app/assets/ic_my_profile_card.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
app/assets/ic_payatpump.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
app/assets/ic_peso.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 866 B

BIN
app/assets/ic_products.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
app/assets/ic_promos.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

BIN
app/assets/ic_reminder.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
app/assets/ic_rewards.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
app/assets/ic_scheduler.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 915 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

BIN
app/assets/ic_station.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 966 B

BIN
app/assets/ic_station_map_pin.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

BIN
app/assets/ic_stations.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
app/assets/ic_topup.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
app/assets/ic_tutorial.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
app/assets/ic_type.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
app/assets/icon_googlemaps.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

BIN
app/assets/icon_internet.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
app/assets/icon_unioil.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

BIN
app/assets/icon_waze.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
app/assets/img_bg_about.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 MiB

BIN
app/assets/loading.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 501 KiB

BIN
app/assets/login_bg.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 KiB

BIN
app/assets/logo_paypal.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
app/assets/logo_unioil.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

BIN
app/assets/mapsIcon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 391 KiB

BIN
app/assets/onboarding_01x.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 MiB

BIN
app/assets/onboarding_02.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 KiB

BIN
app/assets/onboarding_03x.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 MiB

BIN
app/assets/onboarding_04.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
app/assets/pump_grey.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Some files were not shown because too many files have changed in this diff Show More