vbea 2 år sedan
förälder
incheckning
73b2bc184f

+ 1 - 0
Strides-APP/README.md

@@ -162,3 +162,4 @@ https://stackoverflow.com/questions/71597475/symbols-not-found-for-architecture-
 https://stackoverflow.com/questions/71702392/viewproptypes-will-be-removed-from-react-native-migrate-to-viewproptypes-export  
 https://stackoverflow.com/questions/55664673/require-cycles-are-allowed-but-can-result-in-uninitialized-values-consider-ref  
 https://www.jianshu.com/p/dd7c5d002303  
+https://stackoverflow.com/questions/75772965/error-react-native-permissions-nativemodule-rnpermissions-is-null   

+ 1 - 0
Strides-APP/app.json

@@ -9,6 +9,7 @@
   "modules": {
     "i18n": false,
     "bookmarks": true,
+    "membership": true,
     "nationally": false,
     "notifications": true,
     "support": {

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

@@ -413,6 +413,14 @@ const Router = () => {
       navigation.current?.dispatch(params);
     }
     global.goBack = () => {
+      if (global.pageBackFallback && global.pageBackFallback.names) {
+        //console.log("覆盖返回", navigation.current.getCurrentRoute()?.name);
+        if (global.pageBackFallback.names.indexOf(navigation.current.getCurrentRoute()?.name) >= 0) {
+          global.pageBackFallback?.callback();
+          global.pageBackFallback = undefined;
+          return;
+        }
+      }
       if (navigation.current?.canGoBack()) {
         navigation.current?.goBack();
       } else {

+ 2 - 4
Strides-APP/app/pages/alert/Notification.js

@@ -9,6 +9,7 @@ import { PageList } from '../Router';
 import Alerts from './Alerts';
 import Promotions from './Promotions';
 import app from '../../../app.json';
+import utils from '../../utils/utils';
 
 export default class Notification extends Component {
   constructor(props) {
@@ -37,6 +38,7 @@ export default class Notification extends Component {
   }
 
   componentDidMount() {
+    utils.setBackClick([this.props?.route?.name, "Alerts", "Promotions"], this.backPage)
     this.props.navigation.addListener('focus', () => {
       this.isHide = false;
     });
@@ -58,10 +60,6 @@ export default class Notification extends Component {
     }
   }
 
-  onPullRefresh() {
-
-  }
-
   render() {
     const Tab = createMaterialTopTabNavigator();
     return (

+ 3 - 1
Strides-APP/app/pages/chargeV2/ChargeAdapter.js

@@ -66,6 +66,7 @@ export default class ChargeAdapter extends Component {
   }
 
   componentDidMount() {
+    utils.setBackClick([this.props?.route?.name, PagerList.tabCharge, PagerList.tabInfo, PagerList.tabReserve], this.backPage)
     this.props.navigation.addListener('beforeRemove', (e) => {
       this.hideDialog();
     });
@@ -264,7 +265,8 @@ export default class ChargeAdapter extends Component {
             lazy: false,
             lazyPreloadDistance: 1,
             ...this.tabBarStyle
-          }}>
+          }}
+          initialRouteName={PagerList.tabCharge}>
           { this.pageAdapter.map((item, index) => 
             <Tab.Screen
               key={index}

+ 13 - 4
Strides-APP/app/pages/chargingV2/ChargingPage.js

@@ -32,11 +32,13 @@ export default class ChargingPage extends Component {
       currentPayment: PaymentDefault.DEFAULT.payType,
       currentPaytype: PaymentDefault.DEFAULT.payName
     };
+    this.isPageShow = true;
     this.waitStartCharging = false;
   }
 
   componentDidMount() {
     this.init();
+    this.isPageShow = true;
     console.log("参数", this.props.route.params);
     if (this.props.route.params.connectorId && this.props.route.params.chargeBoxId) {
       this.setState({
@@ -50,6 +52,10 @@ export default class ChargingPage extends Component {
     }
   }
 
+  componentWillUnmount() {
+    this.isPageShow = false;
+  }
+
   testInit() {
     this.setState({
       isCharging: true,
@@ -74,6 +80,7 @@ export default class ChargingPage extends Component {
   }
 
   getConnectorInfo() {
+    if (!this.isPageShow) return;
     //this.init();
     apiCharge.getConnectorDetail(this.state.stationInfo).then(res => {
       if (res.data.status) {
@@ -171,10 +178,12 @@ export default class ChargingPage extends Component {
   }
 
   refreshChargeData(time=2000) {
-    //console.log("[刷新获取充电信息]", time);
-    setTimeout(() => {
-      this.getConnectorInfo();
-    }, time);
+    if (this.isPageShow) {
+      //console.log("[刷新获取充电信息]", time);
+      setTimeout(() => {
+        this.getConnectorInfo();
+      }, time);
+    }
   }
 
   onPaymentMethodChanged(payment) {

+ 3 - 3
Strides-APP/app/pages/chargingV2/StepCharging.js

@@ -49,7 +49,7 @@ const StepCharging = ({
 
   useEffect(() => {
     const isCharge = (connectorInfo.status == "Charging");
-    console.log("[useEffect]:start", isCharge, fadeAnim);
+    //console.log("[useEffect]:start", isCharge, fadeAnim);
     setCharging(isCharge);
     setAnimSkip(isCharge);
     if (!isCharge) {
@@ -133,7 +133,7 @@ const StepCharging = ({
               numberOfLines={2}
               ellipsizeMode="tail"
               style={styles.infoText}>{connectorInfo.rates || "S$0.00/kWh"}</TextView>
-            { app.modules.nationally && (
+            {(app.modules.nationally && connectorInfo.rates != connectorInfo.userRates) && (
               <TextView
                 numberOfLines={1}
                 ellipsizeMode="tail"
@@ -146,7 +146,7 @@ const StepCharging = ({
               numberOfLines={2}
               ellipsizeMode="tail"
               style={styles.infoText}>{connectorInfo.totalCharges || "S$ 0.0"}</TextView>
-            { app.modules.nationally && (
+            {(app.modules.nationally && connectorInfo.totalCharges != connectorInfo.userTotalCharges) && (
               <TextView
                 numberOfLines={1}
                 ellipsizeMode="tail"

+ 1 - 1
Strides-APP/app/pages/chargingV2/StepStart.js

@@ -58,7 +58,7 @@ export default StepStart = ({
             numberOfLines={2}
             ellipsizeMode="tail"
             style={styles.infoText}>{connectorInfo.rates || "S$0.00/kWh"}</TextView>
-          { app.modules.nationally && (
+          {(app.modules.nationally && connectorInfo.rates != connectorInfo.userRates) && (
             <TextView
               numberOfLines={1}
               ellipsizeMode="tail"

+ 1 - 1
Strides-APP/app/pages/home/Drawer.js

@@ -330,7 +330,7 @@ const DrawerContent = ({isLogin, userInfo, onLogout, notificationCount=0, naviga
         </Button>
       }
       {/*附加功能-结束*/}
-      { isLogin &&
+      { (app.modules.membership && isLogin) &&
         <Button
           style={styles.itemButton}
           viewStyle={styles.itemView}

+ 1 - 1
Strides-APP/app/pages/home/maps/LocationPermission.js

@@ -3,7 +3,7 @@
  * @邠心vbe on 2023/02/15
  */
 import React from 'react';
-import { StyleSheet, Text, View } from 'react-native';
+import { StyleSheet, View } from 'react-native';
 import { check, openSettings, PERMISSIONS, request, RESULTS } from 'react-native-permissions';
 import Button from '../../../components/Button';
 import TextView from '../../../components/TextView';

+ 3 - 2
Strides-APP/app/pages/my/ProfileV2.js

@@ -12,6 +12,7 @@ import TextView from '../../components/TextView';
 import { getStorageJsonSync, setStorage, setStorageJson } from '../../utils/storage';
 import utils from '../../utils/utils';
 import { PageList } from '../Router';
+import app from '../../../app.json';
 
 export default class ProfileV2 extends Component {
   constructor(props) {
@@ -235,7 +236,7 @@ export default class ProfileV2 extends Component {
             color={textCancel}
             name='angle-right'/>
         </Button>
-        {/* this.state.userInfo.userType == "Public" &&
+        { (!app.modules.membership && this.state.userInfo.userType == "Public") &&
           <Button
             style={styles.cardView}
             viewStyle={styles.profileItem}
@@ -253,7 +254,7 @@ export default class ProfileV2 extends Component {
               color={textCancel}
               name='angle-right'/>
           </Button>
-        */}
+        }
         <Button
           style={styles.cardView}
           viewStyle={styles.profileItem}

+ 7 - 1
Strides-APP/app/utils/utils.js

@@ -252,7 +252,7 @@ export default {
    * @param {String} token 原始保存的Firebase令牌
    * @param {Function} back 执行结果(boolean)
    */
-   async registerFirebaseToken(token, back) {
+  async registerFirebaseToken(token, back) {
     const thisDate = this.formatYYMM(new Date()) + "-" + getUserId();
     const lastDate = await getStorageSync('RegisterTokenDate');
     console.log('>>>RegisterToken<<<', thisDate, lastDate + "●");
@@ -272,5 +272,11 @@ export default {
     } else {
       if (back) back(false);
     }
+  },
+  setBackClick(routeNames, func) {
+    global.pageBackFallback = {
+      names: routeNames,
+      callback: func
+    }
   }
 }

+ 9 - 1
Strides-APP/package.json

@@ -56,7 +56,7 @@
     "react-native-permissions": "^3.9.0",
     "react-native-progress": "^4.1.2",
     "react-native-push-notification": "^8.1.1",
-    "react-native-qrcode-scanner": "^1.5.4",
+    "react-native-qrcode-scanner": "^1.6.0",
     "react-native-reanimated": "^3.4.2",
     "react-native-root-siblings": "^4.1.1",
     "react-native-root-toast": "^3.5.1",
@@ -87,6 +87,14 @@
     "react-test-renderer": "18.2.0",
     "typescript": "4.8.4"
   },
+  "resolutions": {
+    "react-native-permissions": "^3.9.0"
+  },
+  "overrides": {
+    "react-native-qrcode-scanner": {
+      "react-native-permissions": "^3.9.0"
+    }
+  },
   "engines": {
     "node": ">=16"
   },