FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add custom title renderer for Apple Pay · EdgeApp/edge-react-gui@8b06619 · GitHub

Commit 8b06619

Browse files
Jon Tzeng
committed
Add custom title renderer for Apple Pay
1 parent a223883 commit 8b06619

4 files changed

Lines changed: 47 additions & 6 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
- changed: Wording in light account persistent notification
66

7+
## 4.15.1
8+
9+
- fixed: "Apple Pay" title per latest branding requirements
10+
711
## 4.16.0
812

913
- added: "Transaction Details" button to `SwapSuccessScene`

‎src/__tests__/__snapshots__/GuiPlugins.test.ts.snap‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ Settlement: 5 min - 24 hours",
211211
},
212212
{
213213
"cryptoCodes": [],
214+
"customTitleKey": "applepay",
214215
"deepPath": "",
215216
"deepQuery": {},
216217
"description": "Fee: 5-7%
@@ -221,7 +222,7 @@ Settlement: 10 - 30 minutes",
221222
"credit",
222223
],
223224
"pluginId": "creditcard",
224-
"title": "Pay with Apple Pay",
225+
"title": "",
225226
},
226227
{
227228
"cryptoCodes": [],

‎src/components/scenes/GuiPluginListScene.tsx‎

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { checkAndShowLightBackupModal } from '../../actions/BackupModalActions'
1212
import { checkAndSetRegion, showCountrySelectionModal } from '../../actions/CountryListActions'
1313
import { getDeviceSettings, writeDeveloperPluginUri } from '../../actions/DeviceSettingsActions'
1414
import { NestedDisableMap } from '../../actions/ExchangeInfoActions'
15+
import paymentTypeLogoApplePay from '../../assets/images/paymentTypes/paymentTypeLogoApplePay.png'
1516
import { FLAG_LOGO_URL } from '../../constants/CdnConstants'
1617
import { COUNTRY_CODES } from '../../constants/CountryConstants'
1718
import buyPluginJsonRaw from '../../constants/plugins/buyPluginList.json'
@@ -316,6 +317,30 @@ class GuiPluginList extends React.PureComponent<Props, State> {
316317
onPluginOpened()
317318
}
318319

320+
renderTitle = (guiPluginRow: GuiPluginRow) => {
321+
const styles = getStyles(this.props.theme)
322+
const { title, customTitleKey } = guiPluginRow
323+
324+
switch (customTitleKey) {
325+
case 'applepay':
326+
// Per Apple branding guidelines, "Pay With" is NOT to be translated.
327+
return (
328+
<View style={styles.titleAppleContainer}>
329+
<EdgeText style={styles.titleText} numberOfLines={1}>
330+
{'Pay with '}
331+
</EdgeText>
332+
<Image style={styles.titleAppleLogo} source={paymentTypeLogoApplePay} />
333+
</View>
334+
)
335+
default:
336+
return (
337+
<EdgeText style={styles.titleText} numberOfLines={1}>
338+
{title}
339+
</EdgeText>
340+
)
341+
}
342+
}
343+
319344
renderPlugin = ({ item, index }: ListRenderItemInfo<GuiPluginRow>) => {
320345
const { theme } = this.props
321346
const { pluginId } = item
@@ -328,7 +353,6 @@ class GuiPluginList extends React.PureComponent<Props, State> {
328353
const partnerLogoThemeKey = pluginPartnerLogos[pluginId]
329354
const pluginPartnerLogo = partnerLogoThemeKey ? theme[partnerLogoThemeKey] : { uri: getPartnerIconUri(item.partnerIconPath ?? '') }
330355
const poweredBy = plugin.poweredBy ?? plugin.displayName
331-
332356
return (
333357
<EdgeAnim enter={{ type: 'fadeInDown', distance: 30 * (index + 1) }} style={styles.hackContainer}>
334358
<EdgeCard
@@ -344,9 +368,7 @@ class GuiPluginList extends React.PureComponent<Props, State> {
344368
paddingRem={[1, 0.5, 1, 0.5]}
345369
>
346370
<View style={styles.cardContentContainer}>
347-
<EdgeText style={styles.titleText} numberOfLines={1}>
348-
{item.title}
349-
</EdgeText>
371+
{this.renderTitle(item)}
350372
{item.description === '' ? null : <EdgeText style={styles.subtitleText}>{item.description}</EdgeText>}
351373
{poweredBy != null && item.partnerIconPath != null ? (
352374
<>
@@ -529,6 +551,19 @@ const getStyles = cacheStyles((theme: Theme) => ({
529551
titleText: {
530552
fontFamily: theme.fontFaceMedium
531553
},
554+
titleAppleContainer: {
555+
flexDirection: 'row',
556+
justifyContent: 'flex-start',
557+
alignItems: 'flex-end',
558+
flexShrink: 1
559+
},
560+
titleAppleLogo: {
561+
height: theme.rem(1),
562+
width: 'auto',
563+
aspectRatio: 150 / 64,
564+
resizeMode: 'contain',
565+
marginBottom: 1
566+
},
532567
subtitleText: {
533568
marginTop: theme.rem(0.25),
534569
fontSize: theme.rem(0.75),

‎src/constants/plugins/buyPluginList.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,8 @@
319319
"paymentType": "applepay",
320320
"description": "Fee: 5-7%\nSettlement: 10 - 30 minutes",
321321
"paymentTypes": ["credit"],
322-
"title": "Pay with Apple Pay",
322+
"title": "",
323+
"customTitleKey": "applepay",
323324
"forCountries": [
324325
"AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR",
325326
"AS", "AT", "AU", "AW", "AZ", "BA", "BB", "BD", "BE", "BF",

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL