Ian Fung hace 1 año
padre
commit
27d871973c

+ 9 - 3
app.json

@@ -23,18 +23,24 @@
         },
         "android": {
             "adaptiveIcon": {
-                "foregroundImage": "./assets/cc_android_logo.png",
+                "foregroundImage": "./assets/cc_android_ccLogo.png",
                 "backgroundColor": "#000000"
             },
-            "icon": "./assets/CC_Logo.png",
+            "icon": "./assets/cc_android_ccLogo.png",
             "permissions": [
                 "android.permission.CAMERA",
                 "android.permission.RECORD_AUDIO",
                 "android.permission.ACCESS_COARSE_LOCATION",
                 "android.permission.ACCESS_FINE_LOCATION"
             ],
+            "config": {
+                "googleMaps": {
+                    "apiKey": "AIzaSyDYVSNuXFDNOhZAKfqeSwBTc8Pa7hKma1A"
+                }
+            },
             "package": "hk.com.crazycharge",
-            "versionCode": 21
+            "versionCode": 21,
+            "googleServicesFile": "./google-services.json"
         },
         "web": {
             "favicon": "./assets/favicon.png"

+ 1 - 1
app/_layout.tsx

@@ -13,7 +13,7 @@ export default function RootLayout() {
     const { expoPushToken, notification } = usePushNotifications();
 
     console.log('notification', notification);
-    console.log('expoPushToken', expoPushToken);
+    console.log('expoPushToken', expoPushToken?.data);
 
     const data = JSON.stringify(notification, undefined, 2);
 

BIN
assets/cc_android_ccLogo.png


+ 2 - 2
component/accountPages/accountMainPageComponent.tsx

@@ -108,7 +108,7 @@ const AccountMainPageComponent = () => {
                             <Text className="text-lg pl-2 text-black dark:text-white">排除解難</Text>
                         </Pressable>
                     </View>
-                    <View className="h-0.5  bg-[#f4f4f4] dark:bg-[#5E6C70]" />
+                    {/* <View className="h-0.5  bg-[#f4f4f4] dark:bg-[#5E6C70]" />
                     <View className=" py-4 ">
                         <Pressable
                             // onPress={() => router.push('/assistancePage')}
@@ -128,7 +128,7 @@ const AccountMainPageComponent = () => {
                                 <Switch value={colorScheme == 'dark'} onChange={toggleColorScheme} />
                             </View>
                         </Pressable>
-                    </View>
+                    </View> */}
                     <View className="h-0.5  bg-[#f4f4f4] dark:bg-[#5E6C70]" />
                     <View className="py-4">
                         <Pressable

+ 1 - 1
component/bindingMultiStepForm/formComponent/form.tsx

@@ -8,7 +8,7 @@ import BindingPhoneNumberPageStepTwo from './formPages/bindingPhoneNumberPageSte
 import BindingFinishPage from './formPages/bindingFinishPage';
 
 const BindingPhoneNumberForm = ({ bindingFormData, setBindingFormData }: any) => {
-    const [screen, setScreen] = useState<number>(2);
+    const [screen, setScreen] = useState<number>(0);
     const FormTitle = ['舊用戶手機號碼綁定 (1/2)', '舊用戶手機號碼綁定 (2/2)'];
     // const goToPreviousPage = () => {
     //         router.back();

+ 2 - 3
component/bindingMultiStepForm/formComponent/formPages/bindingFinishPage.tsx

@@ -12,10 +12,9 @@ const BindingFinishPage = () => {
                     </Text>
 
                     <Text style={styles.text}>
-                        從現在起客戶只能<Text style={{ fontWeight: 'bold' }}>使用手機號碼進行登入</Text>
+                        <Text style={{ fontWeight: 'bold' }}>使用手機號碼進行登入</Text>
                     </Text>
-                    <Text style={styles.text}>電子郵件將不能進行登入</Text>
-                    <Text style={styles.text}>謝謝您的體諒</Text>
+                    <Text style={styles.text}>謝謝</Text>
                 </View>
 
                 <NormalButton

+ 9 - 3
component/homePage/homePage.tsx

@@ -2,6 +2,7 @@ import { View, Text, ScrollView, FlatList, Pressable, ActivityIndicator, Image,
 import NormalButton from '../global/normal_button';
 import { SafeAreaView } from 'react-native-safe-area-context';
 import { router } from 'expo-router';
+import { useColorScheme } from 'nativewind';
 import RecentlyBookedScrollView from '../global/recentlyBookedScrollView';
 import {
     BellIconSvg,
@@ -21,10 +22,15 @@ interface HomePageProps {}
 
 const HomePage: React.FC<HomePageProps> = () => {
     const now = new Date();
-
     const { user } = useContext(AuthContext);
     const { userID, currentPrice, setUserID, setCurrentPrice } = useUserInfoStore();
-
+    const { colorScheme, toggleColorScheme } = useColorScheme();
+    useEffect(() => {
+        // Set to light mode on component mount
+        if (colorScheme === 'dark') {
+            toggleColorScheme();
+        }
+    }, []);
     // Effect for fetching user ID
     useEffect(() => {
         const fetchID = async () => {
@@ -85,7 +91,7 @@ const HomePage: React.FC<HomePageProps> = () => {
     }, []);
 
     return (
-        <SafeAreaView edges={['top', 'left', 'right']} className="flex-1 bg-white dark:bg-black">
+        <SafeAreaView edges={['top', 'left', 'right']} className="flex-1 bg-white">
             {/* Add Modal component */}
             {mainPromotionImage && (
                 <Modal

+ 1 - 1
component/registrationMultiStepForm/formComponent/form.tsx

@@ -20,7 +20,7 @@ import BindingMultiStepForm from '../../bindingMultiStepForm/bindingMultiStepFor
 type FormProps = {};
 const Form: React.FC<FormProps> = ({}) => {
     const [screen, setScreen] = useState<number>(0);
-    const FormTitle = ['', '註冊 - 電驗證', '註冊 - 基本資料', '註冊 - 基本資料', '註冊 - 設立銀包'];
+    const FormTitle = ['', '註冊 - 電驗證', '註冊 - 基本資料', '註冊 - 基本資料', '註冊 - 設立銀包'];
 
     const ScreenDisplay = () => {
         switch (screen) {

+ 1 - 1
component/registrationMultiStepForm/formComponent/formPages/loginPage.tsx

@@ -146,7 +146,7 @@ const LoginPage: React.FC<LoginPageProps> = ({ goToNextPage, goToForgetPassWordP
                 </Text>
                 <Pressable onPress={goToBindingPhoneNumberPage}>
                     <Text className="text-lg text-center text-[#888888] font-[600] underline">
-                        立即按我前往綁定頁面 (需時兩分鐘)
+                        立即按我前往綁定頁面
                     </Text>
                 </Pressable>
                 {/* <NormalInput

+ 9 - 2
component/registrationMultiStepForm/formComponent/formPages/verification.tsx

@@ -6,6 +6,7 @@ import NormalButton from '../../../global/normal_button';
 import useSignUpStore from '../../../../providers/signup_form_store';
 import NormalInput from '../../../global/normal_input';
 import { authenticationService } from '../../../../service/authService';
+import { usePushNotifications } from '../../../../app/hooks/usePushNotifications';
 
 type VerificationProps = {
     setScreen: React.Dispatch<React.SetStateAction<number>>;
@@ -19,17 +20,23 @@ const Verification: React.FC<VerificationProps> = ({ setScreen }) => {
     const [lockPhoneInput, setLockPhoneInput] = useState(false);
     const [countdown, setCountdown] = useState(0);
     const [loading, setLoading] = useState(false);
+    const { expoPushToken } = usePushNotifications();
+    const notify_session_id = expoPushToken?.data || '';
     const handleVerification = async () => {
         setLoading(true);
         if (signUpFormData.phone === '' || otp === '') {
             setError('請確保所有資料都已填寫。');
         } else {
             setError('');
-            //*************use new otp function**************
             console.log('signUpFormData.phone', signUpFormData.phone);
             console.log('otp', otp);
+            console.log('notifysession id in handleVerification', expoPushToken?.data);
             try {
-                const result = await authenticationService.verifyPhoneOtp(signUpFormData.phone, otp);
+                const result = await authenticationService.verifyPhoneOtp(
+                    signUpFormData.phone,
+                    otp,
+                    expoPushToken?.data
+                );
                 if (result.status === 200) {
                     setScreen(2);
                 } else {

+ 11 - 3
component/searchPage/searchResultComponent.tsx

@@ -38,7 +38,13 @@ const GOOGLE_API_KEY = 'AIzaSyDYVSNuXFDNOhZAKfqeSwBTc8Pa7hKma1A';
 // ***************************************
 
 const SearchResultComponent = () => {
-    const [region, setRegion] = useState<Region | undefined>(undefined);
+    const [region, setRegion] = useState<Region>({
+        latitude: 22.302711, // Default to Hong Kong coordinates
+        longitude: 114.177216,
+        latitudeDelta: 0.01,
+        longitudeDelta: 0.01
+    });
+
     const [errorMsg, setErrorMsg] = useState<string | null>(null);
     const [searchInput, setSearchInput] = useState<string>('');
     const sheetRef = useRef<BottomSheet>(null);
@@ -232,8 +238,10 @@ const SearchResultComponent = () => {
                     </View>
                     <MapView
                         ref={mapRef}
+                        provider="google"
                         style={styles.map}
                         region={region}
+                        initialRegion={region}
                         cameraZoomRange={{
                             minCenterCoordinateDistance: 500,
                             maxCenterCoordinateDistance: 90000,
@@ -270,8 +278,8 @@ const SearchResultComponent = () => {
                                                     key={index}
                                                     onPress={() => {
                                                         handleRegionChange({
-                                                            latitude: item.latitude,
-                                                            longitude: item.longitude,
+                                                            latitude: item.lat,
+                                                            longitude: item.lng,
                                                             latitudeDelta: 0.01,
                                                             longitudeDelta: 0.01
                                                         });

+ 29 - 0
google-services.json

@@ -0,0 +1,29 @@
+{
+  "project_info": {
+    "project_number": "402837943835",
+    "project_id": "crazy-charge-21951",
+    "storage_bucket": "crazy-charge-21951.firebasestorage.app"
+  },
+  "client": [
+    {
+      "client_info": {
+        "mobilesdk_app_id": "1:402837943835:android:f64754c4082287e6f9aabe",
+        "android_client_info": {
+          "package_name": "hk.com.crazycharge"
+        }
+      },
+      "oauth_client": [],
+      "api_key": [
+        {
+          "current_key": "AIzaSyDNUvRnKFkpmnv8GKgFjL_zNR-CYjA_fwQ"
+        }
+      ],
+      "services": {
+        "appinvite_service": {
+          "other_platform_oauth_client": []
+        }
+      }
+    }
+  ],
+  "configuration_version": "1"
+}

+ 3 - 2
service/authService.tsx

@@ -492,13 +492,14 @@ class AuthenticationService {
         }
     }
 
-    async verifyPhoneOtp(phoneNumber: string, otp: string) {
+    async verifyPhoneOtp(phoneNumber: string, otp: string, notify_session_id: string) {
         try {
             const response = await axios.put(
                 `${this.apiUrl}/public/client/customer/phone/otp`,
                 {
                     phone: phoneNumber,
-                    code: otp
+                    code: otp,
+                    notify_session_id: notify_session_id
                 },
                 {
                     headers: {