panhui 5 yıl önce
ebeveyn
işleme
ace6a2cbb1

+ 3 - 1
App.tsx

@@ -51,8 +51,10 @@ export default function App() {
                 zIndex={999}
                 bg="transparent"
                 color="black"
+                bottom={50}
+                left={20}
               >
-                骑手端测试版 (0807) 版本一
+                骑手端测试版 (0819) 版本一
               </Button>
               <Navigation colorScheme={colorScheme} />
             </Div>

+ 1 - 1
login/model.ts

@@ -87,7 +87,7 @@ const MapModel = (now) => ({
         const { getInit } = now(User);
         return getInit();
       })
-      .then(() => {
+      .then(() => { 
         toastHide();
         toastSuccess('注册成功');
       })

+ 3 - 0
mine/MineAppraisalScreen.tsx

@@ -118,6 +118,9 @@ export default function MineAppraisalScreen({ navigation }: StackScreenProps) {
       defaultLoading: false,
       debounceInterval: 1000,
       loadMore: true,
+      initialData: {
+        list: [],
+      },
     }
   );
 

+ 2 - 0
mine/MineScreen.tsx

@@ -4,6 +4,7 @@ import { Div, Button, Image, Text, Avatar, Icon } from 'react-native-magnus';
 import { ScrollView } from 'react-native-gesture-handler';
 
 import { RootStackParamList } from '../types';
+import { useTranslation } from 'react-i18next';
 
 import useModel from 'flooks';
 
@@ -17,6 +18,7 @@ export default function RegisterScreen({ navigation }: StackScreenProps) {
   const { userInfo, riderInfo } = useModel(User, ['userInfo']);
   const { avatar, nickname, money } = userInfo;
   const { jobNumber } = riderInfo;
+  const { t } = useTranslation();
 
   return (
     <Div bg="yellow500" flex={1}>

+ 6 - 4
mine/SettingSysScreen.tsx

@@ -7,8 +7,10 @@ import User from '../stores/User';
 
 import request from '../utils/RequestUtils';
 import { toastShow, toastInfo, toastSuccess } from '../utils/SystemUtils';
+import { useTranslation } from 'react-i18next';
 
 export default function SettingSysScreen({ navigation }: StackScreenProps) {
+  const { t } = useTranslation();
   const { riderInfo, setRider } = useModel(User, ['riderInfo']);
   const {
     newNews,
@@ -52,7 +54,7 @@ export default function SettingSysScreen({ navigation }: StackScreenProps) {
           row
           px={14}
         >
-          <Text fontSize="sm">t('xin-xiao-xi-tong-zhi')</Text>
+          <Text fontSize="sm">{t('xin-xiao-xi-tong-zhi')}</Text>
           <Toggle
             on={newNews}
             onPress={() => {
@@ -67,7 +69,7 @@ export default function SettingSysScreen({ navigation }: StackScreenProps) {
         </Div>
         <Div bg="white" px={14} py={10} my={10}>
           <Div row alignItems="center" justifyContent="space-between" py={10}>
-            <Text fontSize="sm">t('xin-dan-ti-shi-yin')</Text>
+            <Text fontSize="sm">{t('xin-dan-ti-shi-yin')}</Text>
             <Toggle
               on={newOrderTone}
               onPress={() => {
@@ -81,7 +83,7 @@ export default function SettingSysScreen({ navigation }: StackScreenProps) {
             />
           </Div>
           <Div row alignItems="center" justifyContent="space-between" py={10}>
-            <Text fontSize="sm">t('cui-dan-ti-shi-yin')</Text>
+            <Text fontSize="sm">{t('cui-dan-ti-shi-yin')}</Text>
             <Toggle
               on={reminderTone}
               onPress={() => {
@@ -95,7 +97,7 @@ export default function SettingSysScreen({ navigation }: StackScreenProps) {
             />
           </Div>
           <Div row alignItems="center" justifyContent="space-between" py={10}>
-            <Text fontSize="sm">t('liao-tian-xiao-xi-ti-xing')</Text>
+            <Text fontSize="sm">{t('liao-tian-xiao-xi-ti-xing')}</Text>
             <Toggle
               on={chatMessageReminder}
               onPress={() => {

+ 6 - 4
notice/ChatScreen.tsx

@@ -1,20 +1,22 @@
 import { StackScreenProps } from '@react-navigation/stack';
 import React, { useState, useCallback, useEffect } from 'react';
-import { Platform, View } from 'react-native';
+import { Platform, View, KeyboardAvoidingView } from 'react-native';
 import { Div, Button, Image, Text, Avatar } from 'react-native-magnus';
-import { GiftedChat, KeyboardAvoidingView } from 'react-native-gifted-chat';
+import { GiftedChat } from 'react-native-gifted-chat';
 import { ScrollView } from 'react-native-gesture-handler';
 import * as Localization from 'expo-localization';
 import useModel from 'flooks';
 import User from '../stores/User';
 import IM from './model';
 import { parse } from '../utils/TimeUtils';
+import { useTranslation } from 'react-i18next';
 
 import { useRequest } from 'ahooks';
 
 export default function ChatScreen({ navigation, route }: StackScreenProps) {
   const { params } = route;
   const { toUserId, toUserName } = params;
+  const { t } = useTranslation();
 
   if (toUserName) {
     navigation.setOptions({
@@ -55,7 +57,7 @@ export default function ChatScreen({ navigation, route }: StackScreenProps) {
   );
 
   React.useEffect(() => {
-    if (chatInfo && chatInfo.from === 'toUserId') {
+    if (chatInfo && chatInfo.from === toUserId.toString()) {
       run();
     }
   }, [chatInfo]);
@@ -80,7 +82,7 @@ export default function ChatScreen({ navigation, route }: StackScreenProps) {
           avatar: userInfo.avatar,
         }}
       />
-      {Platform.OS === 'android' && <KeyboardAvoidingView behavior="padding" />}
+      {/* {Platform.OS === 'android' && <KeyboardAvoidingView behavior="padding" />} */}
     </Div>
   );
 }

+ 43 - 30
notice/NoticeScreen.tsx

@@ -17,6 +17,7 @@ import User from '../stores/User';
 import { useTranslation } from 'react-i18next';
 
 import NoticeCom from './NoticeCom';
+import { SoundPlay } from '../utils/SoundUtils';
 
 const NoticeTab = createMaterialTopTabNavigator();
 
@@ -70,7 +71,7 @@ export default function NoticeScreen({
           name="Chat"
           component={UserChatScreen}
           options={{
-            title:t('yong-hu-xiao-xi'),
+            title: t('yong-hu-xiao-xi'),
           }}
         />
       </NoticeTab.Navigator>
@@ -79,36 +80,48 @@ export default function NoticeScreen({
 }
 
 function SysNoticeScreen({ navigation }) {
-  const { sysNoticeList } = useModel(IM, ['sysNoticeList']);
+  const { sysNoticeList, sendPushNotification } = useModel(IM, [
+    'sysNoticeList',
+  ]);
   return (
-    <FlatList
-      renderItem={({ item }) => {
-        return (
-          <NoticeCom
-            info={item}
-            type="email"
-            onPress={() => {
-              navigation.navigate('NoticeStack', {
-                screen: 'EmailDetail',
-                params: {
-                  emailId: item.id,
-                },
-              });
-            }}
-          />
-        );
-      }}
-      data={sysNoticeList}
-      keyExtractor={(item, index) => `email${index}`}
-      ListEmptyComponent={() => {
-        return (
-          <Text color="gary200" fontSize="sm" textAlign="center" py={20}>
-            t('zan-wu-shu-ju')
-          </Text>
-        );
-      }}
-      contentContainerStyle={{ flexGrow: 1, backgroundColor: '#fff' }}
-    />
+    <>
+      {/* <Button
+        onPress={() => {
+          sendPushNotification();
+          SoundPlay('voice_664');
+        }}
+      >
+        发送系统消息
+      </Button> */}
+      <FlatList
+        renderItem={({ item }) => {
+          return (
+            <NoticeCom
+              info={item}
+              type="email"
+              onPress={() => {
+                navigation.navigate('NoticeStack', {
+                  screen: 'EmailDetail',
+                  params: {
+                    emailId: item.id,
+                  },
+                });
+              }}
+            />
+          );
+        }}
+        data={sysNoticeList}
+        keyExtractor={(item, index) => `email${index}`}
+        ListEmptyComponent={() => {
+          return (
+            <Text color="gary200" fontSize="sm" textAlign="center" py={20}>
+              t('zan-wu-shu-ju')
+            </Text>
+          );
+        }}
+        contentContainerStyle={{ flexGrow: 1, backgroundColor: '#fff' }}
+      />
+    </>
   );
 }
 

+ 113 - 24
notice/TimScreen.tsx

@@ -1,8 +1,10 @@
+import Constants from 'expo-constants';
+import * as Notifications from 'expo-notifications';
+import * as Permissions from 'expo-permissions';
 import { StackScreenProps } from '@react-navigation/stack';
 import * as React from 'react';
 import { useNavigation } from '@react-navigation/native';
 import { WebView } from 'react-native-webview';
-
 import useModel from 'flooks';
 import { useMount } from 'ahooks';
 
@@ -10,6 +12,17 @@ import IM from './model';
 
 import { useTranslation } from 'react-i18next';
 
+import { SoundPlay } from '../utils/SoundUtils';
+if (!__DEV__) {
+  Notifications.setNotificationHandler({
+    handleNotification: async () => ({
+      shouldShowAlert: true,
+      shouldPlaySound: false,
+      shouldSetBadge: false,
+    }),
+  });
+}
+
 export default function NoticeScreen({
   navigation,
 }: StackScreenProps<RootStackParamList, 'Login'>) {
@@ -17,17 +30,49 @@ export default function NoticeScreen({
   const webRef = React.useRef();
   const {
     getChat,
+    getSysNotice,
     userID,
     userSig,
     tim,
     setTim,
     initChat,
     updateChatInfo,
+    sendPushNotification,
   } = useModel(IM, ['userID', 'userSig', 'tim']);
   useMount(() => {
     initChat();
   });
 
+  const [expoPushToken, setExpoPushToken] = React.useState('');
+  const [notification, setNotification] = React.useState(false);
+  const notificationListener = React.useRef();
+  const responseListener = React.useRef();
+
+  React.useEffect(() => {
+    if (!__DEV__) {
+      registerForPushNotificationsAsync().then((token) =>
+        setExpoPushToken(token)
+      );
+
+      notificationListener.current = Notifications.addNotificationReceivedListener(
+        (notification) => {
+          setNotification(notification);
+        }
+      );
+
+      responseListener.current = Notifications.addNotificationResponseReceivedListener(
+        (response) => {
+          console.log(response);
+        }
+      );
+
+      return () => {
+        Notifications.removeNotificationSubscription(notificationListener);
+        Notifications.removeNotificationSubscription(responseListener);
+      };
+    }
+  }, []);
+
   React.useEffect(() => {
     if (userSig && tim)
       tim.injectJavaScript(
@@ -36,30 +81,74 @@ export default function NoticeScreen({
   }, [userSig, tim]);
 
   return (
-    <WebView
-      ref={webRef}
-      source={{
-        uri: `http://dingdong.izouma.com/map/tim`,
-      }}
-      onMessage={({ nativeEvent }) => {
-        console.log(nativeEvent);
-        const info = JSON.parse(nativeEvent.data);
-        switch (info.name) {
-          case 'onConversationListUpdated':
+    <>
+      <WebView
+        ref={webRef}
+        source={{
+          uri: `http://dingdong.izouma.com/map/tim`,
+        }}
+        onMessage={({ nativeEvent }) => {
+          console.log(nativeEvent);
+          const info =
+            nativeEvent.data.indexOf('{') !== -1
+              ? JSON.parse(nativeEvent.data)
+              : {};
+          console.log(info);
+          if (Array.isArray(info)) {
             getChat();
-            break;
+            const message = info[0];
+            if (/^\d{n}$/.test(message.from)) {
+              updateChatInfo(message);
+            } else {
+              getSysNotice();
+              const { payload } = message;
+              let body = payload ? payload.text : '';
+              if (body.indexOf('voice_') !== -1) {
+                const textInfo = body.split(';');
+                body = textInfo[1];
+                SoundPlay(textInfo[0]);
+              }
+              sendPushNotification('系统通知', body);
+            }
+          }
+        }}
+        onLoadEnd={() => {
+          setTim(webRef.current);
+        }}
+      />
+    </>
+  );
+}
 
-          default:
-            break;
-        }
+async function registerForPushNotificationsAsync() {
+  let token;
+  if (Constants.isDevice) {
+    const { status: existingStatus } = await Permissions.getAsync(
+      Permissions.NOTIFICATIONS
+    );
+    let finalStatus = existingStatus;
+    if (existingStatus !== 'granted') {
+      const { status } = await Permissions.askAsync(Permissions.NOTIFICATIONS);
+      finalStatus = status;
+    }
+    if (finalStatus !== 'granted') {
+      alert('Failed to get push token for push notification!');
+      return;
+    }
+    token = (await Notifications.getExpoPushTokenAsync()).data;
+    console.log(token);
+  } else {
+    alert('Must use physical device for Push Notifications');
+  }
 
-        if (info.conversationType === 'C2C') {
-          updateChatInfo(info);
-        }
-      }}
-      onLoadEnd={() => {
-        setTim(webRef.current);
-      }}
-    />
-  );
+  if (Platform.OS === 'android') {
+    Notifications.setNotificationChannelAsync('default', {
+      name: 'default',
+      importance: Notifications.AndroidImportance.MAX,
+      vibrationPattern: [0, 250, 250, 250],
+      lightColor: '#FF231F7C',
+    });
+  }
+
+  return token;
 }

+ 10 - 0
notice/model.ts

@@ -2,6 +2,7 @@ import TIM from 'tim-js-sdk';
 import COS from 'cos-js-sdk-v5';
 import request from '../utils/RequestUtils';
 import User from '../stores/User';
+import * as Notifications from 'expo-notifications';
 
 const IM = (now) => ({
   SDKAppID: 1400401634,
@@ -70,6 +71,15 @@ const IM = (now) => ({
     const { tim } = now();
     if (tim) tim.injectJavaScript(`window.sendMessage(${text},${toUserId})`);
   },
+  async sendPushNotification(title, body) {
+    await Notifications.scheduleNotificationAsync({
+      content: {
+        title: title || '您有一条新的信息 📬',
+        body: body || '请打开app查看',
+      },
+      trigger: { seconds: 2 },
+    });
+  },
 });
 
 export default IM;

+ 2 - 0
order/OrderDetailScreen.tsx

@@ -8,6 +8,7 @@ import { toastInfo, toastSuccess, alert } from '../utils/SystemUtils';
 
 import { RiderStatusMap } from '../utils/RiderInfoUtils';
 import ImagePicker from '../components/ImagePicker';
+import { useTranslation } from 'react-i18next';
 
 import useModel from 'flooks';
 import OrderModel from './model';
@@ -16,6 +17,7 @@ export default function OrderDetailScreen({
   navigation,
   route,
 }: StackScreenProps) {
+  const { t } = useTranslation();
   const { params } = route;
   const { orderId } = params;
 

+ 2 - 2
order/model.ts

@@ -1,8 +1,8 @@
 import request from '../utils/RequestUtils';
 import { toastShow, toastInfo, toastSuccess } from '../utils/SystemUtils';
 import MapModel from '../map/model';
-const OrderMap = (now, successEvent) => ({
-  receiverOrder(orderId) {
+const OrderMap = (now) => ({
+  receiverOrder(orderId, successEvent) {
     toastShow();
     request
       .get('/rider/receiver', {

+ 274 - 9
package-lock.json

@@ -1205,12 +1205,12 @@
       }
     },
     "@expo/configure-splash-screen": {
-      "version": "0.1.12",
-      "resolved": "https://registry.npmjs.org/@expo/configure-splash-screen/-/configure-splash-screen-0.1.12.tgz",
-      "integrity": "sha512-XvXZEmRaHmuO4/oJnE4cD2VFwYQec7kXBq0Ki9NtSdNHmGWE8XuXslZpn9anORcTjas/X0p9KtJbRsYQVVqbww==",
+      "version": "0.1.14",
+      "resolved": "https://registry.npmjs.org/@expo/configure-splash-screen/-/configure-splash-screen-0.1.14.tgz",
+      "integrity": "sha512-5Ex4AcqkGN/MNT2qmNiYzDG8/l+eQ5Zb6Fid+CCFOUdM84JUTdKW5GwYkPAMFwwqxWod2l/pY0nz+wvKX8ePRg==",
       "requires": {
-        "@react-native-community/cli-platform-android": "4.7.0",
-        "@react-native-community/cli-platform-ios": "4.7.0",
+        "@react-native-community/cli-platform-android": "^4.10.0",
+        "@react-native-community/cli-platform-ios": "^4.10.0",
         "color-string": "^1.5.3",
         "commander": "^5.1.0",
         "core-js": "^3.6.5",
@@ -1221,10 +1221,264 @@
         "xml-js": "^1.6.11"
       },
       "dependencies": {
-        "core-js": {
-          "version": "3.6.5",
-          "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.6.5.tgz",
-          "integrity": "sha512-vZVEEwZoIsI+vPEuoF9Iqf5H7/M3eeQqWlQnYa8FSKKePuYTf5MWnxb5SDAzCa60b3JBRS5g9b+Dq7b1y/RCrA=="
+        "@react-native-community/cli-platform-android": {
+          "version": "4.11.0",
+          "resolved": "https://registry.npmjs.org/@react-native-community/cli-platform-android/-/cli-platform-android-4.11.0.tgz",
+          "integrity": "sha512-BzqocGjOCjpDW0bM/LUrHMXw4nBvOhDXnHWxaoRp3eeUVsD2oSegoRn52kZo9yhPb9cCPkZJ3b+Web71Ue4j9w==",
+          "requires": {
+            "@react-native-community/cli-tools": "^4.11.0",
+            "chalk": "^3.0.0",
+            "execa": "^1.0.0",
+            "fs-extra": "^8.1.0",
+            "glob": "^7.1.3",
+            "jetifier": "^1.6.2",
+            "lodash": "^4.17.15",
+            "logkitty": "^0.7.1",
+            "slash": "^3.0.0",
+            "xmldoc": "^1.1.2"
+          },
+          "dependencies": {
+            "fs-extra": {
+              "version": "8.1.0",
+              "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
+              "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==",
+              "requires": {
+                "graceful-fs": "^4.2.0",
+                "jsonfile": "^4.0.0",
+                "universalify": "^0.1.0"
+              }
+            }
+          }
+        },
+        "@react-native-community/cli-platform-ios": {
+          "version": "4.11.0",
+          "resolved": "https://registry.npmjs.org/@react-native-community/cli-platform-ios/-/cli-platform-ios-4.11.0.tgz",
+          "integrity": "sha512-/qkjnhhJ7BGBTNkHSS8a+z8UgWUQbU6YZOTuYxjNywGUzMiTsb/wlm2cWCY1VEAvWtY97c4plAZ5OferPJHaVA==",
+          "requires": {
+            "@react-native-community/cli-tools": "^4.11.0",
+            "chalk": "^3.0.0",
+            "glob": "^7.1.3",
+            "js-yaml": "^3.13.1",
+            "lodash": "^4.17.15",
+            "plist": "^3.0.1",
+            "xcode": "^2.0.0"
+          },
+          "dependencies": {
+            "xcode": {
+              "version": "2.1.0",
+              "resolved": "https://registry.npmjs.org/xcode/-/xcode-2.1.0.tgz",
+              "integrity": "sha512-uCrmPITrqTEzhn0TtT57fJaNaw8YJs1aCzs+P/QqxsDbvPZSv7XMPPwXrKvHtD6pLjBM/NaVwraWJm8q83Y4iQ==",
+              "requires": {
+                "simple-plist": "^1.0.0",
+                "uuid": "^3.3.2"
+              }
+            }
+          }
+        },
+        "@react-native-community/cli-tools": {
+          "version": "4.11.0",
+          "resolved": "https://registry.npmjs.org/@react-native-community/cli-tools/-/cli-tools-4.11.0.tgz",
+          "integrity": "sha512-o2dh9q/778lIYBJxgIvTXkcxi9bSozjt8lv3tpyVmLZNA/PAPmQ7CafT37jWWwdmaSgP7nWyp4DtuE/gRsrXkA==",
+          "requires": {
+            "chalk": "^3.0.0",
+            "lodash": "^4.17.15",
+            "mime": "^2.4.1",
+            "node-fetch": "^2.6.0",
+            "open": "^6.2.0",
+            "shell-quote": "1.6.1"
+          }
+        },
+        "ansi-regex": {
+          "version": "5.0.0",
+          "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
+          "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg=="
+        },
+        "ansi-styles": {
+          "version": "4.2.1",
+          "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
+          "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
+          "requires": {
+            "@types/color-name": "^1.1.1",
+            "color-convert": "^2.0.1"
+          }
+        },
+        "chalk": {
+          "version": "3.0.0",
+          "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
+          "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==",
+          "requires": {
+            "ansi-styles": "^4.1.0",
+            "supports-color": "^7.1.0"
+          }
+        },
+        "cliui": {
+          "version": "6.0.0",
+          "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz",
+          "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==",
+          "requires": {
+            "string-width": "^4.2.0",
+            "strip-ansi": "^6.0.0",
+            "wrap-ansi": "^6.2.0"
+          }
+        },
+        "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==",
+          "requires": {
+            "color-name": "~1.1.4"
+          }
+        },
+        "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=="
+        },
+        "emoji-regex": {
+          "version": "8.0.0",
+          "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
+          "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="
+        },
+        "find-up": {
+          "version": "4.1.0",
+          "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
+          "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
+          "requires": {
+            "locate-path": "^5.0.0",
+            "path-exists": "^4.0.0"
+          }
+        },
+        "get-caller-file": {
+          "version": "2.0.5",
+          "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
+          "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="
+        },
+        "has-flag": {
+          "version": "4.0.0",
+          "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+          "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="
+        },
+        "is-fullwidth-code-point": {
+          "version": "3.0.0",
+          "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+          "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="
+        },
+        "locate-path": {
+          "version": "5.0.0",
+          "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
+          "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
+          "requires": {
+            "p-locate": "^4.1.0"
+          }
+        },
+        "logkitty": {
+          "version": "0.7.1",
+          "resolved": "https://registry.npmjs.org/logkitty/-/logkitty-0.7.1.tgz",
+          "integrity": "sha512-/3ER20CTTbahrCrpYfPn7Xavv9diBROZpoXGVZDWMw4b/X4uuUwAC0ki85tgsdMRONURyIJbcOvS94QsUBYPbQ==",
+          "requires": {
+            "ansi-fragments": "^0.2.1",
+            "dayjs": "^1.8.15",
+            "yargs": "^15.1.0"
+          }
+        },
+        "node-fetch": {
+          "version": "2.6.0",
+          "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz",
+          "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA=="
+        },
+        "p-limit": {
+          "version": "2.3.0",
+          "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
+          "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
+          "requires": {
+            "p-try": "^2.0.0"
+          }
+        },
+        "p-locate": {
+          "version": "4.1.0",
+          "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
+          "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
+          "requires": {
+            "p-limit": "^2.2.0"
+          }
+        },
+        "p-try": {
+          "version": "2.2.0",
+          "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
+          "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ=="
+        },
+        "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=="
+        },
+        "require-main-filename": {
+          "version": "2.0.0",
+          "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
+          "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg=="
+        },
+        "string-width": {
+          "version": "4.2.0",
+          "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz",
+          "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==",
+          "requires": {
+            "emoji-regex": "^8.0.0",
+            "is-fullwidth-code-point": "^3.0.0",
+            "strip-ansi": "^6.0.0"
+          }
+        },
+        "strip-ansi": {
+          "version": "6.0.0",
+          "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
+          "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
+          "requires": {
+            "ansi-regex": "^5.0.0"
+          }
+        },
+        "supports-color": {
+          "version": "7.1.0",
+          "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
+          "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
+          "requires": {
+            "has-flag": "^4.0.0"
+          }
+        },
+        "wrap-ansi": {
+          "version": "6.2.0",
+          "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
+          "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==",
+          "requires": {
+            "ansi-styles": "^4.0.0",
+            "string-width": "^4.1.0",
+            "strip-ansi": "^6.0.0"
+          }
+        },
+        "yargs": {
+          "version": "15.4.1",
+          "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz",
+          "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==",
+          "requires": {
+            "cliui": "^6.0.0",
+            "decamelize": "^1.2.0",
+            "find-up": "^4.1.0",
+            "get-caller-file": "^2.0.1",
+            "require-directory": "^2.1.1",
+            "require-main-filename": "^2.0.0",
+            "set-blocking": "^2.0.0",
+            "string-width": "^4.2.0",
+            "which-module": "^2.0.0",
+            "y18n": "^4.0.0",
+            "yargs-parser": "^18.1.2"
+          }
+        },
+        "yargs-parser": {
+          "version": "18.1.3",
+          "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz",
+          "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==",
+          "requires": {
+            "camelcase": "^5.0.0",
+            "decamelize": "^1.2.0"
+          }
         }
       }
     },
@@ -5988,6 +6242,17 @@
         "invariant": "^2.2.4"
       }
     },
+    "expo-notifications": {
+      "version": "0.3.3",
+      "resolved": "https://registry.npmjs.org/expo-notifications/-/expo-notifications-0.3.3.tgz",
+      "integrity": "sha512-iBqvlbB6UVkU5yF4W9K/sqdPIbJ52VVeL7543G4IA3ARWhx6wdhfzcuGTCtUgV0XmkJu7vmPs+sC31aXjRa0Kg==",
+      "requires": {
+        "badgin": "^1.1.5",
+        "expo-application": "~2.2.1",
+        "expo-constants": "9.1.1",
+        "uuid": "^3.4.0"
+      }
+    },
     "expo-permissions": {
       "version": "9.0.1",
       "resolved": "https://registry.npmjs.org/expo-permissions/-/expo-permissions-9.0.1.tgz",

+ 1 - 0
package.json

@@ -34,6 +34,7 @@
     "expo-linking": "^1.0.1",
     "expo-localization": "~8.2.1",
     "expo-location": "~8.2.1",
+    "expo-notifications": "~0.3.3",
     "expo-permissions": "~9.0.1",
     "expo-splash-screen": "~0.3.1",
     "expo-status-bar": "^1.0.2",

+ 6 - 2
stores/User.ts

@@ -166,11 +166,15 @@ const user = (now) => ({
       })
       .then((res) => {
         if (res.content.length > 0) {
+          const info = res.content.find((item) => {
+            return !!item.takingOrders;
+          });
           now({
-            sign: res.content[0].takingOrders,
+            sign: info ? true : res.content[0].takingOrders,
+            signInfo: info || res.content[0],
             noSign: false,
           });
-          return Promise.resolve(res.content[0].takingOrders);
+          return Promise.resolve(info ? true : res.content[0].takingOrders);
         } else {
           now({
             sign: false,

+ 27 - 0
utils/SoundUtils.ts

@@ -0,0 +1,27 @@
+import { Audio } from 'expo-av';
+import request from './RequestUtils';
+
+async function play(sound) {
+  console.log(sound);
+  const soundObject = new Audio.Sound();
+  try {
+    await soundObject.loadAsync({ uri: sound });
+    await soundObject.playAsync();
+
+    await soundObject.unloadAsync();
+  } catch (error) {
+    // An error occurred!
+  }
+}
+
+function SoundPlay(info) {
+  const infos = info.split('_');
+  console.log(infos);
+  request.get(`/voice/get/${infos[1]}`).then((res) => {
+    console.log(res);
+    if (res.url) {
+      play(res.url);
+    }
+  });
+}
+export { SoundPlay };

+ 2 - 1
utils/SystemUtils.ts

@@ -1,7 +1,7 @@
 import i18n from '../i18n';
 import * as Linking from 'expo-linking';
 
-// import { Toast, ModalIndicator } from 'teaset';
+import { Toast, ModalIndicator, PopoverPicker } from 'teaset';
 import { Platform } from 'react-native';
 
 function connect(navigation) {
@@ -84,4 +84,5 @@ export {
   toastSuccess,
   getMoney,
   alert,
+  PopoverPicker,
 };

+ 2 - 0
wallet/MineRecordScreen.tsx

@@ -14,6 +14,8 @@ import { MonthDate, getSearchDate } from '../utils/TimeUtils';
 import request from '../utils/RequestUtils';
 import ReacordCom from './ReacordCom';
 
+import { PopoverPicker } from '../utils/SystemUtils';
+
 // import { PopoverPicker } from 'teaset';
 
 interface Result {