Skip to content

Commit b0a8e4f

Browse files
committed
Show Myself when any routable wallet exists
The control gated on another wallet of the same type, which is right for the plain send that owns that test. A Stealth Send supplies the whole set of assets it can route to, so the gate hid the picker from exactly the account it exists for: one wallet on the source chain and the rest elsewhere.
1 parent 2e1d113 commit b0a8e4f

2 files changed

Lines changed: 103 additions & 2 deletions

File tree

‎src/__tests__/scenes/__snapshots__/SendScene2.ui.test.tsx.snap‎

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17176,6 +17176,93 @@ exports[`SendScene2 Render SendScene 1`] = `
1717617176
Enter
1717717177
</Text>
1717817178
</View>
17179+
<View
17180+
accessibilityState={
17181+
{
17182+
"busy": undefined,
17183+
"checked": undefined,
17184+
"disabled": false,
17185+
"expanded": undefined,
17186+
"selected": undefined,
17187+
}
17188+
}
17189+
accessibilityValue={
17190+
{
17191+
"max": undefined,
17192+
"min": undefined,
17193+
"now": undefined,
17194+
"text": undefined,
17195+
}
17196+
}
17197+
accessible={true}
17198+
collapsable={false}
17199+
focusable={true}
17200+
onClick={[Function]}
17201+
onResponderGrant={[Function]}
17202+
onResponderMove={[Function]}
17203+
onResponderRelease={[Function]}
17204+
onResponderTerminate={[Function]}
17205+
onResponderTerminationRequest={[Function]}
17206+
onStartShouldSetResponder={[Function]}
17207+
style={
17208+
{
17209+
"alignItems": "center",
17210+
"flex": 1,
17211+
"flexDirection": "column",
17212+
"height": 67,
17213+
"justifyContent": "space-evenly",
17214+
"opacity": 1,
17215+
}
17216+
}
17217+
testID="addressTileMyself"
17218+
>
17219+
<Text
17220+
allowFontScaling={false}
17221+
selectable={false}
17222+
style={
17223+
[
17224+
{
17225+
"color": "#00f1a2",
17226+
"fontSize": 45,
17227+
},
17228+
undefined,
17229+
{
17230+
"fontFamily": "anticon",
17231+
"fontStyle": "normal",
17232+
"fontWeight": "normal",
17233+
},
17234+
{},
17235+
]
17236+
}
17237+
>
17238+
17239+
</Text>
17240+
<Text
17241+
adjustsFontSizeToFit={true}
17242+
allowFontScaling={false}
17243+
minimumFontScale={0.65}
17244+
numberOfLines={1}
17245+
style={
17246+
[
17247+
{
17248+
"color": "#FFFFFF",
17249+
"fontFamily": "Quicksand-Regular",
17250+
"fontSize": 22,
17251+
"includeFontPadding": false,
17252+
},
17253+
{
17254+
"alignSelf": "center",
17255+
"color": "#00f1a2",
17256+
"fontSize": 17,
17257+
"marginTop": 6,
17258+
},
17259+
null,
17260+
]
17261+
}
17262+
>
17263+
Myself
17264+
</Text>
17265+
</View>
1717917266
<View
1718017267
accessibilityState={
1718117268
{

‎src/components/tiles/AddressTile2.tsx‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,23 @@ export const AddressTile2 = React.forwardRef(
206206
const canSelfTransfer: boolean = Object.keys(currencyWallets).some(
207207
walletId => {
208208
if (walletId === coreWallet.id) return false
209-
if (currencyWallets[walletId].type !== coreWallet.type) return false
209+
const wallet = currencyWallets[walletId]
210+
// A self-transfer caller offers every asset the send can route to, so
211+
// the control has to appear whenever the user holds ANY of them. The
212+
// same-type test below would hide it from exactly the account the
213+
// cross-chain picker exists for: one wallet on the source chain and
214+
// the rest elsewhere.
215+
if (selfTransfer != null) {
216+
return selfTransfer.allowedAssets.some(
217+
asset =>
218+
asset.pluginId === wallet.currencyInfo.pluginId &&
219+
(asset.tokenId == null ||
220+
wallet.enabledTokenIds.includes(asset.tokenId))
221+
)
222+
}
223+
if (wallet.type !== coreWallet.type) return false
210224
if (tokenId == null) return true
211-
return currencyWallets[walletId].enabledTokenIds.includes(tokenId)
225+
return wallet.enabledTokenIds.includes(tokenId)
212226
}
213227
)
214228

0 commit comments

Comments
 (0)