Merge branch 'main' into staging

This commit is contained in:
aliamerce 2023-09-22 12:55:48 +05:00 committed by GitHub
commit 2d79a0296e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
63 changed files with 881 additions and 44183 deletions

2
.gitignore vendored
View File

@ -1,2 +0,0 @@
CustomerApp/node_modules
RiderApp/node_modules

View File

@ -1,8 +1,8 @@
NODE_PATH=./src NODE_PATH=./src
SKIP_PREFLIGHT_CHECK=true SKIP_PREFLIGHT_CHECK=true
REACT_APP_CLOUDINARY_UPLOAD_URL = https://api.cloudinary.com/v1_1/dimjm4ald/image/upload REACT_APP_CLOUDINARY_UPLOAD_URL = https://api.cloudinary.com/v1_1/dimjm4ald/image/upload
REACT_APP_SERVER_URL = http://localhost:8000/ REACT_APP_SERVER_URL = https://enatega-singlevendor.up.railway.app/
REACT_APP_WS_SERVER_URL = ws://localhost:8000/ REACT_APP_WS_SERVER_URL = wss://enatega-singlevendor.up.railway.app/
REACT_APP_CLOUDINARY_CATEGORY = hmtkg7s5 REACT_APP_CLOUDINARY_CATEGORY = hmtkg7s5
REACT_APP_CLOUDINARY_FOOD = wdgvyas8 REACT_APP_CLOUDINARY_FOOD = wdgvyas8
REACT_APP_ENV = “dev” REACT_APP_ENV = “dev”

View File

@ -1,8 +1,8 @@
NODE_PATH=./src NODE_PATH=./src
SKIP_PREFLIGHT_CHECK=true SKIP_PREFLIGHT_CHECK=true
REACT_APP_CLOUDINARY_UPLOAD_URL = https://api.cloudinary.com/v1_1/dimjm4ald/image/upload REACT_APP_CLOUDINARY_UPLOAD_URL = https://api.cloudinary.com/v1_1/dimjm4ald/image/upload
REACT_APP_SERVER_URL = https://prod-enatega-single-api.herokuapp.com/ REACT_APP_SERVER_URL = https://enatega-singlevendor.up.railway.app/
REACT_APP_WS_SERVER_URL = wss://prod-enatega-single-api.herokuapp.com/ REACT_APP_WS_SERVER_URL = wss://enatega-singlevendor.up.railway.app/
REACT_APP_CLOUDINARY_CATEGORY = hmtkg7s5 REACT_APP_CLOUDINARY_CATEGORY = hmtkg7s5
REACT_APP_CLOUDINARY_FOOD = wdgvyas8 REACT_APP_CLOUDINARY_FOOD = wdgvyas8
REACT_APP_ENV = "prod" REACT_APP_ENV = "prod"

View File

@ -1,8 +1,8 @@
NODE_PATH=./src NODE_PATH=./src
SKIP_PREFLIGHT_CHECK=true SKIP_PREFLIGHT_CHECK=true
REACT_APP_CLOUDINARY_UPLOAD_URL = https://api.cloudinary.com/v1_1/dimjm4ald/image/upload REACT_APP_CLOUDINARY_UPLOAD_URL = https://api.cloudinary.com/v1_1/dimjm4ald/image/upload
REACT_APP_SERVER_URL = https://staging-enatega-single-api.herokuapp.com/ REACT_APP_SERVER_URL = https://enatega-singlevendor.up.railway.app/
REACT_APP_WS_SERVER_URL = wss://staging-enatega-single-api.herokuapp.com/ REACT_APP_WS_SERVER_URL = wss://enatega-singlevendor.up.railway.app/
REACT_APP_CLOUDINARY_CATEGORY = hmtkg7s5 REACT_APP_CLOUDINARY_CATEGORY = hmtkg7s5
REACT_APP_CLOUDINARY_FOOD = wdgvyas8 REACT_APP_CLOUDINARY_FOOD = wdgvyas8
REACT_APP_ENV = “staging” REACT_APP_ENV = “staging”

View File

@ -1 +0,0 @@
legacy-peer-deps=true

View File

@ -1,151 +0,0 @@
import { ApolloProvider } from '@apollo/react-hooks'
import * as Font from 'expo-font'
import * as Location from 'expo-location'
import * as Notifications from 'expo-notifications'
import * as SplashScreen from 'expo-splash-screen'
import React, { useEffect, useState } from 'react'
import {
ActivityIndicator,
BackHandler,
Platform,
StatusBar,
StyleSheet,
useColorScheme,
View
} from 'react-native'
import FlashMessage from 'react-native-flash-message'
import i18n from './i18n'
import setupApolloClient from './src/apollo/index'
import { ConfigurationProvider } from './src/context/Configuration'
import { UserProvider } from './src/context/User'
import AppContainer from './src/routes'
import { AnimatedSplash } from './src/screens'
import { COLORS, THEME } from './src/Theme'
import { exitAlert } from './src/utils/androidBackButton'
import { requestTrackingPermissions } from './src/utils/useAppTrackingTransparency'
SplashScreen.preventAutoHideAsync().catch(() => {})
export default function App() {
const colorScheme = useColorScheme()
const isDark = colorScheme === 'dark'
const [fontLoaded, setFontLoaded] = useState(false)
const [client, setupClient] = useState(null)
useEffect(() => {
requestTrackingPermissions()
}, [])
useEffect(() => {
loadAppData()
return () => {
BackHandler.removeEventListener('hardwareBackPress', exitAlert)
}
}, [])
async function loadAppData() {
const client = await setupApolloClient()
setupClient(client)
await i18n.initAsync()
// load fonts
await Font.loadAsync({
Poppin300: require('./src/assets/font/Poppin/Poppins-Light.ttf'),
Poppin400: require('./src/assets/font/Poppin/Poppins-Regular.ttf'),
Poppin500: require('./src/assets/font/Poppin/Poppins-Medium.ttf'),
Poppin600: require('./src/assets/font/Poppin/Poppins-SemiBold.ttf'),
Poppin700: require('./src/assets/font/Poppin/Poppins-Bold.ttf'),
icomoon: require('./src/assets/font/icomoon.ttf')
})
await permissionForLocationAsync()
await permissionForPushNotificationsAsync()
BackHandler.addEventListener('hardwareBackPress', exitAlert)
setFontLoaded(true)
}
async function permissionForPushNotificationsAsync() {
const { status: existingStatus } = await Notifications.getPermissionsAsync()
let finalStatus = existingStatus
// only ask if permissions have not already been determined, because
// iOS won't necessarily prompt the user a second time.
if (existingStatus !== 'granted') {
// Android remote notification permissions are granted during the app
// install, so this will only ask on iOS
const { status } = await Notifications.requestPermissionsAsync()
finalStatus = status
}
// Stop here if the user did not grant permissions
if (finalStatus !== 'granted') {
return
}
if (Platform.OS === 'android') {
Notifications.setNotificationChannelAsync('default', {
name: 'default',
sound: true,
priority: 'max',
importance: Notifications.AndroidImportance.HIGH,
vibrate: [0, 250, 250, 250],
lightColor: COLORS.primary
})
}
}
async function permissionForLocationAsync() {
const { status: existingStatus } =
await Location.getForegroundPermissionsAsync()
// only ask if permissions have not already been determined, because
// iOS won't necessarily prompt the user a second time.
if (existingStatus !== 'granted') {
// Android location permissions are granted during the app
// install, so this will only ask on iOS
const { status } = await Location.requestForegroundPermissionsAsync()
// eslint-disable-next-line no-undef
finalStatus = status
}
}
if (fontLoaded && client) {
return (
<ApolloProvider client={client}>
<StatusBar
translucent
backgroundColor={'transparent'}
barStyle={isDark ? 'light-content' : 'dark-content'}
/>
<ConfigurationProvider>
<UserProvider>
<AnimatedSplash image={require('./assets/splash.png')}>
<AppContainer />
</AnimatedSplash>
</UserProvider>
</ConfigurationProvider>
<FlashMessage duration={2000} position="center" />
</ApolloProvider>
)
} else {
return (
<View style={[styles.flex, styles.mainContainer]}>
<ActivityIndicator
size="large"
color={
isDark
? THEME.Dark.colors.spinnerColor
: THEME.Light.colors.spinnerColor
}
/>
</View>
)
}
}
const styles = StyleSheet.create({
flex: {
flex: 1
},
mainContainer: {
justifyContent: 'center',
alignItems: 'center'
}
})

View File

@ -1,83 +0,0 @@
{
"expo": {
"name": "Enatega",
"version": "1.0.16",
"scheme": "enategasinglevendor",
"description": "Enatega is a starter kit food ordering app built in React Native using Expo for IOS and Android. It's made keeping good aesthetics in mind as well keeping the best coding practices in mind. Its fully customisable to easily help you in your next food delivery project. https://market.nativebase.io/view/react-native-food-delivery-backend-app",
"slug": "enategasinglevendor",
"privacy": "public",
"androidStatusBar": {
"backgroundColor": "#000"
},
"platforms": [
"ios",
"android"
],
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "cover",
"backgroundColor": "#febb2c"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.enatega.vendor",
"config": {
"googleMapsApiKey": ""
},
"usesAppleSignIn": true,
"infoPlist": {
"NSLocationWhenInUseUsageDescription": "This app uses the location to determine the delivery address for your orders.",
"NSUserTrackingUsageDescription": "Allow this app to collect app-related data that can be used for tracking you or your device."
}
},
"notification": {
"iosDisplayInForeground": true,
"color": "#d83765",
"icon": "./assets/not-icon.png",
"androidMode": "default",
"androidCollapsedTitle": "Enatega"
},
"android": {
"versionCode": 22,
"package": "com.enatega.vendor",
"googleServicesFile": "./google-services-prod.json",
"config": {
"googleMaps": {
"apiKey": ""
}
},
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#febb2c"
},
"permissions": [
"ACCESS_FINE_LOCATION",
"ACCESS_COARSE_LOCATION"
]
},
"plugins": [
[
"expo-tracking-transparency",
{
"userTrackingPermission": "Allow this app to collect app-related data that can be used for tracking you or your device."
}
]
],
"facebookScheme": "fb3017447961609878",
"facebookAppId": "3017447961609878",
"facebookDisplayName": "Food delivery",
"extra": {
"eas": {
"projectId": "0b51ea6b-d9fd-48e2-9480-54149ca73a7a"
}
}
}
}

View File

@ -1,10 +0,0 @@
module.exports = function (api) {
api.cache(true);
return {
presets: ["babel-preset-expo"],
plugins: [
"react-native-reanimated/plugin",
"@babel/plugin-syntax-dynamic-import",
],
};
};

View File

@ -1,36 +0,0 @@
{
"cli": {
"version": ">= 3.8.0"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal",
"android": {
"buildType": "apk"
},
"ios": {
"resourceClass": "m-medium"
}
},
"preview": {
"distribution": "internal",
"ios": {
"resourceClass": "m-medium"
}
},
"production": {
"developmentClient": false,
"releaseChannel": "production",
"android": {
"buildType": "apk"
},
"ios": {
"resourceClass": "m-medium"
}
}
},
"submit": {
"production": {}
}
}

View File

@ -1,65 +0,0 @@
/*****************************
* environment.js
* path: '/environment.js' (root of your project)
******************************/
import Constants from "expo-constants";
const ENV = {
development: {
GRAPHQL_URL: "http://10.97.28.88.90:8000/graphql",
WS_GRAPHQL_URL: "ws://10.97.28.88.90:8000/graphql",
SERVER_URL: "http://10.97.28.88.90:8000/", // put / at the end of server url
IOS_CLIENT_ID_GOOGLE: "",
ANDROID_CLIENT_ID_GOOGLE: "",
FACEBOOK_APP_ID: "404956210315749",
AMPLITUDE_API_KEY: "",
STRIPE_PUBLIC_KEY: "",
STRIPE_IMAGE_URL: "http://10.97.28.88.90:8000/assets/images/logo.png",
STRIPE_STORE_NAME: "Enatega",
},
staging: {
GRAPHQL_URL: "https://staging-enatega-single-api.herokuapp.com/graphql",
WS_GRAPHQL_URL: "wss://staging-enatega-single-api.herokuapp.com/graphql",
SERVER_URL: "https://staging-enatega-single-api.herokuapp.com/", // put / at the end of server url
IOS_CLIENT_ID_GOOGLE: "",
ANDROID_CLIENT_ID_GOOGLE: "",
FACEBOOK_APP_ID: "404956210315749",
AMPLITUDE_API_KEY: "",
STRIPE_PUBLIC_KEY: "",
STRIPE_IMAGE_URL:
"https://staging-enatega-single-api.herokuapp.com/assets/images/logo.png",
STRIPE_STORE_NAME: "Enatega",
},
production: {
GRAPHQL_URL: "https://prod-enatega-single-api.herokuapp.com/graphql",
WS_GRAPHQL_URL: "wss://prod-enatega-single-api.herokuapp.com/graphql",
SERVER_URL: "https://prod-enatega-single-api.herokuapp.com/", // put / at the end of server url
IOS_CLIENT_ID_GOOGLE: "",
ANDROID_CLIENT_ID_GOOGLE: "",
FACEBOOK_APP_ID: "3017447961609878",
AMPLITUDE_API_KEY: "",
STRIPE_PUBLIC_KEY: "",
STRIPE_IMAGE_URL:
"https://prod-enatega-single-api.herokuapp.com/assets/images/logo.png",
STRIPE_STORE_NAME: "Enatega",
},
};
const getEnvVars = (env = Constants.manifest.releaseChannel) => {
// What is __DEV__ ?
// This variable is set to true when react-native is running in Dev mode.
// __DEV__ is true when run locally, but false when published.
// eslint-disable-next-line no-undef
if (__DEV__) {
return ENV.development;
} else if (env === "production") {
return ENV.production;
} else if (env === "staging") {
return ENV.staging;
} else {
return ENV.production;
}
};
export default getEnvVars;

View File

@ -1,8 +0,0 @@
import { registerRootComponent } from 'expo';
import App from './App';
// registerRootComponent calls AppRegistry.registerComponent('main', () => App);
// It also ensures that whether you load the app in Expo Go or in a native build,
// the environment is set up appropriately
registerRootComponent(App);

View File

@ -1,4 +0,0 @@
// Learn more https://docs.expo.io/guides/customizing-metro
const { getDefaultConfig } = require('expo/metro-config');
module.exports = getDefaultConfig(__dirname);

File diff suppressed because it is too large Load Diff

View File

@ -1,124 +0,0 @@
{
"name": "enatega-full-app",
"version": "5.0.0",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"eject": "expo eject",
"test": "jest",
"format": "prettier --write '**/*.js'",
"lint:fix": "eslint . --ext .js --fix",
"postinstall": "patch-package"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.js": [
"npm run format",
"npm run lint:fix"
]
},
"dependencies": {
"@amplitude/analytics-react-native": "^1.1.1",
"@apollo/react-hooks": "^3.1.3",
"@expo/vector-icons": "^13.0.0",
"@ptomasroos/react-native-multi-slider": "^2.2.2",
"@react-native-async-storage/async-storage": "~1.17.3",
"@react-native-community/masked-view": "0.1.11",
"@react-navigation/drawer": "^6.6.0",
"@react-navigation/native": "^6.1.4",
"@react-navigation/native-stack": "^6.9.10",
"@react-navigation/stack": "^6.3.14",
"apollo-boost": "^0.4.9",
"apollo-cache-inmemory": "^1.5.1",
"apollo-cache-persist": "^0.1.1",
"apollo-client": "^2.5.1",
"apollo-link-context": "^1.0.17",
"apollo-link-http": "^1.5.14",
"apollo-link-state": "^0.4.2",
"apollo-link-ws": "^1.0.20",
"apollo-upload-client": "^10.0.0",
"apollo-utilities": "^1.3.4",
"deprecated-react-native-prop-types": "^4.0.0",
"expo": "~47.0.12",
"expo-app-auth": "~11.1.0",
"expo-app-loading": "~2.1.1",
"expo-apple-authentication": "~5.0.1",
"expo-application": "~5.0.1",
"expo-asset": "~8.7.0",
"expo-auth-session": "~3.8.0",
"expo-camera": "~13.1.0",
"expo-constants": "~14.0.2",
"expo-contacts": "~11.0.1",
"expo-device": "~5.0.0",
"expo-font": "~11.0.1",
"expo-google-app-auth": "^8.3.0",
"expo-image-picker": "~14.0.2",
"expo-linking": "~3.3.1",
"expo-localization": "~14.0.0",
"expo-location": "~15.0.1",
"expo-notifications": "~0.17.0",
"expo-random": "~13.0.0",
"expo-sensors": "~12.0.1",
"expo-splash-screen": "~0.17.5",
"expo-status-bar": "~1.4.2",
"expo-tracking-transparency": "~3.0.1",
"expo-updates": "~0.15.6",
"graphql": "^16.6.0",
"graphql-tag": "^2.10.1",
"i18n-js": "^3.2.2",
"lodash": "^4.17.21",
"patch-package": "^6.5.1",
"react": "18.1.0",
"react-apollo": "^3.1.5",
"react-native": "0.70.5",
"react-native-button": "^3.0.1",
"react-native-flash-message": "^0.4.0",
"react-native-flatlist-slider": "^1.0.5",
"react-native-gesture-handler": "~2.8.0",
"react-native-gifted-chat": "^1.1.1",
"react-native-maps": "1.3.2",
"react-native-material-textfield": "^0.16.1",
"react-native-modal": "^13.0.1",
"react-native-modalize": "^2.0.8",
"react-native-reanimated": "~2.12.0",
"react-native-safe-area-context": "4.4.1",
"react-native-screens": "~3.18.0",
"react-native-star-rating": "^1.1.0",
"react-native-svg": "13.4.0",
"react-native-timeline-flatlist": "^0.8.0",
"react-native-webview": "11.23.1",
"subscriptions-transport-ws": "^0.11.0",
"uuid": "^3.3.2",
"validate.js": "^0.13.1"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"babel-jest": "^29.4.3",
"babel-preset-expo": "~9.2.1",
"babel-preset-react-native": "^4.0.1",
"eslint": "^8.34.0",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.20.0",
"eslint-plugin-standard": "^5.0.0",
"husky": "^8.0.3",
"jest": "^29.4.3",
"jest-react-native": "^18.0.0",
"lint-staged": "^13.1.2",
"metro-react-native-babel-preset": "^0.75.0",
"prettier": "^2.3.1",
"prettier-config-standard": "^5.0.0",
"react-test-renderer": "^18.2.0"
},
"jest": {
"preset": "react-native"
},
"private": true
}

View File

@ -1,38 +0,0 @@
diff --git a/node_modules/react-native-button/Button.js b/node_modules/react-native-button/Button.js
index b248176..3c6aefa 100644
--- a/node_modules/react-native-button/Button.js
+++ b/node_modules/react-native-button/Button.js
@@ -1,4 +1,5 @@
import PropTypes from 'prop-types';
+import {TextPropTypes,ViewPropTypes} from 'deprecated-react-native-prop-types'
import React, { Component } from 'react';
import {
Platform,
@@ -7,7 +8,7 @@ import {
TouchableOpacity,
TouchableNativeFeedback,
View,
- ViewPropTypes
+ //ViewPropTypes
} from 'react-native';
import coalesceNonElementChildren from './coalesceNonElementChildren';
@@ -18,12 +19,15 @@ export default class Button extends Component {
static propTypes = {
...TouchableOpacity.propTypes,
accessibilityLabel: PropTypes.string,
- allowFontScaling: Text.propTypes.allowFontScaling,
+ // allowFontScaling: Text.propTypes.allowFontScaling,
+ allowFontScaling: TextPropTypes.allowFontScaling,
containerStyle: ViewPropTypes.style,
disabledContainerStyle: ViewPropTypes.style,
disabled: PropTypes.bool,
- style: Text.propTypes.style,
- styleDisabled: Text.propTypes.style,
+ style: TextPropTypes.style,
+ styleDisabled: TextPropTypes.style,
+ // style: Text.propTypes.style,
+ // styleDisabled: Text.propTypes.style,
childGroupStyle: ViewPropTypes.style,
androidBackground: PropTypes.object,
};

View File

@ -1,405 +0,0 @@
diff --git a/node_modules/react-native-material-textfield/src/components/affix/index.js b/node_modules/react-native-material-textfield/src/components/affix/index.js
index 0f85022..e467adb 100644
--- a/node_modules/react-native-material-textfield/src/components/affix/index.js
+++ b/node_modules/react-native-material-textfield/src/components/affix/index.js
@@ -9,26 +9,26 @@ export default class Affix extends PureComponent {
numberOfLines: 1,
};
- static propTypes = {
- numberOfLines: PropTypes.number,
- style: Animated.Text.propTypes.style,
+ // static propTypes = {
+ // numberOfLines: PropTypes.number,
+ // style: PropTypes.object,
- color: PropTypes.string.isRequired,
- fontSize: PropTypes.number.isRequired,
+ // color: PropTypes.string.isRequired,
+ // fontSize: PropTypes.number.isRequired,
- type: PropTypes
- .oneOf(['prefix', 'suffix'])
- .isRequired,
+ // type: PropTypes
+ // .oneOf(['prefix', 'suffix'])
+ // .isRequired,
- labelAnimation: PropTypes
- .instanceOf(Animated.Value)
- .isRequired,
+ // labelAnimation: PropTypes
+ // .instanceOf(Animated.Value)
+ // .isRequired,
- children: PropTypes.oneOfType([
- PropTypes.arrayOf(PropTypes.node),
- PropTypes.node,
- ]),
- };
+ // children: PropTypes.oneOfType([
+ // PropTypes.arrayOf(PropTypes.node),
+ // PropTypes.node,
+ // ]),
+ // };
render() {
let { labelAnimation, style, children, type, fontSize, color } = this.props;
diff --git a/node_modules/react-native-material-textfield/src/components/counter/index.js b/node_modules/react-native-material-textfield/src/components/counter/index.js
index 35d3264..089b871 100644
--- a/node_modules/react-native-material-textfield/src/components/counter/index.js
+++ b/node_modules/react-native-material-textfield/src/components/counter/index.js
@@ -5,15 +5,15 @@ import { Text } from 'react-native';
import styles from './styles';
export default class Counter extends PureComponent {
- static propTypes = {
- count: PropTypes.number.isRequired,
- limit: PropTypes.number,
+ // static propTypes = {
+ // count: PropTypes.number.isRequired,
+ // limit: PropTypes.number,
- baseColor: PropTypes.string.isRequired,
- errorColor: PropTypes.string.isRequired,
+ // baseColor: PropTypes.string.isRequired,
+ // errorColor: PropTypes.string.isRequired,
- style: Text.propTypes.style,
- };
+ // style: PropTypes.object,
+ // };
render() {
let { count, limit, baseColor, errorColor, style } = this.props;
diff --git a/node_modules/react-native-material-textfield/src/components/field/index.js b/node_modules/react-native-material-textfield/src/components/field/index.js
index 494bbaa..2a71c82 100644
--- a/node_modules/react-native-material-textfield/src/components/field/index.js
+++ b/node_modules/react-native-material-textfield/src/components/field/index.js
@@ -1,5 +1,6 @@
import PropTypes from 'prop-types';
import React, { PureComponent } from 'react';
+import {ViewPropTypes} from 'deprecated-react-native-prop-types';
import {
View,
Text,
@@ -7,7 +8,7 @@ import {
Animated,
StyleSheet,
Platform,
- ViewPropTypes,
+ //ViewPropTypes,
} from 'react-native';
import Line from '../line';
@@ -65,60 +66,60 @@ export default class TextField extends PureComponent {
disabled: false,
};
- static propTypes = {
- ...TextInput.propTypes,
+ // static propTypes = {
+ // ...TextInput.propTypes,
- animationDuration: PropTypes.number,
+ // animationDuration: PropTypes.number,
- fontSize: PropTypes.number,
- labelFontSize: PropTypes.number,
+ // fontSize: PropTypes.number,
+ // labelFontSize: PropTypes.number,
- contentInset: PropTypes.shape({
- top: PropTypes.number,
- label: PropTypes.number,
- input: PropTypes.number,
- left: PropTypes.number,
- right: PropTypes.number,
- }),
+ // contentInset: PropTypes.shape({
+ // top: PropTypes.number,
+ // label: PropTypes.number,
+ // input: PropTypes.number,
+ // left: PropTypes.number,
+ // right: PropTypes.number,
+ // }),
- labelOffset: Label.propTypes.offset,
+ // labelOffset: Label.propTypes.offset,
- labelTextStyle: Text.propTypes.style,
- titleTextStyle: Text.propTypes.style,
- affixTextStyle: Text.propTypes.style,
+ // labelTextStyle: PropTypes.object.style,
+ // // titleTextStyle: PropTypes.object.style,
+ // // affixTextStyle: PropTypes.object.style,
- tintColor: PropTypes.string,
- textColor: PropTypes.string,
- baseColor: PropTypes.string,
+ // tintColor: PropTypes.string,
+ // textColor: PropTypes.string,
+ // baseColor: PropTypes.string,
- label: PropTypes.string,
- title: PropTypes.string,
+ // label: PropTypes.string,
+ // title: PropTypes.string,
- characterRestriction: PropTypes.number,
+ // characterRestriction: PropTypes.number,
- error: PropTypes.string,
- errorColor: PropTypes.string,
+ // error: PropTypes.string,
+ // errorColor: PropTypes.string,
- lineWidth: PropTypes.number,
- activeLineWidth: PropTypes.number,
- disabledLineWidth: PropTypes.number,
+ // lineWidth: PropTypes.number,
+ // activeLineWidth: PropTypes.number,
+ // disabledLineWidth: PropTypes.number,
- lineType: Line.propTypes.lineType,
- disabledLineType: Line.propTypes.lineType,
+ // lineType: Line.propTypes.lineType,
+ // disabledLineType: Line.propTypes.lineType,
- disabled: PropTypes.bool,
+ // disabled: PropTypes.bool,
- formatText: PropTypes.func,
+ // formatText: PropTypes.func,
- renderLeftAccessory: PropTypes.func,
- renderRightAccessory: PropTypes.func,
+ // renderLeftAccessory: PropTypes.func,
+ // renderRightAccessory: PropTypes.func,
- prefix: PropTypes.string,
- suffix: PropTypes.string,
+ // prefix: PropTypes.string,
+ // suffix: PropTypes.string,
- containerStyle: (ViewPropTypes || View.propTypes).style,
- inputContainerStyle: (ViewPropTypes || View.propTypes).style,
- };
+ // containerStyle: (ViewPropTypes || View.propTypes).style,
+ // inputContainerStyle: (ViewPropTypes || View.propTypes).style,
+ // };
static inputContainerStyle = styles.inputContainer;
@@ -221,6 +222,7 @@ export default class TextField extends PureComponent {
let options = {
toValue: this.focusState(),
+ useNativeDriver: false,
duration,
};
diff --git a/node_modules/react-native-material-textfield/src/components/helper/index.js b/node_modules/react-native-material-textfield/src/components/helper/index.js
index 6060f9f..86ac2c0 100644
--- a/node_modules/react-native-material-textfield/src/components/helper/index.js
+++ b/node_modules/react-native-material-textfield/src/components/helper/index.js
@@ -1,23 +1,24 @@
import PropTypes from 'prop-types';
+
import React, { PureComponent } from 'react';
import { Animated } from 'react-native';
import styles from './styles';
export default class Helper extends PureComponent {
- static propTypes = {
- title: PropTypes.string,
- error: PropTypes.string,
+ // static propTypes = {
+ // title: PropTypes.string,
+ // error: PropTypes.string,
- disabled: PropTypes.bool,
+ // disabled: PropTypes.bool,
- style: Animated.Text.propTypes.style,
+ // style: PropTypes.object,
- baseColor: PropTypes.string,
- errorColor: PropTypes.string,
+ // baseColor: PropTypes.string,
+ // errorColor: PropTypes.string,
- focusAnimation: PropTypes.instanceOf(Animated.Value),
- };
+ // focusAnimation: PropTypes.instanceOf(Animated.Value),
+ // };
constructor(props) {
super(props);
diff --git a/node_modules/react-native-material-textfield/src/components/label/index.js b/node_modules/react-native-material-textfield/src/components/label/index.js
index 82eaf03..1ad9a93 100644
--- a/node_modules/react-native-material-textfield/src/components/label/index.js
+++ b/node_modules/react-native-material-textfield/src/components/label/index.js
@@ -11,41 +11,41 @@ export default class Label extends PureComponent {
restricted: false,
};
- static propTypes = {
- numberOfLines: PropTypes.number,
+ // static propTypes = {
+ // numberOfLines: PropTypes.number,
- disabled: PropTypes.bool,
- restricted: PropTypes.bool,
+ // disabled: PropTypes.bool,
+ // restricted: PropTypes.bool,
- fontSize: PropTypes.number.isRequired,
- activeFontSize: PropTypes.number.isRequired,
+ // fontSize: PropTypes.number.isRequired,
+ // activeFontSize: PropTypes.number.isRequired,
- baseColor: PropTypes.string.isRequired,
- tintColor: PropTypes.string.isRequired,
- errorColor: PropTypes.string.isRequired,
+ // baseColor: PropTypes.string.isRequired,
+ // tintColor: PropTypes.string.isRequired,
+ // errorColor: PropTypes.string.isRequired,
- focusAnimation: PropTypes
- .instanceOf(Animated.Value)
- .isRequired,
+ // focusAnimation: PropTypes
+ // .instanceOf(Animated.Value)
+ // .isRequired,
- labelAnimation: PropTypes
- .instanceOf(Animated.Value)
- .isRequired,
+ // labelAnimation: PropTypes
+ // .instanceOf(Animated.Value)
+ // .isRequired,
- contentInset: PropTypes.shape({
- label: PropTypes.number,
- }),
+ // contentInset: PropTypes.shape({
+ // label: PropTypes.number,
+ // }),
- offset: PropTypes.shape({
- x0: PropTypes.number,
- y0: PropTypes.number,
- x1: PropTypes.number,
- y1: PropTypes.number,
- }),
+ // offset: PropTypes.shape({
+ // x0: PropTypes.number,
+ // y0: PropTypes.number,
+ // x1: PropTypes.number,
+ // y1: PropTypes.number,
+ // }),
- style: Animated.Text.propTypes.style,
- label: PropTypes.string,
- };
+ // style: PropTypes.object,
+ // label: PropTypes.string,
+ // };
render() {
let {
diff --git a/node_modules/react-native-material-textfield/src/components/line/index.js b/node_modules/react-native-material-textfield/src/components/line/index.js
index 44995e9..b689387 100644
--- a/node_modules/react-native-material-textfield/src/components/line/index.js
+++ b/node_modules/react-native-material-textfield/src/components/line/index.js
@@ -16,23 +16,23 @@ export default class Line extends PureComponent {
restricted: false,
};
- static propTypes = {
- lineType: lineTypes,
- disabledLineType: lineTypes,
+ // static propTypes = {
+ // lineType: lineTypes,
+ // disabledLineType: lineTypes,
- disabled: PropTypes.bool,
- restricted: PropTypes.bool,
+ // disabled: PropTypes.bool,
+ // restricted: PropTypes.bool,
- tintColor: PropTypes.string,
- baseColor: PropTypes.string,
- errorColor: PropTypes.string,
+ // tintColor: PropTypes.string,
+ // baseColor: PropTypes.string,
+ // errorColor: PropTypes.string,
- lineWidth: PropTypes.number,
- activeLineWidth: PropTypes.number,
- disabledLineWidth: PropTypes.number,
+ // lineWidth: PropTypes.number,
+ // activeLineWidth: PropTypes.number,
+ // disabledLineWidth: PropTypes.number,
- focusAnimation: PropTypes.instanceOf(Animated.Value),
- };
+ // focusAnimation: PropTypes.instanceOf(Animated.Value),
+ // };
static getDerivedStateFromProps(props, state) {
let { lineWidth, activeLineWidth, disabledLineWidth } = props;
diff --git a/node_modules/react-native-material-textfield/src/components/outline/index.js b/node_modules/react-native-material-textfield/src/components/outline/index.js
index 9347a99..9c3e8a3 100644
--- a/node_modules/react-native-material-textfield/src/components/outline/index.js
+++ b/node_modules/react-native-material-textfield/src/components/outline/index.js
@@ -11,29 +11,29 @@ export default class Line extends PureComponent {
restricted: false,
};
- static propTypes = {
- lineType: PropTypes.oneOf(['solid', 'none']),
+ // static propTypes = {
+ // lineType: PropTypes.oneOf(['solid', 'none']),
- disabled: PropTypes.bool,
- restricted: PropTypes.bool,
+ // disabled: PropTypes.bool,
+ // restricted: PropTypes.bool,
- tintColor: PropTypes.string,
- baseColor: PropTypes.string,
- errorColor: PropTypes.string,
+ // tintColor: PropTypes.string,
+ // baseColor: PropTypes.string,
+ // errorColor: PropTypes.string,
- lineWidth: PropTypes.number,
- activeLineWidth: PropTypes.number,
- disabledLineWidth: PropTypes.number,
+ // lineWidth: PropTypes.number,
+ // activeLineWidth: PropTypes.number,
+ // disabledLineWidth: PropTypes.number,
- focusAnimation: PropTypes.instanceOf(Animated.Value),
- labelAnimation: PropTypes.instanceOf(Animated.Value),
- labelWidth: PropTypes.instanceOf(Animated.Value),
+ // focusAnimation: PropTypes.instanceOf(Animated.Value),
+ // labelAnimation: PropTypes.instanceOf(Animated.Value),
+ // labelWidth: PropTypes.instanceOf(Animated.Value),
- contentInset: PropTypes.shape({
- left: PropTypes.number,
- right: PropTypes.number,
- }),
- };
+ // contentInset: PropTypes.shape({
+ // left: PropTypes.number,
+ // right: PropTypes.number,
+ // }),
+ // };
borderProps() {
let {

View File

@ -1,34 +0,0 @@
diff --git a/node_modules/react-native-star-rating/node_modules/react-native-button/Button.js b/node_modules/react-native-star-rating/node_modules/react-native-button/Button.js
index fb7cf46..8e4c522 100644
--- a/node_modules/react-native-star-rating/node_modules/react-native-button/Button.js
+++ b/node_modules/react-native-star-rating/node_modules/react-native-button/Button.js
@@ -1,11 +1,12 @@
import PropTypes from 'prop-types';
import React, { Component } from 'react';
+import {TextPropTypes,ViewPropTypes} from 'deprecated-react-native-prop-types'
import {
StyleSheet,
Text,
TouchableOpacity,
View,
- ViewPropTypes,
+ //ViewPropTypes,
} from 'react-native';
import coalesceNonElementChildren from './coalesceNonElementChildren';
@@ -16,12 +17,12 @@ export default class Button extends Component {
static propTypes = {
...TouchableOpacity.propTypes,
accessibilityLabel: PropTypes.string,
- allowFontScaling: Text.propTypes.allowFontScaling,
+ allowFontScaling: TextPropTypes.allowFontScaling,
containerStyle: ViewPropTypes.style,
disabledContainerStyle: ViewPropTypes.style,
disabled: PropTypes.bool,
- style: Text.propTypes.style,
- styleDisabled: Text.propTypes.style,
+ style: TextPropTypes.style,
+ styleDisabled: TextPropTypes.style,
childGroupStyle: ViewPropTypes.style,
};

View File

@ -1,26 +0,0 @@
diff --git a/node_modules/react-native-star-rating/StarButton.js b/node_modules/react-native-star-rating/StarButton.js
index b6db613..8a62f5a 100644
--- a/node_modules/react-native-star-rating/StarButton.js
+++ b/node_modules/react-native-star-rating/StarButton.js
@@ -1,6 +1,7 @@
// React and react native imports
import React, { Component } from 'react';
-import { Image, StyleSheet, ViewPropTypes } from 'react-native';
+import { Image, StyleSheet } from 'react-native';
+import {ViewPropTypes} from 'deprecated-react-native-prop-types';
import PropTypes from 'prop-types';
import { createIconSetFromIcoMoon } from 'react-native-vector-icons';
diff --git a/node_modules/react-native-star-rating/StarRating.js b/node_modules/react-native-star-rating/StarRating.js
index 7aecc95..de6397c 100644
--- a/node_modules/react-native-star-rating/StarRating.js
+++ b/node_modules/react-native-star-rating/StarRating.js
@@ -1,6 +1,7 @@
// React and react native imports
import React, { Component } from 'react';
-import { View, ViewPropTypes, StyleSheet } from 'react-native';
+import { View, StyleSheet } from 'react-native';
+import {ViewPropTypes} from 'deprecated-react-native-prop-types';
import PropTypes from 'prop-types';
import { View as AnimatableView } from 'react-native-animatable';

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

View File

@ -1,5 +0,0 @@
import FdEmailBtn from "./FdEmailBtn/FdEmailBtn";
import FdGoogleBtn from "./FdGoogleBtn/FdGoogleBtn";
export { FdEmailBtn, FdGoogleBtn };

View File

@ -1,115 +0,0 @@
import { useNavigation, useTheme } from "@react-navigation/native";
import React, { useContext } from "react";
import { FlatList, TouchableOpacity, View } from "react-native";
import ConfigurationContext from "../../../context/Configuration";
import UserContext from "../../../context/User";
import { alignment } from "../../../utils/alignment";
import { NAVIGATION_SCREEN } from "../../../utils/constant";
import Spinner from "../../Spinner/Spinner";
import TextDefault from "../../Text/TextDefault/TextDefault";
import TextError from "../../Text/TextError/TextError";
import useStyle from "./styles";
export const orderStatuses = [
{
key: "PENDING",
status: 1,
statusText: "Your order is still pending.",
},
{
key: "ACCEPTED",
status: 2,
statusText: "Restaurant is preparing Food.",
},
{
key: "PICKED",
status: 3,
statusText: "Rider is on the way.",
},
{
key: "DELIVERED",
status: 4,
statusText: "Order is delivered.",
},
{
key: "COMPLETED",
status: 5,
statusText: "Order is completed.",
},
];
const orderStatusActive = ["PENDING", "PICKED", "ACCEPTED"];
const StatusCard = () => {
const { colors } = useTheme();
const styles = useStyle();
const navigation = useNavigation();
const {
loadingOrders,
errorOrders,
orders,
networkStatusOrders,
fetchOrders,
} = useContext(UserContext);
const configuration = useContext(ConfigurationContext);
const checkStatus = (status) => {
const obj = orderStatuses.filter((x) => {
return x.key === status;
});
return obj[0];
};
if (loadingOrders) return <Spinner />;
if (errorOrders) return <TextError>{errorOrders.message}</TextError>;
return (
<FlatList
contentContainerStyle={styles.mainContainer}
showsVerticalScrollIndicator={false}
showsHorizontalScrollIndicator={false}
horizontal={true}
refreshing={networkStatusOrders === 4}
onRefresh={() => networkStatusOrders === 7 && fetchOrders()}
data={orders.filter((o) => orderStatusActive.includes(o.order_status))}
//keyExtractor={(item) => item._id}
keyExtractor={(item, index) => String(index)}
renderItem={({ item, index }) => (
<TouchableOpacity
activeOpacity={0.8}
style={{ flex: 1, paddingHorizontal: 10 }}
onPress={() =>
navigation.navigate(NAVIGATION_SCREEN.OrderDetail, {
_id: item._id,
currency_symbol: configuration.currency_symbol,
})
}
>
<View key={index} style={styles.statusContainer}>
<View style={styles.textContainer}>
<TextDefault H5 medium textColor={styles.lightText.color}>
Your order ID
</TextDefault>
<TextDefault style={{ ...alignment.PBlarge }} H4 bolder>
{item.order_id}
</TextDefault>
<TextDefault H5 textColor={colors.placeHolderColor} medium>
Status
</TextDefault>
<TextDefault textColor={"#00b9c6"} H5 medium>
{item.order_status}{" "}
<TextDefault numberOfLines={2} medium>
{/* {checkStatus(item.order_status).status}.{' '} */}(
{checkStatus(item.order_status).statusText})
</TextDefault>
</TextDefault>
</View>
</View>
</TouchableOpacity>
)}
/>
);
};
export default StatusCard;

View File

@ -1,50 +0,0 @@
import { useTheme } from "@react-navigation/native";
import { useHeaderHeight } from "@react-navigation/elements";
import { StyleSheet } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { scale } from "../../utils/scaling";
const useStyle = () => {
const { colors } = useTheme();
const inset = useSafeAreaInsets();
const headerHeight = useHeaderHeight();
return StyleSheet.create({
flex: {
flex: 1,
},
wrapperView: {
backgroundColor: colors.background,
paddingTop: headerHeight,
paddingBottom: inset.bottom,
},
topCurve: {
position: "absolute",
opacity: 0.2,
left: -75,
borderTopRightRadius: scale(90),
borderBottomEndRadius: scale(200),
top: -20,
width: scale(250),
height: scale(260),
borderRadius: 100,
backgroundColor: colors.curve,
},
bottomCurve: {
position: "absolute",
height: scale(185),
width: scale(170),
borderTopRightRadius: scale(110),
borderTopLeftRadius: scale(90),
borderBottomRightRadius: scale(100),
borderBottomLeftRadius: scale(110),
right: -90,
backgroundColor: colors.curve,
opacity: 0.2,
bottom: -80,
zIndex: -1,
},
});
};
export default useStyle;

View File

@ -1,65 +0,0 @@
import CartItem from "./CartItem/CartItem";
import {
CartComponent,
CheckComponent,
HeadingComponent,
ImageHeader,
RadioComponent,
TitleComponent,
} from "./CustomizeComponents";
import { DrawerProfile } from "./Drawer";
import CheckboxBtn from "./FdCheckbox/CheckboxBtn";
import RadioBtn from "./FdRadioBtn/RadioBtn";
import { FdEmailBtn, FdGoogleBtn } from "./FdSocialBtn";
import { FlashMessage } from "./FlashMessage/FlashMessage";
import {
BackButton,
LeftButton,
RightButton,
RegistrationHeader,
} from "./Header";
import { MenuCard, StatusCard } from "./Menu";
import { FilterModal } from "./Modals";
import ActiveOrders from "./MyOrders/ActiveOrders";
import { TrackingRider } from "./OrderDetail";
import Sidebar from "./Sidebar/Sidebar";
import Spinner from "./Spinner/Spinner";
import { TextDefault, TextError, TextLine } from "./Text";
import Triangle from "./Triangle/Triangle";
import EnategaImage from "./EnategaImage/EnategaImage";
import WrapperView from "./WrapperView/WrapperView";
import { CustomIcon } from "./CustomIcon";
export {
WrapperView,
CustomIcon,
CartItem,
EnategaImage,
CartComponent,
CheckComponent,
HeadingComponent,
ImageHeader,
RadioComponent,
TitleComponent,
DrawerProfile,
RadioBtn,
CheckboxBtn,
FdEmailBtn,
FdGoogleBtn,
FlashMessage,
BackButton,
LeftButton,
RightButton,
MenuCard,
StatusCard,
FilterModal,
RegistrationHeader,
ActiveOrders,
Sidebar,
Triangle,
TextDefault,
TextError,
TextLine,
Spinner,
TrackingRider,
};

View File

@ -1,360 +0,0 @@
/* eslint-disable react/prop-types */
import { createDrawerNavigator } from "@react-navigation/drawer";
import { NavigationContainer, useTheme } from "@react-navigation/native";
import { createStackNavigator } from "@react-navigation/stack";
import * as Notifications from "expo-notifications";
import React, { useEffect } from "react";
import { Text, useColorScheme, View } from "react-native";
import Animated from "react-native-reanimated";
import {
initialWindowMetrics,
SafeAreaProvider,
} from "react-native-safe-area-context";
import { TextDefault, LeftButton, Sidebar } from "../components";
import Menu from "../screens/Menu/Menu";
import MenuItems from "../screens/MenuItems/MenuItems";
import Addresses from "../screens/Addresses/Addresses";
import NewAddress from "../screens/NewAddress/NewAddress";
import EditAddress from "../screens/EditAddress/EditAddress";
import Cart from "../screens/Cart/Cart";
import Profile from "../screens/Profile/Profile";
import FullMap from "../screens/FullMap/FullMap";
import CartAddress from "../screens/CartAddress/CartAddress";
import SelectVoucher from "../screens/Coupon/Coupon";
import Help from "../screens/Help/Help";
import HelpBrowser from "../screens/HelpBrowser/HelpBrowser";
import Chat from "../screens/Chat/Chat";
import Settings from "../screens/Settings/Settings";
import Paypal from "../screens/Paypal/Paypal";
import ItemDetail from "../screens/ItemDetail/ItemDetail";
import MyOrders from "../screens/MyOrders/MyOrders";
import OrderDetail from "../screens/OrderDetail/OrderDetail";
import StripeCheckout from "../screens/Stripe/StripeCheckout";
import RateAndReview from "../screens/RateAndReview/RateAndReview";
import CreateAccount from "../screens/CreateAccount/CreateAccount";
import Login from "../screens/Login/Login";
import Register from "../screens/Register/Register";
import ForgotPassword from "../screens/ForgotPassword/ForgotPassword";
// import {
// Addresses,
// Cart,
// CartAddress,
// Chat,
// CreateAccount,
// EditAddress,
// ForgotPassword,
// FullMap,
// Help,
// HelpBrowser,
// ItemDetail,
// Login,
// MenuItems,
// MyOrders,
// NewAddress,
// OrderDetail,
// Paypal,
// Profile,
// RateAndReview,
// Register,
// SelectVoucher,
// Settings,
// StripeCheckout,
// Menu,
// } from "../screens";
import { THEME } from "../Theme";
import { ICONS_NAME, NAVIGATION_SCREEN } from "../utils/constant";
import navigationService from "./navigationService";
import screenOptions from "./screenOptions";
import styles from "./styles";
const NavigationStack = createStackNavigator();
const MainStack = createStackNavigator();
const SideDrawer = createDrawerNavigator();
function Drawer() {
const { colors } = useTheme();
let animatedStyle = {};
let opacity;
let OuterWindowSlide, InnerWindowSlide;
return (
<SideDrawer.Navigator
drawerType="slide"
overlayColor="transparent"
screenOptions={{
drawerStyle: {
flex: 1,
backgroundColor: colors.drawerBackground,
width: "60%",
justifyContent: "space-between",
borderRightWidth: 0,
shadowOpacity: 0,
elevation: 0,
},
sceneContainerStyle: { backgroundColor: colors.drawerBackground },
}}
// drawerStyle={{
// flex: 1,
// backgroundColor: colors.drawerBackground,
// width: "60%",
// justifyContent: "space-between",
// borderRightWidth: 0,
// shadowOpacity: 0,
// elevation: 0,
// }}
// sceneContainerStyle={{ backgroundColor: colors.drawerBackground }}
drawerContent={(props) => {
const scale = Animated.interpolateNode(props.progress, {
inputRange: [0, 1],
outputRange: [1, 0.7],
});
const Animatedopacity = Animated.interpolateNode(props.progress, {
inputRange: [0, 0.6, 1],
outputRange: [0, 0, 1],
});
const AnimatedOuterSlide = Animated.interpolateNode(props.progress, {
inputRange: [0, 1],
outputRange: [0, -35],
});
const AnimatedInnerSlide = Animated.interpolateNode(props.progress, {
inputRange: [0, 1],
outputRange: [0, -15],
});
const borderRadius = Animated.interpolateNode(props.progress, {
inputRange: [0, 1],
outputRange: [0, 20],
});
animatedStyle = { borderRadius, transform: [{ scale }] };
opacity = Animatedopacity;
OuterWindowSlide = AnimatedOuterSlide;
InnerWindowSlide = AnimatedInnerSlide;
return <Sidebar {...props} />;
}}
>
<SideDrawer.Screen name="noDrawer" options={{ headerShown: false }}>
{(props) => (
<NoDrawer
{...props}
style={animatedStyle}
opacity={opacity}
OuterWindowSlide={OuterWindowSlide}
InnerWindowSlide={InnerWindowSlide}
/>
)}
</SideDrawer.Screen>
</SideDrawer.Navigator>
);
}
function NoDrawer({ style, opacity = 1, OuterWindowSlide, InnerWindowSlide }) {
const { colors } = useTheme();
return (
<React.Fragment>
<Animated.View
style={[styles.outerView, style, { marginLeft: OuterWindowSlide }]}
/>
<Animated.View
style={[styles.innerView, style, { marginLeft: InnerWindowSlide }]}
/>
<Animated.View style={[styles.animatedView, style]}>
<NavigationStack.Navigator
//mode="modal"
presentation="modal"
screenOptions={screenOptions({
textColor: colors.headerTextColor,
})}
>
<NavigationStack.Screen
name={NAVIGATION_SCREEN.Menu}
component={Menu}
options={{
headerLeft: () => <LeftButton icon={ICONS_NAME.Menu} />,
}}
/>
<NavigationStack.Screen
name={NAVIGATION_SCREEN.MenuItems}
component={MenuItems}
/>
<NavigationStack.Screen
name={NAVIGATION_SCREEN.Cart}
component={Cart}
/>
<NavigationStack.Screen
name={NAVIGATION_SCREEN.Profile}
component={Profile}
options={{
headerLeft: () => <LeftButton icon={ICONS_NAME.Menu} />,
}}
/>
<NavigationStack.Screen
name={NAVIGATION_SCREEN.Addresses}
component={Addresses}
options={{
headerLeft: () => <LeftButton icon={ICONS_NAME.Menu} />,
}}
/>
<NavigationStack.Screen
name={NAVIGATION_SCREEN.NewAddress}
component={NewAddress}
/>
<NavigationStack.Screen
name={NAVIGATION_SCREEN.EditAddress}
component={EditAddress}
/>
<NavigationStack.Screen
name={NAVIGATION_SCREEN.FullMap}
component={FullMap}
/>
<NavigationStack.Screen
name={NAVIGATION_SCREEN.CartAddress}
component={CartAddress}
/>
<NavigationStack.Screen
name={NAVIGATION_SCREEN.Coupon}
component={SelectVoucher}
/>
<NavigationStack.Screen
name={NAVIGATION_SCREEN.Help}
component={Help}
options={{
headerLeft: () => <LeftButton icon={ICONS_NAME.Menu} />,
}}
/>
<NavigationStack.Screen
name={NAVIGATION_SCREEN.Chat}
component={Chat}
options={{
headerLeft: () => <LeftButton icon={ICONS_NAME.Menu} />,
}}
/>
<NavigationStack.Screen
name={NAVIGATION_SCREEN.HelpBrowser}
component={HelpBrowser}
/>
<NavigationStack.Screen
name={NAVIGATION_SCREEN.Settings}
component={Settings}
options={{
headerLeft: () => <LeftButton icon={ICONS_NAME.Menu} />,
}}
/>
<NavigationStack.Screen
name={NAVIGATION_SCREEN.Paypal}
component={Paypal}
/>
<NavigationStack.Screen
name={NAVIGATION_SCREEN.ItemDetail}
component={ItemDetail}
/>
<NavigationStack.Screen
name={NAVIGATION_SCREEN.MyOrders}
component={MyOrders}
options={{
headerLeft: () => <LeftButton icon={ICONS_NAME.Menu} />,
}}
/>
<NavigationStack.Screen
name={NAVIGATION_SCREEN.OrderDetail}
component={OrderDetail}
/>
<NavigationStack.Screen
name={NAVIGATION_SCREEN.RateAndReview}
component={RateAndReview}
/>
<NavigationStack.Screen
name={NAVIGATION_SCREEN.StripeCheckout}
component={StripeCheckout}
/>
<NavigationStack.Screen
name={NAVIGATION_SCREEN.CreateAccount}
options={{ headerShown: false }}
component={CreateAccount}
/>
<NavigationStack.Screen
options={{ headerShown: false }}
name={NAVIGATION_SCREEN.Login}
component={Login}
/>
<NavigationStack.Screen
options={{ headerShown: false }}
name={NAVIGATION_SCREEN.Register}
component={Register}
/>
<NavigationStack.Screen
name={NAVIGATION_SCREEN.ForgotPassword}
options={{ headerShown: false }}
component={ForgotPassword}
/>
</NavigationStack.Navigator>
</Animated.View>
<Animated.View style={[styles.closeView, { opacity: opacity }]}>
<TextDefault H4 medium>
{"Close X"}
</TextDefault>
</Animated.View>
</React.Fragment>
);
}
function AppContainer() {
console.log("AppContainer Working");
const colorScheme = useColorScheme();
function _handleNotification(notification) {
try {
if (notification.origin === "selected") {
if (notification.data.order) {
navigationService.navigate(NAVIGATION_SCREEN.OrderDetail, {
_id: notification.data._id,
});
}
}
} catch (e) {
console.log(e);
}
}
useEffect(() => {
Notifications.setNotificationHandler({
handleNotification: async () => ({
shouldShowAlert: true,
shouldPlaySound: false,
shouldSetBadge: false,
}),
});
const subscription =
Notifications.addNotificationResponseReceivedListener(
_handleNotification
);
return () => subscription.remove();
}, []);
return (
<SafeAreaProvider initialMetrics={initialWindowMetrics}>
<NavigationContainer
theme={colorScheme === "dark" ? THEME.Dark : THEME.Light}
ref={(ref) => {
navigationService.setGlobalRef(ref);
Notifications.addNotificationReceivedListener(_handleNotification);
}}
>
<MainStack.Navigator
screenOptions={{
headerShown: false,
}}
//headerMode="none"
initialRouteName={NAVIGATION_SCREEN.Drawer}
>
<MainStack.Screen
name={NAVIGATION_SCREEN.Drawer}
component={Drawer}
/>
</MainStack.Navigator>
</NavigationContainer>
</SafeAreaProvider>
);
}
export default AppContainer;

View File

@ -1,194 +0,0 @@
import { useMutation } from "@apollo/react-hooks";
import { useNavigation, useTheme } from "@react-navigation/native";
import gql from "graphql-tag";
import React, { useContext, useLayoutEffect } from "react";
import { FlatList, TouchableOpacity, View } from "react-native";
import i18n from "../../../i18n";
import { deleteAddress } from "../../apollo/server";
import EmptyAddress from "../../assets/images/SVG/imageComponents/EmptyAddress";
import {
CustomIcon,
RightButton,
TextDefault,
WrapperView,
} from "../../components";
import UserContext from "../../context/User";
import { COLORS } from "../../Theme";
import { alignment } from "../../utils/alignment";
import { ICONS_NAME, NAVIGATION_SCREEN } from "../../utils/constant";
import { scale } from "../../utils/scaling";
import useStyle from "./styles";
const DELETE_ADDRESS = gql`
${deleteAddress}
`;
function Addresses() {
const styles = useStyle();
const { colors } = useTheme();
const navigation = useNavigation();
const { profile } = useContext(UserContext);
const [mutate, { loading: loadingMutation }] = useMutation(DELETE_ADDRESS);
useLayoutEffect(() => {
navigation.setOptions({
title: i18n.t("myAddresses"),
headerRight: () => (
<RightButton
icon={ICONS_NAME.Plus}
iconSize={scale(18)}
onPress={() => navigation.navigate(NAVIGATION_SCREEN.NewAddress)}
/>
),
});
}, [navigation]);
const addressIcons = {
Home: ICONS_NAME.Home,
Work: ICONS_NAME.Cart,
Other: ICONS_NAME.Location,
};
const colorIcons = {
Other: COLORS.primary,
Home: COLORS.redishPink,
Work: COLORS.primaryLightBlue,
};
const emptyView = React.memo(() => {
return (
<View style={styles.subContainerImage}>
<View style={styles.image}>
<EmptyAddress width={scale(180)} height={scale(180)} />
</View>
<View style={styles.descriptionEmpty}>
<TextDefault
textColor={colors.fontMainColor}
bold
H5
style={alignment.Msmall}
>
No Addresses found.
</TextDefault>
<View>
<TextDefault textColor={colors.fontSecondColor}>
You haven&#39;t saved any address yet.
{"\n"}
Click Add New Address to get started
</TextDefault>
</View>
<TouchableOpacity
activeOpacity={0.8}
style={styles.adressBtn}
onPress={() => navigation.navigate(NAVIGATION_SCREEN.NewAddress)}
>
<TextDefault textColor={colors.white} H5 bold>
Add New Address
</TextDefault>
</TouchableOpacity>
</View>
</View>
);
});
return (
<WrapperView>
<View style={styles.containerInfo}>
<FlatList
showsVerticalScrollIndicator={false}
data={profile.addresses}
style={[styles.flex, styles.width100]}
contentContainerStyle={
profile.addresses.length > 0
? styles.contentContainer
: { flexGrow: 1 }
}
ListEmptyComponent={emptyView}
// keyExtractor={(item) => item._id}
keyExtractor={(item, index) => String(index)}
ItemSeparatorComponent={() => <View style={styles.line} />}
ListHeaderComponent={() => <View style={alignment.MTmedium} />}
renderItem={({ item: address }) => (
<TouchableOpacity
activeOpacity={0.7}
style={styles.width100}
onPress={() => {
navigation.navigate(NAVIGATION_SCREEN.EditAddress, {
...address,
});
}}
>
<View style={[styles.titleAddress, styles.width100]}>
<View
style={{
alignItems: "center",
flexDirection: "row",
flex: 1,
}}
>
<CustomIcon
name={addressIcons[address.label]}
size={scale(20)}
color={colorIcons[address.label]}
/>
<TextDefault
bold
H5
style={[alignment.MTxSmall, alignment.MLsmall]}
>
{address.label}
</TextDefault>
</View>
<View style={[styles.titleAddress]}>
<TouchableOpacity
activeOpacity={0.7}
disabled={loadingMutation}
style={[styles.iconButton, alignment.MRsmall]}
onPress={() => {
navigation.navigate(NAVIGATION_SCREEN.EditAddress, {
...address,
});
}}
>
<CustomIcon
name={ICONS_NAME.Pencil}
size={scale(20)}
color={colors.placeHolderColor}
/>
</TouchableOpacity>
<TouchableOpacity
activeOpacity={0.7}
disabled={loadingMutation}
style={styles.iconButton}
onPress={() => {
mutate({ variables: { id: address._id } });
}}
>
<CustomIcon
name={ICONS_NAME.Trash}
size={scale(20)}
color={colors.placeHolderColor}
/>
</TouchableOpacity>
</View>
</View>
<View style={styles.addressDetail}>
<TextDefault textColor={colors.fontSecondColor}>
{address.delivery_address}, {address.details}
</TextDefault>
</View>
</TouchableOpacity>
)}
/>
<TextDefault
textColor={colors.fontSecondColor}
style={alignment.MBsmall}
>
All rights are reserved by Enatega
</TextDefault>
</View>
</WrapperView>
);
}
export default React.memo(Addresses);

View File

@ -1,135 +0,0 @@
import { useMutation } from "@apollo/react-hooks";
import { useNavigation, useTheme } from "@react-navigation/native";
import gql from "graphql-tag";
import React, { useContext, useLayoutEffect } from "react";
import { FlatList, TouchableOpacity, View } from "react-native";
import i18n from "../../../i18n";
import { selectAddress } from "../../apollo/server";
import {
CustomIcon,
RightButton,
TextDefault,
WrapperView,
} from "../../components";
import RadioButton from "../../components/FdRadioBtn/RadioBtn";
import UserContext from "../../context/User";
import { alignment } from "../../utils/alignment";
import { ICONS_NAME, NAVIGATION_SCREEN } from "../../utils/constant";
import { scale } from "../../utils/scaling";
import useStyle from "./styles";
const SELECT_ADDRESS = gql`
${selectAddress}
`;
function CartAddresses() {
const { colors } = useTheme();
const styles = useStyle();
const navigation = useNavigation();
const { profile } = useContext(UserContext);
const [mutate] = useMutation(SELECT_ADDRESS, { onError });
useLayoutEffect(() => {
navigation.setOptions({
title: i18n.t("myAddresses"),
headerRight: () => (
<RightButton
icon={ICONS_NAME.Plus}
iconSize={scale(18)}
onPress={() => navigation.navigate(NAVIGATION_SCREEN.NewAddress)}
/>
),
});
}, [navigation]);
function onError(error) {
console.log(error);
}
const onSelectAddress = (address) => {
mutate({ variables: { id: address._id } });
navigation.goBack();
};
return (
<WrapperView>
<View style={styles.containerInfo}>
<FlatList
showsVerticalScrollIndicator={false}
style={styles.flex}
data={profile.addresses}
keyExtractor={(item, index) => String(index)}
contentContainerStyle={styles.contentContainer}
ItemSeparatorComponent={() => <View style={styles.line} />}
ListHeaderComponent={() => <View style={{ ...alignment.MTmedium }} />}
renderItem={({ item: address }) => (
<View style={styles.width100}>
<TouchableOpacity
activeOpacity={0.7}
style={styles.width100}
onPress={() => {
onSelectAddress(address);
}}
>
<View style={styles.width100}>
<View style={[styles.titleAddress, styles.width100]}>
<View style={[styles.homeIcon]}>
<RadioButton
size={10}
outerColor={colors.radioOuterColor}
innerColor={colors.radioColor}
animation={"bounceIn"}
isSelected={address.selected}
onPress={() => {
onSelectAddress(address);
}}
/>
</View>
<TextDefault style={{ width: "70%" }} H5 bold>
{address.label}
</TextDefault>
<TouchableOpacity
activeOpacity={0.7}
style={styles.editButton}
onPress={() =>
navigation.navigate(NAVIGATION_SCREEN.EditAddress, {
...address,
})
}
>
<CustomIcon
name={ICONS_NAME.Pencil}
size={scale(20)}
color={colors.tagColor}
/>
</TouchableOpacity>
</View>
<View style={{ ...alignment.MTxSmall }}></View>
<View style={styles.addressDetail}>
<TextDefault
line={4}
textColor={colors.fontSecondColor}
bold
>
{address.delivery_address}
</TextDefault>
<TextDefault
line={3}
textColor={colors.fontSecondColor}
bold
>
{address.details}
</TextDefault>
</View>
</View>
</TouchableOpacity>
</View>
)}
/>
</View>
</WrapperView>
);
}
export default CartAddresses;

View File

@ -1,211 +0,0 @@
import { Feather, FontAwesome } from "@expo/vector-icons";
import { useNavigation, useTheme } from "@react-navigation/native";
import React, { useCallback, useEffect, useState } from "react";
import { Keyboard, View } from "react-native";
import {
Bubble,
GiftedChat,
InputToolbar,
Send,
} from "react-native-gifted-chat";
import { TextDefault, WrapperView } from "../../components";
import { alignment } from "../../utils/alignment";
import { scale } from "../../utils/scaling";
import useStyle from "./styles";
const UserInfo = {
_id: 1,
name: "Jason",
active: true,
};
function Chat() {
const styles = useStyle();
const { colors } = useTheme();
const navigation = useNavigation();
const [messages, setMessages] = useState([]);
const [isTyping, setIsTyping] = useState(false);
useEffect(() => {
Keyboard.addListener("keyboardDidShow", _keyboardDidShow);
Keyboard.addListener("keyboardDidHide", _keyboardDidHide);
// cleanup function
return () => {
Keyboard.remove("keyboardDidShow", _keyboardDidShow);
Keyboard.remove("keyboardDidHide", _keyboardDidHide);
};
}, []);
const _keyboardDidShow = () => setIsTyping(true);
const _keyboardDidHide = () => setIsTyping(false);
useEffect(() => {
navigation.setOptions({
title: "Chat",
});
setMessages([
{
_id: 1,
text: "How can I help you?",
sent: true,
received: true,
createdAt: new Date(),
user: {
_id: 2,
name: "React Native",
avatar: "https://placeimg.com/140/140/any",
},
},
]);
}, [navigation]);
const onSend = useCallback((messages = []) => {
setMessages((previousMessages) =>
GiftedChat.append(previousMessages, messages)
);
}, []);
const renderBubble = (props) => {
return (
<Bubble
{...props}
textStyle={{
right: {
color: colors.fontMainColor,
},
left: {
color: colors.fontMainColor,
},
}}
bottomContainerStyle={{
right: {
...alignment.PTxSmall,
},
left: {
...alignment.PTxSmall,
},
}}
wrapperStyle={{
right: {
minWidth: 150,
backgroundColor: colors.chatBubblePrimary,
borderTopRightRadius: scale(15),
borderTopLeftRadius: scale(15),
borderBottomLeftRadius: scale(15),
borderBottomRightRadius: 0,
...alignment.MVxSmall,
...alignment.PVxSmall,
shadowColor: colors.shadowColor,
shadowOffset: {
width: 0,
height: 1,
},
shadowOpacity: 0.2,
shadowRadius: 2,
elevation: 3,
},
left: {
minWidth: 150,
backgroundColor: colors.lightBackground,
borderTopRightRadius: scale(15),
borderTopLeftRadius: scale(15),
borderBottomRightRadius: scale(15),
borderBottomLeftRadius: 0,
...alignment.MVxSmall,
...alignment.PVxSmall,
shadowColor: colors.shadowColor,
shadowOffset: {
width: 0,
height: 1,
},
shadowOpacity: 0.2,
shadowRadius: 2,
elevation: 3,
},
}}
/>
);
};
const renderSend = (props) => (
<Send {...props} containerStyle={styles.sendBtn}>
<View style={styles.rightBtn}>
<Feather
name={"send"}
color={colors.buttonText}
size={scale(17)}
style={{
transform: [
{ rotateZ: "45deg" },
{ translateY: 2 },
{ translateX: -1 },
],
}}
/>
</View>
</Send>
);
const customtInputToolbar = (props) => {
return (
<InputToolbar
{...props}
containerStyle={styles.inputContainer}
renderSend={renderSend}
render
/>
);
};
return (
<WrapperView>
<View style={[styles.flex, styles.mainContainer]}>
<View style={styles.header}>
<FontAwesome
name="circle"
color={UserInfo.active ? colors.active : colors.fontSecondColor}
/>
<TextDefault medium H5 style={alignment.PLsmall}>
{UserInfo.active ? UserInfo.name : "Offline"}
</TextDefault>
</View>
<GiftedChat
inverted
alwaysShowSend
user={UserInfo}
isTyping={isTyping}
messages={messages}
onSend={(messages) => onSend(messages)}
renderAvatar={() => null}
renderBubble={renderBubble}
renderInputToolbar={customtInputToolbar}
textInputStyle={styles.inputStyle}
minInputToolbarHeight={60}
// renderFooter={() =>
// isTyping ? (
// <TextDefault
// textColor={colors.selected}
// style={[alignment.PLlarge, alignment.MBsmall]}>
// User is typing...
// </TextDefault>
// ) : null
// }
timeTextStyle={{
left: {
width: "100%",
color: colors.fontMainColor,
fontSize: 11,
textAlign: "right",
},
right: {
color: colors.fontMainColor,
fontSize: 11,
},
}}
/>
</View>
</WrapperView>
);
}
export default Chat;

View File

@ -1,268 +0,0 @@
import { useMutation } from "@apollo/react-hooks";
import { FontAwesome } from "@expo/vector-icons";
import { useNavigation, useTheme } from "@react-navigation/native";
import * as AppleAuthentication from "expo-apple-authentication";
import Constants from "expo-constants";
//import * as Google from 'expo-google-app-auth'
import * as Google from "expo-auth-session/providers/google";
import * as Notifications from "expo-notifications";
import gql from "graphql-tag";
import React, { useContext, useEffect, useState } from "react";
import { Platform, TouchableOpacity, View } from "react-native";
import getEnvVars from "../../../environment";
import { login } from "../../apollo/server";
import {
EnategaImage,
FdEmailBtn,
FdGoogleBtn,
FlashMessage,
RegistrationHeader,
Spinner,
TextDefault,
WrapperView,
} from "../../components";
import UserContext from "../../context/User";
import { alignment } from "../../utils/alignment";
import Analytics from "../../utils/analytics";
import { NAVIGATION_SCREEN } from "../../utils/constant";
import { scale } from "../../utils/scaling";
import useStyle from "./styles";
import ApolloClient from "apollo-client";
const {
IOS_CLIENT_ID_GOOGLE,
ANDROID_CLIENT_ID_GOOGLE,
Expo_CLIENT_ID_GOOGLE,
} = getEnvVars();
const LOGIN = gql`
${login}
`;
const Logo = require("../../../assets/logo.png");
const CreateAccount = () => {
const styles = useStyle();
const { colors } = useTheme();
const navigation = useNavigation();
const [enableApple, setEnableApple] = useState(false);
const [loginButton, loginButtonSetter] = useState(null);
const [loading, setLoading] = useState(false);
const { setTokenAsync } = useContext(UserContext);
useEffect(() => {
checkIfSupportsAppleAuthentication();
}, []);
const [mutate] = useMutation(LOGIN, { onCompleted, onError });
async function checkIfSupportsAppleAuthentication() {
setEnableApple(await AppleAuthentication.isAvailableAsync());
}
async function onCompleted(data) {
try {
const trackingOpts = {
id: data.login.userId,
usernameOrEmail: data.login.email,
};
Analytics.identify(data.login.userId, trackingOpts);
Analytics.track(Analytics.events.USER_CREATED_ACCOUNT, trackingOpts);
setTokenAsync(data.login.token);
navigation.navigate(NAVIGATION_SCREEN.Menu);
} catch (e) {
console.log(e);
} finally {
setLoading(false);
}
}
function onError(error) {
try {
console.log(JSON.stringify(error));
FlashMessage({
message: error.graphQLErrors[0].message,
});
loginButtonSetter(null);
} catch (e) {
console.log(e);
} finally {
setLoading(false);
}
}
async function mutateLogin(user) {
setLoading(true);
let notificationToken = null;
if (Constants.isDevice) {
const { status: existingStatus } =
await Notifications.getPermissionsAsync();
if (existingStatus === "granted") {
notificationToken = (await Notifications.getExpoPushTokenAsync()).data;
}
}
mutate({ variables: { ...user, notificationToken } });
}
function renderAppleAction() {
if (loading && loginButton === "Apple") {
return (
<View style={styles.buttonBackground}>
<Spinner backColor="rgba(0,0,0,0.1)" spinnerColor={colors.tagColor} />
</View>
);
}
return (
<TouchableOpacity
style={styles.appleBtn}
onPress={async () => {
try {
const credential = await AppleAuthentication.signInAsync({
requestedScopes: [
AppleAuthentication.AppleAuthenticationScope.FULL_NAME,
AppleAuthentication.AppleAuthenticationScope.EMAIL,
],
});
console.log(credential);
if (credential) {
const user = {
appleId: credential.user,
phone: "",
email: credential.email,
password: "",
name:
credential.fullName.givenName +
" " +
credential.fullName.familyName,
picture: "",
type: "apple",
};
mutateLogin(user);
}
loginButtonSetter("Apple");
// signed in
} catch (e) {
if (e.code === "ERR_CANCELLED") {
// handle that the user canceled the sign-in flow
loginButtonSetter(null);
} else {
// handle other errors
loginButtonSetter(null);
}
}
}}
>
<FontAwesome
style={styles.marginLeft5}
name="apple"
size={scale(19)}
color="#000"
/>
<TextDefault style={alignment.MLsmall} bold>
Signup with Apple
</TextDefault>
</TouchableOpacity>
);
}
const [googleRequest, googleResponse, googlePromptAsync] =
Google.useAuthRequest({
expoClientId: Expo_CLIENT_ID_GOOGLE,
iosClientId: IOS_CLIENT_ID_GOOGLE,
iosStandaloneAppClientId: IOS_CLIENT_ID_GOOGLE,
androidClientId: ANDROID_CLIENT_ID_GOOGLE,
androidStandaloneAppClientId: ANDROID_CLIENT_ID_GOOGLE,
//redirectUrl: `${AuthSession.OAuthRedirect}:/oauth2redirect/google`,
scopes: ["profile", "email"],
...{ useProxy: true },
});
const googleSignUp = () => {
if (googleResponse?.type === "success") {
const { authentication } = googleResponse;
console.log(authentication.accessToken);
(async () => {
const userInfoResponse = await fetch(
"https://www.googleapis.com/oauth2/v1/userinfo?alt=json",
{
headers: { Authorization: `Bearer ${authentication.accessToken}` },
}
);
const googleUser = await userInfoResponse.json();
const user = {
phone: "",
email: googleUser.email,
password: "",
name: googleUser.name,
picture: googleUser.picture,
type: "google",
};
mutateLogin(user);
})();
}
};
useEffect(() => {
googleSignUp();
}, [googleResponse]);
function renderGoogleAction() {
return (
<FdGoogleBtn
loadingIcon={loading && loginButton === "Google"}
onPressIn={() => {
loginButtonSetter("Google");
}}
disabled={!googleRequest}
onPress={() => googlePromptAsync()}
/>
);
}
function renderEmailAction() {
return (
<FdEmailBtn
loadingIcon={loading && loginButton === "Email"}
onPress={() => {
loginButtonSetter("Email");
navigation.navigate(NAVIGATION_SCREEN.Register);
}}
/>
);
}
return (
<WrapperView>
<View style={[styles.mainContainer, styles.flex]}>
<RegistrationHeader title={"Get Started"} />
<View style={styles.subContainer}>
<View style={[styles.flex, styles.upperContainer]}>
<EnategaImage
imgStyle={styles.imgResponsive}
imgSource={Logo}
spinnerProps={{ style: styles.loadingView }}
/>
</View>
<View style={styles.width100}>
<View style={alignment.MTmedium}>{renderGoogleAction()}</View>
{enableApple && (
<View style={alignment.MTmedium}>{renderAppleAction()}</View>
)}
<View style={alignment.MTmedium}>{renderEmailAction()}</View>
<TouchableOpacity
activeOpacity={0.7}
style={styles.alreadyBtn}
onPress={() => navigation.navigate(NAVIGATION_SCREEN.Login)}
>
<TextDefault style={[alignment.MLsmall]} bold>
Already a member? Log in
</TextDefault>
</TouchableOpacity>
</View>
</View>
</View>
</WrapperView>
);
};
export default CreateAccount;

View File

@ -1,107 +0,0 @@
import { useQuery } from "@apollo/react-hooks";
import { useNavigation } from "@react-navigation/native";
import gql from "graphql-tag";
import React, { useContext, useLayoutEffect } from "react";
import { FlatList, View } from "react-native";
import { categories } from "../../apollo/server";
import EmptyFood from "../../assets/images/SVG/imageComponents/EmptyFood";
import {
MenuCard,
Spinner,
StatusCard,
TextDefault,
TextError,
WrapperView,
} from "../../components";
import UserContext from "../../context/User";
import { alignment } from "../../utils/alignment";
import { NAVIGATION_SCREEN } from "../../utils/constant";
import { scale } from "../../utils/scaling";
import useStyle from "./styles";
// constants
const CATEGORIES = gql`
${categories}
`;
function Menu() {
const styles = useStyle();
const navigation = useNavigation();
const { isLoggedIn, profile } = useContext(UserContext);
const { data, refetch, networkStatus, loading, error } = useQuery(CATEGORIES);
useLayoutEffect(() => {
navigation.setOptions({
title: "Home",
});
}, []);
function emptyView() {
if (loading) {
return <Spinner />;
} else if (error) {
return (
<TextError
text={error ? error.message : "No Foods"}
backColor="transparent"
/>
);
} else {
return (
<View style={styles.emptyContainer}>
<EmptyFood width={scale(250)} height={scale(250)} />
<TextDefault H4 bold style={alignment.MTlarge}>
No item found
</TextDefault>
</View>
);
}
}
return (
<WrapperView>
<View style={[styles.flex, styles.mainContentContainer]}>
<FlatList
style={styles.flex}
contentContainerStyle={styles.contentContainer}
showsVerticalScrollIndicator={false}
keyExtractor={(item, index) => String(index)}
ListEmptyComponent={emptyView()}
data={loading ? [] : error ? [] : data.categories}
refreshing={networkStatus === 4}
onRefresh={() => refetch()}
ListHeaderComponent={() => {
if (!error && !loading) {
return (
<>
{isLoggedIn && profile && <StatusCard />}
<TextDefault style={alignment.Psmall} H4 medium>
Featured
</TextDefault>
</>
);
}
return null;
}}
renderItem={({ item }) => (
<View key={item._id} style={styles.cardViewContainer}>
<MenuCard
onPress={() =>
navigation.navigate(NAVIGATION_SCREEN.MenuItems, {
...item,
})
}
title={item.title}
description={item.description}
image={item.img_menu || ""}
/>
</View>
)}
/>
</View>
</WrapperView>
);
}
export default React.memo(Menu);

View File

@ -1,283 +0,0 @@
import { useQuery } from "@apollo/react-hooks";
import { useNavigation, useRoute } from "@react-navigation/native";
//import { useHeaderHeight } from '@react-navigation/stack'
import { useHeaderHeight } from "@react-navigation/elements";
import gql from "graphql-tag";
import { get } from "lodash";
import React, { useContext, useLayoutEffect, useRef, useState } from "react";
import {
FlatList,
ImageBackground,
Platform,
TouchableOpacity,
View,
} from "react-native";
import { Modalize } from "react-native-modalize";
import { foods } from "../../apollo/server";
import EmptyFood from "../../assets/images/SVG/imageComponents/EmptyFood";
import {
EnategaImage,
FilterModal,
FlashMessage,
RightButton,
Spinner,
TextDefault,
TextError,
WrapperView,
} from "../../components";
import ConfigurationContext from "../../context/Configuration";
import UserContext from "../../context/User";
import { alignment } from "../../utils/alignment";
import { ICONS_NAME, NAVIGATION_SCREEN, SORT_DATA } from "../../utils/constant";
import { moderateScale, scale } from "../../utils/scaling";
import useStyle from "./styles";
// constants
const FOODS = gql`
${foods}
`;
function MenuItems() {
const route = useRoute();
const styles = useStyle();
const headerHeight = useHeaderHeight();
const navigation = useNavigation();
const _id = route.params._id ?? null;
const imgMenu = route.params.img_menu ?? null;
const title = route.params.title ?? null;
const description = route.params.description ?? null;
const [filters, setFilters] = useState({});
const { loading, error, data, refetch, networkStatus } = useQuery(FOODS, {
variables: { category: _id, ...filters },
});
const { addCartItem } = useContext(UserContext);
const configuration = useContext(ConfigurationContext);
const modalizeRef = useRef(null);
const closeModal = () => {
modalizeRef.current.close();
};
useLayoutEffect(() => {
navigation.setOptions({
headerTitle: title,
headerRight: () => (
<RightButton
icon={ICONS_NAME.Filter}
onPress={() => modalizeRef.current.open()}
/>
),
});
}, [navigation]);
async function onAddToCart(food) {
if (food.stock < 1) {
FlashMessage({
message: "Item out of stock",
});
return;
}
if (
food.variations.length === 1 &&
food.variations[0].addons.length === 0
) {
await addCartItem(food._id, food.variations[0]._id);
navigation.navigate(NAVIGATION_SCREEN.Cart);
} else {
navigation.navigate(NAVIGATION_SCREEN.ItemDetail, { food });
}
}
function renderGridCards(item) {
return (
<TouchableOpacity
onPress={() => {
onAddToCart(item);
}}
activeOpacity={0.7}
style={styles.cardContainer}
>
<View style={styles.cardImageContainer}>
<EnategaImage
imgStyle={styles.imgResponsive}
imgSource={
item.img_url
? { uri: item.img_url }
: require("../../assets/images/food_placeholder.png")
}
resizeMode={"cover"}
spinnerProps={{ style: styles.loadingView }}
/>
{item.stock < 1 && (
<View style={styles.emtpyStockLabel}>
<TextDefault textColor={styles.whiteFont.color} center>
No Stock
</TextDefault>
</View>
)}
</View>
<View style={[styles.textContainer]}>
<TextDefault numberOfLines={2} style={alignment.MBxSmall} bolder H5>
{item.title}
</TextDefault>
<TextDefault
numberOfLines={2}
textColor={styles.lightColor.color}
small
medium
>
{item.description}
</TextDefault>
<View style={{ flexDirection: "row", alignItems: "center" }}>
{item.variations[0].discounted > 0 && (
<TextDefault
textColor={styles.lightColor.color}
style={[alignment.MRxSmall]}
small
bold
H5
lineOver
>
{configuration.currency_symbol}{" "}
{(
item.variations[0].price + item.variations[0].discounted
).toFixed(2)}
</TextDefault>
)}
<TextDefault textColor={styles.tagColor.color} H4 bolder>
{configuration.currency_symbol}{" "}
{item.variations[0].price.toFixed(2)}
</TextDefault>
</View>
</View>
</TouchableOpacity>
);
}
function sortData(foods) {
const VALUE = get(SORT_DATA, get(filters, "sort"));
switch (VALUE) {
case SORT_DATA.NameAsc:
return foods.sort((a, b) =>
a.title.toLowerCase() > b.title.toLowerCase() ? 1 : -1
);
case SORT_DATA.NameDesc:
return foods.sort((a, b) =>
a.title.toLowerCase() < b.title.toLowerCase() ? 1 : -1
);
case SORT_DATA.PriceAsc:
return foods.sort((a, b) =>
a.variations[0].price > b.variations[0].price ? 1 : -1
);
case SORT_DATA.PriceDesc:
return foods.sort((a, b) =>
a.variations[0].price < b.variations[0].price ? 1 : -1
);
default:
return foods.sort((a, b) => (a.img_url < b.img_url ? 1 : -1));
}
}
const setFilterss = (filterObj) => {
setFilters(filterObj);
};
function emptyView() {
if (loading) {
return <Spinner />;
} else if (error) {
return (
<TextError
text={error ? error.message : "No Foods"}
backColor="transparent"
/>
);
} else {
return (
<View style={styles.emptyContainer}>
<EmptyFood width={scale(250)} height={scale(250)} />
<TextDefault H4 bold style={alignment.MTlarge}>
No food item found
</TextDefault>
</View>
);
}
}
function renderListHeader() {
return (
<View style={styles.backgroundImageContainer}>
<ImageBackground
style={styles.backgroundImage}
borderRadius={moderateScale(20)}
source={
imgMenu
? { uri: imgMenu }
: require("../../assets/images/food_placeholder.png")
}
>
<View style={styles.shadeContainer}></View>
<View style={styles.backgroundImageTextContainer}>
<TextDefault
numberOfLines={1}
textColor={styles.whiteFont.color}
H4
bolder
>
{title}
</TextDefault>
<TextDefault
numberOfLines={1}
textColor={styles.whiteFont.color}
bold
>
{description}
</TextDefault>
</View>
</ImageBackground>
</View>
);
}
return (
<WrapperView>
<View style={[styles.flex]}>
<FlatList
style={styles.flex}
contentContainerStyle={styles.contentContaienr}
showsVerticalScrollIndicator={false}
ListHeaderComponent={renderListHeader()}
keyExtractor={(item, index) => String(index)}
ListEmptyComponent={emptyView}
data={loading ? [] : error ? [] : sortData(data.foodByCategory)}
refreshing={networkStatus === 4}
onRefresh={() =>
refetch({
variables: { category: _id, ...filters },
})
}
renderItem={({ item }) => renderGridCards(item)}
/>
</View>
<Modalize
ref={modalizeRef}
adjustToContentHeight
handlePosition="inside"
modalTopOffset={headerHeight}
avoidKeyboardLikeIOS={Platform.select({
ios: true,
android: false,
})}
keyboardAvoidingOffset={2}
keyboardAvoidingBehavior="height"
>
<FilterModal
filterObj={filters}
setFilters={setFilterss}
closeFilterModal={closeModal}
/>
</Modalize>
</WrapperView>
);
}
export default MenuItems;

View File

@ -1,198 +0,0 @@
import { useApolloClient } from "@apollo/react-hooks";
import { useNavigation, useTheme } from "@react-navigation/native";
import React, { useContext, useLayoutEffect } from "react";
import { FlatList, TouchableOpacity, View } from "react-native";
import uuid from "uuid";
import i18n from "../../../i18n";
import EmptyOrder from "../../assets/images/SVG/imageComponents/EmptyOrder";
import {
ActiveOrders,
CustomIcon,
EnategaImage,
Spinner,
TextDefault,
TextError,
WrapperView,
} from "../../components";
import ConfigurationContext from "../../context/Configuration";
import UserContext from "../../context/User";
import { alignment } from "../../utils/alignment";
import { ICONS_NAME, NAVIGATION_SCREEN } from "../../utils/constant";
import { scale } from "../../utils/scaling";
import useStyle from "./style";
const orderStatusActive = ["PENDING", "PICKED", "ACCEPTED"];
const orderStatusInactive = ["DELIVERED", "COMPLETED"];
function MyOrders() {
const styles = useStyle();
const { colors } = useTheme();
const client = useApolloClient();
const navigation = useNavigation();
const configuration = useContext(ConfigurationContext);
const {
orders,
loadingOrders,
errorOrders,
fetchOrders,
fetchMoreOrdersFunc,
networkStatusOrders,
updateCart,
} = useContext(UserContext);
useLayoutEffect(() => {
navigation.setOptions({
headerTitle: i18n.t("titleOrders"),
headerRight: null,
});
}, [navigation]);
// add items to cart and navigate to cart screen
async function onReOrder({ order }) {
const data = {
cartItems: order.items.map((item) => {
return {
...item.food,
key: uuid.v4(),
__typename: "CartItem",
variation: {
__typename: "ItemVariation",
_id: item.variation._id,
},
quantity: item.quantity,
addons: item.addons.map((addon) => ({
...addon,
__typename: "ItemAddon",
options: addon.options.map(({ _id }) => ({
_id,
__typename: "ItemOption",
})),
})),
};
}),
};
await updateCart(data.cartItems);
navigation.navigate(NAVIGATION_SCREEN.Cart);
}
function emptyView() {
if (loadingOrders) return <Spinner visible={loadingOrders} />;
if (errorOrders) return <TextError text={errorOrders.message} />;
else {
return (
<View style={styles.subContainerImage}>
<View style={styles.imageContainer}>
<EmptyOrder width={scale(250)} height={scale(250)} />
</View>
<View style={styles.descriptionEmpty}>
<TextDefault bolder center H4>
No Orders Found
</TextDefault>
</View>
<TouchableOpacity
activeOpacity={0.7}
style={styles.emptyButton}
onPress={() => navigation.navigate(NAVIGATION_SCREEN.Menu)}
>
<TextDefault textColor={colors.buttonText} bold H5 center>
Start Shopping
</TextDefault>
</TouchableOpacity>
</View>
);
}
}
return (
<WrapperView>
<FlatList
data={
loadingOrders || errorOrders
? []
: orders.filter((o) => orderStatusInactive.includes(o.order_status))
}
style={styles.container}
contentContainerStyle={styles.contentContainer}
ListEmptyComponent={emptyView()}
ListHeaderComponent={
<ActiveOrders
navigation={navigation}
activeOrders={orders.filter((o) =>
orderStatusActive.includes(o.order_status)
)}
pastOrders={orders.filter((o) =>
orderStatusInactive.includes(o.order_status)
)}
loading={loadingOrders}
error={errorOrders}
/>
}
//keyExtractor={(item) => item._id}
keyExtractor={(item, index) => String(index)}
refreshing={networkStatusOrders === 4}
onRefresh={() => networkStatusOrders === 7 && fetchOrders()}
renderItem={({ item }) => (
<TouchableOpacity
activeOpacity={0.7}
onPress={() =>
navigation.navigate(NAVIGATION_SCREEN.OrderDetail, {
_id: item._id,
currency_symbol: configuration.currency_symbol,
})
}
>
<View style={styles.subContainer}>
<View style={styles.imgContainer}>
<EnategaImage
imgStyle={styles.imgResponsive}
source={{ uri: item.items[0].food.img_url }}
spinnerProps={{ style: styles.loadingView }}
/>
</View>
<View style={styles.infoContainer}>
<TextDefault H5 bold style={alignment.MBxSmall}>
{"ID: "}
{item.order_id}
</TextDefault>
<TextDefault line={3} textColor={colors.tagColor} H5 medium>
{configuration.currency_symbol}
{item.order_amount}
{/* {item.order_status === 'PENDING'
? "We're asking the restaurant how long it will take to deliver your food."
: 'The restaurant rider will be at your place around.'} */}
</TextDefault>
</View>
<View style={styles.Vline} />
<TouchableOpacity
activeOpacity={0.8}
onPress={() => onReOrder({ order: item, client })}
style={styles.subContainerRight}
>
<View>
<View style={{ alignSelf: "center" }}>
<CustomIcon
name={ICONS_NAME.Refresh}
size={scale(28)}
color={colors.text}
/>
</View>
<TextDefault
textColor={colors.text}
style={alignment.MTxSmall}
bold
center
>
{"Re-Order"}
</TextDefault>
</View>
</TouchableOpacity>
</View>
</TouchableOpacity>
)}
onEndReached={fetchMoreOrdersFunc}
/>
</WrapperView>
);
}
export default MyOrders;

View File

@ -1,328 +0,0 @@
import { useMutation } from "@apollo/react-hooks";
import AsyncStorage from "@react-native-async-storage/async-storage";
import { useNavigation, useTheme } from "@react-navigation/native";
import Constants from "expo-constants";
import * as Device from "expo-device";
import * as Localization from "expo-localization";
import * as Notifications from "expo-notifications";
import * as Updates from "expo-updates";
import gql from "graphql-tag";
import React, { useContext, useEffect, useRef, useState } from "react";
import {
AppState,
Linking,
Platform,
StyleSheet,
TouchableOpacity,
View,
} from "react-native";
import { Modalize } from "react-native-modalize";
import i18n from "../../../i18n";
import {
profile,
pushToken,
updateNotificationStatus,
} from "../../apollo/server";
import {
CustomIcon,
FlashMessage,
Spinner,
TextDefault,
WrapperView,
} from "../../components";
import SwitchBtn from "../../components/FdSwitch/SwitchBtn";
import UserContext from "../../context/User";
import { alignment } from "../../utils/alignment";
import { ICONS_NAME } from "../../utils/constant";
import { scale } from "../../utils/scaling";
import SettingModal from "./components/SettingModal";
import useStyle from "./styles";
const languageTypes = [
{ value: "English", code: "en", index: 0 },
{ value: "français", code: "fr", index: 1 },
{ value: "ភាសាខ្មែរ", code: "km", index: 2 },
{ value: "中文", code: "zh", index: 3 },
{ value: "Deutsche", code: "de", index: 4 },
];
const PUSH_TOKEN = gql`
${pushToken}
`;
const UPDATE_NOTIFICATION_TOKEN = gql`
${updateNotificationStatus}
`;
const PROFILE = gql`
${profile}
`;
function Settings() {
const styles = useStyle();
const { colors } = useTheme();
const navigation = useNavigation();
const { profile } = useContext(UserContext);
const [languageName, languageNameSetter] = useState("English");
const [offerNotification, offerNotificationSetter] = useState(
profile.is_offer_notification
);
const [orderNotification, orderNotificationSetter] = useState(
profile.is_order_notification
);
const [activeRadio, activeRadioSetter] = useState(languageTypes[0].index);
// eslint-disable-next-line no-unused-vars
const [appState, setAppState] = useState(AppState.currentState);
const [uploadToken] = useMutation(PUSH_TOKEN);
const [mutate, { loading }] = useMutation(UPDATE_NOTIFICATION_TOKEN, {
onCompleted,
onError,
refetchQueries: [{ query: PROFILE }],
});
const modalizeRef = useRef(null);
useEffect(() => {
navigation.setOptions({
headerTitle: i18n.t("titleSettings"),
headerRight: null,
});
selectLanguage();
checkPermission();
}, [navigation]);
const _handleAppStateChange = async (nextAppState) => {
if (nextAppState === "active") {
let token = null;
const permission = await getPermission();
if (permission === "granted") {
if (!profile.notificationToken) {
token = (await Notifications.getExpoPushTokenAsync()).data;
uploadToken({ variables: { token } });
}
offerNotificationSetter(profile.is_offer_notification);
orderNotificationSetter(profile.is_order_notification);
} else {
offerNotificationSetter(false);
orderNotificationSetter(false);
}
}
setAppState(nextAppState);
};
useEffect(() => {
AppState.addEventListener("change", _handleAppStateChange);
return () => {
AppState.remove("change", _handleAppStateChange);
};
}, []);
async function checkPermission() {
const permission = await getPermission();
if (permission !== "granted") {
offerNotificationSetter(false);
orderNotificationSetter(false);
} else {
offerNotificationSetter(profile.is_offer_notification);
orderNotificationSetter(profile.is_order_notification);
}
}
async function getPermission() {
const { status } = await Notifications.getPermissionsAsync();
return status;
}
async function selectLanguage() {
const lang = await AsyncStorage.getItem("enatega-language");
if (lang) {
const defLang = languageTypes.findIndex((el) => el.code === lang);
const langName = languageTypes[defLang].value;
activeRadioSetter(defLang);
languageNameSetter(langName);
}
}
const onSelectedLanguage = async (active) => {
const languageInd = active;
if (Platform.OS === "android") {
const localization = await Localization.getLocalizationAsync();
localization.locale = languageTypes[languageInd].code;
await AsyncStorage.setItem(
"enatega-language",
languageTypes[languageInd].code
);
Updates.reloadAsync();
}
};
const onClose = () => {
modalizeRef.current.close();
};
function onCompleted() {
FlashMessage({
message: "Notification Status Updated",
});
}
function onError(error) {
try {
FlashMessage({
message: error.networkError.result.errors[0].message,
});
} catch (err) {}
}
async function updateNotificationStatus(notificationCheck) {
let orderNotify, offerNotify;
if (!Device.isDevice) {
FlashMessage({
message: "Notification do not work on simulator",
});
return;
}
const permission = await getPermission();
if (!profile.notificationToken || permission !== "granted") {
Linking.openSettings();
}
if (notificationCheck === "offer") {
offerNotificationSetter(!offerNotification);
orderNotify = orderNotification;
offerNotify = !offerNotification;
}
if (notificationCheck === "order") {
orderNotificationSetter(!orderNotification);
orderNotify = !orderNotification;
offerNotify = offerNotification;
}
mutate({
variables: {
offerNotification: offerNotify,
orderNotification: orderNotify,
},
});
}
return (
<WrapperView>
{loading && (
<View style={{ ...StyleSheet.absoluteFill }}>
<Spinner />
</View>
)}
<View style={[styles.flex, styles.mainContainer]}>
<View style={alignment.Plarge}>
{Platform.OS === "android" && (
<View style={[styles.languageContainer, styles.shadow]}>
<View style={styles.changeLanguage}>
<View style={styles.headingLanguage}>
<TextDefault
numberOfLines={1}
textColor={colors.fontSecondColor}
medium
H5
>
Language
</TextDefault>
<TextDefault medium H5>
({languageName})
</TextDefault>
</View>
<TouchableOpacity
activeOpacity={0.5}
onPress={() => modalizeRef.current.open("top")}
style={styles.button}
>
<CustomIcon
name={ICONS_NAME.Pencil}
size={scale(22)}
color={colors.fontMainColor}
/>
</TouchableOpacity>
</View>
</View>
)}
<TouchableOpacity
activeOpacity={0.7}
onPress={() => {
updateNotificationStatus("offer");
}}
style={[styles.notificationContainer, styles.shadow]}
>
<View style={styles.notificationChekboxContainer}>
<TextDefault
numberOfLines={1}
textColor={colors.statusSecondColor}
>
{" "}
Receive Special Offers{" "}
</TextDefault>
<SwitchBtn
isEnabled={offerNotification}
onPress={() => {
updateNotificationStatus("offer");
}}
/>
</View>
</TouchableOpacity>
<TouchableOpacity
activeOpacity={0.7}
onPress={() => {
updateNotificationStatus("order");
}}
style={[styles.notificationContainer, styles.shadow]}
>
<View style={styles.notificationChekboxContainer}>
<TextDefault
numberOfLines={1}
textColor={colors.statusSecondColor}
>
{" "}
Get updates on your order status!{" "}
</TextDefault>
<SwitchBtn
isEnabled={orderNotification}
onPress={() => {
updateNotificationStatus("order");
}}
/>
</View>
</TouchableOpacity>
<View style={styles.versionContainer}>
<TextDefault textColor={colors.fontSecondColor}>
Version: {Constants.manifest.version}
</TextDefault>
</View>
</View>
</View>
<TextDefault
textColor={colors.fontSecondColor}
style={alignment.MBsmall}
center
>
All rights are reserved by Enatega
</TextDefault>
{/* Modal for language Changes */}
<Modalize
ref={modalizeRef}
adjustToContentHeight
handlePosition="inside"
avoidKeyboardLikeIOS={Platform.select({
ios: true,
android: false,
})}
keyboardAvoidingOffset={2}
keyboardAvoidingBehavior="height"
>
<SettingModal
onClose={onClose}
onSelectedLanguage={onSelectedLanguage}
activeRadio={activeRadio}
/>
</Modalize>
</WrapperView>
);
}
export default Settings;

View File

@ -1,66 +0,0 @@
import * as Amplitude from "@amplitude/analytics-react-native";
import { normalizeTrackingOptions } from "./analyticsUtils";
import getEnvVars from "../../environment";
import { getTrackingPermissions } from "./useAppTrackingTransparency";
const { AMPLITUDE_API_KEY } = getEnvVars();
let isInitialized = false;
export const events = {
USER_LOGGED_IN: "USER_LOGGED_IN",
USER_LOGGED_OUT: "USER_LOGGED_OUT",
USER_CREATED_ACCOUNT: "USER_CREATED_ACCOUNT",
// USER_RESET_PASSWORD: 'USER_RESET_PASSWORD',
// USER_LINKED_SOCIAL: 'USER_LINKED_SOCIAL',
// USER_UPDATED_EMAIL: 'USER_UPDATED_EMAIL',
// USER_UPDATED_PROFILE: 'USER_UPDATED_PROFILE',
// USER_UPDATED_LINKS: 'USER_UPDATED_SOCIAL_LINKS',
// USER_UPDATED_LIKE: 'USER_UPDATED_LIKE',
// USER_UPDATED_PRIVACY: 'USER_UPDATED_PRIVACY',
// USER_REMOVED_PROJECT: 'USER_REMOVED_PROJECT',
// USER_OPENED_CREATION: 'USER_OPENED_CREATION',
// USER_UPDATED_SETTINGS: 'USER_UPDATED_SETTINGS',
USER_PLACED_ORDER: "USER_PLACED_ORDER",
};
export async function initialize() {
const trackingStatus = await getTrackingPermissions();
if (isInitialized || !AMPLITUDE_API_KEY || trackingStatus !== "granted") {
return;
}
Amplitude.init(AMPLITUDE_API_KEY);
isInitialized = true;
}
export async function identify(id, options) {
initialize();
const properties = normalizeTrackingOptions(options);
if (properties) {
Amplitude.Identify(properties);
//await Amplitude.setUserPropertiesAsync(properties)
} else {
//await Amplitude.clearUserPropertiesAsync()
const identifyObj = new Amplitude.Identify();
identifyObj.remove(properties);
Amplitude.Identify(identifyObj);
}
}
export async function track(event, options) {
initialize();
const properties = normalizeTrackingOptions(options);
if (properties) {
Amplitude.track(event, properties);
} else {
Amplitude.track(event);
}
}
export default {
events,
initialize,
identify,
track,
};

View File

@ -1,35 +0,0 @@
// packages
import { BackHandler, Alert } from "react-native";
/**
* Attaches an event listener that handles the android-only hardware
* back button
* @param {Function} callback The function to call on click
*/
const handleAndroidBackButton = (callback) => {
BackHandler.addEventListener("hardwareBackPress", () => {
callback();
return true;
});
};
/**
* Removes the event listener in order not to add a new one
* every time the view component re-mounts
*/
const removeAndroidBackButtonHandler = () => {
// BackHandler.removeEventListener('hardwareBackPress')
BackHandler.remove("hardwareBackPress");
};
const exitAlert = () => {
Alert.alert("Confirm exit", "Do you want to quit the app?", [
{ text: "CANCEL", style: "cancel" },
{
text: "OK",
onPress: () => {
BackHandler.exitApp();
},
},
]);
return true;
};
export { handleAndroidBackButton, removeAndroidBackButtonHandler, exitAlert };

View File

@ -1,7 +1,7 @@
{ {
"expo": { "expo": {
"name": "Enatega", "name": "Enatega",
"version": "1.0.18", "version": "1.0.21",
"scheme": "enategasinglevendor", "scheme": "enategasinglevendor",
"description": "Enatega is a starter kit food ordering app built in React Native using Expo for IOS and Android. It's made keeping good aesthetics in mind as well keeping the best coding practices in mind. Its fully customisable to easily help you in your next food delivery project. https://market.nativebase.io/view/react-native-food-delivery-backend-app", "description": "Enatega is a starter kit food ordering app built in React Native using Expo for IOS and Android. It's made keeping good aesthetics in mind as well keeping the best coding practices in mind. Its fully customisable to easily help you in your next food delivery project. https://market.nativebase.io/view/react-native-food-delivery-backend-app",
"slug": "enategasinglevendor", "slug": "enategasinglevendor",
@ -46,12 +46,12 @@
"androidCollapsedTitle": "Enatega" "androidCollapsedTitle": "Enatega"
}, },
"android": { "android": {
"versionCode": 23, "versionCode": 25,
"package": "com.enatega.vendor", "package": "com.enatega.vendor",
"googleServicesFile": "./google-services-prod.json", "googleServicesFile": "./google-services-prod.json",
"config": { "config": {
"googleMaps": { "googleMaps": {
"apiKey": "" "apiKey": "AIzaSyCzNP5qQql2a5y8lOoO-1yj1lj_tzjVImA"
} }
}, },
"adaptiveIcon": { "adaptiveIcon": {

View File

@ -7,9 +7,11 @@ import Constants from "expo-constants";
const ENV = { const ENV = {
development: { development: {
GRAPHQL_URL: "http://10.97.28.88.90:8000/graphql", GRAPHQL_URL: "https://enatega-singlevendor.up.railway.app/graphql",
WS_GRAPHQL_URL: "ws://10.97.28.88.90:8000/graphql", WS_GRAPHQL_URL: "wss://enatega-singlevendor.up.railway.app/graphql",
SERVER_URL: "http://10.97.28.88.90:8000/", // put / at the end of server url SERVER_URL: "https://enatega-singlevendor.up.railway.app/",
Expo_CLIENT_ID_GOOGLE:
"630195385603-82e52jpb722a8l0huhkspq3tqh2d6r6f.apps.googleusercontent.com",
IOS_CLIENT_ID_GOOGLE: IOS_CLIENT_ID_GOOGLE:
"967541328677-uq7f7odvmeea2pb2sq0l7q320ds86536.apps.googleusercontent.com", "967541328677-uq7f7odvmeea2pb2sq0l7q320ds86536.apps.googleusercontent.com",
ANDROID_CLIENT_ID_GOOGLE: ANDROID_CLIENT_ID_GOOGLE:
@ -21,9 +23,9 @@ const ENV = {
STRIPE_STORE_NAME: "Enatega", STRIPE_STORE_NAME: "Enatega",
}, },
staging: { staging: {
GRAPHQL_URL: "https://staging-enatega-single-api.herokuapp.com/graphql", GRAPHQL_URL: "https://enatega-singlevendor.up.railway.app/graphql",
WS_GRAPHQL_URL: "wss://staging-enatega-single-api.herokuapp.com/graphql", WS_GRAPHQL_URL: "wss://enatega-singlevendor.up.railway.app/graphql",
SERVER_URL: "https://staging-enatega-single-api.herokuapp.com/", // put / at the end of server url SERVER_URL: "https://enatega-singlevendor.up.railway.app/", // put / at the end of server url
IOS_CLIENT_ID_GOOGLE: IOS_CLIENT_ID_GOOGLE:
"967541328677-nf8h4ou7rhmq9fahs87p057rggo95eah.apps.googleusercontent.com", "967541328677-nf8h4ou7rhmq9fahs87p057rggo95eah.apps.googleusercontent.com",
ANDROID_CLIENT_ID_GOOGLE: ANDROID_CLIENT_ID_GOOGLE:
@ -36,9 +38,9 @@ const ENV = {
STRIPE_STORE_NAME: "Enatega", STRIPE_STORE_NAME: "Enatega",
}, },
production: { production: {
GRAPHQL_URL: "https://prod-enatega-single-api.herokuapp.com/graphql", GRAPHQL_URL: "https://enatega-singlevendor.up.railway.app/graphql",
WS_GRAPHQL_URL: "wss://prod-enatega-single-api.herokuapp.com/graphql", WS_GRAPHQL_URL: "wss://enatega-singlevendor.up.railway.app/graphql",
SERVER_URL: "https://prod-enatega-single-api.herokuapp.com/", // put / at the end of server url SERVER_URL: "https://enatega-singlevendor.up.railway.app/", // put / at the end of server url
IOS_CLIENT_ID_GOOGLE: IOS_CLIENT_ID_GOOGLE:
"94983896797-irt6u2cmq2sjcp7j1rj9m9pqptjd12ue.apps.googleusercontent.com", "94983896797-irt6u2cmq2sjcp7j1rj9m9pqptjd12ue.apps.googleusercontent.com",
ANDROID_CLIENT_ID_GOOGLE: ANDROID_CLIENT_ID_GOOGLE:

View File

@ -0,0 +1,12 @@
{
"type": "service_account",
"project_id": "pc-api-8741271665364646084-744",
"private_key_id": "ac6cf3caa3f03a39b82511e6cf118e0f4349f204",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCYl3+dsZuMKn8K\nqYyae5IH4ax4JbTsOipt8XTG1MQpEh2kt2oxCYi64WPWxI6waOyORo+v+IEQRbuG\nH5gaD4mGsXEsxIPhJg3lTui+FeWmglZBEe/jI7GeVqGpi/yd/pPbEqP7kJJPQWvK\nIa6PmqiLR6TMCHBm7xJ/+etvKn9sKURtxTaIgs3wZPdH8noNeP2eL3KRuB2hiFNO\ngfVAb0clCMNPPuqQoXHbowfiuFZwoquoX2lbZC3npl19dZJs2H5l7ea/zrwIU+x/\nKTKZazN9jdjElLGbfxvmb8yhuuGOXBHVOmGAITg09b1ALICGv3p2QJEPuTgfahsn\nkZmYAORvAgMBAAECggEAM82S9I08Wmx+7ra61iNHY0eZDrz2XBAvIV4MoAfRhIPy\n7l2aPoWXFqK4C0x1iKxGStLnqvz5i/WwgQsuzwIhVUneOy2H/CK4KvYMC6RRb6Ll\n93dIcltGzJNqlK3CmDy6I3CDnT7qfN+f4WJn6ba+q3IqH15qEnftVucYp4fM9IHT\n1hmKFPtPsaEsnA2VVw1lvYTWhH89lz9bJPLgMllzYJ+p/qHQDsyIdVTEVTLBniDa\ne7SOKA8P3c+jIcXQldH/4BFen4aYThHO8zcG+bj3IX5gOxrg2QrqNxRp04Lqymr0\nDsCTLaChwmGTAi+AYw84uYzDWHKDQD+yZLmXXpaOyQKBgQDHhaJmbcA4rkNYvTkr\nPQ+al8bX91xUDSDqkvJAFbUU9raZrnxiVO5MvxDMRrQAEyz4qj70RrLx2bjghRn0\nQlPewH6nSWzoRe/LE+ixXbzND1sMsK2l3N5jGD9/Y7WjhcYmHttAYNuhlw4lYh2e\nD0IQ0KIdmkXzH+hA0LsAjP584wKBgQDDyRCqZ4k3mVxg3cvCWfWCy2AfnCr0UcLS\nIwkqLoRT0vNDr5ritd15G6L6Z5IqAp/6KcfWtAy+ZbmnV6/Tvitolq5OGXTBuLmE\ncMN//kv0j3rXG0nH0yhRmG+wqurg12xAZqNoV8H0JmjcNIJmTyGBEIdBfym/sNQx\n5WNRF9P8BQKBgQCgmWBvMkhXV22+MBGkTDITLbhQfjtDLI4iQsXb750ikrPIYDqe\nq95kyCatRvv8U3MPdXnXBlFjeuzlTD3n7ruzwR4xaVjQXfr2a8ARhHJEXOfc/xnH\nOFGJUitKTugWB8fHR28UEuK23u/0B1XvtDhpcIYNbfCAEl7QTTM47kSqIQKBgFhV\nonhP6IA2aJCn4aQZtITDv+XjLxo2vYDUH/FxNXEgj3NtiqNZTMi0qG70ReVAc++J\n5ElByTIqcX5IOON/PNSej5xbLeutrb5MplhcYua/ybu96ycGZX2TGmmKZBj3+TaB\nWJ7eYXsHzW31HxSMBWDXFT9+4VZEsSimB45yAsoFAoGAWcqPXt9j6MfTuA2JGuw6\nbKLuXC4JT/Mhte0S7X5WuiKTV5CRwHYRVgyVFO69PMR4pmsmi5OHxpii9fBimgGi\nTeSwYCjrrqj2hKlPOTKDpbowNBKomDGBnLESc7uiTXlmKVLvjQTg/gxwrhjDRkSm\ndRhJ6ccoldcoZFAq1hBlajI=\n-----END PRIVATE KEY-----\n",
"client_email": "android-playstore-eas@pc-api-8741271665364646084-744.iam.gserviceaccount.com",
"client_id": "115125915270931853179",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/android-playstore-eas%40pc-api-8741271665364646084-744.iam.gserviceaccount.com"
}

View File

@ -31,6 +31,7 @@
"apollo-utilities": "^1.3.4", "apollo-utilities": "^1.3.4",
"deprecated-react-native-prop-types": "^4.0.0", "deprecated-react-native-prop-types": "^4.0.0",
"expo": "^47.0.12", "expo": "^47.0.12",
"expo-app-auth": "~11.1.0",
"expo-app-loading": "~2.1.1", "expo-app-loading": "~2.1.1",
"expo-apple-authentication": "~5.0.1", "expo-apple-authentication": "~5.0.1",
"expo-application": "~5.0.1", "expo-application": "~5.0.1",
@ -2141,9 +2142,9 @@
} }
}, },
"node_modules/@eslint-community/eslint-utils": { "node_modules/@eslint-community/eslint-utils": {
"version": "4.3.0", "version": "4.4.0",
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.3.0.tgz", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz",
"integrity": "sha512-v3oplH6FYCULtFuCeqyuTd9D2WKO937Dxdq+GmHOLL72TTRriLxz2VLlNfkZRsvj6PKnOPAtuT6dwrs/pA5DvA==", "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"eslint-visitor-keys": "^3.3.0" "eslint-visitor-keys": "^3.3.0"
@ -2156,9 +2157,9 @@
} }
}, },
"node_modules/@eslint-community/regexpp": { "node_modules/@eslint-community/regexpp": {
"version": "4.4.0", "version": "4.4.1",
"resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.4.0.tgz", "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.4.1.tgz",
"integrity": "sha512-A9983Q0LnDGdLPjxyXQ00sbV+K+O+ko2Dr+CZigbHWtX9pNfxlaBkMR8X1CztI73zuEyEBXTVjx7CE+/VSwDiQ==", "integrity": "sha512-BISJ6ZE4xQsuL/FmsyRaiffpq977bMlsKfGHTQrOGFErfByxIe6iZTxPf/00Zon9b9a7iUykfQwejN3s2ZW/Bw==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": "^12.0.0 || ^14.0.0 || >=16.0.0" "node": "^12.0.0 || ^14.0.0 || >=16.0.0"
@ -6033,9 +6034,9 @@
"dev": true "dev": true
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "18.15.3", "version": "18.15.7",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.3.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.7.tgz",
"integrity": "sha512-p6ua9zBxz5otCmbpb5D3U4B5Nanw6Pk3PPyX05xnxbB/fRv71N7CPmORg7uAD5P70T0xmx1pzAx/FUfa5X+3cw==" "integrity": "sha512-LFmUbFunqmBn26wJZgZPYZPrDR1RwGOu2v79Mgcka1ndO6V0/cwjivPTc4yoK6n9kmw4/ls1r8cLrvh2iMibFA=="
}, },
"node_modules/@types/prettier": { "node_modules/@types/prettier": {
"version": "2.7.2", "version": "2.7.2",
@ -6064,9 +6065,9 @@
} }
}, },
"node_modules/@types/scheduler": { "node_modules/@types/scheduler": {
"version": "0.16.2", "version": "0.16.3",
"resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz", "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.3.tgz",
"integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==" "integrity": "sha512-5cJ8CB4yAx7BH1oMvdU0Jh9lrEXyPkar6F9G/ERswkCuvP4KQZfZkSjcMbAICCpQTN4OuZn8tz0HiKv9TGZgrQ=="
}, },
"node_modules/@types/stack-utils": { "node_modules/@types/stack-utils": {
"version": "2.0.1", "version": "2.0.1",
@ -6075,9 +6076,9 @@
"dev": true "dev": true
}, },
"node_modules/@types/yargs": { "node_modules/@types/yargs": {
"version": "17.0.22", "version": "17.0.23",
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.22.tgz", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.23.tgz",
"integrity": "sha512-pet5WJ9U8yPVRhkwuEIp5ktAeAqRZOq4UdAyWLWzxbtpyXnzbtLdKiXAjJzi/KLmPGS9wk86lUFWZFN6sISo4g==", "integrity": "sha512-yuogunc04OnzGQCrfHx+Kk883Q4X0aSwmYZhKjI21m+SVYzjIbrWl8dOOwSv5hf2Um2pdCOXWo9isteZTNXUZQ==",
"dependencies": { "dependencies": {
"@types/yargs-parser": "*" "@types/yargs-parser": "*"
} }
@ -8248,9 +8249,9 @@
} }
}, },
"node_modules/caniuse-lite": { "node_modules/caniuse-lite": {
"version": "1.0.30001468", "version": "1.0.30001469",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001468.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001469.tgz",
"integrity": "sha512-zgAo8D5kbOyUcRAgSmgyuvBkjrGk5CGYG5TYgFdpQv+ywcyEpo1LOWoG8YmoflGnh+V+UsNuKYedsoYs0hzV5A==", "integrity": "sha512-Rcp7221ScNqQPP3W+lVOYDyjdR6dC+neEQCttoNr5bAyz54AboB4iwpnWgyi8P4YUsPybVzT4LgWiBbI3drL4g==",
"funding": [ "funding": [
{ {
"type": "opencollective", "type": "opencollective",
@ -9278,9 +9279,9 @@
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
}, },
"node_modules/electron-to-chromium": { "node_modules/electron-to-chromium": {
"version": "1.4.333", "version": "1.4.339",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.333.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.339.tgz",
"integrity": "sha512-YyE8+GKyGtPEP1/kpvqsdhD6rA/TP1DUFDN4uiU/YI52NzDxmwHkEb3qjId8hLBa5siJvG0sfC3O66501jMruQ==" "integrity": "sha512-MSXHBJGcbBydq/DQDlpBeUKnJ6C7aTiNCTRpfDV5Iz0sNr/Ng6RJFloq82AAicp/SrmDq4zF6XsKG0B8Xwn1UQ=="
}, },
"node_modules/emittery": { "node_modules/emittery": {
"version": "0.13.1", "version": "0.13.1",
@ -10383,6 +10384,249 @@
"expo-error-recovery": "~4.0.1" "expo-error-recovery": "~4.0.1"
} }
}, },
"node_modules/expo-app-auth": {
"version": "11.1.1",
"resolved": "https://registry.npmjs.org/expo-app-auth/-/expo-app-auth-11.1.1.tgz",
"integrity": "sha512-BYsVJ54GySnpVjRLmUX//XkDkqlqigpOS+MWBARURecPu038Ei2tsIsboLqbaa6oyoWhtU9OfYacVHczE/BFmQ==",
"deprecated": "Please migrate to expo-auth-session",
"dependencies": {
"@expo/config-plugins": "^4.0.2",
"invariant": "^2.2.4"
},
"peerDependencies": {
"expo": "*"
}
},
"node_modules/expo-app-auth/node_modules/@babel/code-frame": {
"version": "7.10.4",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz",
"integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==",
"dependencies": {
"@babel/highlight": "^7.10.4"
}
},
"node_modules/expo-app-auth/node_modules/@expo/config-plugins": {
"version": "4.1.5",
"resolved": "https://registry.npmjs.org/@expo/config-plugins/-/config-plugins-4.1.5.tgz",
"integrity": "sha512-RVvU40RtZt12HavuDAe+LDIq9lHj7sheOfMEHdmpJ/uTA8pgvkbc56XF6JHQD+yRr6+uhhb+JnAasGq49dsQbw==",
"dependencies": {
"@expo/config-types": "^45.0.0",
"@expo/json-file": "8.2.36",
"@expo/plist": "0.0.18",
"@expo/sdk-runtime-versions": "^1.0.0",
"@react-native/normalize-color": "^2.0.0",
"chalk": "^4.1.2",
"debug": "^4.3.1",
"find-up": "~5.0.0",
"getenv": "^1.0.0",
"glob": "7.1.6",
"resolve-from": "^5.0.0",
"semver": "^7.3.5",
"slash": "^3.0.0",
"xcode": "^3.0.1",
"xml2js": "0.4.23"
}
},
"node_modules/expo-app-auth/node_modules/@expo/config-types": {
"version": "45.0.0",
"resolved": "https://registry.npmjs.org/@expo/config-types/-/config-types-45.0.0.tgz",
"integrity": "sha512-/QGhhLWyaGautgEyU50UJr5YqKJix5t77ePTwreOVAhmZH+ff3nrrtYTTnccx+qF08ZNQmfAyYMCD3rQfzpiJA=="
},
"node_modules/expo-app-auth/node_modules/@expo/json-file": {
"version": "8.2.36",
"resolved": "https://registry.npmjs.org/@expo/json-file/-/json-file-8.2.36.tgz",
"integrity": "sha512-tOZfTiIFA5KmMpdW9KF7bc6CFiGjb0xnbieJhTGlHrLL+ps2G0OkqmuZ3pFEXBOMnJYUVpnSy++52LFxvpa5ZQ==",
"dependencies": {
"@babel/code-frame": "~7.10.4",
"json5": "^1.0.1",
"write-file-atomic": "^2.3.0"
}
},
"node_modules/expo-app-auth/node_modules/ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dependencies": {
"color-convert": "^2.0.1"
},
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
}
},
"node_modules/expo-app-auth/node_modules/chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dependencies": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
"node_modules/expo-app-auth/node_modules/color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dependencies": {
"color-name": "~1.1.4"
},
"engines": {
"node": ">=7.0.0"
}
},
"node_modules/expo-app-auth/node_modules/color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
},
"node_modules/expo-app-auth/node_modules/find-up": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
"integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==",
"dependencies": {
"locate-path": "^6.0.0",
"path-exists": "^4.0.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/expo-app-auth/node_modules/glob": {
"version": "7.1.6",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
"integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
"dependencies": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.0.4",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
},
"engines": {
"node": "*"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/expo-app-auth/node_modules/has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"engines": {
"node": ">=8"
}
},
"node_modules/expo-app-auth/node_modules/json5": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz",
"integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==",
"dependencies": {
"minimist": "^1.2.0"
},
"bin": {
"json5": "lib/cli.js"
}
},
"node_modules/expo-app-auth/node_modules/locate-path": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
"integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==",
"dependencies": {
"p-locate": "^5.0.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/expo-app-auth/node_modules/lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"dependencies": {
"yallist": "^4.0.0"
},
"engines": {
"node": ">=10"
}
},
"node_modules/expo-app-auth/node_modules/p-locate": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz",
"integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==",
"dependencies": {
"p-limit": "^3.0.2"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/expo-app-auth/node_modules/path-exists": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
"integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
"engines": {
"node": ">=8"
}
},
"node_modules/expo-app-auth/node_modules/semver": {
"version": "7.3.8",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
"integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
"dependencies": {
"lru-cache": "^6.0.0"
},
"bin": {
"semver": "bin/semver.js"
},
"engines": {
"node": ">=10"
}
},
"node_modules/expo-app-auth/node_modules/supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dependencies": {
"has-flag": "^4.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/expo-app-auth/node_modules/write-file-atomic": {
"version": "2.4.3",
"resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.3.tgz",
"integrity": "sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ==",
"dependencies": {
"graceful-fs": "^4.1.11",
"imurmurhash": "^0.1.4",
"signal-exit": "^3.0.2"
}
},
"node_modules/expo-app-auth/node_modules/yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
},
"node_modules/expo-app-loading": { "node_modules/expo-app-loading": {
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/expo-app-loading/-/expo-app-loading-2.1.1.tgz", "resolved": "https://registry.npmjs.org/expo-app-loading/-/expo-app-loading-2.1.1.tgz",
@ -14846,9 +15090,9 @@
"integrity": "sha512-dZ6Ra7u1G8c4Letq/B5EzAxj4tLFHL+cGtdpR+PVm4yzPDj+lCk+AbivWt1eOM+ikzkowtyV7qSqX6qr3t71Ww==" "integrity": "sha512-dZ6Ra7u1G8c4Letq/B5EzAxj4tLFHL+cGtdpR+PVm4yzPDj+lCk+AbivWt1eOM+ikzkowtyV7qSqX6qr3t71Ww=="
}, },
"node_modules/joi": { "node_modules/joi": {
"version": "17.8.4", "version": "17.9.1",
"resolved": "https://registry.npmjs.org/joi/-/joi-17.8.4.tgz", "resolved": "https://registry.npmjs.org/joi/-/joi-17.9.1.tgz",
"integrity": "sha512-jjdRHb5WtL+KgSHvOULQEPPv4kcl+ixd1ybOFQq3rWLgEEqc03QMmilodL0GVJE14U/SQDXkUhQUSZANGDH/AA==", "integrity": "sha512-FariIi9j6QODKATGBrEX7HZcja8Bsh3rfdGYy/Sb65sGlZWK/QWesU1ghk7aJWDj95knjXlQfSmzFSPPkLVsfw==",
"dependencies": { "dependencies": {
"@hapi/hoek": "^9.0.0", "@hapi/hoek": "^9.0.0",
"@hapi/topo": "^5.0.0", "@hapi/topo": "^5.0.0",
@ -14863,9 +15107,9 @@
"integrity": "sha512-bF7vcQxbODoGK1imE2P9GS9aw4zD0Sd+Hni68IMZLj7zRnquH7dXUmMw9hDI5S/Jzt7q+IyTXN0rSg2GI0IKhQ==" "integrity": "sha512-bF7vcQxbODoGK1imE2P9GS9aw4zD0Sd+Hni68IMZLj7zRnquH7dXUmMw9hDI5S/Jzt7q+IyTXN0rSg2GI0IKhQ=="
}, },
"node_modules/js-sdsl": { "node_modules/js-sdsl": {
"version": "4.3.0", "version": "4.4.0",
"resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.3.0.tgz", "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.4.0.tgz",
"integrity": "sha512-mifzlm2+5nZ+lEcLJMoBK0/IH/bDg8XnJfd/Wq6IP+xoCjLZsTOnV2QpxlVbX9bMnkl5PdEjNtBJ9Cj1NjifhQ==", "integrity": "sha512-FfVSdx6pJ41Oa+CF7RDaFmTnCaFhua+SNYQX74riGOpl96x+2jQCqEfQ2bnXu/5DPCqlRuiqyvTJM0Qjz26IVg==",
"dev": true, "dev": true,
"funding": { "funding": {
"type": "opencollective", "type": "opencollective",
@ -18837,9 +19081,9 @@
} }
}, },
"node_modules/prettier": { "node_modules/prettier": {
"version": "2.8.5", "version": "2.8.7",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.5.tgz", "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.7.tgz",
"integrity": "sha512-3gzuxrHbKUePRBB4ZeU08VNkUcqEHaUaouNt0m7LGP4Hti/NuB07C7PPTM/LkWqXoJYJn2McEo5+kxPNrtQkLQ==", "integrity": "sha512-yPngTo3aXUUmyuTjeTUT75txrf+aMh9FiD7q9ZE/i6r0bPb22g4FsE6Y338PQX1bmfy08i9QQCB7/rcUAVntfw==",
"dev": true, "dev": true,
"bin": { "bin": {
"prettier": "bin-prettier.js" "prettier": "bin-prettier.js"
@ -20273,9 +20517,9 @@
"deprecated": "https://github.com/lydell/resolve-url#deprecated" "deprecated": "https://github.com/lydell/resolve-url#deprecated"
}, },
"node_modules/resolve.exports": { "node_modules/resolve.exports": {
"version": "2.0.1", "version": "2.0.2",
"resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.1.tgz", "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz",
"integrity": "sha512-OEJWVeimw8mgQuj3HfkNl4KqRevH7lzeQNaWRPfx0PPse7Jk6ozcsG4FKVgtzDsC1KUF+YlTHh17NcgHOPykLw==", "integrity": "sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": ">=10" "node": ">=10"
@ -21391,9 +21635,9 @@
} }
}, },
"node_modules/sucrase": { "node_modules/sucrase": {
"version": "3.29.0", "version": "3.30.0",
"resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.29.0.tgz", "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.30.0.tgz",
"integrity": "sha512-bZPAuGA5SdFHuzqIhTAqt9fvNEo9rESqXIG3oiKdF8K4UmkQxC4KlNL3lVyAErXp+mPvUqZ5l13qx6TrDIGf3A==", "integrity": "sha512-7d37d3vLF0IeH2dzvHpzDNDxUqpbDHJXTJOAnQ8jvMW04o2Czps6mxtaSnKWpE+hUS/eczqfWPUgQTrazKZPnQ==",
"dependencies": { "dependencies": {
"commander": "^4.0.0", "commander": "^4.0.0",
"glob": "7.1.6", "glob": "7.1.6",

View File

@ -46,6 +46,7 @@
"deprecated-react-native-prop-types": "^4.0.0", "deprecated-react-native-prop-types": "^4.0.0",
"expo": "^47.0.12", "expo": "^47.0.12",
"expo-app-loading": "~2.1.1", "expo-app-loading": "~2.1.1",
"expo-app-auth": "~11.1.0",
"expo-apple-authentication": "~5.0.1", "expo-apple-authentication": "~5.0.1",
"expo-application": "~5.0.1", "expo-application": "~5.0.1",
"expo-asset": "~8.7.0", "expo-asset": "~8.7.0",

View File

@ -1,92 +1,92 @@
import AsyncStorage from '@react-native-async-storage/async-storage' import AsyncStorage from "@react-native-async-storage/async-storage";
import { defaultDataIdFromObject, InMemoryCache } from 'apollo-cache-inmemory' import { defaultDataIdFromObject, InMemoryCache } from "apollo-cache-inmemory";
import { persistCache } from 'apollo-cache-persist' import { persistCache } from "apollo-cache-persist";
import { ApolloClient } from 'apollo-client' import { ApolloClient } from "apollo-client";
import { ApolloLink, concat, Observable, split } from 'apollo-link' import { ApolloLink, concat, Observable, split } from "apollo-link";
import { createHttpLink } from 'apollo-link-http' import { createHttpLink } from "apollo-link-http";
import { WebSocketLink } from 'apollo-link-ws' import { WebSocketLink } from "apollo-link-ws";
import { getMainDefinition } from 'apollo-utilities' import { getMainDefinition } from "apollo-utilities";
import getEnvVars from '../../environment' import getEnvVars from "../../environment";
const { GRAPHQL_URL, WS_GRAPHQL_URL } = getEnvVars() const { GRAPHQL_URL, WS_GRAPHQL_URL } = getEnvVars();
const cache = new InMemoryCache({ const cache = new InMemoryCache({
dataIdFromObject: object => { dataIdFromObject: (object) => {
switch (object.__typename) { switch (object.__typename) {
case 'CartItem': case "CartItem":
return object.key // use `key` as the primary key return object.key; // use `key` as the primary key
default: default:
return defaultDataIdFromObject(object) // fall back to default handling return defaultDataIdFromObject(object); // fall back to default handling
} }
} },
}) });
const httpLink = createHttpLink({ const httpLink = createHttpLink({
uri: GRAPHQL_URL uri: GRAPHQL_URL,
}) });
const wsLink = new WebSocketLink({ const wsLink = new WebSocketLink({
uri: WS_GRAPHQL_URL, uri: WS_GRAPHQL_URL,
options: { options: {
reconnect: true reconnect: true,
} },
}) });
const request = async operation => {
const token = await AsyncStorage.getItem('token')
const request = async (operation) => {
const token = await AsyncStorage.getItem("token");
console.log("token", token);
operation.setContext({ operation.setContext({
// get the authentication token from local storage if it exists // get the authentication token from local storage if it exists
// return the headers to the context so httpLink can read them // return the headers to the context so httpLink can read them
headers: { headers: {
authorization: token ? `Bearer ${token}` : '' authorization: token ? `Bearer ${token}` : "",
} },
}) });
} };
const requestLink = new ApolloLink( const requestLink = new ApolloLink(
(operation, forward) => (operation, forward) =>
new Observable(observer => { new Observable((observer) => {
// console.log(observer) // console.log(observer)
let handle let handle;
Promise.resolve(operation) Promise.resolve(operation)
.then(oper => request(oper)) .then((oper) => request(oper))
.then(() => { .then(() => {
handle = forward(operation).subscribe({ handle = forward(operation).subscribe({
next: observer.next.bind(observer), next: observer.next.bind(observer),
error: observer.error.bind(observer), error: observer.error.bind(observer),
complete: observer.complete.bind(observer) complete: observer.complete.bind(observer),
});
}) })
}) .catch(observer.error.bind(observer));
.catch(observer.error.bind(observer))
return () => { return () => {
if (handle) handle.unsubscribe() if (handle) handle.unsubscribe();
} };
}) })
) );
const terminatingLink = split(({ query }) => { const terminatingLink = split(({ query }) => {
const { kind, operation } = getMainDefinition(query) const { kind, operation } = getMainDefinition(query);
return kind === 'OperationDefinition' && operation === 'subscription' return kind === "OperationDefinition" && operation === "subscription";
}, wsLink) }, wsLink);
const setupApollo = async () => { const setupApollo = async () => {
await persistCache({ await persistCache({
cache, cache,
storage: AsyncStorage storage: AsyncStorage,
}) });
const client = new ApolloClient({ const client = new ApolloClient({
link: concat(ApolloLink.from([terminatingLink, requestLink]), httpLink), link: concat(ApolloLink.from([terminatingLink, requestLink]), httpLink),
cache, cache,
resolvers: {} resolvers: {},
}) });
// set ref for global use // set ref for global use
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
clientRef = client clientRef = client;
return client return client;
} };
export default setupApollo export default setupApollo;

View File

@ -3,13 +3,14 @@ mutation Login($facebookId:String,$email:String,$password:String,$type:String!,$
login(facebookId:$facebookId,email:$email,password:$password,type:$type,appleId:$appleId,name:$name,notificationToken:$notificationToken){ login(facebookId:$facebookId,email:$email,password:$password,type:$type,appleId:$appleId,name:$name,notificationToken:$notificationToken){
userId userId
token token
is_active
tokenExpiration tokenExpiration
name name
email email
phone phone
} }
} }
` `;
export const categories = ` export const categories = `
{ {
@ -19,7 +20,7 @@ export const categories = `
description description
img_menu img_menu
} }
}` }`;
export const foods = ` export const foods = `
query FoodByCategory($category:String!,$onSale:Boolean,$inStock:Boolean,$min:Float,$max:Float,$search:String){ query FoodByCategory($category:String!,$onSale:Boolean,$inStock:Boolean,$min:Float,$max:Float,$search:String){
@ -50,7 +51,7 @@ query FoodByCategory($category:String!,$onSale:Boolean,$inStock:Boolean,$min:Flo
img_url img_url
stock stock
} }
}` }`;
export const createUser = ` export const createUser = `
mutation CreateUser($facebookId:String,$phone:String,$email:String,$password:String,$name:String,$notificationToken:String,$appleId:String){ mutation CreateUser($facebookId:String,$phone:String,$email:String,$password:String,$name:String,$notificationToken:String,$appleId:String){
@ -71,16 +72,17 @@ export const createUser = `
phone phone
notificationToken notificationToken
} }
}` }`;
export const updateUser = ` export const updateUser = `
mutation UpdateUser($name:String!,$phone:String!){ mutation UpdateUser($name:String!,$phone:String!,$is_active:Boolean!){
updateUser(updateUserInput:{name:$name,phone:$phone}){ updateUser(updateUserInput:{name:$name,phone:$phone,is_active:$is_active}){
_id _id
name name
phone phone
is_active
} }
}` }`;
export const updateNotificationStatus = ` export const updateNotificationStatus = `
mutation UpdateNotificationStatus($offerNotification:Boolean!,$orderNotification:Boolean!){ mutation UpdateNotificationStatus($offerNotification:Boolean!,$orderNotification:Boolean!){
@ -90,7 +92,7 @@ export const updateNotificationStatus = `
is_order_notification is_order_notification
is_offer_notification is_offer_notification
} }
}` }`;
export const profile = ` export const profile = `
query{ query{
profile{ profile{
@ -98,6 +100,8 @@ export const profile = `
name name
phone phone
email email
is_active
notificationToken notificationToken
is_order_notification is_order_notification
is_offer_notification is_offer_notification
@ -111,7 +115,7 @@ export const profile = `
selected selected
} }
} }
}` }`;
export const order = `query Order($id:String!){ export const order = `query Order($id:String!){
order(id:$id){ order(id:$id){
@ -184,7 +188,7 @@ export const order = `query Order($id:String!){
} }
} }
} }
` `;
export const myOrders = `query Orders($offset:Int){ export const myOrders = `query Orders($offset:Int){
orders(offset:$offset){ orders(offset:$offset){
@ -257,7 +261,7 @@ export const myOrders = `query Orders($offset:Int){
} }
} }
} }
` `;
// //
// can we get userId from request instead?? // can we get userId from request instead??
@ -340,7 +344,7 @@ export const orderStatusChanged = `subscription OrderStatusChanged($userId:Strin
} }
} }
} }
` `;
// //
// status queue?? // status queue??
@ -417,7 +421,7 @@ mutation PlaceOrder($orderInput:[OrderInput!]!,$paymentMethod:String!,$couponCod
description description
} }
} }
}` }`;
export const reviewOrder = `mutation ReviewOrder( export const reviewOrder = `mutation ReviewOrder(
$orderId:String!, $orderId:String!,
@ -440,7 +444,7 @@ export const reviewOrder = `mutation ReviewOrder(
updatedAt updatedAt
is_active is_active
} }
}` }`;
// //
// use this to push token instead of login, signup mutation? // use this to push token instead of login, signup mutation?
@ -451,7 +455,7 @@ export const pushToken = `mutation PushToken($token:String!){
_id _id
notificationToken notificationToken
} }
}` }`;
export const getConfiguration = `query Configuration{ export const getConfiguration = `query Configuration{
configuration{ configuration{
@ -460,7 +464,7 @@ export const getConfiguration = `query Configuration{
currency_symbol currency_symbol
delivery_charges delivery_charges
} }
}` }`;
export const foodByIds = `query FoodByIds($ids:[String!]!){ export const foodByIds = `query FoodByIds($ids:[String!]!){
foodByIds(ids: $ids) { foodByIds(ids: $ids) {
@ -492,7 +496,7 @@ export const foodByIds = `query FoodByIds($ids:[String!]!){
} }
} }
} }
}` }`;
export const getCoupon = `mutation Coupon($coupon:String!){ export const getCoupon = `mutation Coupon($coupon:String!){
coupon(coupon:$coupon){ coupon(coupon:$coupon){
@ -501,7 +505,7 @@ export const getCoupon = `mutation Coupon($coupon:String!){
discount discount
enabled enabled
} }
}` }`;
export const deleteAddress = `mutation DeleteAddress($id:ID!){ export const deleteAddress = `mutation DeleteAddress($id:ID!){
deleteAddress(id:$id){ deleteAddress(id:$id){
@ -516,7 +520,7 @@ export const deleteAddress = `mutation DeleteAddress($id:ID!){
selected selected
} }
} }
}` }`;
export const createAddress = `mutation CreateAddress($addressInput:AddressInput!){ export const createAddress = `mutation CreateAddress($addressInput:AddressInput!){
createAddress(addressInput:$addressInput){ createAddress(addressInput:$addressInput){
@ -531,7 +535,7 @@ export const createAddress = `mutation CreateAddress($addressInput:AddressInput!
selected selected
} }
} }
}` }`;
export const editAddress = `mutation EditAddress($addressInput:AddressInput!){ export const editAddress = `mutation EditAddress($addressInput:AddressInput!){
editAddress(addressInput:$addressInput){ editAddress(addressInput:$addressInput){
@ -542,17 +546,17 @@ export const editAddress = `mutation EditAddress($addressInput:AddressInput!){
longitude longitude
latitude latitude
} }
}` }`;
export const changePassword = `mutation ChangePassword($oldPassword:String!,$newPassword:String!){ export const changePassword = `mutation ChangePassword($oldPassword:String!,$newPassword:String!){
changePassword(oldPassword:$oldPassword,newPassword:$newPassword) changePassword(oldPassword:$oldPassword,newPassword:$newPassword)
}` }`;
export const forgotPassword = `mutation ForgotPassword($email:String!){ export const forgotPassword = `mutation ForgotPassword($email:String!){
forgotPassword(email:$email){ forgotPassword(email:$email){
result result
} }
}` }`;
export const selectAddress = `mutation SelectAddress($id:String!){ export const selectAddress = `mutation SelectAddress($id:String!){
selectAddress(id:$id){ selectAddress(id:$id){
@ -567,7 +571,7 @@ export const selectAddress = `mutation SelectAddress($id:String!){
selected selected
} }
} }
}` }`;
export const subscriptionRiderLocation = `subscription SubscriptionRiderLocation($riderId:String!){ export const subscriptionRiderLocation = `subscription SubscriptionRiderLocation($riderId:String!){
subscriptionRiderLocation(riderId:$riderId) { subscriptionRiderLocation(riderId:$riderId) {
@ -577,7 +581,7 @@ export const subscriptionRiderLocation = `subscription SubscriptionRiderLocation
longitude longitude
} }
} }
}` }`;
export const rider = `query Rider($id:String){ export const rider = `query Rider($id:String){
rider(id:$id){ rider(id:$id){
@ -587,4 +591,4 @@ export const rider = `query Rider($id:String){
longitude longitude
} }
} }
}` }`;

View File

@ -1,49 +1,49 @@
/* eslint-disable react/prop-types */ /* eslint-disable react/prop-types */
import { SimpleLineIcons } from '@expo/vector-icons' import { SimpleLineIcons } from "@expo/vector-icons";
import { DrawerContentScrollView, DrawerItem } from '@react-navigation/drawer' import { DrawerContentScrollView, DrawerItem } from "@react-navigation/drawer";
import { import {
DrawerActions, DrawerActions,
useNavigation, useNavigation,
useTheme useTheme,
} from '@react-navigation/native' } from "@react-navigation/native";
import React, { useContext } from 'react' import React, { useContext } from "react";
import { Animated, View } from 'react-native' import { Animated, View } from "react-native";
import { useSafeAreaInsets } from 'react-native-safe-area-context' import { useSafeAreaInsets } from "react-native-safe-area-context";
import i18n from '../../../i18n' import i18n from "../../../i18n";
import UserContext from '../../context/User' import UserContext from "../../context/User";
import NavigationService from '../../routes/navigationService' import NavigationService from "../../routes/navigationService";
import { alignment } from '../../utils/alignment' import { alignment } from "../../utils/alignment";
import { ICONS_NAME, NAVIGATION_SCREEN } from '../../utils/constant' import { ICONS_NAME, NAVIGATION_SCREEN } from "../../utils/constant";
import { scale } from '../../utils/scaling' import { scale } from "../../utils/scaling";
import { CustomIcon } from '../CustomIcon' import { CustomIcon } from "../CustomIcon";
import SideDrawerProfile from '../Drawer/Profile/DrawerProfile' import SideDrawerProfile from "../Drawer/Profile/DrawerProfile";
import { TextDefault } from '../Text' import { TextDefault } from "../Text";
import useStyle from './styles' import useStyle from "./styles";
const MENU = [ const MENU = [
{ {
title: 'home', title: "home",
icon: ICONS_NAME.Home, icon: ICONS_NAME.Home,
navigateTo: NAVIGATION_SCREEN.Menu, navigateTo: NAVIGATION_SCREEN.Menu,
isAuth: false isAuth: false,
}, },
{ {
title: 'titleProfile', title: "titleProfile",
icon: 'user', icon: "user",
navigateTo: 'Profile', navigateTo: "Profile",
isAuth: true isAuth: true,
}, },
{ {
title: 'titleOrders', title: "titleOrders",
icon: ICONS_NAME.Cart, icon: ICONS_NAME.Cart,
navigateTo: NAVIGATION_SCREEN.MyOrders, navigateTo: NAVIGATION_SCREEN.MyOrders,
isAuth: true isAuth: true,
}, },
{ {
title: 'myAddresses', title: "myAddresses",
icon: ICONS_NAME.Location, icon: ICONS_NAME.Location,
navigateTo: NAVIGATION_SCREEN.Addresses, navigateTo: NAVIGATION_SCREEN.Addresses,
isAuth: true isAuth: true,
}, },
// { // {
// title: 'titleChat', // title: 'titleChat',
@ -52,36 +52,38 @@ const MENU = [
// isAuth: false // isAuth: false
// }, // },
{ {
title: 'titleHelp', title: "titleHelp",
icon: ICONS_NAME.Info, icon: ICONS_NAME.Info,
navigateTo: NAVIGATION_SCREEN.Help, navigateTo: NAVIGATION_SCREEN.Help,
isAuth: false isAuth: false,
}, },
{ {
title: 'titleSettings', title: "titleSettings",
icon: ICONS_NAME.Setting, icon: ICONS_NAME.Setting,
navigateTo: NAVIGATION_SCREEN.Settings, navigateTo: NAVIGATION_SCREEN.Settings,
isAuth: true isAuth: true,
} },
] ];
function SidebBar(props) { function SidebBar(props) {
const styles = useStyle() const styles = useStyle();
const { colors } = useTheme() const { colors } = useTheme();
const navigation = useNavigation() const navigation = useNavigation();
const inset = useSafeAreaInsets() const inset = useSafeAreaInsets();
const { isLoggedIn, logout } = useContext(UserContext) const { isLoggedIn, logout } = useContext(UserContext);
const navigationName = NavigationService.currentRoute()?.name const navigationName = NavigationService.currentRoute()?.name;
return ( return (
<DrawerContentScrollView <DrawerContentScrollView
{...props} {...props}
contentContainerStyle={styles.scrollContent}> contentContainerStyle={styles.scrollContent}
>
<Animated.View <Animated.View
style={{ style={{
flex: 1, flex: 1,
backgroundColor: 'transparent', backgroundColor: "transparent",
marginBottom: inset.bottom marginBottom: inset.bottom,
}}> }}
>
<View style={styles.headerContainer}> <View style={styles.headerContainer}>
<SideDrawerProfile /> <SideDrawerProfile />
</View> </View>
@ -89,31 +91,32 @@ function SidebBar(props) {
<View> <View>
{MENU.map((item, index) => ( {MENU.map((item, index) => (
<DrawerItem <DrawerItem
pressColor={'rgba(0,0,0,0.2)'} pressColor={"rgba(0,0,0,0.2)"}
key={`DRAWER_ITEM_LIST_${index}`} key={`DRAWER_ITEM_LIST_${index}`}
style={styles.drawerItem} style={styles.drawerItem}
activeBackgroundColor={'transparent'} activeBackgroundColor={"transparent"}
activeTintColor={colors.black} activeTintColor={colors.black}
inactiveTintColor={colors.fontWhite} inactiveTintColor={colors.fontWhite}
focused={navigationName === item.navigateTo} focused={navigationName === item.navigateTo}
label={props => ( label={(props) => (
<TextDefault <TextDefault
H5 H5
medium medium
textColor={props.color} textColor={props.color}
style={[styles.textView, styles.flex]}> style={[styles.textView, styles.flex]}
>
{i18n.t(item.title)} {i18n.t(item.title)}
</TextDefault> </TextDefault>
)} )}
icon={props => { icon={(props) => {
if (item.icon !== 'user') { if (item.icon !== "user") {
return ( return (
<CustomIcon <CustomIcon
name={item.icon} name={item.icon}
color={props.color} color={props.color}
size={scale(22)} size={scale(22)}
/> />
) );
} else { } else {
return ( return (
<SimpleLineIcons <SimpleLineIcons
@ -121,14 +124,14 @@ function SidebBar(props) {
color={props.color} color={props.color}
size={scale(22)} size={scale(22)}
/> />
) );
} }
}} }}
onPress={async () => { onPress={async () => {
if (item.isAuth && !isLoggedIn) { if (item.isAuth && !isLoggedIn) {
navigation.navigate(NAVIGATION_SCREEN.CreateAccount) navigation.navigate(NAVIGATION_SCREEN.CreateAccount);
} else { } else {
navigation.navigate(item.navigateTo) navigation.navigate(item.navigateTo);
} }
}} }}
/> />
@ -137,15 +140,16 @@ function SidebBar(props) {
<View style={alignment.PBmedium}> <View style={alignment.PBmedium}>
{isLoggedIn && ( {isLoggedIn && (
<DrawerItem <DrawerItem
pressColor={'rgba(0,0,0,0.2)'} pressColor={"rgba(0,0,0,0.2)"}
style={styles.drawerItem} style={styles.drawerItem}
label={() => ( label={() => (
<TextDefault <TextDefault
H5 H5
medium medium
textColor={styles.whiteFont.color} textColor={styles.whiteFont.color}
style={[styles.textView, styles.flex]}> style={[styles.textView, styles.flex]}
{i18n.t('titleLogout')} >
{i18n.t("titleLogout")}
</TextDefault> </TextDefault>
)} )}
icon={() => ( icon={() => (
@ -156,11 +160,11 @@ function SidebBar(props) {
/> />
)} )}
onPress={async () => { onPress={async () => {
logout() logout();
navigation.reset({ navigation.reset({
routes: [{ name: 'Menu' }] routes: [{ name: "Menu" }],
}) });
navigation.dispatch(DrawerActions.closeDrawer()) navigation.dispatch(DrawerActions.closeDrawer());
// await client.resetStore(); // await client.resetStore();
}} }}
/> />
@ -169,6 +173,6 @@ function SidebBar(props) {
</View> </View>
</Animated.View> </Animated.View>
</DrawerContentScrollView> </DrawerContentScrollView>
) );
} }
export default SidebBar export default SidebBar;

View File

@ -62,6 +62,12 @@ const CreateAccount = () => {
} }
async function onCompleted(data) { async function onCompleted(data) {
if (!data.login.is_active) {
FlashMessage({
message: "Can't Login,This Account is Deleted!",
});
setLoading(false);
} else {
try { try {
const trackingOpts = { const trackingOpts = {
id: data.login.userId, id: data.login.userId,
@ -77,6 +83,7 @@ const CreateAccount = () => {
setLoading(false); setLoading(false);
} }
} }
}
function onError(error) { function onError(error) {
try { try {
console.log(JSON.stringify(error)); console.log(JSON.stringify(error));
@ -139,6 +146,7 @@ const CreateAccount = () => {
}; };
mutateLogin(user); mutateLogin(user);
} }
loginButtonSetter("Apple"); loginButtonSetter("Apple");
// signed in // signed in
} catch (e) { } catch (e) {

View File

@ -1,9 +1,9 @@
import { useMutation } from '@apollo/react-hooks' import { useMutation } from "@apollo/react-hooks";
import { useNavigation, useTheme } from '@react-navigation/native' import { useNavigation, useTheme } from "@react-navigation/native";
import * as Notifications from 'expo-notifications' import * as Notifications from "expo-notifications";
import Constants from 'expo-constants' import Constants from "expo-constants";
import gql from 'graphql-tag' import gql from "graphql-tag";
import React, { useContext, useEffect, useState } from 'react' import React, { useContext, useEffect, useState } from "react";
import { import {
ActivityIndicator, ActivityIndicator,
BackHandler, BackHandler,
@ -11,141 +11,151 @@ import {
Platform, Platform,
ScrollView, ScrollView,
TouchableOpacity, TouchableOpacity,
View View,
} from 'react-native' } from "react-native";
import { FilledTextField } from 'react-native-material-textfield' import { FilledTextField } from "react-native-material-textfield";
import { useSafeAreaInsets } from 'react-native-safe-area-context' import { useSafeAreaInsets } from "react-native-safe-area-context";
import i18n from '../../../i18n' import i18n from "../../../i18n";
import { login } from '../../apollo/server' import { login } from "../../apollo/server";
import { import {
EnategaImage, EnategaImage,
FlashMessage, FlashMessage,
RegistrationHeader, RegistrationHeader,
TextDefault, TextDefault,
WrapperView WrapperView,
} from '../../components' } from "../../components";
import UserContext from '../../context/User' import UserContext from "../../context/User";
import { alignment } from '../../utils/alignment' import { alignment } from "../../utils/alignment";
import Analytics from '../../utils/analytics' import Analytics from "../../utils/analytics";
import { NAVIGATION_SCREEN } from '../../utils/constant' import { NAVIGATION_SCREEN } from "../../utils/constant";
import { scale, verticalScale } from '../../utils/scaling' import { scale, verticalScale } from "../../utils/scaling";
import useStyle from './styles' import useStyle from "./styles";
// Constants // Constants
const LOGIN = gql` const LOGIN = gql`
${login} ${login}
` `;
const Logo = require('../../../assets/logo.png') const Logo = require("../../../assets/logo.png");
function Login() { function Login() {
let _didFocusSubscription = null let _didFocusSubscription = null;
let _willBlurSubscription = null let _willBlurSubscription = null;
const styles = useStyle() const styles = useStyle();
const inset = useSafeAreaInsets() const inset = useSafeAreaInsets();
const { colors } = useTheme() const { colors } = useTheme();
const navigation = useNavigation() const navigation = useNavigation();
const [email, setEmail] = useState('john@test.com') const [email, setEmail] = useState("john@test.com");
const [loading, setLoading] = useState(false) const [loading, setLoading] = useState(false);
const [password, setPassword] = useState('123123') const [password, setPassword] = useState("123123");
const [emailError, setEmailError] = useState('') const [emailError, setEmailError] = useState("");
const { setTokenAsync } = useContext(UserContext) const { setTokenAsync, logout } = useContext(UserContext);
const [passwordError, setPasswordError] = useState(null) const [passwordError, setPasswordError] = useState(null);
const [mutate] = useMutation(LOGIN, { onCompleted, onError }) const [mutate] = useMutation(LOGIN, { onCompleted, onError });
useEffect(() => { useEffect(() => {
_didFocusSubscription = navigation.addListener('didFocus', () => { _didFocusSubscription = navigation.addListener("didFocus", () => {
BackHandler.addEventListener( BackHandler.addEventListener(
'hardwareBackPress', "hardwareBackPress",
onBackButtonPressAndroid onBackButtonPressAndroid
) );
}) });
_willBlurSubscription = navigation.addListener('willBlur', () => { _willBlurSubscription = navigation.addListener("willBlur", () => {
BackHandler.removeEventListener( BackHandler.removeEventListener(
'hardwareBackPress', "hardwareBackPress",
onBackButtonPressAndroid onBackButtonPressAndroid
) );
}) });
return () => { return () => {
_didFocusSubscription && _didFocusSubscription() _didFocusSubscription && _didFocusSubscription();
_willBlurSubscription && _willBlurSubscription() _willBlurSubscription && _willBlurSubscription();
BackHandler.removeEventListener( BackHandler.removeEventListener(
'hardwareBackPress', "hardwareBackPress",
onBackButtonPressAndroid onBackButtonPressAndroid
) );
} };
}, []) }, []);
function validateCredentials() { function validateCredentials() {
let result = true let result = true;
setEmailError(null) setEmailError(null);
setPasswordError(null) setPasswordError(null);
if (!email) { if (!email) {
setEmailError('Email/Phone is required') setEmailError("Email/Phone is required");
result = false result = false;
} else { } else {
const emailRegex = /^\w+([\\.-]?\w+)*@\w+([\\.-]?\w+)*(\.\w{2,3})+$/ const emailRegex = /^\w+([\\.-]?\w+)*@\w+([\\.-]?\w+)*(\.\w{2,3})+$/;
const phoneRegex = /^[+]\d{6,15}$/ const phoneRegex = /^[+]\d{6,15}$/;
if (emailRegex.test(email) !== true && phoneRegex.test(email) !== true) { if (emailRegex.test(email) !== true && phoneRegex.test(email) !== true) {
setEmailError('Invalid Email/Phone') setEmailError("Invalid Email/Phone");
result = false result = false;
} }
} }
if (!password) { if (!password) {
setPasswordError('Password is required') setPasswordError("Password is required");
result = false result = false;
} }
return result return result;
} }
async function onCompleted(data) { async function onCompleted(data) {
if (!data.login.is_active) {
FlashMessage({
message: "Can't Login,This Account is Deleted!",
});
setLoading(false);
} else {
try { try {
const trackingOpts = { const trackingOpts = {
id: data.login.userId, id: data.login.userId,
usernameOrEmail: data.login.email usernameOrEmail: data.login.email,
} };
Analytics.identify(data.login.userId, trackingOpts)
Analytics.track(Analytics.events.USER_LOGGED_IN, trackingOpts) Analytics.identify(data.login.userId, trackingOpts);
setTokenAsync(data.login.token) Analytics.track(Analytics.events.USER_LOGGED_IN, trackingOpts);
navigation.navigate(NAVIGATION_SCREEN.Menu) setTokenAsync(data.login.token);
console.log("Data Before Navigation:", data.login.is_active);
navigation.navigate(NAVIGATION_SCREEN.Menu);
} catch (e) { } catch (e) {
console.log(e) console.log(e);
} finally { } finally {
setLoading(false) setLoading(false);
}
} }
} }
function onError(error) { function onError(error) {
try { try {
console.log(JSON.stringify(error)) console.log(JSON.stringify(error));
FlashMessage({ FlashMessage({
message: error.graphQLErrors[0].message message: error.graphQLErrors[0].message,
}) });
} catch (e) { } catch (e) {
console.log(e) console.log(e);
} finally { } finally {
setLoading(false) setLoading(false);
} }
} }
function onBackButtonPressAndroid() { function onBackButtonPressAndroid() {
navigation.navigate(NAVIGATION_SCREEN.Menu) navigation.navigate(NAVIGATION_SCREEN.Menu);
return true return true;
} }
async function mutateLogin(user) { async function mutateLogin(user) {
try { try {
setLoading(true) setLoading(true);
let notificationToken = null let notificationToken = null;
if (Constants.isDevice) { if (Constants.isDevice) {
const { status: existingStatus } = const { status: existingStatus } =
await Notifications.getPermissionsAsync() await Notifications.getPermissionsAsync();
if (existingStatus === 'granted') { if (existingStatus === "granted") {
notificationToken = (await Notifications.getExpoPushTokenAsync()).data notificationToken = (await Notifications.getExpoPushTokenAsync())
.data;
} }
} }
mutate({ variables: { ...user, notificationToken } }) mutate({ variables: { ...user, notificationToken } });
} catch (e) { } catch (e) {
console.log(e) console.log(e);
} finally { } finally {
} }
} }
@ -159,37 +169,40 @@ function Login() {
const user = { const user = {
email: email, email: email,
password: password, password: password,
type: 'default' type: "default",
} };
if (validateCredentials()) { if (validateCredentials()) {
mutateLogin(user) mutateLogin(user);
} }
}}> }}
>
{loading ? ( {loading ? (
<ActivityIndicator <ActivityIndicator
size="large" size="large"
style={{ flex: 1, justifyContent: 'center' }} style={{ flex: 1, justifyContent: "center" }}
color={colors.buttonText} color={colors.buttonText}
/> />
) : ( ) : (
<TextDefault bold>{i18n.t('loginBtn')}</TextDefault> <TextDefault bold>{i18n.t("loginBtn")}</TextDefault>
)} )}
</TouchableOpacity> </TouchableOpacity>
) );
} }
return ( return (
<WrapperView> <WrapperView>
<KeyboardAvoidingView <KeyboardAvoidingView
behavior={Platform.OS === 'ios' ? 'padding' : 'height'} behavior={Platform.OS === "ios" ? "padding" : "height"}
style={styles.flex}> style={styles.flex}
>
<ScrollView <ScrollView
style={[styles.flex, { paddingTop: inset.top }]} style={[styles.flex, { paddingTop: inset.top }]}
contentContainerStyle={{ flexGrow: 1, paddingTop: verticalScale(20) }} contentContainerStyle={{ flexGrow: 1, paddingTop: verticalScale(20) }}
showsVerticalScrollIndicator={false} showsVerticalScrollIndicator={false}
alwaysBounceVertical={false}> alwaysBounceVertical={false}
>
<View style={styles.mainContainer}> <View style={styles.mainContainer}>
<RegistrationHeader title={'Login'} back /> <RegistrationHeader title={"Login"} back />
<View style={styles.subContainer}> <View style={styles.subContainer}>
<View style={[styles.flex, styles.upperContainer]}> <View style={[styles.flex, styles.upperContainer]}>
<EnategaImage <EnategaImage
@ -204,10 +217,10 @@ function Login() {
</TextDefault> </TextDefault>
<View style={styles.marginTop3} /> <View style={styles.marginTop3} />
<FilledTextField <FilledTextField
defaultValue={'john@test.com'} defaultValue={"john@test.com"}
error={emailError} error={emailError}
keyboardType={'email-address'} keyboardType={"email-address"}
label={i18n.t('emailphone')} label={i18n.t("emailphone")}
labelFontSize={scale(12)} labelFontSize={scale(12)}
fontSize={scale(12)} fontSize={scale(12)}
activeLineWidth={0} activeLineWidth={0}
@ -219,14 +232,14 @@ function Login() {
tintColor={colors.selected} tintColor={colors.selected}
labelTextStyle={styles.labelStyle} labelTextStyle={styles.labelStyle}
inputContainerStyle={styles.textContainer} inputContainerStyle={styles.textContainer}
onChangeText={text => { onChangeText={(text) => {
setEmail(text.toLowerCase().trim()) setEmail(text.toLowerCase().trim());
}} }}
/> />
<FilledTextField <FilledTextField
defaultValue={'123123'} defaultValue={"123123"}
error={passwordError} error={passwordError}
label={i18n.t('password')} label={i18n.t("password")}
secureTextEntry secureTextEntry
labelFontSize={scale(12)} labelFontSize={scale(12)}
fontSize={scale(12)} fontSize={scale(12)}
@ -239,20 +252,22 @@ function Login() {
tintColor={colors.selected} tintColor={colors.selected}
labelTextStyle={styles.labelStyle} labelTextStyle={styles.labelStyle}
inputContainerStyle={styles.textContainer} inputContainerStyle={styles.textContainer}
onChangeText={text => { onChangeText={(text) => {
setPassword(text.trim()) setPassword(text.trim());
}} }}
/> />
<TouchableOpacity <TouchableOpacity
activeOpacity={0.7} activeOpacity={0.7}
style={{ alignSelf: 'flex-end' }} style={{ alignSelf: "flex-end" }}
onPress={() => onPress={() =>
navigation.navigate(NAVIGATION_SCREEN.ForgotPassword) navigation.navigate(NAVIGATION_SCREEN.ForgotPassword)
}> }
>
<TextDefault <TextDefault
style={[alignment.PTmedium, alignment.PBxSmall]} style={[alignment.PTmedium, alignment.PBxSmall]}
medium medium
center> center
>
Forgot Password? Forgot Password?
</TextDefault> </TextDefault>
</TouchableOpacity> </TouchableOpacity>
@ -262,7 +277,8 @@ function Login() {
style={[alignment.MTlarge, styles.loginBtn, styles.whiteBtn]} style={[alignment.MTlarge, styles.loginBtn, styles.whiteBtn]}
onPress={() => onPress={() =>
navigation.navigate(NAVIGATION_SCREEN.CreateAccount) navigation.navigate(NAVIGATION_SCREEN.CreateAccount)
}> }
>
<TextDefault textColor={colors.fontSecondColor} bold center> <TextDefault textColor={colors.fontSecondColor} bold center>
Create New Account Create New Account
</TextDefault> </TextDefault>
@ -273,7 +289,7 @@ function Login() {
</ScrollView> </ScrollView>
</KeyboardAvoidingView> </KeyboardAvoidingView>
</WrapperView> </WrapperView>
) );
} }
export default Login export default Login;

View File

@ -1,139 +1,139 @@
import { useMutation } from '@apollo/react-hooks' import { useMutation } from "@apollo/react-hooks";
import { MaterialCommunityIcons } from '@expo/vector-icons' import { MaterialCommunityIcons } from "@expo/vector-icons";
import { useNavigation, useRoute, useTheme } from '@react-navigation/native' import { useNavigation, useRoute, useTheme } from "@react-navigation/native";
import gql from 'graphql-tag' import gql from "graphql-tag";
import React, { import React, {
useContext, useContext,
useEffect, useEffect,
useLayoutEffect, useLayoutEffect,
useRef, useRef,
useState useState,
} from 'react' } from "react";
import { import {
KeyboardAvoidingView, KeyboardAvoidingView,
Platform, Platform,
ScrollView, ScrollView,
TouchableOpacity, TouchableOpacity,
View View,
} from 'react-native' } from "react-native";
import { TextField } from 'react-native-material-textfield' import { TextField } from "react-native-material-textfield";
import i18n from '../../../i18n' import i18n from "../../../i18n";
import { updateUser } from '../../apollo/server' import { updateUser } from "../../apollo/server";
import { import {
FlashMessage, FlashMessage,
RightButton, RightButton,
TextDefault, TextDefault,
WrapperView WrapperView,
} from '../../components' } from "../../components";
import UserContext from '../../context/User' import UserContext from "../../context/User";
import { alignment } from '../../utils/alignment' import { alignment } from "../../utils/alignment";
import { ICONS_NAME } from '../../utils/constant' import { ICONS_NAME } from "../../utils/constant";
import { moderateScale, scale } from '../../utils/scaling' import { moderateScale, scale } from "../../utils/scaling";
import { textStyles } from '../../utils/textStyles' import { textStyles } from "../../utils/textStyles";
import ChangePassword from './ChangePassword' import ChangePassword from "./ChangePassword";
import useStyle from './styles' import useStyle from "./styles";
const UPDATEUSER = gql` const UPDATEUSER = gql`
${updateUser} ${updateUser}
` `;
function Profile() { function Profile() {
const refName = useRef() const refName = useRef();
const route = useRoute() const route = useRoute();
const styles = useStyle() const styles = useStyle();
const refPhone = useRef(null) const refPhone = useRef(null);
const { colors } = useTheme() const { colors } = useTheme();
const navigation = useNavigation() const navigation = useNavigation();
const [nameError, setNameError] = useState('') const [nameError, setNameError] = useState("");
const [phoneError, setPhoneError] = useState('') const [phoneError, setPhoneError] = useState("");
const [toggleView, setToggleView] = useState(true) const [toggleView, setToggleView] = useState(true);
const [modelVisible, setModalVisible] = useState(false) const [modelVisible, setModalVisible] = useState(false);
const { profile } = useContext(UserContext) const { profile } = useContext(UserContext);
const backScreen = route.params ? route.params.backScreen : null const backScreen = route.params ? route.params.backScreen : null;
const [mutate, { loading: loadingMutation }] = useMutation(UPDATEUSER, { const [mutate, { loading: loadingMutation }] = useMutation(UPDATEUSER, {
onCompleted, onCompleted,
onError onError,
}) });
useLayoutEffect(() => { useLayoutEffect(() => {
navigation.setOptions({ navigation.setOptions({
title: 'Profile', title: "Profile",
headerRight: () => ( headerRight: () => (
<RightButton <RightButton
icon={toggleView ? ICONS_NAME.Pencil : ICONS_NAME.Cross} icon={toggleView ? ICONS_NAME.Pencil : ICONS_NAME.Cross}
onPress={viewHideAndShow} onPress={viewHideAndShow}
iconSize={scale(18)} iconSize={scale(18)}
/> />
) ),
}) });
}, [navigation, toggleView]) }, [navigation, toggleView]);
useEffect(() => { useEffect(() => {
if (backScreen) { if (backScreen) {
viewHideAndShow() viewHideAndShow();
setPhoneError('Phone number is required') setPhoneError("Phone number is required");
FlashMessage({ FlashMessage({
message: 'Phone Number is missing' message: "Phone Number is missing",
}) });
} }
}, [backScreen]) }, [backScreen]);
function viewHideAndShow() { function viewHideAndShow() {
setToggleView(prev => !prev) setToggleView((prev) => !prev);
} }
function onCompleted({ updateUser }) { function onCompleted({ updateUser }) {
if (updateUser) { if (updateUser) {
FlashMessage({ FlashMessage({
message: "User's Info Updated" message: "User's Info Updated",
}) });
if (backScreen) { if (backScreen) {
navigation.goBack() navigation.goBack();
} }
} }
} }
function validateInfo() { function validateInfo() {
// clear errors // clear errors
setNameError('') setNameError("");
setPhoneError('') setPhoneError("");
const name = refName.current.value() const name = refName.current.value();
const phone = refPhone.current.value() const phone = refPhone.current.value();
if (name === profile.name && phone === profile.phone && phone.length > 0) { if (name === profile.name && phone === profile.phone && phone.length > 0) {
return return;
} }
let res = true let res = true;
if (!name.trim()) { if (!name.trim()) {
refName.current.focus() refName.current.focus();
setNameError('Name is required') setNameError("Name is required");
res = false res = false;
} }
const num = phone.trim().replace('.', '') const num = phone.trim().replace(".", "");
if (num.length < 11 || num.length > 15 || isNaN(num)) { if (num.length < 11 || num.length > 15 || isNaN(num)) {
setPhoneError('Minimum 11 and maximum 15 characters allowed') setPhoneError("Minimum 11 and maximum 15 characters allowed");
if (res) { if (res) {
refPhone.current.focus() refPhone.current.focus();
} }
res = false res = false;
} }
return res return res;
} }
function onError(error) { function onError(error) {
try { try {
if (error.graphQLErrors) { if (error.graphQLErrors) {
FlashMessage({ FlashMessage({
message: error.graphQLErrors[0].message message: error.graphQLErrors[0].message,
}) });
} else if (error.networkError) { } else if (error.networkError) {
FlashMessage({ FlashMessage({
message: error.networkError.result.errors[0].message message: error.networkError.result.errors[0].message,
}) });
} }
} catch (err) {} } catch (err) {}
} }
@ -142,7 +142,7 @@ function Profile() {
return ( return (
<View style={styles.containerInfo}> <View style={styles.containerInfo}>
<TextField <TextField
label={i18n.t('name')} label={i18n.t("name")}
ref={refName} ref={refName}
editable={false} editable={false}
defaultValue={profile.name} defaultValue={profile.name}
@ -151,27 +151,27 @@ function Profile() {
style={{ style={{
...textStyles.Medium, ...textStyles.Medium,
...textStyles.H5, ...textStyles.H5,
color: colors.fontMainColor color: colors.fontMainColor,
}} }}
maxLength={20} maxLength={20}
textColor={colors.fontMainColor} textColor={colors.fontMainColor}
baseColor={colors.fontSecondColor} baseColor={colors.fontSecondColor}
errorColor={colors.errorColor} errorColor={colors.errorColor}
tintColor={!nameError ? colors.tagColor : 'red'} tintColor={!nameError ? colors.tagColor : "red"}
labelTextStyle={{ labelTextStyle={{
...textStyles.Normal, ...textStyles.Normal,
paddingTop: scale(1) paddingTop: scale(1),
}} }}
error={nameError} error={nameError}
/> />
<View style={{ ...alignment.MTxSmall }}></View> <View style={{ ...alignment.MTxSmall }}></View>
<TextField <TextField
keyboardType={'email-address'} keyboardType={"email-address"}
label={i18n.t('email')} label={i18n.t("email")}
style={{ style={{
...textStyles.Medium, ...textStyles.Medium,
...textStyles.H5, ...textStyles.H5,
color: colors.fontMainColor color: colors.fontMainColor,
}} }}
editable={false} editable={false}
defaultValue={profile.email} defaultValue={profile.email}
@ -183,20 +183,20 @@ function Profile() {
tintColor={colors.tagColor} tintColor={colors.tagColor}
labelTextStyle={{ labelTextStyle={{
...textStyles.Normal, ...textStyles.Normal,
paddingTop: scale(1) paddingTop: scale(1),
}} }}
/> />
<View style={{ ...alignment.MTxSmall }}></View> <View style={{ ...alignment.MTxSmall }}></View>
<TextField <TextField
keyboardType={'phone-pad'} keyboardType={"phone-pad"}
label={i18n.t('phone')} label={i18n.t("phone")}
ref={refPhone} ref={refPhone}
editable={false} editable={false}
defaultValue={profile.phone} defaultValue={profile.phone}
style={{ style={{
...textStyles.Medium, ...textStyles.Medium,
...textStyles.H5, ...textStyles.H5,
color: colors.fontMainColor color: colors.fontMainColor,
}} }}
labelFontSize={scale(12)} labelFontSize={scale(12)}
fontSize={scale(12)} fontSize={scale(12)}
@ -204,25 +204,26 @@ function Profile() {
textColor={colors.fontMainColor} textColor={colors.fontMainColor}
baseColor={colors.fontSecondColor} baseColor={colors.fontSecondColor}
errorColor={colors.errorColor} errorColor={colors.errorColor}
tintColor={!phoneError ? colors.tagColor : 'red'} tintColor={!phoneError ? colors.tagColor : "red"}
labelTextStyle={{ labelTextStyle={{
...textStyles.Normal, ...textStyles.Normal,
paddingTop: scale(1) paddingTop: scale(1),
}} }}
error={phoneError} error={phoneError}
/> />
<TouchableOpacity <TouchableOpacity
onPress={() => setModalVisible(true)} onPress={() => setModalVisible(true)}
style={styles.changePassword}> style={styles.changePassword}
>
<TextDefault>Change Password</TextDefault> <TextDefault>Change Password</TextDefault>
<MaterialCommunityIcons <MaterialCommunityIcons
name={'pencil'} name={"pencil"}
size={20} size={20}
color={colors.tagColor} color={colors.tagColor}
/> />
</TouchableOpacity> </TouchableOpacity>
</View> </View>
) );
} }
return ( return (
@ -230,29 +231,31 @@ function Profile() {
<ChangePassword <ChangePassword
modalVisible={modelVisible} modalVisible={modelVisible}
hideModal={() => { hideModal={() => {
setModalVisible(false) setModalVisible(false);
}} }}
/> />
<View style={styles.formContainer}> <View style={styles.formContainer}>
<KeyboardAvoidingView <KeyboardAvoidingView
behavior={Platform.OS === 'ios' ? 'padding' : null} behavior={Platform.OS === "ios" ? "padding" : null}
style={styles.flex}> style={styles.flex}
>
<ScrollView style={styles.flex}> <ScrollView style={styles.flex}>
<View style={[styles.formSubContainer]}> <View style={[styles.formSubContainer]}>
<View <View
style={{ style={{
width: scale(100), width: scale(100),
paddingTop: scale(10), paddingTop: scale(10),
position: 'absolute', position: "absolute",
alignItems: 'center', alignItems: "center",
justifyContent: 'center', justifyContent: "center",
height: scale(100), height: scale(100),
top: moderateScale(-50), top: moderateScale(-50),
borderColor: colors.buttonBackground, borderColor: colors.buttonBackground,
borderWidth: 2, borderWidth: 2,
borderRadius: scale(10), borderRadius: scale(10),
borderStyle: 'dashed' borderStyle: "dashed",
}}> }}
>
<View style={styles.imgContainer}> <View style={styles.imgContainer}>
<TextDefault textColor={colors.tagColor} bold H1> <TextDefault textColor={colors.tagColor} bold H1>
{profile.name.substr(0, 1).toUpperCase()} {profile.name.substr(0, 1).toUpperCase()}
@ -266,13 +269,13 @@ function Profile() {
<View> <View>
<View style={{ margin: scale(0) }}></View> <View style={{ margin: scale(0) }}></View>
<TextField <TextField
label={i18n.t('name')} label={i18n.t("name")}
ref={refName} ref={refName}
defaultValue={profile.name} defaultValue={profile.name}
style={{ style={{
...textStyles.Bold, ...textStyles.Bold,
...textStyles.H5, ...textStyles.H5,
color: colors.fontMainColor color: colors.fontMainColor,
}} }}
labelFontSize={scale(12)} labelFontSize={scale(12)}
fontSize={scale(12)} fontSize={scale(12)}
@ -280,21 +283,21 @@ function Profile() {
textColor={colors.fontMainColor} textColor={colors.fontMainColor}
baseColor={colors.fontSecondColor} baseColor={colors.fontSecondColor}
errorColor={colors.errorColor} errorColor={colors.errorColor}
tintColor={!nameError ? colors.buttonBackground : 'red'} tintColor={!nameError ? colors.buttonBackground : "red"}
labelTextStyle={{ labelTextStyle={{
...textStyles.Normal, ...textStyles.Normal,
paddingTop: scale(1) paddingTop: scale(1),
}} }}
error={nameError} error={nameError}
/> />
<View style={{ ...alignment.MTxSmall }}></View> <View style={{ ...alignment.MTxSmall }}></View>
<TextField <TextField
keyboardType={'email-address'} keyboardType={"email-address"}
label={i18n.t('email')} label={i18n.t("email")}
style={{ style={{
...textStyles.Bold, ...textStyles.Bold,
...textStyles.H5, ...textStyles.H5,
color: colors.fontMainColor color: colors.fontMainColor,
}} }}
editable={false} editable={false}
defaultValue={profile.email} defaultValue={profile.email}
@ -306,17 +309,17 @@ function Profile() {
tintColor={colors.buttonBackground} tintColor={colors.buttonBackground}
labelTextStyle={{ labelTextStyle={{
...textStyles.Normal, ...textStyles.Normal,
paddingTop: scale(1) paddingTop: scale(1),
}} }}
/> />
<View style={{ ...alignment.MTxSmall }}></View> <View style={{ ...alignment.MTxSmall }}></View>
<TextField <TextField
keyboardType={'phone-pad'} keyboardType={"phone-pad"}
label={i18n.t('phone')} label={i18n.t("phone")}
style={{ style={{
...textStyles.Bold, ...textStyles.Bold,
...textStyles.H5, ...textStyles.H5,
color: colors.fontMainColor color: colors.fontMainColor,
}} }}
ref={refPhone} ref={refPhone}
defaultValue={profile.phone} defaultValue={profile.phone}
@ -326,10 +329,10 @@ function Profile() {
textColor={colors.fontMainColor} textColor={colors.fontMainColor}
baseColor={colors.fontSecondColor} baseColor={colors.fontSecondColor}
errorColor={colors.errorColor} errorColor={colors.errorColor}
tintColor={!phoneError ? colors.buttonBackground : 'red'} tintColor={!phoneError ? colors.buttonBackground : "red"}
labelTextStyle={{ labelTextStyle={{
...textStyles.Normal, ...textStyles.Normal,
paddingTop: scale(1) paddingTop: scale(1),
}} }}
error={phoneError} error={phoneError}
/> />
@ -344,29 +347,34 @@ function Profile() {
mutate({ mutate({
variables: { variables: {
name: refName.current.value(), name: refName.current.value(),
phone: refPhone.current.value() phone: refPhone.current.value(),
is_active: true,
},
});
} }
}) }}
} >
}}>
<TextDefault <TextDefault
textColor={colors.buttonText} textColor={colors.buttonText}
H5 H5
bold bold
style={[alignment.MTsmall, alignment.MBsmall]}> style={[alignment.MTsmall, alignment.MBsmall]}
{i18n.t('saveBtn')} >
{i18n.t("saveBtn")}
</TextDefault> </TextDefault>
</TouchableOpacity> </TouchableOpacity>
<TouchableOpacity <TouchableOpacity
style={{ alignSelf: 'center', ...alignment.MTsmall }} style={{ alignSelf: "center", ...alignment.MTsmall }}
activeOpacity={0.7} activeOpacity={0.7}
onPress={viewHideAndShow}> onPress={viewHideAndShow}
>
<TextDefault <TextDefault
textColor={colors.fontMainColor} textColor={colors.fontMainColor}
H5 H5
bold bold
style={[alignment.MTsmall, alignment.MBsmall]}> style={[alignment.MTsmall, alignment.MBsmall]}
{'Cancel'} >
{"Cancel"}
</TextDefault> </TextDefault>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
@ -375,14 +383,15 @@ function Profile() {
<TextDefault <TextDefault
center center
textColor={colors.fontSecondColor} textColor={colors.fontSecondColor}
style={alignment.MBsmall}> style={alignment.MBsmall}
>
All rights are reserved by Enatega All rights are reserved by Enatega
</TextDefault> </TextDefault>
</ScrollView> </ScrollView>
</KeyboardAvoidingView> </KeyboardAvoidingView>
</View> </View>
</WrapperView> </WrapperView>
) );
} }
export default Profile export default Profile;

View File

@ -16,9 +16,14 @@ import {
TouchableOpacity, TouchableOpacity,
View, View,
} from "react-native"; } from "react-native";
import { Modalize } from "react-native-modalize"; import { Modalize } from "react-native-modalize";
import { async } from "validate.js";
import i18n from "../../../i18n"; import i18n from "../../../i18n";
import { moderateScale } from "../../utils/scaling";
import { import {
updateUser,
profile, profile,
pushToken, pushToken,
updateNotificationStatus, updateNotificationStatus,
@ -55,12 +60,14 @@ const UPDATE_NOTIFICATION_TOKEN = gql`
const PROFILE = gql` const PROFILE = gql`
${profile} ${profile}
`; `;
const UPDATEUSER = gql`
${updateUser}
`;
function Settings() { function Settings() {
const styles = useStyle(); const styles = useStyle();
const { colors } = useTheme(); const { colors } = useTheme();
const navigation = useNavigation(); const navigation = useNavigation();
const { profile } = useContext(UserContext); const { profile, logout } = useContext(UserContext);
const [languageName, languageNameSetter] = useState("English"); const [languageName, languageNameSetter] = useState("English");
const [offerNotification, offerNotificationSetter] = useState( const [offerNotification, offerNotificationSetter] = useState(
@ -73,12 +80,14 @@ function Settings() {
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
const [appState, setAppState] = useState(AppState.currentState); const [appState, setAppState] = useState(AppState.currentState);
const [uploadToken] = useMutation(PUSH_TOKEN); const [uploadToken] = useMutation(PUSH_TOKEN);
const [updateUserInfo] = useMutation(UPDATEUSER);
const [mutate, { loading }] = useMutation(UPDATE_NOTIFICATION_TOKEN, { const [mutate, { loading }] = useMutation(UPDATE_NOTIFICATION_TOKEN, {
onCompleted, onCompleted,
onError, onError,
refetchQueries: [{ query: PROFILE }], refetchQueries: [{ query: PROFILE }],
}); });
const modalizeRef = useRef(null); const modalizeRef = useRef(null);
const modalizeRef1 = useRef(null);
useEffect(() => { useEffect(() => {
navigation.setOptions({ navigation.setOptions({
@ -204,6 +213,16 @@ function Settings() {
}); });
} }
async function updateUserInformation() {
console.log("profile data", profile);
updateUserInfo({
variables: {
name: profile.name,
phone: profile.phone,
is_active: false,
},
});
}
return ( return (
<WrapperView> <WrapperView>
{loading && ( {loading && (
@ -289,6 +308,24 @@ function Settings() {
/> />
</View> </View>
</TouchableOpacity> </TouchableOpacity>
<TouchableOpacity
activeOpacity={0.7}
onPress={() => modalizeRef1.current.open("top")}
style={[styles.notificationContainer, styles.shadow]}
>
<View style={styles.notificationChekboxContainer}>
<TextDefault numberOfLines={1} textColor={"red"}>
{" "}
Delete Account{" "}
</TextDefault>
<CustomIcon
name={ICONS_NAME.Trash}
size={scale(28)}
color={"red"}
/>
</View>
</TouchableOpacity>
<View style={styles.versionContainer}> <View style={styles.versionContainer}>
<TextDefault textColor={colors.fontSecondColor}> <TextDefault textColor={colors.fontSecondColor}>
Version: {Constants.manifest.version} Version: {Constants.manifest.version}
@ -322,6 +359,52 @@ function Settings() {
activeRadio={activeRadio} activeRadio={activeRadio}
/> />
</Modalize> </Modalize>
{/* Modal for Delete Account */}
<Modalize
ref={modalizeRef1}
adjustToContentHeight
handlePosition="inside"
avoidKeyboardLikeIOS={Platform.select({
ios: true,
android: true,
})}
keyboardAvoidingOffset={2}
keyboardAvoidingBehavior="height"
>
<View style={{ flex: 1, alignItems: "center" }}>
<TextDefault bolder H5 style={{ marginTop: 20 }}>
Are you Sure you want to delete Account?
</TextDefault>
<TouchableOpacity
activeOpacity={0.7}
style={{
justifyContent: "center",
alignItems: "center",
backgroundColor: colors.buttonBackgroundBlue,
borderRadius: moderateScale(10),
width: "70%",
padding: moderateScale(15),
...alignment.MTlarge,
}}
onPress={async () => {
await updateUserInformation();
logout();
navigation.reset({
routes: [{ name: "Menu" }],
});
}}
>
<TextDefault center>Delete Account</TextDefault>
</TouchableOpacity>
<TouchableOpacity
activeOpacity={0.7}
style={[styles.width100, alignment.PBlarge, alignment.PTlarge]}
onPress={() => onClose()}
>
<TextDefault center>Cancel</TextDefault>
</TouchableOpacity>
</View>
</Modalize>
</WrapperView> </WrapperView>
); );
} }

View File

@ -1,24 +1,24 @@
import { useTheme } from '@react-navigation/native' import { useTheme } from "@react-navigation/native";
import PropTypes from 'prop-types' import PropTypes from "prop-types";
import React, { useState } from 'react' import React, { useState } from "react";
import { TouchableOpacity, View } from 'react-native' import { TouchableOpacity, View } from "react-native";
import RadioButton from '../../../components/FdRadioBtn/RadioBtn' import RadioButton from "../../../components/FdRadioBtn/RadioBtn";
import TextDefault from '../../../components/Text/TextDefault/TextDefault' import TextDefault from "../../../components/Text/TextDefault/TextDefault";
import { alignment } from '../../../utils/alignment' import { alignment } from "../../../utils/alignment";
import useStyle from './styles' import useStyle from "./styles";
const languageTypes = [ const languageTypes = [
{ value: 'English', code: 'en', index: 0 }, { value: "English", code: "en", index: 0 },
{ value: 'français', code: 'fr', index: 1 }, { value: "français", code: "fr", index: 1 },
{ value: 'ភាសាខ្មែរ', code: 'km', index: 2 }, { value: "ភាសាខ្មែរ", code: "km", index: 2 },
{ value: '中文', code: 'zh', index: 3 }, { value: "中文", code: "zh", index: 3 },
{ value: 'Deutsche', code: 'de', index: 4 } { value: "Deutsche", code: "de", index: 4 },
] ];
function SettingModal(props) { function SettingModal(props) {
const styles = useStyle() const styles = useStyle();
const { colors } = useTheme() const { colors } = useTheme();
const [activeRadio, activeRadioSetter] = useState(props.activeRadio) const [activeRadio, activeRadioSetter] = useState(props.activeRadio);
return ( return (
<View style={styles.flex}> <View style={styles.flex}>
@ -31,12 +31,13 @@ function SettingModal(props) {
activeOpacity={0.7} activeOpacity={0.7}
key={item.index} key={item.index}
onPress={() => activeRadioSetter(item.index)} onPress={() => activeRadioSetter(item.index)}
style={[styles.radioContainer]}> style={[styles.radioContainer]}
>
<TextDefault numberOfLines={1} bold style={alignment.MLsmall}> <TextDefault numberOfLines={1} bold style={alignment.MLsmall}>
{item.value} {item.value}
</TextDefault> </TextDefault>
<RadioButton <RadioButton
animation={'bounceIn'} animation={"bounceIn"}
size={13} size={13}
outerColor={colors.radioOuterColor} outerColor={colors.radioOuterColor}
innerColor={colors.radioColor} innerColor={colors.radioColor}
@ -51,7 +52,8 @@ function SettingModal(props) {
<TouchableOpacity <TouchableOpacity
activeOpacity={0.7} activeOpacity={0.7}
style={styles.button} style={styles.button}
onPress={() => props.onSelectedLanguage(activeRadio)}> onPress={() => props.onSelectedLanguage(activeRadio)}
>
<TextDefault textColor={colors.lightBackground} bolder uppercase> <TextDefault textColor={colors.lightBackground} bolder uppercase>
Done Done
</TextDefault> </TextDefault>
@ -59,17 +61,18 @@ function SettingModal(props) {
<TouchableOpacity <TouchableOpacity
activeOpacity={0.7} activeOpacity={0.7}
style={[styles.width100, alignment.PBlarge, alignment.PTlarge]} style={[styles.width100, alignment.PBlarge, alignment.PTlarge]}
onPress={() => props.onClose()}> onPress={() => props.onClose()}
>
<TextDefault center>Cancel</TextDefault> <TextDefault center>Cancel</TextDefault>
</TouchableOpacity> </TouchableOpacity>
{/* </View> */} {/* </View> */}
</View> </View>
) );
} }
SettingModal.propTypes = { SettingModal.propTypes = {
activeRadio: PropTypes.number, activeRadio: PropTypes.number,
onSelectedLanguage: PropTypes.func, onSelectedLanguage: PropTypes.func,
onClose: PropTypes.func onClose: PropTypes.func,
} };
export default SettingModal export default SettingModal;

View File

@ -82,7 +82,7 @@ Enatega is a state of the art white label storefront delivery solution that allo
Our solution contains three separate modules. These include the admin panel, the delivery app and the rider app. Below, the capabilities of all three modules have been listed: Our solution contains three separate modules. These include the admin panel, the delivery app and the rider app. Below, the capabilities of all three modules have been listed:
- The admin panel receives the orders that can be placed via the customer app. It also allows managing the restaurants orders as well as the riders accounts. - The admin panel receives the orders that can be placed via the customer app. It also allows managing the restaurants orders as well as the riders accounts.(Run on node version 14)
- The customer app allows for customers to choose their specific selections and customize their order before placing it. - The customer app allows for customers to choose their specific selections and customize their order before placing it.
@ -108,13 +108,13 @@ Our solution contains three separate modules. These include the admin panel, the
As weve mentioned above, the solution includes three separate modules. To setup these modules, follow the steps below: As weve mentioned above, the solution includes three separate modules. To setup these modules, follow the steps below:
To run the module, you need to have nodejs installed on your machine. Once nodejs is installed, go to the directory and enter the following commands To run the module, you need to have nodejs installed on your machine(Install node version 14). Once nodejs is installed, go to the directory and enter the following commands
The required credentials and keys have been set already. You can setup your own keys and credentials The required credentials and keys have been set already. You can setup your own keys and credentials
The version of nodejs should be between 14.0 to 16.0 The version of nodejs should be between 14.0 to 16.0
-[Link to Video tutorial/demonstration of Setup](https://enatega-1.gitbook.io/enatega-multivendor/configurations/google-maps-api-keys) -[Link to Video tutorial/demonstration of Setup](https://enatega.com/singlevendor-documentation/)
## :framed_picture: Screenshots: <a id="heading-6"></a> ## :framed_picture: Screenshots: <a id="heading-6"></a>
@ -184,15 +184,18 @@ The version of nodejs should be between 14.0 to 16.0
|:------------:|:------------:|:-------:|:---------:|:-----------:|:---------:| |:------------:|:------------:|:-------:|:---------:|:-----------:|:---------:|
|<a href="https://reactnative.dev/"><img src="https://enatega.com/wp-content/uploads/2023/09/react-native.png" alt="Enatega Logos" width="100"></a> | <a href="https://reactrouter.com/"><img src="https://enatega.com/wp-content/uploads/2023/09/react-router-svgrepo-com.png" alt="Enatega Logos" width="100"></a> |<a href="https://graphql.org/"><img src="https://enatega.com/wp-content/uploads/2023/09/graphQl.png" alt="Enatega Logos" width="100"></a> | <a href="https://expressjs.com/"><img src="https://enatega.com/wp-content/uploads/2023/09/expo.png" alt="Enatega Logos" width="100"></a> |<a href="https://reactstrap.github.io/"><img src="https://enatega.com/wp-content/uploads/2023/09/React-strap.png" alt="Enatega Logos" width="100"></a> | <a href="https://amplitude.com/"><img src="https://enatega.com/wp-content/uploads/2023/09/Amplitude.png" alt="Enatega Logos" width="100"></a> | |<a href="https://reactnative.dev/"><img src="https://enatega.com/wp-content/uploads/2023/09/react-native.png" alt="Enatega Logos" width="100"></a> | <a href="https://reactrouter.com/"><img src="https://enatega.com/wp-content/uploads/2023/09/react-router-svgrepo-com.png" alt="Enatega Logos" width="100"></a> |<a href="https://graphql.org/"><img src="https://enatega.com/wp-content/uploads/2023/09/graphQl.png" alt="Enatega Logos" width="100"></a> | <a href="https://expressjs.com/"><img src="https://enatega.com/wp-content/uploads/2023/09/expo.png" alt="Enatega Logos" width="100"></a> |<a href="https://reactstrap.github.io/"><img src="https://enatega.com/wp-content/uploads/2023/09/React-strap.png" alt="Enatega Logos" width="100"></a> | <a href="https://amplitude.com/"><img src="https://enatega.com/wp-content/uploads/2023/09/Amplitude.png" alt="Enatega Logos" width="100"></a> |
## :iphone: Demos: <a id="heading-9"></a> ## :iphone: Demos: <a id="heading-9"></a>
| Customer App | Rider App | Restaurant App | Customer Web | Admin Dashboard | | Customer App | Rider App | Restaurant App | Customer Web | Admin Dashboard |
| :---------------------------: | :----------------------------: | :----------------------------:|:----------------------------:|:----------------------------:| | :---------------------------: | :----------------------------: | :----------------------------:|:----------------------------:|:----------------------------:|
| <a href="#heading-9" style="pointer-events: none;"><img src="https://enatega.com/wp-content/uploads/2023/09/logooo.png" alt="Enatega Logos" width="150"></a>| <a href="#heading-9" style="pointer-events: none;"><img src="https://enatega.com/wp-content/uploads/2023/09/Untitled-1-1.png" alt="Enatega Logos" width="150"></a>| <a href="#heading-9" style="pointer-events: none;"><img src="https://enatega.com/wp-content/uploads/2023/09/LOGOS-FOR-ENATGEA-res.png" alt="Enatega Logos" width="150"></a>| <a href="http://multivendor.enatega.com/"><img src="https://enatega.com/wp-content/uploads/2023/09/worldwide.png" alt="Enatega Logos" width="180"></a> | <a href="http://multivendor-admin-staging.enatega.com/"><img src="https://enatega.com/wp-content/uploads/2023/09/dashboard.png" alt="Enatega Logos" width="150"></a> | | <a href="#heading-9" style="pointer-events: none;"><img src="https://enatega.com/wp-content/uploads/2023/09/logooo.png" alt="Enatega Logos" width="150"></a>| <a href="#heading-9" style="pointer-events: none;"><img src="https://enatega.com/wp-content/uploads/2023/09/Untitled-1-1.png" alt="Enatega Logos" width="150"></a>| <a href="#heading-9" style="pointer-events: none;"><img src="https://enatega.com/wp-content/uploads/2023/09/LOGOS-FOR-ENATGEA-res.png" alt="Enatega Logos" width="150"></a>| <a href="http://multivendor.enatega.com/"><img src="https://enatega.com/wp-content/uploads/2023/09/worldwide.png" alt="Enatega Logos" width="180"></a> | <a href="http://multivendor-admin-staging.enatega.com/"><img src="https://enatega.com/wp-content/uploads/2023/09/dashboard.png" alt="Enatega Logos" width="150"></a> |
| <a href="https://play.google.com/store/apps/details?id=com.enatega.multivendor"><img src="https://enatega.com/wp-content/uploads/2023/09/android_518705.png" alt="Android Logo" width="25"></a> <a href="https://apps.apple.com/pk/app/enatega-multivendor/id1526488093"><img src="https://enatega.com/wp-content/uploads/2023/09/social_10096939.png" alt="iOS Logo" width="25"></a> |<a href="https://play.google.com/store/apps/details?id=com.enatega.multirider"><img src="https://enatega.com/wp-content/uploads/2023/09/android_518705.png" alt="Android Logo" width="25"></a> <a href="https://apps.apple.com/pk/app/enatega-mulitvendor-rider/id1526674511"><img src="https://enatega.com/wp-content/uploads/2023/09/social_10096939.png" alt="iOS Logo" width="25"></a> |<a href="https://play.google.com/store/apps/details?id=multivendor.enatega.restaurant"><img src="https://enatega.com/wp-content/uploads/2023/09/android_518705.png" alt="Android Logo" width="25"></a> <a href="https://apps.apple.com/pk/app/enatega-multivendor-restaurant/id1526672537"><img src="https://enatega.com/wp-content/uploads/2023/09/social_10096939.png" alt="iOS Logo" width="25"></a> | | <a href="https://play.google.com/store/apps/details?id=com.enatega.multivendor"><img src="https://enatega.com/wp-content/uploads/2023/09/android_518705.png" alt="Android Logo" width="25"></a> <a href="https://apps.apple.com/pk/app/enatega-multivendor/id1526488093"><img src="https://enatega.com/wp-content/uploads/2023/09/social_10096939.png" alt="iOS Logo" width="25"></a> |<a href="https://play.google.com/store/apps/details?id=com.enatega.multirider"><img src="https://enatega.com/wp-content/uploads/2023/09/android_518705.png" alt="Android Logo" width="25"></a> <a href="https://apps.apple.com/pk/app/enatega-mulitvendor-rider/id1526674511"><img src="https://enatega.com/wp-content/uploads/2023/09/social_10096939.png" alt="iOS Logo" width="25"></a> |<a href="https://play.google.com/store/apps/details?id=multivendor.enatega.restaurant"><img src="https://enatega.com/wp-content/uploads/2023/09/android_518705.png" alt="Android Logo" width="25"></a> <a href="https://apps.apple.com/pk/app/enatega-multivendor-restaurant/id1526672537"><img src="https://enatega.com/wp-content/uploads/2023/09/social_10096939.png" alt="iOS Logo" width="25"></a> |
## :book: Documentation <a id="heading-8"></a> ## :book: Documentation <a id="heading-8"></a>
Find the link for the complete documentation of the Enatega Single Vendor Solution [here](https://ninjas-code.gitbook.io/enatega-full-app/). Find the link for the complete documentation of the Enatega Single Vendor Solution [here](https://enatega.com/singlevendor-documentation/).
## :tv: Demo Videos: <a id="heading-14"></a> ## :tv: Demo Videos: <a id="heading-14"></a>
If you want to see demo video of the product please check out the link over [here](https://www.youtube.com/watch?v=AWbdt9GX1t4&t=3s&ab_channel=NinjasCode) If you want to see demo video of the product please check out the link over [here](https://www.youtube.com/watch?v=AWbdt9GX1t4&t=3s&ab_channel=NinjasCode)

View File

@ -1,15 +0,0 @@
> Why do I have a folder named ".expo" in my project?
The ".expo" folder is created when an Expo project is started using "expo start" command.
> What do the files contain?
- "devices.json": contains information about devices that have recently opened this project. This is used to populate the "Development sessions" list in your development builds.
- "packager-info.json": contains port numbers and process PIDs that are used to serve the application to the mobile device/simulator.
- "settings.json": contains the server configuration that is used to serve the application manifest.
> Should I commit the ".expo" folder?
No, you should not share the ".expo" folder. It does not contain any information that is relevant for other developers working on the project, it is specific to your machine.
Upon project creation, the ".expo" folder is already added to your ".gitignore" file.

View File

@ -1,3 +0,0 @@
{
"devices": []
}

View File

@ -1,9 +0,0 @@
{
"expoServerPort": null,
"packagerPort": null,
"packagerPid": null,
"expoServerNgrokUrl": null,
"packagerNgrokUrl": null,
"ngrokPid": null,
"webpackServerPort": null
}

View File

@ -1,9 +0,0 @@
{
"hostType": "lan",
"lanType": "ip",
"dev": true,
"minify": false,
"urlRandomness": null,
"https": false,
"scheme": null
}

View File

@ -1 +0,0 @@
/node_modules

View File

@ -1,117 +0,0 @@
import { ApolloProvider } from "@apollo/react-hooks";
import AsyncStorage from "@react-native-async-storage/async-storage";
import * as Font from "expo-font";
import * as Notifications from "expo-notifications";
import * as SplashScreen from "expo-splash-screen";
import React, { useEffect, useState } from "react";
import { Platform, StatusBar } from "react-native";
import FlashMessage from "react-native-flash-message";
import i18n from "./i18n";
import setupApolloClient from "./src/apollo/index";
import { AuthContext } from "./src/context/auth";
import { ConfigurationProvider } from "./src/context/configuration";
import AppContainer from "./src/routes/index";
export default function App() {
const [fontLoaded, setFontLoaded] = useState(false);
const [client, setClient] = useState(null);
const [token, setToken] = useState(false);
const [appIsReady, setAppIsReady] = useState(false);
useEffect(() => {
(async () => {
const token = await AsyncStorage.getItem("rider-token");
if (token) setToken(token);
setAppIsReady(true);
})();
}, []);
useEffect(() => {
(async () => {
try {
await SplashScreen.preventAutoHideAsync();
} catch (e) {
console.log(e);
}
})();
loadData();
}, []);
const setTokenAsync = async (token) => {
await AsyncStorage.setItem("rider-token", token);
setToken(token);
};
const logout = async () => {
try {
await AsyncStorage.removeItem("rider-token");
setToken(null);
} catch (e) {
console.log("Logout Error: ", e);
}
};
async function loadData() {
await i18n.initAsync();
await Font.loadAsync({
MuseoSans300: require("./assets/font/MuseoSans/MuseoSans300.ttf"),
MuseoSans500: require("./assets/font/MuseoSans/MuseoSans500.ttf"),
MuseoSans700: require("./assets/font/MuseoSans/MuseoSans700.ttf"),
icomoon: require("./assets/font/icomoon.ttf"),
});
const client = await setupApolloClient();
await permissionForPushNotificationsAsync();
setClient(client);
setFontLoaded(true);
await SplashScreen.hideAsync();
}
async function permissionForPushNotificationsAsync() {
const {
status: existingStatus,
} = await Notifications.getPermissionsAsync();
let finalStatus = existingStatus;
// only ask if permissions have not already been determined, because
// iOS won't necessarily prompt the user a second time.
if (existingStatus !== "granted") {
// Android remote notification permissions are granted during the app
// install, so this will only ask on iOS
const { status } = await Notifications.requestPermissionsAsync();
finalStatus = status;
}
// Stop here if the user did not grant permissions
if (finalStatus !== "granted") {
return;
}
if (Platform.OS === "android") {
Notifications.setNotificationChannelAsync("default", {
name: "default",
sound: true,
priority: "max",
importance: Notifications.AndroidImportance.HIGH,
vibrate: [0, 250, 250, 250],
});
}
}
if (fontLoaded && client && appIsReady) {
return (
<ApolloProvider client={client}>
<StatusBar
translucent
backgroundColor={"transparent"}
barStyle="dark-content"
/>
<ConfigurationProvider>
<AuthContext.Provider value={{ token, setTokenAsync, logout }}>
<AppContainer />
</AuthContext.Provider>
</ConfigurationProvider>
<FlashMessage duration={2000} position="center" />
</ApolloProvider>
);
}
return null;
}

16906
Rider App/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,89 +0,0 @@
{
"name": "enatega-rider-app",
"version": "5.0.0",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"eject": "expo eject",
"format": "prettier --write '**/*.js'",
"lint:fix": "eslint . --ext .js --fix",
"postinstall": "patch-package"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.js": [
"npm run format",
"npm run lint:fix"
]
},
"dependencies": {
"@apollo/react-hooks": "^3.1.3",
"@expo/vector-icons": "^13.0.0",
"@react-native-async-storage/async-storage": "~1.17.3",
"@react-native-community/masked-view": "0.1.10",
"@react-navigation/bottom-tabs": "^5.11.11",
"@react-navigation/drawer": "^5.12.5",
"@react-navigation/native": "^5.5.1",
"@react-navigation/stack": "^5.14.5",
"apollo-boost": "^0.4.3",
"apollo-cache-inmemory": "^1.6.2",
"apollo-client": "^2.6.3",
"apollo-link": "^1.2.12",
"apollo-link-context": "^1.0.18",
"apollo-link-state": "^0.4.2",
"apollo-link-ws": "^1.0.20",
"apollo-upload-client": "^10.0.1",
"deprecated-react-native-prop-types": "^4.0.0",
"expo": "^47.0.0",
"expo-constants": "~14.0.2",
"expo-font": "~11.0.1",
"expo-localization": "~14.0.0",
"expo-location": "~15.0.1",
"expo-notifications": "~0.17.0",
"expo-splash-screen": "~0.17.5",
"expo-task-manager": "~11.0.1",
"expo-updates": "~0.15.6",
"graphql": "^14.3.1",
"graphql-tag": "^2.10.1",
"i18n-js": "^3.3.0",
"patch-package": "^6.5.1",
"react": "18.1.0",
"react-apollo": "^2.5.8",
"react-native": "0.70.5",
"react-native-animatable": "^1.3.2",
"react-native-flash-message": "^0.1.13",
"react-native-gesture-handler": "~2.8.0",
"react-native-gifted-chat": "^0.16.3",
"react-native-maps": "1.3.2",
"react-native-maps-directions": "^1.8.0",
"react-native-material-textfield": "^0.16.1",
"react-native-modal": "^11.5.6",
"react-native-reanimated": "~2.12.0",
"react-native-safe-area-context": "4.4.1",
"react-native-screens": "~3.18.0",
"react-native-svg": "13.4.0",
"react-native-webview": "11.23.1",
"subscriptions-transport-ws": "^0.9.16"
},
"devDependencies": {
"babel-preset-expo": "~9.2.1",
"eslint": "^7.1.0",
"eslint-config-standard": "^14.1.1",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.20.0",
"eslint-plugin-standard": "^4.0.1",
"husky": "^4.2.5",
"lint-staged": "^10.2.7",
"prettier": "2.0.5",
"prettier-config-standard": "^1.0.1"
},
"private": true
}

View File

@ -1,251 +0,0 @@
diff --git a/node_modules/react-native-material-textfield/src/components/affix/index.js b/node_modules/react-native-material-textfield/src/components/affix/index.js
index 0f85022..e467adb 100644
--- a/node_modules/react-native-material-textfield/src/components/affix/index.js
+++ b/node_modules/react-native-material-textfield/src/components/affix/index.js
@@ -9,26 +9,26 @@ export default class Affix extends PureComponent {
numberOfLines: 1,
};
- static propTypes = {
- numberOfLines: PropTypes.number,
- style: Animated.Text.propTypes.style,
+ // static propTypes = {
+ // numberOfLines: PropTypes.number,
+ // style: PropTypes.object,
- color: PropTypes.string.isRequired,
- fontSize: PropTypes.number.isRequired,
+ // color: PropTypes.string.isRequired,
+ // fontSize: PropTypes.number.isRequired,
- type: PropTypes
- .oneOf(['prefix', 'suffix'])
- .isRequired,
+ // type: PropTypes
+ // .oneOf(['prefix', 'suffix'])
+ // .isRequired,
- labelAnimation: PropTypes
- .instanceOf(Animated.Value)
- .isRequired,
+ // labelAnimation: PropTypes
+ // .instanceOf(Animated.Value)
+ // .isRequired,
- children: PropTypes.oneOfType([
- PropTypes.arrayOf(PropTypes.node),
- PropTypes.node,
- ]),
- };
+ // children: PropTypes.oneOfType([
+ // PropTypes.arrayOf(PropTypes.node),
+ // PropTypes.node,
+ // ]),
+ // };
render() {
let { labelAnimation, style, children, type, fontSize, color } = this.props;
diff --git a/node_modules/react-native-material-textfield/src/components/counter/index.js b/node_modules/react-native-material-textfield/src/components/counter/index.js
index 35d3264..e4258cd 100644
--- a/node_modules/react-native-material-textfield/src/components/counter/index.js
+++ b/node_modules/react-native-material-textfield/src/components/counter/index.js
@@ -5,15 +5,15 @@ import { Text } from 'react-native';
import styles from './styles';
export default class Counter extends PureComponent {
- static propTypes = {
- count: PropTypes.number.isRequired,
- limit: PropTypes.number,
+ // static propTypes = {
+ // count: PropTypes.number.isRequired,
+ // limit: PropTypes.number,
- baseColor: PropTypes.string.isRequired,
- errorColor: PropTypes.string.isRequired,
+ // baseColor: PropTypes.string.isRequired,
+ // errorColor: PropTypes.string.isRequired,
- style: Text.propTypes.style,
- };
+ // style: Text.propTypes.style,
+ // };
render() {
let { count, limit, baseColor, errorColor, style } = this.props;
diff --git a/node_modules/react-native-material-textfield/src/components/field/index.js b/node_modules/react-native-material-textfield/src/components/field/index.js
index 494bbaa..d3960a6 100644
--- a/node_modules/react-native-material-textfield/src/components/field/index.js
+++ b/node_modules/react-native-material-textfield/src/components/field/index.js
@@ -1,4 +1,5 @@
import PropTypes from 'prop-types';
+import {ViewPropTypes} from 'deprecated-react-native-prop-types'
import React, { PureComponent } from 'react';
import {
View,
@@ -7,7 +8,7 @@ import {
Animated,
StyleSheet,
Platform,
- ViewPropTypes,
+ //ViewPropTypes,
} from 'react-native';
import Line from '../line';
@@ -83,9 +84,7 @@ export default class TextField extends PureComponent {
labelOffset: Label.propTypes.offset,
- labelTextStyle: Text.propTypes.style,
- titleTextStyle: Text.propTypes.style,
- affixTextStyle: Text.propTypes.style,
+
tintColor: PropTypes.string,
textColor: PropTypes.string,
@@ -221,6 +220,7 @@ export default class TextField extends PureComponent {
let options = {
toValue: this.focusState(),
+ useNativeDriver: false,
duration,
};
diff --git a/node_modules/react-native-material-textfield/src/components/helper/index.js b/node_modules/react-native-material-textfield/src/components/helper/index.js
index 6060f9f..7f790ca 100644
--- a/node_modules/react-native-material-textfield/src/components/helper/index.js
+++ b/node_modules/react-native-material-textfield/src/components/helper/index.js
@@ -5,19 +5,19 @@ import { Animated } from 'react-native';
import styles from './styles';
export default class Helper extends PureComponent {
- static propTypes = {
- title: PropTypes.string,
- error: PropTypes.string,
+ // static propTypes = {
+ // title: PropTypes.string,
+ // error: PropTypes.string,
- disabled: PropTypes.bool,
+ // disabled: PropTypes.bool,
- style: Animated.Text.propTypes.style,
+ // style: PropTypes.object,
- baseColor: PropTypes.string,
- errorColor: PropTypes.string,
+ // baseColor: PropTypes.string,
+ // errorColor: PropTypes.string,
- focusAnimation: PropTypes.instanceOf(Animated.Value),
- };
+ // focusAnimation: PropTypes.instanceOf(Animated.Value),
+ // };
constructor(props) {
super(props);
diff --git a/node_modules/react-native-material-textfield/src/components/label/index.js b/node_modules/react-native-material-textfield/src/components/label/index.js
index 82eaf03..eebad36 100644
--- a/node_modules/react-native-material-textfield/src/components/label/index.js
+++ b/node_modules/react-native-material-textfield/src/components/label/index.js
@@ -5,11 +5,11 @@ import { Animated } from 'react-native';
import styles from './styles';
export default class Label extends PureComponent {
- static defaultProps = {
- numberOfLines: 1,
- disabled: false,
- restricted: false,
- };
+ // static defaultProps = {
+ // numberOfLines: 1,
+ // disabled: false,
+ // restricted: false,
+ // };
static propTypes = {
numberOfLines: PropTypes.number,
@@ -43,7 +43,7 @@ export default class Label extends PureComponent {
y1: PropTypes.number,
}),
- style: Animated.Text.propTypes.style,
+ style: PropTypes.object,
label: PropTypes.string,
};
diff --git a/node_modules/react-native-material-textfield/src/components/line/index.js b/node_modules/react-native-material-textfield/src/components/line/index.js
index 44995e9..7ba8db0 100644
--- a/node_modules/react-native-material-textfield/src/components/line/index.js
+++ b/node_modules/react-native-material-textfield/src/components/line/index.js
@@ -8,13 +8,13 @@ const lineTypes = PropTypes
.oneOf(['solid', 'dotted', 'dashed', 'none']);
export default class Line extends PureComponent {
- static defaultProps = {
- lineType: 'solid',
- disabledLineType: 'dotted',
+ // static defaultProps = {
+ // lineType: 'solid',
+ // disabledLineType: 'dotted',
- disabled: false,
- restricted: false,
- };
+ // disabled: false,
+ // restricted: false,
+ // };
static propTypes = {
lineType: lineTypes,
diff --git a/node_modules/react-native-material-textfield/src/components/outline/index.js b/node_modules/react-native-material-textfield/src/components/outline/index.js
index 9347a99..9c3e8a3 100644
--- a/node_modules/react-native-material-textfield/src/components/outline/index.js
+++ b/node_modules/react-native-material-textfield/src/components/outline/index.js
@@ -11,29 +11,29 @@ export default class Line extends PureComponent {
restricted: false,
};
- static propTypes = {
- lineType: PropTypes.oneOf(['solid', 'none']),
+ // static propTypes = {
+ // lineType: PropTypes.oneOf(['solid', 'none']),
- disabled: PropTypes.bool,
- restricted: PropTypes.bool,
+ // disabled: PropTypes.bool,
+ // restricted: PropTypes.bool,
- tintColor: PropTypes.string,
- baseColor: PropTypes.string,
- errorColor: PropTypes.string,
+ // tintColor: PropTypes.string,
+ // baseColor: PropTypes.string,
+ // errorColor: PropTypes.string,
- lineWidth: PropTypes.number,
- activeLineWidth: PropTypes.number,
- disabledLineWidth: PropTypes.number,
+ // lineWidth: PropTypes.number,
+ // activeLineWidth: PropTypes.number,
+ // disabledLineWidth: PropTypes.number,
- focusAnimation: PropTypes.instanceOf(Animated.Value),
- labelAnimation: PropTypes.instanceOf(Animated.Value),
- labelWidth: PropTypes.instanceOf(Animated.Value),
+ // focusAnimation: PropTypes.instanceOf(Animated.Value),
+ // labelAnimation: PropTypes.instanceOf(Animated.Value),
+ // labelWidth: PropTypes.instanceOf(Animated.Value),
- contentInset: PropTypes.shape({
- left: PropTypes.number,
- right: PropTypes.number,
- }),
- };
+ // contentInset: PropTypes.shape({
+ // left: PropTypes.number,
+ // right: PropTypes.number,
+ // }),
+ // };
borderProps() {
let {

View File

@ -11,6 +11,10 @@ import setupApolloClient from "./src/apollo/index";
import { AuthContext } from "./src/context/auth"; import { AuthContext } from "./src/context/auth";
import { ConfigurationProvider } from "./src/context/configuration"; import { ConfigurationProvider } from "./src/context/configuration";
import AppContainer from "./src/routes/index"; import AppContainer from "./src/routes/index";
import { LogBox } from "react-native";
LogBox.ignoreLogs(["Warning: ..."]);
LogBox.ignoreAllLogs();
export default function App() { export default function App() {
const [fontLoaded, setFontLoaded] = useState(false); const [fontLoaded, setFontLoaded] = useState(false);

View File

@ -2,7 +2,7 @@
"expo": { "expo": {
"name": "Enatega Rider", "name": "Enatega Rider",
"description": "Enatega is a starter kit food ordering app built in React Native using Expo for IOS and Android. It's made keeping good aesthetics in mind as well keeping the best coding practices in mind. Its fully customisable to easily help you in your next food delivery project. https://market.nativebase.io/view/react-native-food-delivery-backend-app", "description": "Enatega is a starter kit food ordering app built in React Native using Expo for IOS and Android. It's made keeping good aesthetics in mind as well keeping the best coding practices in mind. Its fully customisable to easily help you in your next food delivery project. https://market.nativebase.io/view/react-native-food-delivery-backend-app",
"version": "4.2.4", "version": "4.2.7",
"slug": "food-delivery-rider", "slug": "food-delivery-rider",
"privacy": "public", "privacy": "public",
"androidStatusBar": { "androidStatusBar": {
@ -38,7 +38,7 @@
"supportsTablet": true, "supportsTablet": true,
"bundleIdentifier": "com.enatega.driver", "bundleIdentifier": "com.enatega.driver",
"config": { "config": {
"googleMapsApiKey": "" "googleMapsApiKey": "AIzaSyCzNP5qQql2a5y8lOoO-1yj1lj_tzjVImA"
}, },
"infoPlist": { "infoPlist": {
"NSCameraUsageDescription": "To scan credit cards using Stripe sdk.", "NSCameraUsageDescription": "To scan credit cards using Stripe sdk.",
@ -51,7 +51,7 @@
} }
}, },
"android": { "android": {
"versionCode": 14, "versionCode": 15,
"googleServicesFile": "./google-services.json", "googleServicesFile": "./google-services.json",
"permissions": [ "permissions": [
"ACCESS_COARSE_LOCATION", "ACCESS_COARSE_LOCATION",

View File

@ -8,16 +8,16 @@ const ENV = {
development: { development: {
// GRAPHQL_URL: 'http://192.168.100.90:8000/graphql', // GRAPHQL_URL: 'http://192.168.100.90:8000/graphql',
// WS_GRAPHQL_URL: 'ws://192.168.100.90:8000/graphql' // WS_GRAPHQL_URL: 'ws://192.168.100.90:8000/graphql'
GRAPHQL_URL: "https://prod-enatega-single-api.herokuapp.com/graphql", GRAPHQL_URL: "https://enatega-singlevendor.up.railway.app/graphql",
WS_GRAPHQL_URL: "wss://prod-enatega-single-api.herokuapp.com/graphql", WS_GRAPHQL_URL: "wss://enatega-singlevendor.up.railway.app/graphql",
}, },
staging: { staging: {
GRAPHQL_URL: "https://staging-enatega-single-api.herokuapp.com/graphql", GRAPHQL_URL: "https://enatega-singlevendor.up.railway.app/graphql",
WS_GRAPHQL_URL: "wss://staging-enatega-single-api.herokuapp.com/graphql", WS_GRAPHQL_URL: "wss://enatega-singlevendor.up.railway.app/graphql",
}, },
production: { production: {
GRAPHQL_URL: "https://prod-enatega-single-api.herokuapp.com/graphql", GRAPHQL_URL: "https://enatega-singlevendor.up.railway.app/graphql",
WS_GRAPHQL_URL: "wss://prod-enatega-single-api.herokuapp.com/graphql", WS_GRAPHQL_URL: "wss://enatega-singlevendor.up.railway.app/graphql",
}, },
}; };

View File

@ -0,0 +1,12 @@
{
"type": "service_account",
"project_id": "pc-api-8741271665364646084-744",
"private_key_id": "ac6cf3caa3f03a39b82511e6cf118e0f4349f204",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCYl3+dsZuMKn8K\nqYyae5IH4ax4JbTsOipt8XTG1MQpEh2kt2oxCYi64WPWxI6waOyORo+v+IEQRbuG\nH5gaD4mGsXEsxIPhJg3lTui+FeWmglZBEe/jI7GeVqGpi/yd/pPbEqP7kJJPQWvK\nIa6PmqiLR6TMCHBm7xJ/+etvKn9sKURtxTaIgs3wZPdH8noNeP2eL3KRuB2hiFNO\ngfVAb0clCMNPPuqQoXHbowfiuFZwoquoX2lbZC3npl19dZJs2H5l7ea/zrwIU+x/\nKTKZazN9jdjElLGbfxvmb8yhuuGOXBHVOmGAITg09b1ALICGv3p2QJEPuTgfahsn\nkZmYAORvAgMBAAECggEAM82S9I08Wmx+7ra61iNHY0eZDrz2XBAvIV4MoAfRhIPy\n7l2aPoWXFqK4C0x1iKxGStLnqvz5i/WwgQsuzwIhVUneOy2H/CK4KvYMC6RRb6Ll\n93dIcltGzJNqlK3CmDy6I3CDnT7qfN+f4WJn6ba+q3IqH15qEnftVucYp4fM9IHT\n1hmKFPtPsaEsnA2VVw1lvYTWhH89lz9bJPLgMllzYJ+p/qHQDsyIdVTEVTLBniDa\ne7SOKA8P3c+jIcXQldH/4BFen4aYThHO8zcG+bj3IX5gOxrg2QrqNxRp04Lqymr0\nDsCTLaChwmGTAi+AYw84uYzDWHKDQD+yZLmXXpaOyQKBgQDHhaJmbcA4rkNYvTkr\nPQ+al8bX91xUDSDqkvJAFbUU9raZrnxiVO5MvxDMRrQAEyz4qj70RrLx2bjghRn0\nQlPewH6nSWzoRe/LE+ixXbzND1sMsK2l3N5jGD9/Y7WjhcYmHttAYNuhlw4lYh2e\nD0IQ0KIdmkXzH+hA0LsAjP584wKBgQDDyRCqZ4k3mVxg3cvCWfWCy2AfnCr0UcLS\nIwkqLoRT0vNDr5ritd15G6L6Z5IqAp/6KcfWtAy+ZbmnV6/Tvitolq5OGXTBuLmE\ncMN//kv0j3rXG0nH0yhRmG+wqurg12xAZqNoV8H0JmjcNIJmTyGBEIdBfym/sNQx\n5WNRF9P8BQKBgQCgmWBvMkhXV22+MBGkTDITLbhQfjtDLI4iQsXb750ikrPIYDqe\nq95kyCatRvv8U3MPdXnXBlFjeuzlTD3n7ruzwR4xaVjQXfr2a8ARhHJEXOfc/xnH\nOFGJUitKTugWB8fHR28UEuK23u/0B1XvtDhpcIYNbfCAEl7QTTM47kSqIQKBgFhV\nonhP6IA2aJCn4aQZtITDv+XjLxo2vYDUH/FxNXEgj3NtiqNZTMi0qG70ReVAc++J\n5ElByTIqcX5IOON/PNSej5xbLeutrb5MplhcYua/ybu96ycGZX2TGmmKZBj3+TaB\nWJ7eYXsHzW31HxSMBWDXFT9+4VZEsSimB45yAsoFAoGAWcqPXt9j6MfTuA2JGuw6\nbKLuXC4JT/Mhte0S7X5WuiKTV5CRwHYRVgyVFO69PMR4pmsmi5OHxpii9fBimgGi\nTeSwYCjrrqj2hKlPOTKDpbowNBKomDGBnLESc7uiTXlmKVLvjQTg/gxwrhjDRkSm\ndRhJ6ccoldcoZFAq1hBlajI=\n-----END PRIVATE KEY-----\n",
"client_email": "android-playstore-eas@pc-api-8741271665364646084-744.iam.gserviceaccount.com",
"client_id": "115125915270931853179",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/android-playstore-eas%40pc-api-8741271665364646084-744.iam.gserviceaccount.com"
}

View File

@ -356,11 +356,11 @@ function OrderDetail() {
<MapView <MapView
style={styles.flex} style={styles.flex}
scrollEnabled={false} scrollEnabled={false}
zoomEnabled={false}
loadingBackgroundColor={colors.tagColor} loadingBackgroundColor={colors.tagColor}
zoomControlEnabled={false} zoomControlEnabled={false}
rotateEnabled={false} rotateEnabled={false}
cacheEnabled={true} cacheEnabled={true}
googleMapsApiKey="AIzaSyCzNP5qQql2a5y8lOoO-1yj1lj_tzjVImA"
initialRegion={{ initialRegion={{
latitude: parseFloat(selectedOrder.delivery_address.latitude), latitude: parseFloat(selectedOrder.delivery_address.latitude),
latitudeDelta: LATITUDE_DELTA, latitudeDelta: LATITUDE_DELTA,