From c80d4b7f0d0e157fac95c6c279474bd610024452 Mon Sep 17 00:00:00 2001 From: Ivan Sorokin Date: Wed, 11 Dec 2019 15:55:54 +0100 Subject: [PATCH] Address comments in the PR --- .../mobile/locales/en-US/inviteFlow11.json | 2 + .../locales/en-US/paymentRequestFlow.json | 3 +- .../mobile/locales/es-419/inviteFlow11.json | 2 + .../locales/es-419/paymentRequestFlow.json | 3 +- .../mobile/locales/es-419/walletFlow5.json | 1 - .../src/escrow/EscrowedPaymentLineItem.tsx | 28 +- ...owedPaymentReminderSummaryNotification.tsx | 4 +- .../EscrowedPaymentLineItem.test.tsx.snap | 21 +- ...tReminderSummaryNotification.test.tsx.snap | 84 +- .../NotificationBox.test.tsx.snap | 10 +- ...omingPaymentRequestSummaryNotification.tsx | 4 +- ...goingPaymentRequestSummaryNotification.tsx | 4 +- .../PaymentRequestNotificationInner.tsx | 23 +- ...comingPaymentRequestListItem.test.tsx.snap | 281 +++--- ...mingPaymentRequestListScreen.test.tsx.snap | 843 +++++++++--------- ...ntRequestSummaryNotification.test.tsx.snap | 291 +++--- ...ntRequestSummaryNotification.test.tsx.snap | 10 +- ...mentRequestNotificationInner.test.tsx.snap | 5 +- .../components/BaseNotification.tsx | 20 +- 19 files changed, 813 insertions(+), 826 deletions(-) diff --git a/packages/mobile/locales/en-US/inviteFlow11.json b/packages/mobile/locales/en-US/inviteFlow11.json index 3e22d57f925..47f0f97393f 100644 --- a/packages/mobile/locales/en-US/inviteFlow11.json +++ b/packages/mobile/locales/en-US/inviteFlow11.json @@ -26,5 +26,7 @@ "inviteComplete": "Invite Complete", "inviteReceived": "Invite Received", "escrowPaymentNotificationTitle": "Invited ({{amount}}) {{mobile}}", + "escrowPaymentNotificationLine": "<0>{{recipientPhone}} for <1>{{amount}}", + "escrowPaymentNotificationLine_missingRecipientPhone": "<0>Unknown for <1>{{amount}}", "defaultComment": "Invitation sent" } diff --git a/packages/mobile/locales/en-US/paymentRequestFlow.json b/packages/mobile/locales/en-US/paymentRequestFlow.json index 0eb94c35fe4..55d175c34ea 100644 --- a/packages/mobile/locales/en-US/paymentRequestFlow.json +++ b/packages/mobile/locales/en-US/paymentRequestFlow.json @@ -7,5 +7,6 @@ "paymentRequestUpdateFailed": "Cannot update payment request", "incomingPaymentRequestNotificationTitle": "{{name}} requested {{amount}}", "outgoingPaymentRequestNotificationTitle": "Requested {{amount}} from {{name}}", - "defaultComment": "Payment Requested" + "defaultComment": "Payment Requested", + "paymentRequestNotificationLine": "<0>{{displayName}} for <1>{{amount}}" } diff --git a/packages/mobile/locales/es-419/inviteFlow11.json b/packages/mobile/locales/es-419/inviteFlow11.json index 39a9927002a..935be142290 100755 --- a/packages/mobile/locales/es-419/inviteFlow11.json +++ b/packages/mobile/locales/es-419/inviteFlow11.json @@ -26,5 +26,7 @@ "inviteComplete": "Invitación completa", "inviteReceived": "Invitación recibida", "escrowPaymentNotificationTitle": "~~Invited ({{amount}}) {{mobile}}", + "escrowPaymentNotificationLine": "~~<0>{{recipientPhone}} for <1>{{amount}}", + "escrowPaymentNotificationLine_missingRecipientPhone": "~~<0>Unknown for <1>{{amount}}", "defaultComment": "~~Invitation sent" } diff --git a/packages/mobile/locales/es-419/paymentRequestFlow.json b/packages/mobile/locales/es-419/paymentRequestFlow.json index 3f9727749ff..60692110920 100644 --- a/packages/mobile/locales/es-419/paymentRequestFlow.json +++ b/packages/mobile/locales/es-419/paymentRequestFlow.json @@ -7,5 +7,6 @@ "paymentRequestUpdateFailed": "No se pudo actualizar el pedido de pago", "incomingPaymentRequestNotificationTitle": "~~{{name}} requested {{amount}}", "outgoingPaymentRequestNotificationTitle": "~~Requested {{amount}} from {{name}}", - "defaultComment": "~~Payment Requested" + "defaultComment": "~~Payment Requested", + "paymentRequestNotificationLine": "~~<0>{{displayName}} for <1>{{amount}}" } diff --git a/packages/mobile/locales/es-419/walletFlow5.json b/packages/mobile/locales/es-419/walletFlow5.json index b6d9b81fb18..eaf9daa9f7f 100755 --- a/packages/mobile/locales/es-419/walletFlow5.json +++ b/packages/mobile/locales/es-419/walletFlow5.json @@ -54,7 +54,6 @@ "balanceNeedUpdating": "Saldo necesita actualizarse", "refreshBalances": "Actualizar saldos", "escrowedPaymentReminder": "Reacuerda al receptor aceptar el pago", - "escrowedPaymentReminderWithCount_plural": "Recordar {{count}} receptores to aceptar el pago", "escrowedPaymentReminderSms": "¡Un recordatorio amistoso de que aún no ha canjeado sus dólares de celo!", "testnetAlert": { diff --git a/packages/mobile/src/escrow/EscrowedPaymentLineItem.tsx b/packages/mobile/src/escrow/EscrowedPaymentLineItem.tsx index 517c3b27230..61fd5759a43 100644 --- a/packages/mobile/src/escrow/EscrowedPaymentLineItem.tsx +++ b/packages/mobile/src/escrow/EscrowedPaymentLineItem.tsx @@ -1,8 +1,9 @@ import fontStyles from '@celo/react-components/styles/fonts' import * as React from 'react' -import { withNamespaces, WithNamespaces } from 'react-i18next' +import { Trans, withNamespaces, WithNamespaces } from 'react-i18next' import { StyleSheet, Text } from 'react-native' import { EscrowedPayment } from 'src/escrow/actions' +import { CURRENCIES, CURRENCY_ENUM } from 'src/geth/consts' import { divideByWei, getCentAwareMoneyDisplay } from 'src/utils/formatting' interface Props { @@ -10,17 +11,24 @@ interface Props { } function EscrowedPaymentLineItem(props: Props & WithNamespaces) { - const { t } = props const { amount, recipientPhone } = props.payment return ( - - {recipientPhone ? recipientPhone : t('unknown')} {t('for')} - - - {' '} - ${getCentAwareMoneyDisplay(divideByWei(amount.toString()))} - + {/* + // @ts-ignore tOptions prop is missing in type bindings, but exists in the implementation */} + + {{ recipientPhone }} for + {{ amount }} + ) } @@ -31,4 +39,4 @@ const styles = StyleSheet.create({ }, }) -export default withNamespaces('global')(EscrowedPaymentLineItem) +export default withNamespaces('inviteFlow11')(EscrowedPaymentLineItem) diff --git a/packages/mobile/src/escrow/EscrowedPaymentReminderSummaryNotification.tsx b/packages/mobile/src/escrow/EscrowedPaymentReminderSummaryNotification.tsx index 4d5f1f5f156..9c929d851f8 100644 --- a/packages/mobile/src/escrow/EscrowedPaymentReminderSummaryNotification.tsx +++ b/packages/mobile/src/escrow/EscrowedPaymentReminderSummaryNotification.tsx @@ -25,8 +25,8 @@ export class EscrowedPaymentReminderSummaryNotification extends React.Component< navigate(Stacks.EscrowStack) } - itemRenderer = (item: EscrowedPayment, key: number) => { - return + itemRenderer = (item: EscrowedPayment) => { + return } render() { diff --git a/packages/mobile/src/escrow/__snapshots__/EscrowedPaymentLineItem.test.tsx.snap b/packages/mobile/src/escrow/__snapshots__/EscrowedPaymentLineItem.test.tsx.snap index 59f758469cf..0f8def0effc 100644 --- a/packages/mobile/src/escrow/__snapshots__/EscrowedPaymentLineItem.test.tsx.snap +++ b/packages/mobile/src/escrow/__snapshots__/EscrowedPaymentLineItem.test.tsx.snap @@ -12,19 +12,16 @@ exports[`renders correctly 1`] = ` > +491522345678 - - for + for - - $ - 7 + 11870000 `; diff --git a/packages/mobile/src/escrow/__snapshots__/EscrowedPaymentReminderSummaryNotification.test.tsx.snap b/packages/mobile/src/escrow/__snapshots__/EscrowedPaymentReminderSummaryNotification.test.tsx.snap index ca0c1fe1c7c..61639ab8403 100644 --- a/packages/mobile/src/escrow/__snapshots__/EscrowedPaymentReminderSummaryNotification.test.tsx.snap +++ b/packages/mobile/src/escrow/__snapshots__/EscrowedPaymentReminderSummaryNotification.test.tsx.snap @@ -103,19 +103,16 @@ exports[`EscrowedPaymentReminderSummaryNotification renders correctly 1`] = ` > +491522345678 - - for + for - - $ - 7 + 11870000 +491522345678 - - for + for - - $ - 7 + 11870000 @@ -524,19 +514,16 @@ exports[`EscrowedPaymentReminderSummaryNotification when more than 2 requests re > +491522345678 - - for + for - - $ - 7 + 11870000 +491522345678 - - for + for - - $ - 7 + 11870000 diff --git a/packages/mobile/src/home/__snapshots__/NotificationBox.test.tsx.snap b/packages/mobile/src/home/__snapshots__/NotificationBox.test.tsx.snap index 06cd653db0f..cfbf818ddb3 100644 --- a/packages/mobile/src/home/__snapshots__/NotificationBox.test.tsx.snap +++ b/packages/mobile/src/home/__snapshots__/NotificationBox.test.tsx.snap @@ -135,8 +135,7 @@ exports[`NotificationBox renders correctly for with all notifications 1`] = ` } > +14155550000 - - for + for - $12.34 + 12.34 +14155550000 - - for + for - $12.34 + 12.34 diff --git a/packages/mobile/src/paymentRequest/IncomingPaymentRequestSummaryNotification.tsx b/packages/mobile/src/paymentRequest/IncomingPaymentRequestSummaryNotification.tsx index 690bdd29878..0ae36790ecb 100644 --- a/packages/mobile/src/paymentRequest/IncomingPaymentRequestSummaryNotification.tsx +++ b/packages/mobile/src/paymentRequest/IncomingPaymentRequestSummaryNotification.tsx @@ -60,10 +60,10 @@ export class IncomingPaymentRequestSummaryNotification extends React.Component

{ + itemRenderer = (item: PaymentRequest) => { return ( { + itemRenderer = (item: PaymentRequest) => { return ( - - {(requesterRecipient && requesterRecipient.displayName) || requesterE164Number} {t('for')} - - - {' ' + CURRENCIES[CURRENCY_ENUM.DOLLAR].symbol + getCentAwareMoneyDisplay(amount)} - + + {{ displayName }} for + {{ amount }} + ) } @@ -32,4 +37,4 @@ const styles = StyleSheet.create({ }, }) -export default withNamespaces('global')(PaymentRequestNotificationInner) +export default withNamespaces('paymentRequestFlow')(PaymentRequestNotificationInner) diff --git a/packages/mobile/src/paymentRequest/__snapshots__/IncomingPaymentRequestListItem.test.tsx.snap b/packages/mobile/src/paymentRequest/__snapshots__/IncomingPaymentRequestListItem.test.tsx.snap index 49da9d65ee2..d7bd9e5d8f0 100644 --- a/packages/mobile/src/paymentRequest/__snapshots__/IncomingPaymentRequestListItem.test.tsx.snap +++ b/packages/mobile/src/paymentRequest/__snapshots__/IncomingPaymentRequestListItem.test.tsx.snap @@ -25,46 +25,36 @@ exports[`IncomingPaymentRequestListItem renders correctly 1`] = ` onResponderTerminate={[Function]} onResponderTerminationRequest={[Function]} onStartShouldSetResponder={[Function]} - style={ - Array [ - Object { - "backgroundColor": "#FFFFFF", - "flexDirection": "row", - "justifyContent": "space-between", - "padding": 16, - "width": "100%", - }, - Object { - "elevation": 2, - "shadowColor": "black", - "shadowOffset": Object { - "height": 1, - "width": 0, - }, - "shadowOpacity": 0.3, - "shadowRadius": 1.6, - }, - ] - } > - + > + + - - - - incomingPaymentRequestNotificationTitle - - Hey thanks for the loan, Ill pay you back ASAP. LOVE YOU + incomingPaymentRequestNotificationTitle - - - global:pay - - + Hey thanks for the loan, Ill pay you back ASAP. LOVE YOU + - + + global:pay + + + - global:decline - + + global:decline + + diff --git a/packages/mobile/src/paymentRequest/__snapshots__/IncomingPaymentRequestListScreen.test.tsx.snap b/packages/mobile/src/paymentRequest/__snapshots__/IncomingPaymentRequestListScreen.test.tsx.snap index 6331de520d0..e4b4832edd9 100644 --- a/packages/mobile/src/paymentRequest/__snapshots__/IncomingPaymentRequestListScreen.test.tsx.snap +++ b/packages/mobile/src/paymentRequest/__snapshots__/IncomingPaymentRequestListScreen.test.tsx.snap @@ -72,46 +72,36 @@ exports[`IncomingPaymentRequestListScreen renders correctly with requests 1`] = onResponderTerminate={[Function]} onResponderTerminationRequest={[Function]} onStartShouldSetResponder={[Function]} - style={ - Array [ - Object { - "backgroundColor": "#FFFFFF", - "flexDirection": "row", - "justifyContent": "space-between", - "padding": 16, - "width": "100%", - }, - Object { - "elevation": 2, - "shadowColor": "black", - "shadowOffset": Object { - "height": 1, - "width": 0, - }, - "shadowOpacity": 0.3, - "shadowRadius": 1.6, - }, - ] - } > - + > + + - - - - incomingPaymentRequestNotificationTitle - - Just the best + incomingPaymentRequestNotificationTitle - - - global:pay - - + Just the best + - - global:decline - + + global:pay + + + + + global:decline + + @@ -298,46 +301,36 @@ exports[`IncomingPaymentRequestListScreen renders correctly with requests 1`] = onResponderTerminate={[Function]} onResponderTerminationRequest={[Function]} onStartShouldSetResponder={[Function]} - style={ - Array [ - Object { - "backgroundColor": "#FFFFFF", - "flexDirection": "row", - "justifyContent": "space-between", - "padding": 16, - "width": "100%", - }, - Object { - "elevation": 2, - "shadowColor": "black", - "shadowOffset": Object { - "height": 1, - "width": 0, - }, - "shadowOpacity": 0.3, - "shadowRadius": 1.6, - }, - ] - } > - + > + + - - - - incomingPaymentRequestNotificationTitle - - Just the best for the best. Thanos & Zeus Gods of ultimate Power + incomingPaymentRequestNotificationTitle - - - global:pay - - + Just the best for the best. Thanos & Zeus Gods of ultimate Power + - + + global:pay + + + - global:decline - + + global:decline + + @@ -524,46 +530,36 @@ exports[`IncomingPaymentRequestListScreen renders correctly with requests 1`] = onResponderTerminate={[Function]} onResponderTerminationRequest={[Function]} onStartShouldSetResponder={[Function]} - style={ - Array [ - Object { - "backgroundColor": "#FFFFFF", - "flexDirection": "row", - "justifyContent": "space-between", - "padding": 16, - "width": "100%", - }, - Object { - "elevation": 2, - "shadowColor": "black", - "shadowOffset": Object { - "height": 1, - "width": 0, - }, - "shadowOpacity": 0.3, - "shadowRadius": 1.6, - }, - ] - } > - + > + + - - - - incomingPaymentRequestNotificationTitle - - Just the best but less + incomingPaymentRequestNotificationTitle - - - global:pay - - + Just the best but less + - + + global:pay + + + - global:decline - + + global:decline + + diff --git a/packages/mobile/src/paymentRequest/__snapshots__/IncomingPaymentRequestSummaryNotification.test.tsx.snap b/packages/mobile/src/paymentRequest/__snapshots__/IncomingPaymentRequestSummaryNotification.test.tsx.snap index b1bed59860e..1bbe103e03d 100644 --- a/packages/mobile/src/paymentRequest/__snapshots__/IncomingPaymentRequestSummaryNotification.test.tsx.snap +++ b/packages/mobile/src/paymentRequest/__snapshots__/IncomingPaymentRequestSummaryNotification.test.tsx.snap @@ -112,8 +112,7 @@ exports[`IncomingPaymentRequestSummaryNotification renders correctly 1`] = ` } > +491522345678 - - for + for - $200,000 + 200000.00 @@ -225,46 +224,36 @@ exports[`IncomingPaymentRequestSummaryNotification when more 1 requests renders onResponderTerminate={[Function]} onResponderTerminationRequest={[Function]} onStartShouldSetResponder={[Function]} - style={ - Array [ - Object { - "backgroundColor": "#FFFFFF", - "flexDirection": "row", - "justifyContent": "space-between", - "padding": 16, - "width": "100%", - }, - Object { - "elevation": 2, - "shadowColor": "black", - "shadowOffset": Object { - "height": 1, - "width": 0, - }, - "shadowOpacity": 0.3, - "shadowRadius": 1.6, - }, - ] - } > - + > + + - - - - incomingPaymentRequestNotificationTitle - - Dinner for me and the gals, PIZZAA! + incomingPaymentRequestNotificationTitle - - - global:pay - - + Dinner for me and the gals, PIZZAA! + - - global:decline - + + global:pay + + + + + global:decline + + @@ -541,8 +543,7 @@ exports[`IncomingPaymentRequestSummaryNotification when more than 2 requests ren } > +491522345678 - - for + for - $200,000 + 200000.00 diff --git a/packages/mobile/src/paymentRequest/__snapshots__/OutgoingPaymentRequestSummaryNotification.test.tsx.snap b/packages/mobile/src/paymentRequest/__snapshots__/OutgoingPaymentRequestSummaryNotification.test.tsx.snap index b54bbd5bbaf..c24102a55ec 100644 --- a/packages/mobile/src/paymentRequest/__snapshots__/OutgoingPaymentRequestSummaryNotification.test.tsx.snap +++ b/packages/mobile/src/paymentRequest/__snapshots__/OutgoingPaymentRequestSummaryNotification.test.tsx.snap @@ -112,8 +112,7 @@ exports[`OutgoingPaymentRequestSummaryNotification renders correctly 1`] = ` } > +491522345678 - - for + for - $200,000 + 200000.00 @@ -529,8 +528,7 @@ exports[`OutgoingPaymentRequestSummaryNotification when more than 2 requests ren } > +491522345678 - - for + for - $200,000 + 200000.00 diff --git a/packages/mobile/src/paymentRequest/__snapshots__/PaymentRequestNotificationInner.test.tsx.snap b/packages/mobile/src/paymentRequest/__snapshots__/PaymentRequestNotificationInner.test.tsx.snap index b3eb61d7395..b12b5f98459 100644 --- a/packages/mobile/src/paymentRequest/__snapshots__/PaymentRequestNotificationInner.test.tsx.snap +++ b/packages/mobile/src/paymentRequest/__snapshots__/PaymentRequestNotificationInner.test.tsx.snap @@ -21,8 +21,7 @@ exports[`renders correctly 1`] = ` } > +14155552671 - - for + for - $24 + 24 `; diff --git a/packages/react-components/components/BaseNotification.tsx b/packages/react-components/components/BaseNotification.tsx index 8c5f2d8c15a..e158571a6ee 100644 --- a/packages/react-components/components/BaseNotification.tsx +++ b/packages/react-components/components/BaseNotification.tsx @@ -1,17 +1,11 @@ import TextButton from '@celo/react-components/components/TextButton' +import Touchable from '@celo/react-components/components/Touchable' import colors from '@celo/react-components/styles/colors' import fontStyles from '@celo/react-components/styles/fonts' import { elevationShadowStyle } from '@celo/react-components/styles/styles' import variables from '@celo/react-components/styles/variables' import * as React from 'react' -import { - Platform, - StyleSheet, - Text, - TouchableNativeFeedback, - TouchableOpacity, - View, -} from 'react-native' +import { StyleSheet, Text, View } from 'react-native' const { contentPadding } = variables @@ -29,15 +23,7 @@ export interface CTA { } function Wrapper({ onPress, children }: { children: React.ReactNode; onPress?: () => unknown }) { - return onPress ? ( - Platform.OS === 'android' ? ( - {children} - ) : ( - {children} - ) - ) : ( - {children} - ) + return onPress ? {children} : {children} } export default function BaseNotification({ icon, title, children, ctas, onPress }: Props) {