From cb781958423954d7939a77eebc9a403046f852ae Mon Sep 17 00:00:00 2001 From: anil_majji Date: Wed, 21 Jun 2023 10:13:43 +0530 Subject: [PATCH] Displaying Received cards option in settings (INJI-96) --- assets/receive-card-icon.png | Bin 0 -> 674 bytes assets/received-cards-icon.png | Bin 0 -> 652 bytes components/ui/themes/DefaultTheme.ts | 12 +++- locales/ara.json | 7 +- locales/en.json | 9 ++- locales/fil.json | 7 +- locales/hin.json | 7 +- locales/kan.json | 7 +- locales/tam.json | 7 +- screens/Home/ReceivedVcsTabController.ts | 10 ++- screens/Scan/ScanScreen.strings.json | 4 +- screens/Settings/ReceiveCard.tsx | 50 ++++++++++++++ screens/Settings/ReceivedCards.tsx | 81 +++++++++++++++++++++++ screens/Settings/SettingScreen.tsx | 35 +++++++--- 14 files changed, 214 insertions(+), 22 deletions(-) create mode 100644 assets/receive-card-icon.png create mode 100644 assets/received-cards-icon.png create mode 100644 screens/Settings/ReceiveCard.tsx create mode 100644 screens/Settings/ReceivedCards.tsx diff --git a/assets/receive-card-icon.png b/assets/receive-card-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..b0db01a00e874f3a79e9c9229c2da746afe7a86a GIT binary patch literal 674 zcmV;T0$u%yP)}7X^XQZ4iWAC#03a z)V}5VA>9NK72!?z4|LN-k`#5(MTkLA(MZiXnV{{5NppSQ+oz#yW6sTl4jed~_k7Ru z{&=4EAa%ocPH6Nn!A_f9V2cW`mI7mF4_Kt~V*rB8JYD*G+%d5uL_D-XK!T3B2WH-EC)?sPnQ&mt z5VZY&0waJ{LFCB&v`^FxeJf~Dxk@XlAT3?Q))&BPoe^5EwncAC^1w&ozY4%u-+^AAQ)! z%srW$bMJ`{bbi054bzwfCly70qBdvd>>m_NkdJWYbsj0NE4KT8#jW|MbT0OH$udXf+7?} zcP>=af+d{P`l#;2h2l>759m^{D7tV_q=HaIsd+VmpqK>38t;r#C8duW(}dIuXLD!H z{LVLLW)2D?k;8^@K?nh=_Cb6ka2J~e(gH!*a|>jS81Gz|a~(F7TJD3Qjl3X2F9=nc zjTo4Oj4`J|iS(@%(1MM=0m)Wl=qxe4_5uiaJ;W3i+W^EwB<<~wYiiq0Bx6kU-VpXW zHhZw*iwcws?RFB`XN{;@zNeIoPAGI>9;#XN>pJP!jPu{2#&91qZh``bsw&k2>or8J z|%!}w2+AHgW=m6JgoP9vE89@oXLHu1*_N_gWB%< zTFddjLFAQNZrR^)`NN;0Dcb0D{kPNW08BU@wwam6pvmsjKB7?;3IcRz&L@{P4(Ddq z7CN-42f^03HhAavpY*8fO6GAznU~Uv!iLgIyl$H0$1wvL&_J8#bF1qkv%ECy-gQRv zZ<`KfSNgP(uX+t9Cih0z=FhLDnCiMy!!oD}cWE>0AX)l>csgWr2bvD`8#nc@puypM zw&~Ed9)qQkNPj4id%7?jKxR)nwLM>rl3G3`Dm_%6{;IRLn2e?%6a!>ZNa`AQ)!_Q5 z#URq7@y0)s|3oLb+uCe)a$(@>dwNd`=V-0d*KG&V5FXUxd$OV^zuM>)ZN|8dxU25K mRW=xdPrsO_!ghAT%jGw8{GxqFb6uGL0000; const { appService } = useContext(GlobalContext); + const [isVisible, setIsVisible] = useState(false); const settingsService = appService.children.get('settings'); const vcService = appService.children.get('vc'); return { + isVisible, vcLabel: useSelector(settingsService, selectVcLabel), vcKeys: useSelector(vcService, selectReceivedVcs), isRefreshingVcs: useSelector(vcService, selectIsRefreshingReceivedVcs), - VIEW_VC: (vcItemActor: ActorRefFrom) => + TOGGLE_RECEIVED_CARDS: () => setIsVisible(!isVisible), + + VIEW_VC: (vcItemActor: ActorRefFrom) => service.send(ReceivedVcsTabEvents.VIEW_VC(vcItemActor)), REFRESH: () => service.send(ReceivedVcsTabEvents.REFRESH()), }; diff --git a/screens/Scan/ScanScreen.strings.json b/screens/Scan/ScanScreen.strings.json index 44e531a3..a3a44e50 100644 --- a/screens/Scan/ScanScreen.strings.json +++ b/screens/Scan/ScanScreen.strings.json @@ -2,8 +2,8 @@ "header": "Scan QR Code", "noShareableVcs": "No shareable {{vcLabel}} are available.", "sharingVc": "Sharing {{vcLabel}}", - "BluetoothStateIos": "Bluetooth is turned OFF, please turn it ON from Control center", - "BluetoothStateAndroid": "Bluetooth is turned OFF, please turn it ON from Quick settings menu", + "bluetoothStateIos": "Bluetooth is turned OFF, please turn it ON from Control center", + "bluetoothStateAndroid": "Bluetooth is turned OFF, please turn it ON from Quick settings menu", "errors": { "locationDisabled": { "message": "Location services must be enabled for the scanning functionality", diff --git a/screens/Settings/ReceiveCard.tsx b/screens/Settings/ReceiveCard.tsx new file mode 100644 index 00000000..476d9173 --- /dev/null +++ b/screens/Settings/ReceiveCard.tsx @@ -0,0 +1,50 @@ +import React, { useState } from 'react'; +import { TFunction, useTranslation } from 'react-i18next'; +import { Switch, Icon } from 'react-native-elements'; +import { Pressable, Platform } from 'react-native'; +import QRCode from 'react-native-qrcode-svg'; + +import { Centered, Button, Column, Row, Text } from '../../components/ui'; +import { Theme } from '../../components/ui/styleUtils'; +import { Image } from 'react-native'; +import { Modal } from '../../components/ui/Modal'; +import { useRequestScreen } from '../Request/RequestScreenController'; +import { isGoogleNearbyEnabled } from '../../lib/smartshare'; + +export const ReceiveCard: React.FC = () => { + const { t } = useTranslation('RequestScreen'); + const controller = useRequestScreen(); + const props: RequestScreenProps = { t, controller }; + + const [showReceiveCard, setShowReceiveCard] = useState(false); + + return ( + + { + setShowReceiveCard(!showReceiveCard); + }}> + + + + {t('receiveCard')} + + + + } + headerTitle={t('receiveCard')} + headerElevation={2} + onDismiss={() => setShowReceiveCard(!showReceiveCard)}> + + + + ); +}; diff --git a/screens/Settings/ReceivedCards.tsx b/screens/Settings/ReceivedCards.tsx new file mode 100644 index 00000000..7acc2e23 --- /dev/null +++ b/screens/Settings/ReceivedCards.tsx @@ -0,0 +1,81 @@ +import React, { useState } from 'react'; +import { useTranslation } from 'react-i18next'; +import { RefreshControl } from 'react-native'; +import { Pressable, TouchableOpacity } from 'react-native'; +import { Centered, Column, Row, Text } from '../../components/ui'; +import { Icon } from 'react-native-elements'; +import { Theme } from '../../components/ui/styleUtils'; +import { Image } from 'react-native'; +import { Modal } from '../../components/ui/Modal'; +import { HomeScreenTabProps } from '../Home/HomeScreen'; +import { useReceivedVcsTab } from '../Home/ReceivedVcsTabController'; +import { VcItem } from '../../components/VcItem'; + +export const ReceivedCards: React.FC = (props) => { + const { t } = useTranslation('ReceivedVcsTab'); + const controller = useReceivedVcsTab(props); + + return ( + + + + + + {t('receivedCards')} + + + + + } + headerTitle={t('header')} + headerElevation={2} + onDismiss={controller.TOGGLE_RECEIVED_CARDS}> + + }> + {controller.vcKeys.map((vcKey) => ( + + ))} + {controller.vcKeys.length === 0 && ( + + + + + {t('noReceivedVcsTitle', { + vcLabel: controller.vcLabel.plural, + })} + + + {t('noReceivedVcsText', { + vcLabel: controller.vcLabel.singular, + })} + + + + )} + + + + ); +}; diff --git a/screens/Settings/SettingScreen.tsx b/screens/Settings/SettingScreen.tsx index 8bf06345..0810b450 100644 --- a/screens/Settings/SettingScreen.tsx +++ b/screens/Settings/SettingScreen.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { Linking, Pressable, View } from 'react-native'; import { Icon, ListItem, Switch } from 'react-native-elements'; -import { Column, Text } from '../../components/ui'; +import { Row, Column, Text } from '../../components/ui'; import { Theme } from '../../components/ui/styleUtils'; import { MainRouteProps } from '../../routes/main'; import { MessageOverlay } from '../../components/MessageOverlay'; @@ -13,6 +13,8 @@ import { ScrollView } from 'react-native-gesture-handler'; import { Modal } from '../../components/ui/Modal'; import getAllConfigurations from '../../shared/commonprops/commonProps'; import { AboutInji } from './AboutInji'; +import { ReceiveCard } from './ReceiveCard'; +import { ReceivedCards } from './ReceivedCards'; const LanguageSetting: React.FC = () => { const { t } = useTranslation('SettingScreen'); @@ -20,7 +22,7 @@ const LanguageSetting: React.FC = () => { return ( + = ( headerTitle={t('header')} headerElevation={2} onDismiss={controller.TOGGLE_SETTINGS}> - - + + + {t('injiAsVerifierApp')} + + + + + + + + {t('basicSettings')} + + = ( - + = ( { Linking.openURL(helpUrl); }}> @@ -120,7 +137,7 @@ export const SettingScreen: React.FC = ( - +