vbea 1 tahun lalu
induk
melakukan
0e59c91ea9

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

@@ -1,2 +1,2 @@
-#Sun Jan 26 15:46:23 CST 2025
-VERSION_CODE=583
+#Sun Jan 26 16:56:29 CST 2025
+VERSION_CODE=589

+ 1 - 1
Strides-APP/android/gradle.properties

@@ -10,7 +10,7 @@
 # Specifies the JVM arguments used for the daemon process.
 # The setting is particularly useful for tweaking memory settings.
 # Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
-org.gradle.jvmargs=-Xmx4196m -XX:MaxMetaspaceSize=512m
+org.gradle.jvmargs=-Xmx5120m -XX:MaxMetaspaceSize=512m
 
 # When configured, Gradle will run in incubating parallel mode.
 # This option should only be used with decoupled projects. More details, visit

+ 71 - 10
Strides-APP/app/pages/wallets/ViewWallet.js

@@ -3,18 +3,38 @@
  * @邠心vbe on 2025/01/17
  */
 import React from 'react';
-import { StyleSheet } from 'react-native';
-import { Text, View } from 'react-native';
+import { Pressable, StyleSheet } from 'react-native';
+import { View } from 'react-native';
 import { ElevationObject } from '../../components/Button';
 import TextView from '../../components/TextView';
 import utils from '../../utils/utils';
+import { toTopupPage } from '../payment/PaymentConfig';
 
 const ViewWallet = ({
-  wallet
+  wallet,
+  setDefault
 }) => (
   <View style={styles.cardWallet}>
-    <View style={ui.flexc}>
-      <TextView style={styles.walletName}>{wallet.walletTypeName}</TextView>
+    <View style={ui.flex}>
+      <TextView style={styles.walletName} numberOfLines={1}>{wallet.walletTypeName}</TextView>
+      { wallet.defaultPaymentMethod
+      ? <View style={styles.defaultView}>
+          <MaterialCommunityIcons
+            name="credit-card-check-outline"
+            size={18}
+            color={textButton}/>
+          <TextView style={styles.defaultText}>Default</TextView>
+        </View>
+      : <Pressable
+          style={styles.setDefaultView}
+          onPress={setDefault}>
+          <MaterialCommunityIcons
+            name="credit-card-edit-outline"
+            size={18}
+            color={textButton}/>
+          <TextView style={styles.defaultText}>Set Default</TextView>
+        </Pressable>
+      }
     </View>
     <TextView style={styles.walletProvider}>{wallet.walletPrincipalName}</TextView>
     <TextView style={styles.walletLabel}>Current Balance:</TextView>
@@ -22,6 +42,19 @@ const ViewWallet = ({
     { utils.isNotEmpty(wallet.expiresDate) &&
       <TextView style={styles.walletLabel}>Expires {wallet.expiresDate}</TextView>
     }
+    { wallet.walletTypeCode == "credit_wallet" &&
+      <View style={styles.topupView}>
+        <Pressable
+          style={styles.setDefaultView}
+          onPress={() => toTopupPage()}>
+          <MaterialCommunityIcons
+            name="credit-card-plus-outline"
+            size={18}
+            color={textButton}/>
+          <TextView style={styles.defaultText}>{$t("wallet.topUp")}</TextView>
+        </Pressable>
+      </View>
+    }
   </View>
 );
 
@@ -29,7 +62,7 @@ export default ViewWallet;
 
 const styles = StyleSheet.create({
   cardWallet: {
-    height: 182,
+    height: 194,
     margin: 16,
     padding: 16,
     borderRadius: 16,
@@ -37,18 +70,20 @@ const styles = StyleSheet.create({
     backgroundColor: colorAccent
   },
   walletName: {
+    flex: 1,
     color: textLight,
-    fontSize: 24,
-    fontWeight: 'bold'
+    fontSize: 22,
+    fontWeight: 'bold',
+    paddingRight: 16
   },
   walletProvider: {
     color: textLight,
-    fontSize: 20,
+    fontSize: 18,
   },
   walletLabel: {
     color: textLight,
     opacity: .9,
-    fontSize: 14,
+    fontSize: 13,
     paddingTop: 16
   },
   walletBalance: {
@@ -56,5 +91,31 @@ const styles = StyleSheet.create({
     fontSize: 20,
     paddingTop: 4,
     fontWeight: 'bold'
+  },
+  setDefaultView: {
+    height: 28,
+    ...$padding(4, 12),
+    borderRadius: 16,
+    alignItems: 'center',
+    flexDirection: 'row',
+    ...ElevationObject(2),
+    backgroundColor: 'rgba(0,0,0,.9)'
+  },
+  defaultView: {
+    height: 28,
+    ...$padding(4, 12),
+    borderRadius: 16,
+    alignItems: 'center',
+    flexDirection: 'row',
+    backgroundColor: 'rgba(0,0,0,.5)'
+  },
+  defaultText: {
+    color: textLight,
+    fontSize: 12,
+    paddingLeft: 4
+  },
+  topupView: {
+    paddingTop: 16,
+    flexDirection: 'row'
   }
 })

+ 51 - 9
Strides-APP/app/pages/wallets/Wallets.js

@@ -6,6 +6,7 @@ import React, { Component } from 'react';
 import { FlatList, StyleSheet } from 'react-native';
 import { View, Text } from 'react-native';
 import PagerView from 'react-native-pager-view';
+import apiCharge from '../../api/apiCharge';
 import apiWallets from '../../api/apiWallets';
 import { ElevationObject } from '../../components/Button';
 import VbeSkeleton from '../../components/VbeSkeleton';
@@ -19,9 +20,7 @@ export default class Wallets extends Component {
       loading: true,
       wallets: [],
       active: 0,
-      history: {
-
-      },
+      history: {},
       historyList: [],
       loadingList: false
     };
@@ -31,14 +30,37 @@ export default class Wallets extends Component {
     setTimeout(() => {
       this.getWalletsInfo();
     }, 500);
+    this.props.navigation.addListener('focus', () => {
+      if (!this.state.loading) {
+        this.refresh();
+      }
+    });
+  }
+
+  refresh() {
+    this.setState({
+      history: {},
+      historyList: [],
+      loadingList: true
+    }, () => {
+      this.getWalletsInfo(true);
+    })
   }
 
-  getWalletsInfo() {
+  getWalletsInfo(refresh) {
     apiWallets.getWalletsInfo().then(res => {
       if (res.data) {
         this.setState({
           wallets: res.data
         })
+        if (refresh) {
+          let wallet = this.state.wallets[this.state.active];
+          if (wallet && wallet.walletTypeCode) {
+            setTimeout(() => {
+              this.getTransactionInfo(wallet.walletTypeCode);
+            }, 300);
+          }
+        }
       }
     }).catch(err => {
       toastShort(err)
@@ -98,6 +120,23 @@ export default class Wallets extends Component {
     })
   }
 
+  setDefault(index) {
+    const code = this.state.wallets[index]?.walletTypeCode;
+    if (code) {
+      Dialog.showProgressDialog();
+      apiCharge.setDefaultPaymentType({
+        defaultPaymentMethod: code
+      }).then(res => {
+        toastShort("success");
+        this.getWalletsInfo();
+      }).catch(err => {
+        toastShort(err)
+      }).finally(() => {
+        Dialog.dismissLoading();
+      })
+    }
+  }
+
   divideView = (props) => {
     return (<View style={styles.divideView}></View>)
   }
@@ -108,8 +147,8 @@ export default class Wallets extends Component {
         <VbeSkeleton
           style={[ui.flex1, $padding(16)]}
           layout={[
-            {width: "100%", height: 200, borderRadius: 16},
-            {width: "100%", height: $vh(100) - 320, borderRadius: 16, marginTop: 24},
+            {width: "100%", height: 210, borderRadius: 16},
+            {width: "100%", height: $vh(100) - 330, borderRadius: 16, marginTop: 24},
           ]}
           animationDirection={"horizontalRight"}
         />
@@ -119,10 +158,13 @@ export default class Wallets extends Component {
       <View style={styles.container}>
         <PagerView
           style={styles.pagerView}
-          initialPage={0}
+          initialPage={this.state.active}
           onPageSelected={e => this.changeCard(e)}>
           { this.state.wallets.map((item, index) => (
-            <ViewWallet key={index} wallet={item}/>
+            <ViewWallet
+              key={index}
+              wallet={item}
+              setDefault={() => this.setDefault(index)}/>
           ))}
         </PagerView>
         <View style={styles.indicatorView}>
@@ -165,7 +207,7 @@ const styles = StyleSheet.create({
     backgroundColor: pageBackground
   },
   pagerView: {
-    height: 200
+    height: 210
   },
   indicatorView: {
     padding: 8,