vbea 3 жил өмнө
parent
commit
d380a004c9

+ 2 - 2
Strides-APP/android/app/version.properties

@@ -1,2 +1,2 @@
-#Tue May 09 17:03:09 CST 2023
-VERSION_CODE=222
+#Mon May 15 12:51:09 CST 2023
+VERSION_CODE=224

+ 1 - 1
Strides-APP/app.json

@@ -3,6 +3,6 @@
   "displayName": "ChargEco",
   "versionCode": 220,
   "versionName": "V2.3.0",
-  "product": true,
+  "product": false,
   "debug": true
 }

+ 2 - 0
Strides-APP/app/pages/Router.js

@@ -307,6 +307,8 @@ const Router = () => {
     global.goBack = () => {
       if (navigation.current.canGoBack()) {
         navigation.current.goBack();
+      } else {
+        startPage(PageList.home);
       }
     }
     return (() => {

+ 15 - 2
Strides-APP/app/pages/chargeV2/QRScan.js

@@ -94,6 +94,18 @@ export default class QRScan extends Component {
         isResult: false
       });
     });
+    this.props.navigation.addListener('beforeRemove', (e) => {
+      if (!this.state.isResult) {
+        e.preventDefault();
+        this.setState({
+          isResult: true
+        }, () => {
+          setTimeout(() => {
+            goBack();
+          }, 300);
+        });
+      }
+    });
   }
 
   scanResult = (msg) => {
@@ -165,9 +177,10 @@ export default class QRScan extends Component {
               containerStyle={{ width: $width, height: $vh(100)}}
               flashMode={RNCamera.Constants.FlashMode.off}
               checkAndroid6Permissions={true} />
-          : <Image
+          : <View style={ui.flex1}></View>
+            /*<Image
               style={Styles.logo}
-              source={require('../../images/app-logo.png')}/>
+              source={require('../../images/app-logo.png')}/>*/
         }
       </View>
     );

+ 17 - 0
Strides-APP/app/pages/my/EditProfile.js

@@ -307,6 +307,23 @@ export default class EditProfile extends Component {
           <ArrowRight/>
         </Pressable>
         <Divide/>
+        <Pressable
+          style={[styles.profileView, {
+            paddingRight: 48
+          }]}>
+          <Text style={styles.label}>User Type</Text>
+          <Text style={styles.infoText}>{userInfo.userType}</Text>
+          {/*<ArrowRight/>*/}
+        </Pressable>
+        <Divide/>
+        <Pressable
+          style={[styles.profileView, {
+            paddingRight: 48
+          }]}>
+          <Text style={styles.label}>Registration Date</Text>
+          <Text style={styles.infoText}>{"-"}</Text>
+          {/*<ArrowRight/>*/}
+        </Pressable>
         <EditDialog
           title={this.state.editDialog.title}
           visible={this.state.editDialog.visible}

+ 52 - 46
Strides-APP/app/pages/my/ProfileV2.js

@@ -3,7 +3,7 @@
  * @邠心vbe on 2021/04/27
  */
 import React, { Component } from 'react';
-import { View, Text, StyleSheet, Image, ScrollView, Switch, Pressable } from 'react-native';
+import { View, Text, StyleSheet, Image, ScrollView } from 'react-native';
 import apiUser from '../../api/apiUser';
 import { host, setAccessToken } from '../../api/http';
 import Button, { ElevationObject } from '../../components/Button';
@@ -129,36 +129,36 @@ export default class ProfileV2 extends Component {
     return (
       <ScrollView style={styles.container}>
         {/* Profile Info */}
-        <View style={styles.cardView}>
-          <Pressable
-            style={styles.profileView}
-            onPress={() => startPage(PageList.editProfile)}>
-            { this.state.userInfo.photoUrl
-            ? <Image
-                style={styles.avatar}
-                source={{uri: host + this.state.userInfo.photoUrl}}/>
-            : <Image
-                style={styles.avatar}
-                source={require('../../images/user/ic-avatar-default.png')}/>
-            }
-            <View style={styles.infoContent}>
-              <Text
-                style={styles.nickname}
-                ellipsizeMode='tail'
-                numberOfLines={1}>{this.state.userInfo.nickName}</Text>
-              <Text style={styles.userText}>{this.state.userInfo.email}</Text>
-              <Text style={styles.userText}>{(utils.isNotEmpty(this.state.userInfo.callingCode) && "+" + this.state.userInfo.callingCode + " ") + this.state.userInfo.phone}</Text>
-            </View>
-            <FontAwesome
-              size={34}
-              color={textCancel}
-              name='angle-right'/>
-          </Pressable>
-        </View>
+        <Button
+          style={styles.cardView}
+          viewStyle={styles.profileView}
+          onClick={() => startPage(PageList.editProfile)}>
+          { this.state.userInfo.photoUrl
+          ? <Image
+              style={styles.avatar}
+              source={{uri: host + this.state.userInfo.photoUrl}}/>
+          : <Image
+              style={styles.avatar}
+              source={require('../../images/user/ic-avatar-default.png')}/>
+          }
+          <View style={styles.infoContent}>
+            <Text
+              style={styles.nickname}
+              ellipsizeMode='tail'
+              numberOfLines={1}>{this.state.userInfo.nickName}</Text>
+            <Text style={styles.userText}>{this.state.userInfo.email}</Text>
+            <Text style={styles.userText}>{(utils.isNotEmpty(this.state.userInfo.callingCode) && "+" + this.state.userInfo.callingCode + " ") + this.state.userInfo.phone}</Text>
+          </View>
+          <FontAwesome
+            size={34}
+            color={textCancel}
+            name='angle-right'/>
+        </Button>
         {/* Wallet Info */}
-        <Pressable 
+        <Button 
           style={styles.cardView}
-          onPress={() => startPage(PageList.wallet)}>
+          viewStyle={styles.profileView}
+          onClick={() => startPage(PageList.wallet)}>
           <Image
             style={styles.cardIcon}
             source={require('../../images/user/card-wallet.png')}/>
@@ -170,11 +170,12 @@ export default class ProfileV2 extends Component {
             size={28}
             color={textCancel}
             name='angle-right'/>
-        </Pressable>
+        </Button>
         {/* Vehicle Info */}
-        <Pressable
+        <Button
           style={styles.cardView}
-          onPress={() => startPage(PageList.myVehicles)}>
+          viewStyle={styles.profileView}
+          onClick={() => startPage(PageList.myVehicles)}>
           <Image
             style={styles.cardIcon}
             source={require('../../images/user/card-vehicle.png')}/>
@@ -186,7 +187,7 @@ export default class ProfileV2 extends Component {
             size={28}
             color={textCancel}
             name='angle-right'/>
-        </Pressable>
+        </Button>
         {/* Vehicle List */}
         {/* <View style={styles.titleView}>
           <Text style={styles.title}>My Vehicles</Text>
@@ -228,9 +229,10 @@ export default class ProfileV2 extends Component {
         <View style={styles.accountList}>
           <CardList refreshId={this.state.refreshId}/>
         </View> */}
-        <Pressable
+        <Button
           style={styles.cardView}
-          onPress={() => startPage(PageList.changePassword, {action: "change"})}>
+          viewStyle={styles.profileView}
+          onClick={() => startPage(PageList.changePassword, {action: "change"})}>
           <Image
             style={styles.cardIcon}
             source={require('../../images/user/card-account.png')}/>
@@ -241,11 +243,12 @@ export default class ProfileV2 extends Component {
             size={28}
             color={textCancel}
             name='angle-right'/>
-        </Pressable>
+        </Button>
         {/* Notifications */}
-        <Pressable
+        <Button
           style={styles.cardView}
-          onPress={() => startPage(PageList.settings)}>
+          viewStyle={styles.profileView}
+          onClick={() => startPage(PageList.settings)}>
           <Image
             style={styles.cardIcon}
             source={require('../../images/user/card-notification.png')}/>
@@ -256,11 +259,12 @@ export default class ProfileV2 extends Component {
             size={28}
             color={textCancel}
             name='angle-right'/>
-        </Pressable>
+        </Button>
         { this.state.userInfo.userType == "Public" &&
-          <Pressable
+          <Button
             style={styles.cardView}
-            onPress={() => startPage(PageList.registerFleet)}>
+            viewStyle={styles.profileView}
+            onClick={() => startPage(PageList.registerFleet)}>
             <MaterialCommunityIcons
               style={styles.cardIcon}
               name="credit-card-edit"
@@ -273,11 +277,12 @@ export default class ProfileV2 extends Component {
               size={28}
               color={textCancel}
               name='angle-right'/>
-          </Pressable>
+          </Button>
         }
-        <Pressable
+        <Button
           style={styles.cardView}
-          onPress={() => this.deleteAccount()}>
+          viewStyle={styles.profileView}
+          onClick={() => this.deleteAccount()}>
           <MaterialCommunityIcons
             style={styles.cardIcon}
             name="account-remove"
@@ -290,7 +295,7 @@ export default class ProfileV2 extends Component {
             size={28}
             color={textCancel}
             name='angle-right'/>
-        </Pressable>
+        </Button>
         {/* <Button
           style={styles.deleteButton}
           text="DELETE MY ACCOUNT"
@@ -326,6 +331,7 @@ const styles = StyleSheet.create({
   },
   profileView: {
     zIndex: 10,
+    padding: 16,
     alignItems: 'center',
     flexDirection: 'row'
   },
@@ -353,7 +359,7 @@ const styles = StyleSheet.create({
     paddingTop: 1.5
   },
   cardView: {
-    padding: 16,
+    //padding: 16,
     marginTop: 16,
     marginLeft: 16,
     marginRight: 16,

+ 13 - 3
Strides-APP/app/pages/wallet/Overview.js

@@ -16,6 +16,7 @@ export default class Overview extends Component {
   constructor(props) {
     super(props);
     this.state = {
+      skeleton: true,
       glanceData: {},
       monthData: [],
       weekdayData: [],
@@ -29,14 +30,17 @@ export default class Overview extends Component {
   }
 
   componentDidMount() {
-    this.getOverview();
+    if (!this.props.skeleton)
+      this.getOverview();
   }
 
   componentDidUpdate() {
-    if (this.props.shown) {
+    if (this.props.shown && !this.props.skeleton) {
       if (this.props.refresh && !this.refreshing) {
         this.refreshing = true;
         this.getOverview();
+      } else if (this.state.skeleton) {
+        this.getOverview();
       } else if (!this.state.chartReady) {
         setTimeout(() => {
           this.setState({
@@ -102,6 +106,7 @@ export default class Overview extends Component {
         monthData: monthData
       }, () => {
         this.setState({
+          skeleton: false,
           chartReady: true
         })
       });
@@ -143,7 +148,6 @@ export default class Overview extends Component {
 
   areaTheme = () => ({
     data: {
-      //fill: chartThemes,
       fill: chartThemes,
       fillOpacity: 0.7,
       stroke: colorPrimary,
@@ -243,6 +247,12 @@ export default class Overview extends Component {
               }
             </Svg>
           </View>
+          { this.state.skeleton &&
+            <View style={styles.statisticView}>
+            <Text style={styles.sectionTitle}>Statistics for the past 6 months</Text>
+            <View style={{height: 200}}></View>
+            </View>
+          }
           { this.state.monthData.length > 0 &&
             <View style={styles.statisticView}>
               <Text style={styles.sectionTitle}>Statistics for the past 6 months</Text>

+ 16 - 1
Strides-APP/app/pages/wallet/Wallet.js

@@ -20,6 +20,7 @@ export default class Wallet extends Component {
       refreshing: false,
       tabWidth: 0,
       tabHeight: 0,
+      pageShown: false
     };
   }
 
@@ -28,10 +29,23 @@ export default class Wallet extends Component {
       this.onRefresh();
       getUserInfo(info => {
         this.setState({
-          balance: info.credit
+          balance: info.credit,
+          pageShown: true
         })
       }, true)
     });
+    this.props.navigation.addListener('beforeRemove', (e) => {
+      if (this.state.pageShown) {
+        e.preventDefault();
+        this.setState({
+          pageShown: false
+        }, () => {
+          setTimeout(() => {
+            goBack();
+          }, 300);
+        });
+      }
+    });
   }
 
   changeTab(index) {
@@ -124,6 +138,7 @@ export default class Wallet extends Component {
           </View>
           <Overview
             atAglance={false}
+            skeleton={!this.state.pageShown}
             refresh={this.state.refreshing}
             refreshed={() => this.stopRefresh()}
             shown={this.state.tabIndex == 0}/>