diff --git a/.yarnrc b/.yarnrc deleted file mode 100644 index b6c6e9f2e9..0000000000 --- a/.yarnrc +++ /dev/null @@ -1,5 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -yarn-path ".yarn/releases/yarn-3.5.1.cjs" diff --git a/src/assets/fonts/config.json b/src/assets/fonts/config.json index c10851f44d..75d1c9e172 100644 --- a/src/assets/fonts/config.json +++ b/src/assets/fonts/config.json @@ -121,7 +121,7 @@ { "uid": "8c802a14f77dea3dc02419584c942c70", "css": "link", - "code": 59392, + "code": 59393, "src": "custom_icons", "selected": true, "svg": { @@ -205,7 +205,7 @@ { "uid": "1692d179ac2d54092854f0999d74036e", "css": "arrow-down", - "code": 59393, + "code": 59394, "src": "custom_icons", "selected": true, "svg": { @@ -219,7 +219,7 @@ { "uid": "991d995828300aa242720d329a7e42b4", "css": "arrow-up", - "code": 59394, + "code": 59395, "src": "custom_icons", "selected": true, "svg": { @@ -289,7 +289,7 @@ { "uid": "6813ca14115f77f449d2a2d3d961e57c", "css": "arrow-back", - "code": 59395, + "code": 59396, "src": "custom_icons", "selected": true, "svg": { @@ -303,7 +303,7 @@ { "uid": "0ef77ca722d925a88e3a6c303f426d34", "css": "lock", - "code": 59396, + "code": 59397, "src": "custom_icons", "selected": true, "svg": { @@ -373,7 +373,7 @@ { "uid": "0a60a377c3e8b7ab05dce66e4d4b8603", "css": "arrow-up-circle", - "code": 59397, + "code": 59398, "src": "custom_icons", "selected": true, "svg": { @@ -387,7 +387,7 @@ { "uid": "1b02d0b1b2201e9507feb650165a3285", "css": "exchange", - "code": 59398, + "code": 59399, "src": "custom_icons", "selected": true, "svg": { @@ -457,7 +457,7 @@ { "uid": "d981b3b38e4f0c88ce37c550796935db", "css": "cake", - "code": 59399, + "code": 59400, "src": "custom_icons", "selected": true, "svg": { @@ -471,7 +471,7 @@ { "uid": "b6c2a3aa44468deec00ee65d165544b4", "css": "camera", - "code": 59400, + "code": 59401, "src": "custom_icons", "selected": true, "svg": { @@ -527,7 +527,7 @@ { "uid": "54fc75218d35d5df058c9ca642ae15a7", "css": "ios-share", - "code": 59401, + "code": 59402, "src": "custom_icons", "selected": true, "svg": { @@ -541,7 +541,7 @@ { "uid": "5223606f9c2ff365f559c2a6e8424bcb", "css": "profile", - "code": 59402, + "code": 59403, "src": "custom_icons", "selected": true, "svg": { @@ -625,7 +625,7 @@ { "uid": "5583f70c05043ef39f41efd72133675e", "css": "bonus-reward", - "code": 59403, + "code": 59404, "src": "custom_icons", "selected": true, "svg": { @@ -639,7 +639,7 @@ { "uid": "d547326029026c1c1df66dbc9a6c78c5", "css": "paste", - "code": 59404, + "code": 59405, "src": "custom_icons", "selected": true, "svg": { @@ -709,7 +709,7 @@ { "uid": "4a5e561409988fe88a652bca5549dcfe", "css": "close", - "code": 59405, + "code": 59406, "src": "custom_icons", "selected": true, "svg": { @@ -723,7 +723,7 @@ { "uid": "0cfc059176d702e1376af4e3b9b2ed64", "css": "convert", - "code": 59406, + "code": 59407, "src": "custom_icons", "selected": true, "svg": { @@ -779,7 +779,7 @@ { "uid": "4221e439cbd906754d36dcf4f8c35c5d", "css": "backspace", - "code": 59407, + "code": 59408, "src": "custom_icons", "selected": true, "svg": { @@ -807,7 +807,7 @@ { "uid": "6b7ef3aff4f46c09a952e34cad966375", "css": "edit", - "code": 59408, + "code": 59409, "src": "custom_icons", "selected": true, "svg": { @@ -863,7 +863,7 @@ { "uid": "7ace7022b78490ee4a3bc44e51e06631", "css": "envelope", - "code": 59409, + "code": 59410, "src": "custom_icons", "selected": true, "svg": { @@ -891,7 +891,7 @@ { "uid": "12cd0d0f954bdb71d3525ce890ab0be4", "css": "gear", - "code": 59410, + "code": 59411, "src": "custom_icons", "selected": true, "svg": { @@ -961,7 +961,7 @@ { "uid": "b9e2d5e1423806fa9e5a763e0ef5faf6", "css": "bridge", - "code": 59411, + "code": 59412, "src": "custom_icons", "selected": true, "svg": { @@ -975,7 +975,7 @@ { "uid": "5e30b1ae690a603113bb2936df830062", "css": "claim-circle", - "code": 59412, + "code": 59413, "src": "custom_icons", "selected": true, "svg": { @@ -1045,7 +1045,7 @@ { "uid": "85bb0dd34def6f4840648af6709a4285", "css": "donate-filled", - "code": 59413, + "code": 59414, "src": "custom_icons", "selected": true, "svg": { @@ -1059,7 +1059,7 @@ { "uid": "1694baf87238754d60da0e6ec08d40ff", "css": "clock-filled", - "code": 59414, + "code": 59415, "src": "custom_icons", "selected": true, "svg": { @@ -1129,7 +1129,7 @@ { "uid": "5631a467e6cbbabb985295cfe2773050", "css": "donate-circle", - "code": 59415, + "code": 59416, "src": "custom_icons", "selected": true, "svg": { @@ -1143,7 +1143,7 @@ { "uid": "ee3a30b74bb3d853018a23f7db1c90ad", "css": "clock", - "code": 59416, + "code": 59436, "src": "custom_icons", "selected": true, "svg": { @@ -1154,20 +1154,6 @@ "clock" ] }, - { - "uid": "4bb96423a4e18d93e272e977afae277e", - "css": "success", - "code": 59441, - "src": "custom_icons", - "selected": true, - "svg": { - "path": "M1267 96A42 42 0 0 0 1207 96L490 814 156 480A42 42 0 0 0 96 480 42 42 0 0 0 96 540L459 904H459L459 904A42 42 0 0 0 489 916 42 42 0 0 0 519 904L1267 156A42 42 0 0 0 1267 96", - "width": 1363 - }, - "search": [ - "success" - ] - }, { "uid": "c69f0d1657a9bf01a1edca9deb94d2ed", "css": "time", @@ -1213,7 +1199,7 @@ { "uid": "abbe2593e171f18485ceed532bfeb524", "css": "receive-filled", - "code": 59436, + "code": 59451, "src": "custom_icons", "selected": true, "svg": { @@ -1227,7 +1213,7 @@ { "uid": "a92c3ee7a38711615c35b580df59336d", "css": "gooddapp", - "code": 59451, + "code": 59456, "src": "custom_icons", "selected": true, "svg": { @@ -1245,16 +1231,38 @@ "src": "fontawesome" }, { - "uid": "a8ed7903f8f548da5a8084e1773f0bbb", - "css": "chat-1", - "code": 61501, - "src": "mfglabs" + "uid": "cbc328d1c779a2b9e3b1199d904199a5", + "css": "emo-grin", + "code": 59392, + "src": "fontelico" }, { - "uid": "21f6a88daf13c62e5a70f5ef6ad9e23f", - "css": "chat", - "code": 59456, - "src": "websymbols" + "uid": "4bb96423a4e18d93e272e977afae277e", + "css": "success", + "code": 59441, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M1267 96A42 42 0 0 0 1207 96L490 814 156 480A42 42 0 0 0 96 480 42 42 0 0 0 96 540L459 904H459L459 904A42 42 0 0 0 489 916 42 42 0 0 0 519 904L1267 156A42 42 0 0 0 1267 96", + "width": 1363 + }, + "search": [ + "success" + ] + }, + { + "uid": "1f0f6201cb7a4346af3872e8920d05a0", + "css": "paste2", + "code": 59458, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M391.4 63L396.6 63.3C339.6 54.2 279.6 96.3 281.7 159.3V181.5L282.1 176.6C278.8 200.8 283.3 225.3 295.8 246.7 308.3 268.2 330.7 286.5 359 291.4L360.9 291.7 362.7 291.8C408.1 294.6 451.8 292.4 493 293.1H494.2 495.4C525 291.5 563.8 298.8 607.7 287.2L609.4 286.7 611 286.2C637.3 276.4 655.1 254.6 663.2 233.2 670.6 213.7 671 194.7 669.8 176.9 672.5 153.6 668.7 129.9 656.6 109.3 644.1 87.9 621.7 69.5 593.4 64.6L591.1 64.3 588.9 64.2C521.8 61.4 455.7 63.7 391.4 63ZM385.4 133.9L387.9 134.3H390.6C455.8 135 519.7 133.1 581.9 135.5 587.7 136.7 591.4 139.2 595 145.3 598.7 151.6 600.6 161.5 599.5 169.6L599 173.7 599.3 177.8C600.4 188.9 599.2 200.6 596.4 207.8 593.9 214.3 591.8 216.3 587 218.3 563.7 223.8 532.2 220 494.1 221.6 450.9 220.9 409.6 222.7 370.4 220.5 364.6 219.3 361 216.9 357.4 210.8 353.7 204.4 351.7 194.4 352.9 186.3L353.1 183.9V157.6 157C352.7 143.1 370.5 131.5 385.4 133.9ZM416.7 678A35.7 35.7 0 0 0 381 713.7 35.7 35.7 0 0 0 416.7 749.4H674.6A35.7 35.7 0 0 0 710.3 713.7 35.7 35.7 0 0 0 674.6 678ZM416.7 400.2A35.7 35.7 0 0 0 381 435.9 35.7 35.7 0 0 0 416.7 471.6H674.6A35.7 35.7 0 0 0 710.3 435.9 35.7 35.7 0 0 0 674.6 400.2ZM277.8 678A35.7 35.7 0 0 0 242.1 713.7 35.7 35.7 0 0 0 277.8 749.4H297.6A35.7 35.7 0 0 0 333.3 713.7 35.7 35.7 0 0 0 297.6 678ZM277.8 400.2A35.7 35.7 0 0 0 242.1 435.9 35.7 35.7 0 0 0 277.8 471.6H297.6A35.7 35.7 0 0 0 333.3 435.9 35.7 35.7 0 0 0 297.6 400.2ZM277.8 539.2A35.7 35.7 0 0 0 242.1 574.9 35.7 35.7 0 0 0 277.8 610.6H297.6A35.7 35.7 0 0 0 333.3 574.9 35.7 35.7 0 0 0 297.6 539.2ZM416.7 539.2A35.7 35.7 0 0 0 381 574.9 35.7 35.7 0 0 0 416.7 610.6H674.6A35.7 35.7 0 0 0 710.3 574.9 35.7 35.7 0 0 0 674.6 539.2ZM316.8 142.4C277.9 143.2 233.7 141.6 187.9 154.1 121.7 169.6 89.8 233.5 87 289.9 80.4 393.4 84.4 495.4 83.3 595.4V596.1 596.7C85.1 667.3 75.9 745.5 95.7 826V826.2L95.8 826.3C104.5 860.4 127.8 886.1 154 901.6 180.3 917.1 209.8 924.1 238 925 343.5 930.4 447.8 927.1 550.5 928H551.2 551.8C619 926.2 695.1 936 773.1 913.7L773.3 913.6 773.7 913.5C809.9 902.4 834.9 875.1 848.5 846.4 862.1 817.6 866.7 787 867.2 759.3 870.7 632.6 868.4 506.5 869 381.4V380.4L869 379.4C866.3 328.3 879.6 249 824.9 188.8L823.8 187.6 822.5 186.5C763.8 133.2 687 144.8 636.6 142.4L633.3 213.7C692.2 216.5 742.9 213.1 772.7 238.7 799.1 269.3 794.5 322.1 797.6 382.9 797.6 383 797.6 383 797.6 383.1 797 508.7 799.2 633.7 795.8 757.6V757.8 758C795.4 778.1 791.5 799.9 784 815.7 776.6 831.3 767.8 840.4 752.9 845.1 693.2 862 624.1 854.6 550 856.6 445.6 855.7 342.4 858.9 241 853.7H240.6 240.3C222.8 853.1 204 848.2 190.4 840.1 176.8 832.1 168.7 822.5 165.1 808.7 149.4 744.6 156.7 672.1 154.8 595.1 154.8 595 154.8 595 154.8 594.9 155.8 492.8 152 392.3 158.3 294V293.7 293.4C159.9 260.5 177.3 229.6 204.3 223.4L205.1 223.2 205.9 223C238.3 214 276.6 214.6 318.2 213.8Z", + "width": 952 + }, + "search": [ + "paste2" + ] } ] } \ No newline at end of file diff --git a/src/assets/fonts/gooddollar.eot b/src/assets/fonts/gooddollar.eot index eb0b5458e9..4b94205126 100644 Binary files a/src/assets/fonts/gooddollar.eot and b/src/assets/fonts/gooddollar.eot differ diff --git a/src/assets/fonts/gooddollar.svg b/src/assets/fonts/gooddollar.svg index cca24f7360..943aa7b6ef 100644 --- a/src/assets/fonts/gooddollar.svg +++ b/src/assets/fonts/gooddollar.svg @@ -6,55 +6,55 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -94,7 +94,7 @@ - + @@ -124,7 +124,7 @@ - + @@ -134,10 +134,12 @@ - + + + @@ -184,8 +186,6 @@ - - diff --git a/src/assets/fonts/gooddollar.ttf b/src/assets/fonts/gooddollar.ttf index 2d8c0dd29a..86f4b81288 100644 Binary files a/src/assets/fonts/gooddollar.ttf and b/src/assets/fonts/gooddollar.ttf differ diff --git a/src/assets/fonts/gooddollar.woff b/src/assets/fonts/gooddollar.woff index 01111dd09f..8ed8c960d7 100644 Binary files a/src/assets/fonts/gooddollar.woff and b/src/assets/fonts/gooddollar.woff differ diff --git a/src/assets/fonts/gooddollar.woff2 b/src/assets/fonts/gooddollar.woff2 index 0cfd0506fe..0167c6c643 100644 Binary files a/src/assets/fonts/gooddollar.woff2 and b/src/assets/fonts/gooddollar.woff2 differ diff --git a/src/assets/fonts/index.css b/src/assets/fonts/index.css index dad296880a..2e9f55b026 100644 --- a/src/assets/fonts/index.css +++ b/src/assets/fonts/index.css @@ -1,11 +1,11 @@ @font-face { font-family: 'gooddollar'; - src: url('./gooddollar.eot?98390687'); - src: url('./gooddollar.eot?98390687#iefix') format('embedded-opentype'), - url('./gooddollar.woff2?98390687') format('woff2'), - url('./gooddollar.woff?98390687') format('woff'), - url('./gooddollar.ttf?98390687') format('truetype'), - url('./gooddollar.svg?98390687#gooddollar') format('svg'); + src: url('./gooddollar.eot?14235354'); + src: url('./gooddollar.eot?14235354#iefix') format('embedded-opentype'), + url('./gooddollar.woff2?14235354') format('woff2'), + url('./gooddollar.woff?14235354') format('woff'), + url('./gooddollar.ttf?14235354') format('truetype'), + url('./gooddollar.svg?14235354#gooddollar') format('svg'); font-weight: normal; font-style: normal; } @@ -15,7 +15,7 @@ @media screen and (-webkit-min-device-pixel-ratio:0) { @font-face { font-family: 'gooddollar'; - src: url('./gooddollar.svg?98390687#gooddollar') format('svg'); + src: url('../font/gooddollar.svg?14235354#gooddollar') format('svg'); } } */ @@ -54,31 +54,31 @@ /* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */ } -.icon-link:before { content: '\e800'; } /* '' */ -.icon-arrow-down:before { content: '\e801'; } /* '' */ -.icon-arrow-up:before { content: '\e802'; } /* '' */ -.icon-arrow-back:before { content: '\e803'; } /* '' */ -.icon-lock:before { content: '\e804'; } /* '' */ -.icon-arrow-up-circle:before { content: '\e805'; } /* '' */ -.icon-exchange:before { content: '\e806'; } /* '' */ -.icon-cake:before { content: '\e807'; } /* '' */ -.icon-camera:before { content: '\e808'; } /* '' */ -.icon-ios-share:before { content: '\e809'; } /* '' */ -.icon-profile:before { content: '\e80a'; } /* '' */ -.icon-bonus-reward:before { content: '\e80b'; } /* '' */ -.icon-paste:before { content: '\e80c'; } /* '' */ -.icon-close:before { content: '\e80d'; } /* '' */ -.icon-convert:before { content: '\e80e'; } /* '' */ -.icon-backspace:before { content: '\e80f'; } /* '' */ -.icon-edit:before { content: '\e810'; } /* '' */ -.icon-envelope:before { content: '\e811'; } /* '' */ -.icon-gear:before { content: '\e812'; } /* '' */ -.icon-bridge:before { content: '\e813'; } /* '' */ -.icon-claim-circle:before { content: '\e814'; } /* '' */ -.icon-donate-filled:before { content: '\e815'; } /* '' */ -.icon-clock-filled:before { content: '\e816'; } /* '' */ -.icon-donate-circle:before { content: '\e817'; } /* '' */ -.icon-clock:before { content: '\e818'; } /* '' */ +.icon-emo-grin:before { content: '\e800'; } /* '' */ +.icon-link:before { content: '\e801'; } /* '' */ +.icon-arrow-down:before { content: '\e802'; } /* '' */ +.icon-arrow-up:before { content: '\e803'; } /* '' */ +.icon-arrow-back:before { content: '\e804'; } /* '' */ +.icon-lock:before { content: '\e805'; } /* '' */ +.icon-arrow-up-circle:before { content: '\e806'; } /* '' */ +.icon-exchange:before { content: '\e807'; } /* '' */ +.icon-cake:before { content: '\e808'; } /* '' */ +.icon-camera:before { content: '\e809'; } /* '' */ +.icon-ios-share:before { content: '\e80a'; } /* '' */ +.icon-profile:before { content: '\e80b'; } /* '' */ +.icon-bonus-reward:before { content: '\e80c'; } /* '' */ +.icon-paste:before { content: '\e80d'; } /* '' */ +.icon-close:before { content: '\e80e'; } /* '' */ +.icon-convert:before { content: '\e80f'; } /* '' */ +.icon-backspace:before { content: '\e810'; } /* '' */ +.icon-edit:before { content: '\e811'; } /* '' */ +.icon-envelope:before { content: '\e812'; } /* '' */ +.icon-gear:before { content: '\e813'; } /* '' */ +.icon-bridge:before { content: '\e814'; } /* '' */ +.icon-claim-circle:before { content: '\e815'; } /* '' */ +.icon-donate-filled:before { content: '\e816'; } /* '' */ +.icon-clock-filled:before { content: '\e817'; } /* '' */ +.icon-donate-circle:before { content: '\e818'; } /* '' */ .icon-receive-circle:before { content: '\e819'; } /* '' */ .icon-send-circle:before { content: '\e81a'; } /* '' */ .icon-send-filled:before { content: '\e81b'; } /* '' */ @@ -98,7 +98,7 @@ .icon-notifications:before { content: '\e829'; } /* '' */ .icon-phone:before { content: '\e82a'; } /* '' */ .icon-privacy:before { content: '\e82b'; } /* '' */ -.icon-receive-filled:before { content: '\e82c'; } /* '' */ +.icon-clock:before { content: '\e82c'; } /* '' */ .icon-qrcode:before { content: '\e82d'; } /* '' */ .icon-search:before { content: '\e82e'; } /* '' */ .icon-settings:before { content: '\e82f'; } /* '' */ @@ -113,13 +113,14 @@ .icon-export-wallet:before { content: '\e838'; } /* '' */ .icon-info:before { content: '\e839'; } /* '' */ .icon-external-link:before { content: '\e83a'; } /* '' */ -.icon-gooddapp:before { content: '\e83b'; } /* '' */ +.icon-receive-filled:before { content: '\e83b'; } /* '' */ .icon-wallet:before { content: '\e83c'; } /* '' */ .icon-goodmarket:before { content: '\e83d'; } /* '' */ .icon-support2:before { content: '\e83e'; } /* '' */ .icon-invite2:before { content: '\e83f'; } /* '' */ -.icon-chat:before { content: '\e840'; } /* '' */ +.icon-gooddapp:before { content: '\e840'; } /* '' */ .icon-statistics:before { content: '\e841'; } /* '' */ +.icon-paste2:before { content: '\e842'; } /* '' */ .icon-vote:before { content: '\e848'; } /* '' */ .icon-donate:before { content: '\e849'; } /* '' */ .icon-rewards-alt:before { content: '\e84a'; } /* '' */ @@ -143,5 +144,4 @@ .icon-privacy-policy:before { content: '\e883'; } /* '' */ .icon-walletconnect:before { content: '\e899'; } /* '' */ .icon-terms-of-use:before { content: '\e89f'; } /* '' */ -.icon-chat-1:before { content: '\f03d'; } /* '' */ -.icon-link-ext:before { content: '\f08e'; } /* '' */ \ No newline at end of file +.icon-link-ext:before { content: '\f08e'; } /* '' */ diff --git a/src/components/appNavigation/__tests__/__snapshots__/AppNavigation.js.snap b/src/components/appNavigation/__tests__/__snapshots__/AppNavigation.js.snap index 82052c22c0..aecd2ef116 100644 --- a/src/components/appNavigation/__tests__/__snapshots__/AppNavigation.js.snap +++ b/src/components/appNavigation/__tests__/__snapshots__/AppNavigation.js.snap @@ -1524,7 +1524,7 @@ exports[`AppNavigation matches snapshot 1`] = ` } } > -  + 
-  + 
{ const [next, ...nextRoutes] = nextRoutesParam ? nextRoutesParam : [] return ( @@ -476,6 +477,7 @@ export const NextButton = ({ style={Platform.OS === 'web' && { flex: 2 }} canContinue={canContinue} loading={loading} + {...props} > {label || 'Next'} diff --git a/src/components/backupWallet/__tests__/__snapshots__/ExportWalletData.js.snap b/src/components/backupWallet/__tests__/__snapshots__/ExportWalletData.js.snap index 5e84486376..eba5478b66 100644 --- a/src/components/backupWallet/__tests__/__snapshots__/ExportWalletData.js.snap +++ b/src/components/backupWallet/__tests__/__snapshots__/ExportWalletData.js.snap @@ -65,7 +65,7 @@ exports[`ReceiveToAddress matches snapshot 1`] = ` } } > -  + 
diff --git a/src/components/common/buttons/BaseButton.js b/src/components/common/buttons/BaseButton.js index 1258bccd1f..e5c0d4dfbe 100644 --- a/src/components/common/buttons/BaseButton.js +++ b/src/components/common/buttons/BaseButton.js @@ -24,6 +24,7 @@ const Button = ({ children, uppercase = true, accessibilityLabel, + noElevation = false, onPress = noop, style, theme, @@ -126,7 +127,7 @@ const Button = ({ borderBottomRightRadius: style ? StyleSheet.flatten(style).borderBottomRightRadius ?? undefined : undefined, } const textStyle = { color: textColor, ...font } - const elevation = disabled || mode !== 'contained' ? 0 : elevationAnim + const elevation = disabled || mode !== 'contained' || noElevation ? 0 : elevationAnim const isChildrenString = typeof children === 'string' const fullSizeStyle = { flex: 1, alignSelf: 'stretch' } diff --git a/src/components/common/form/InputWithAddons.js b/src/components/common/form/InputWithAddons.js new file mode 100644 index 0000000000..6cecccdc3a --- /dev/null +++ b/src/components/common/form/InputWithAddons.js @@ -0,0 +1,151 @@ +// @flow +import React, { useCallback, useContext, useEffect, useMemo } from 'react' +import { StyleSheet, TextInput, TouchableOpacity, View } from 'react-native' +import { noop } from 'lodash' + +import { isMobileWeb as isMobile, isMobileSafari } from '../../../lib/utils/platform' +import normalize from '../../../lib/utils/normalizeText' +import { GlobalTogglesContext } from '../../../lib/contexts/togglesContext' +import { withStyles } from '../../../lib/styles' +import { calculateFontFamily, calculateFontWeight } from '../../../lib/utils/fonts' +import Icon from '../view/Icon' +import Config from '../../../config/config' +import useOnPress from '../../../lib/hooks/useOnPress' +import ErrorText from './ErrorText' + +const shouldChangeSizeOnKeyboardShown = isMobileSafari && Config.safariMobileKeyboardGuidedSize + +/** + * default of icon placement is on the right side + * + */ +const InputTextWAddons = ({ + showAdornment, + showError = true, + error, + styles, + theme, + containerStyle, + style, + getRef, + onBlur, + placeholderTextColor, + + prefixIcon = false, + prefixDisabled = false, + prefixColor, + prefixStyle, + prefixIconSize, + onPrefixClick = noop, + + suffixIcon = false, + suffixDisabled = false, + suffixColor, + suffixStyle, + suffixIconSize, + onSuffixClick = noop, + ...props +}) => { + const { setMobileSafariKeyboardShown, setMobileKeyboardShown } = useContext(GlobalTogglesContext) + + const onTouchStart = useCallback(() => { + if (shouldChangeSizeOnKeyboardShown) { + window.scrollTo(0, 0) + document.body.scrollTop = 0 + setMobileSafariKeyboardShown(true) + } + + if (isMobile) { + setMobileKeyboardShown(true) + } + }, [setMobileSafariKeyboardShown, setMobileKeyboardShown]) + + const onBlurHandler = useCallback(() => { + if (shouldChangeSizeOnKeyboardShown) { + setMobileSafariKeyboardShown(false) + } + + if (isMobile) { + setMobileKeyboardShown(false) + } + + if (onBlur) { + onBlur() + } + }, [setMobileSafariKeyboardShown, setMobileKeyboardShown, onBlur]) + + useEffect(() => { + setMobileSafariKeyboardShown(false) + setMobileKeyboardShown(false) + }, []) + + const inputColor = useMemo(() => { + const { red, lightBlue } = theme.colors + + return error ? red : lightBlue + }, [error]) + + const _onPressPrefix = useOnPress(onPrefixClick) + const _onPressSuffix = useOnPress(onSuffixClick) + + return ( + + + {prefixIcon && ( + + + + )} + + {suffixIcon && ( + + + + )} + + {showError && } + + ) +} + +const getStylesFromProps = ({ theme, fontFamily, fontWeight, style }) => { + const selectedFontFamily = fontFamily || theme.fonts.slab + const selectedFontWeight = StyleSheet.flatten(style)?.fontWeight || fontWeight + + const calculatedFontWeight = isNaN(selectedFontWeight) ? calculateFontWeight(selectedFontWeight) : selectedFontWeight + const calculatedFontFamily = calculateFontFamily(selectedFontFamily, selectedFontWeight) + + return { + input: { + ...theme.fontStyle, + fontWeight: calculatedFontWeight, + backgroundColor: theme.colors.surface, + borderBottomColor: theme.colors.lightBlue, + borderBottomWidth: StyleSheet.hairlineWidth, + color: theme.colors.lightBlue, + fontFamily: calculatedFontFamily, + paddingHorizontal: theme.sizes.defaultQuadruple, + paddingVertical: theme.sizes.defaultHalf, + }, + view: { + width: '100%', + marginBottom: theme.sizes.default, + }, + adornment: { + paddingTop: theme.paddings.mainContainerPadding, + position: 'absolute', + right: theme.sizes.default, + zIndex: 1, + bottom: 10, + }, + } +} + +export default withStyles(getStylesFromProps)(InputTextWAddons) diff --git a/src/components/common/form/InputWithAdornment.js b/src/components/common/form/InputWithAdornment.js index 14ee58b216..c84b884157 100644 --- a/src/components/common/form/InputWithAdornment.js +++ b/src/components/common/form/InputWithAdornment.js @@ -1,131 +1,30 @@ // @flow -import React, { useCallback, useContext, useEffect, useMemo } from 'react' -import { StyleSheet, TextInput, TouchableOpacity, View } from 'react-native' -import { isMobileWeb as isMobile, isMobileSafari } from '../../../lib/utils/platform' -import normalize from '../../../lib/utils/normalizeText' -import { GlobalTogglesContext } from '../../../lib/contexts/togglesContext' -import { withStyles } from '../../../lib/styles' -import { calculateFontFamily, calculateFontWeight } from '../../../lib/utils/fonts' -import Icon from '../view/Icon' -import Config from '../../../config/config' -import useOnPress from '../../../lib/hooks/useOnPress' -import ErrorText from './ErrorText' - -const shouldChangeSizeOnKeyboardShown = isMobileSafari && Config.safariMobileKeyboardGuidedSize +import React from 'react' +import InputWithAddons from './InputWithAddons' const InputText = ({ showAdornment, adornment, - adornmentAction, - adornmentSize = 16, + adornmentSize, adornmentStyle, adornmentColor, - adornmentDisabled = false, - showError = true, - error, - styles, - theme, - containerStyle, - style, - getRef, - onBlur, - placeholderTextColor, + adornmentDisabled, + adornmentAction, ...props }) => { - const { setMobileSafariKeyboardShown, setMobileKeyboardShown } = useContext(GlobalTogglesContext) - - const onTouchStart = useCallback(() => { - if (shouldChangeSizeOnKeyboardShown) { - window.scrollTo(0, 0) - document.body.scrollTop = 0 - setMobileSafariKeyboardShown(true) - } - - if (isMobile) { - setMobileKeyboardShown(true) - } - }, [setMobileSafariKeyboardShown, setMobileKeyboardShown]) - - const onBlurHandler = useCallback(() => { - if (shouldChangeSizeOnKeyboardShown) { - setMobileSafariKeyboardShown(false) - } - - if (isMobile) { - setMobileKeyboardShown(false) - } - - if (onBlur) { - onBlur() - } - }, [setMobileSafariKeyboardShown, setMobileKeyboardShown, onBlur]) - - useEffect(() => { - setMobileSafariKeyboardShown(false) - setMobileKeyboardShown(false) - }, []) - - const inputColor = useMemo(() => { - const { red, lightBlue } = theme.colors - - return error ? red : lightBlue - }, [error]) - - const _onPress = useOnPress(adornmentAction) - return ( - - - - {showAdornment && error !== '' && ( - - - - )} - - {showError && } - + ) } -const getStylesFromProps = ({ theme, fontFamily, fontWeight, style }) => { - const selectedFontFamily = fontFamily || theme.fonts.slab - const selectedFontWeight = StyleSheet.flatten(style)?.fontWeight || fontWeight - - const calculatedFontWeight = isNaN(selectedFontWeight) ? calculateFontWeight(selectedFontWeight) : selectedFontWeight - const calculatedFontFamily = calculateFontFamily(selectedFontFamily, selectedFontWeight) - - return { - input: { - ...theme.fontStyle, - fontWeight: calculatedFontWeight, - backgroundColor: theme.colors.surface, - borderBottomColor: theme.colors.lightBlue, - borderBottomWidth: StyleSheet.hairlineWidth, - color: theme.colors.lightBlue, - fontFamily: calculatedFontFamily, - paddingHorizontal: theme.sizes.defaultQuadruple, - paddingVertical: theme.sizes.defaultHalf, - }, - view: { - width: '100%', - marginBottom: theme.sizes.default, - }, - adornment: { - paddingTop: theme.paddings.mainContainerPadding, - position: 'absolute', - right: theme.sizes.default, - zIndex: 1, - bottom: 10, - }, - } -} - -export default withStyles(getStylesFromProps)(InputText) +export default InputText diff --git a/src/components/common/form/__tests__/__snapshots__/InputGoodDollar.js.snap b/src/components/common/form/__tests__/__snapshots__/InputGoodDollar.js.snap index 8ac6c562bb..fec3f608fe 100644 --- a/src/components/common/form/__tests__/__snapshots__/InputGoodDollar.js.snap +++ b/src/components/common/form/__tests__/__snapshots__/InputGoodDollar.js.snap @@ -59,7 +59,7 @@ exports[`InputGoodDollar matches snapshot 2`] = ` spellCheck={true} style={ Object { - "borderBottomColor": "rgba(250,108,119,1.00)", + "borderBottomColor": "rgba(255,0,0,1.00)", "color": "rgba(250,108,119,1.00)", } } diff --git a/src/components/common/modal/__tests__/__snapshots__/ErrorIcon.js.snap b/src/components/common/modal/__tests__/__snapshots__/ErrorIcon.js.snap index d263647e14..d4b5a9755a 100644 --- a/src/components/common/modal/__tests__/__snapshots__/ErrorIcon.js.snap +++ b/src/components/common/modal/__tests__/__snapshots__/ErrorIcon.js.snap @@ -23,7 +23,7 @@ exports[`ErrorIcon matches snapshot 1`] = ` } } > -  +  diff --git a/src/components/common/view/__tests__/__snapshots__/AmountInput.js.snap b/src/components/common/view/__tests__/__snapshots__/AmountInput.js.snap index dfc75b0ab7..458cce5439 100644 --- a/src/components/common/view/__tests__/__snapshots__/AmountInput.js.snap +++ b/src/components/common/view/__tests__/__snapshots__/AmountInput.js.snap @@ -234,7 +234,7 @@ exports[`AmountInput matches snapshot 1`] = ` } } > -  +  diff --git a/src/components/common/view/__tests__/__snapshots__/Icon.js.snap b/src/components/common/view/__tests__/__snapshots__/Icon.js.snap index efc86f2980..567d5ac336 100644 --- a/src/components/common/view/__tests__/__snapshots__/Icon.js.snap +++ b/src/components/common/view/__tests__/__snapshots__/Icon.js.snap @@ -14,6 +14,6 @@ exports[`Icon matches snapshot 1`] = ` } } > -  +  `; diff --git a/src/components/common/view/__tests__/__snapshots__/NumPadKeyboard.js.snap b/src/components/common/view/__tests__/__snapshots__/NumPadKeyboard.js.snap index 3fa7bc0a0e..9b4b351ede 100644 --- a/src/components/common/view/__tests__/__snapshots__/NumPadKeyboard.js.snap +++ b/src/components/common/view/__tests__/__snapshots__/NumPadKeyboard.js.snap @@ -198,7 +198,7 @@ exports[`NumPadKeyboard matches snapshot 1`] = ` } } > -  +  diff --git a/src/components/dashboard/Amount.js b/src/components/dashboard/Amount.js index f5ae6f34b9..dde737cc02 100644 --- a/src/components/dashboard/Amount.js +++ b/src/components/dashboard/Amount.js @@ -1,10 +1,13 @@ // @flow import React, { useCallback, useContext, useMemo, useState } from 'react' -import { KeyboardAvoidingView } from 'react-native' +import { KeyboardAvoidingView, Platform, View } from 'react-native' import { t } from '@lingui/macro' import { useGetBridgeData } from '@gooddollar/web3sdk-v2' + +import InputWithAddons from '../common/form/InputWithAddons' + import logger from '../../lib/logger/js-logger' -import { AmountInput, ScanQRButton, Section, Wrapper } from '../common' +import { AmountInput, CustomButton, ScanQRButton, Section, Wrapper } from '../common' import TopBar from '../common/view/TopBar' import { BackButton, NextButton, useScreenState } from '../appNavigation/stackNavigation' import { @@ -14,11 +17,24 @@ import { useSwitchNetwork, useWallet, } from '../../lib/wallet/GoodWalletProvider' + +// hooks +import usePermissions from '../permissions/hooks/usePermissions' +import { Permissions } from '../permissions/types' +import { useClipboardPaste } from '../../lib/hooks/useClipboard' + import { isIOS } from '../../lib/utils/platform' import { withStyles } from '../../lib/styles' import { getDesignRelativeWidth } from '../../lib/utils/sizes' import Config from '../../config/config' -import { ACTION_RECEIVE, navigationOptions } from './utils/sendReceiveFlow' +import { theme } from '../theme/styles' +import { + ACTION_BRIDGE, + ACTION_RECEIVE, + ACTION_SEND, + ACTION_SEND_TO_ADDRESS, + navigationOptions, +} from './utils/sendReceiveFlow' export type AmountProps = { screenProps: any, @@ -45,12 +61,106 @@ const { isDeltaApp } = Config const log = logger.child({ from: 'Amount' }) +const NextPageButton = ({ action, cbContinue, loading, values, ...props }) => { + const routeMap = { + [ACTION_BRIDGE]: ['SendLinkSummary', 'Home'], + [ACTION_RECEIVE]: ['Reason', 'ReceiveSummary', 'TransactionConfirmation'], + isNative: ['SendLinkSummary'], + } + + const nextRoute = routeMap[action] || ['Reason', 'SendLinkSummary', 'TransactionConfirmation'] + + return ( + + ) +} + +export const AddressDetails = ({ address, cb, error, handlePressQR, setAddress, screenProps }) => { + const pasteUri = useClipboardPaste(data => { + setAddress(data) + cb(data) + }) + + // check clipboard permission an show dialog is not allowed + const [, requestClipboardPermissions] = usePermissions(Permissions.Clipboard, { + requestOnMounted: false, + onAllowed: pasteUri, + navigate: screenProps.navigate, + }) + const handlePastePress = useCallback(requestClipboardPermissions) + const icon = error || address === '' ? 'paste2' : 'success' + const adornmentColor = error ? theme.colors.red : address !== '' ? theme.colors.primary : undefined + + return ( + + + + + + + + + + ) +} + const Amount = (props: AmountProps) => { const { screenProps, styles } = props const { push } = screenProps const [screenState, setScreenState] = useScreenState(screenProps) const { params = {} } = props.navigation.state - const { isBridge = false } = params const { amount = 0, ...restState } = screenState || {} const goodWallet = useWallet() const { currentNetwork } = useSwitchNetwork() @@ -59,8 +169,13 @@ const Amount = (props: AmountProps) => { const { native, token, balance } = useContext(TokenContext) const { toDecimals, fromDecimals } = useFormatToken(token) const formatFixed = useFixedDecimals(token) + const isNativeFlow = isDeltaApp && native + const isReceive = params && params.action === ACTION_RECEIVE + const isSend = params && params.action === ACTION_SEND + const isBridge = params && params.action === ACTION_BRIDGE + const bridgeState = isBridge ? { isBridge, @@ -71,10 +186,12 @@ const Amount = (props: AmountProps) => { const [GDAmount, setGDAmount] = useState(() => (amount ? formatFixed(amount) : '')) const [loading, setLoading] = useState(() => !amount) const [error, setError] = useState() + const [addressError, setAddressError] = useState() - const GDAmountInWei = useMemo(() => GDAmount && fromDecimals(GDAmount), [GDAmount]) + const [sendViaAddress, setSendAddress] = useState(false) + const [address, setAddress] = useState('') - const isReceive = params && params.action === ACTION_RECEIVE + const GDAmountInWei = useMemo(() => GDAmount && fromDecimals(GDAmount), [GDAmount]) const handlePressQR = useCallback(() => push('SendByQR'), [push]) @@ -96,10 +213,15 @@ const Amount = (props: AmountProps) => { } } - const canSend = await (isNativeFlow ? goodWallet.canSendNative(weiAmount) : goodWallet.canSend(weiAmount)) + let canSend = await (isNativeFlow ? goodWallet.canSendNative(weiAmount) : goodWallet.canSend(weiAmount)) if (!canSend) { setError(t`Sorry, you don't have enough ${token}s`) + return canSend + } + + if (sendViaAddress || isNativeFlow) { + canSend = handleSendViaAddress(address) } return canSend @@ -110,6 +232,20 @@ const Amount = (props: AmountProps) => { } } + const handleSendViaAddress = input => { + setAddressError() + setAddress(input) + const isEth = /^0x[a-fA-F0-9]{40}$/ + const isEthAddress = isEth.test(input) + if (!isEthAddress) { + setAddressError(t`Sorry, this is not a valid address.`) + return isEthAddress + } + + setScreenState({ action: ACTION_SEND_TO_ADDRESS }) + return isEthAddress + } + const handleContinue = async () => { setLoading(true) @@ -127,6 +263,10 @@ const Amount = (props: AmountProps) => { setError('') } + const handleRequestAddress = () => { + setSendAddress(value => !value) + } + const showScanQR = !isReceive && !params?.counterPartyDisplayName // ot in receive flow and also QR wasnt displayed on Who screen return ( @@ -146,30 +286,73 @@ const Amount = (props: AmountProps) => { unit={token} /> - - - - {t`Cancel`} - - - - + {isSend && ( + + + SEND VIA ADDRESS + + {!sendViaAddress && !isNativeFlow ? ( + + ) : ( + + )} - + )} + + {((isSend && sendViaAddress) || !isSend || isNativeFlow) && ( + + + + {t`Cancel`} + + + + + + + )} diff --git a/src/components/dashboard/Dashboard.js b/src/components/dashboard/Dashboard.js index 684ffc0bb8..bac015c089 100644 --- a/src/components/dashboard/Dashboard.js +++ b/src/components/dashboard/Dashboard.js @@ -805,7 +805,7 @@ const Dashboard = props => { const goToProfile = useOnPress(() => screenProps.push('Profile'), [screenProps]) const goToBridge = useCallback(() => { - screenProps.push('Amount', { isBridge: true }) + screenProps.push('Amount', { action: 'Bridge' }) }, [screenProps]) const dispatchScrollEvent = useDebouncedCallback(() => fireEvent(SCROLL_FEED), 250) diff --git a/src/components/dashboard/FeedItems/__tests__/__snapshots__/SendModalItemWithError.js.snap b/src/components/dashboard/FeedItems/__tests__/__snapshots__/SendModalItemWithError.js.snap index 6f13e189b6..a22e525ed8 100644 --- a/src/components/dashboard/FeedItems/__tests__/__snapshots__/SendModalItemWithError.js.snap +++ b/src/components/dashboard/FeedItems/__tests__/__snapshots__/SendModalItemWithError.js.snap @@ -35,7 +35,7 @@ please try again. } } > -  +  diff --git a/src/components/dashboard/SendLinkSummary.js b/src/components/dashboard/SendLinkSummary.js index e500e292dd..4bca83c727 100644 --- a/src/components/dashboard/SendLinkSummary.js +++ b/src/components/dashboard/SendLinkSummary.js @@ -212,8 +212,8 @@ const SendLinkSummary = ({ screenProps, styles }: AmountProps) => { reason, category, amount, - senderEmail: vendorFields.email, - senderName: vendorFields.name, + senderEmail: vendorFields?.email, + senderName: vendorFields?.name, invoiceId: vendorInfo?.invoiceId, sellerWebsite: vendorInfo?.website, sellerName: vendorInfo?.vendorName, diff --git a/src/components/dashboard/__tests__/__snapshots__/Amount.js.snap b/src/components/dashboard/__tests__/__snapshots__/Amount.js.snap index 3316cd4039..1c481f863d 100644 --- a/src/components/dashboard/__tests__/__snapshots__/Amount.js.snap +++ b/src/components/dashboard/__tests__/__snapshots__/Amount.js.snap @@ -344,7 +344,7 @@ exports[`Amount matches snapshot 1`] = ` } } > -  +  @@ -513,12 +513,16 @@ exports[`Amount matches snapshot 1`] = ` tabIndex="-1" >
+
+ - +
+
+ - +
@@ -1045,11 +1046,12 @@ exports[`Dashboard matches snapshot 1`] = ` className="css-view-1dbjc4n r-alignItems-1awozwy r-flexDirection-18u37iz r-justifyContent-1wtj0ep" >
@@ -1144,11 +1146,12 @@ exports[`Dashboard matches snapshot 1`] = ` } >
@@ -1186,11 +1189,12 @@ exports[`Dashboard matches snapshot 1`] = ` className="css-view-1dbjc4n r-alignItems-1awozwy r-flexDirection-18u37iz r-justifyContent-1wtj0ep" >
@@ -1285,11 +1289,12 @@ exports[`Dashboard matches snapshot 1`] = ` } >
@@ -1327,11 +1332,12 @@ exports[`Dashboard matches snapshot 1`] = ` className="css-view-1dbjc4n r-alignItems-1awozwy r-flexDirection-18u37iz r-justifyContent-1wtj0ep" >
@@ -1517,7 +1523,7 @@ exports[`Dashboard matches snapshot 1`] = ` } } > -  + 
-  + 
diff --git a/src/components/dashboard/utils/sendReceiveFlow.js b/src/components/dashboard/utils/sendReceiveFlow.js index ac6b7e89e9..083b18a841 100644 --- a/src/components/dashboard/utils/sendReceiveFlow.js +++ b/src/components/dashboard/utils/sendReceiveFlow.js @@ -31,6 +31,7 @@ export const navigationOptions = ({ navigation }) => { export const RECEIVE_TITLE = t`Receive` export const SEND_TITLE = t`Send` export const BRIDGE_TITLE = t`Bridge` +export const ACTION_BRIDGE = 'Bridge' export const ACTION_RECEIVE = 'Receive' export const ACTION_SEND = 'Send' export const ACTION_SEND_TO_ADDRESS = 'SendToAddress' diff --git a/src/components/profile/__tests__/__snapshots__/Profile.js.snap b/src/components/profile/__tests__/__snapshots__/Profile.js.snap index bd2ca23475..84a9be1099 100644 --- a/src/components/profile/__tests__/__snapshots__/Profile.js.snap +++ b/src/components/profile/__tests__/__snapshots__/Profile.js.snap @@ -77,7 +77,7 @@ exports[`Profile matches snapshot 1`] = ` } } > -  + 
@@ -212,7 +212,7 @@ exports[`Profile matches snapshot 1`] = ` } } > -  + 
-  + 
diff --git a/src/components/profile/__tests__/__snapshots__/ProfileDataTable.js.snap b/src/components/profile/__tests__/__snapshots__/ProfileDataTable.js.snap index bbe3440200..6393662f3f 100644 --- a/src/components/profile/__tests__/__snapshots__/ProfileDataTable.js.snap +++ b/src/components/profile/__tests__/__snapshots__/ProfileDataTable.js.snap @@ -166,7 +166,7 @@ exports[`ProfileDataTable matches snapshot 1`] = ` } } > -  +  @@ -1895,7 +1895,7 @@ exports[`ProfileDataTable matches snapshot editable 1`] = ` } } > -  +  @@ -3652,7 +3652,7 @@ exports[`ProfileDataTable matches snapshot editable with errors 1`] = ` } } > -  +  diff --git a/src/components/profile/__tests__/__snapshots__/ViewOrUploadAvatar.js.snap b/src/components/profile/__tests__/__snapshots__/ViewOrUploadAvatar.js.snap index aa9605b795..f89ea2c105 100644 --- a/src/components/profile/__tests__/__snapshots__/ViewOrUploadAvatar.js.snap +++ b/src/components/profile/__tests__/__snapshots__/ViewOrUploadAvatar.js.snap @@ -81,7 +81,7 @@ exports[`ViewAvatar matches snapshot 1`] = ` } } > -  +  diff --git a/src/components/sidemenu/__tests__/__snapshots__/SideMenuPanel.js.snap b/src/components/sidemenu/__tests__/__snapshots__/SideMenuPanel.js.snap index c70e9362a6..445d9e0e1b 100644 --- a/src/components/sidemenu/__tests__/__snapshots__/SideMenuPanel.js.snap +++ b/src/components/sidemenu/__tests__/__snapshots__/SideMenuPanel.js.snap @@ -42,7 +42,7 @@ exports[`SideMenuPanel matches snapshot 1`] = ` } } > -  + 
-  + 
-  + 
-  + 
-  + 
diff --git a/src/components/signin/__tests__/__snapshots__/SigninInfo.js.snap b/src/components/signin/__tests__/__snapshots__/SigninInfo.js.snap index c292f99a7b..c210f80efd 100644 --- a/src/components/signin/__tests__/__snapshots__/SigninInfo.js.snap +++ b/src/components/signin/__tests__/__snapshots__/SigninInfo.js.snap @@ -77,7 +77,7 @@ exports[`SigninInfo matches snapshot 1`] = ` } } > -  +  diff --git a/src/components/signup/__tests__/__snapshots__/EmailForm.js.snap b/src/components/signup/__tests__/__snapshots__/EmailForm.js.snap index 9a98319dc7..ec82481097 100644 --- a/src/components/signup/__tests__/__snapshots__/EmailForm.js.snap +++ b/src/components/signup/__tests__/__snapshots__/EmailForm.js.snap @@ -153,7 +153,7 @@ exports[`EmailForm matches snapshot 1`] = ` } } > -  + 