From edd14554a32f711ca81e4955d4abca8e4c0373ea Mon Sep 17 00:00:00 2001 From: Robert Daly Date: Wed, 25 Jan 2023 21:32:05 -0500 Subject: [PATCH] Squashed commit of the following: commit e54c4b874e57e6a4e5e033712e6a6be7095685c6 Author: Robert Daly Date: Wed Jan 25 21:31:13 2023 -0500 fixing lint errors commit 445c9f74a45a2044477808411ed00f9cc058debe Merge: b355edc80a a9f1892c76 Author: Robert Daly Date: Tue Jan 24 22:16:06 2023 -0500 Merge remote-tracking branch 'upstream/main' into arrow-feature-signed commit b355edc80aaa63e1b8bff42f24d1978811aea466 Author: Robert Daly Date: Tue Jan 24 22:03:59 2023 -0500 Squashed commit of the following: commit 811dd588e74ef1add3e6cfa2a2300a5e36b557a2 Merge: 6f70a7d554 f133eb4b53 Author: Chris Kosuke Tseng Date: Tue Jan 24 15:19:32 2023 -0800 Merge pull request #14507 from s77rt/hoverable-onblur Fixed regression on Hoverable blur event commit 6f70a7d554761fec11bac51cc3d6698b4f68cbcf Merge: 4ddb47e1dd 3392ff1026 Author: Aldo Canepa Garay <87341702+aldo-expensify@users.noreply.github.com> Date: Tue Jan 24 13:56:15 2023 -0800 Merge pull request #14409 from margelo/fix/scroll-to-picker-regression Fix: Scroll to picker regression commit 4ddb47e1dd1e14e065b7947ebb89118f7fbcd77f Merge: c2ff5f8d3c 93199c41a5 Author: Vit Horacek <36083550+mountiny@users.noreply.github.com> Date: Tue Jan 24 18:47:32 2023 +0000 Merge pull request #14343 from Expensify/vit-updateArchiveMessageForAdmin Add closed report action optimistically when workspace is closed commit c2ff5f8d3c87b5493597a2b03a5637c7cdb41fb1 Merge: 25b47dadef 73d23d8240 Author: Ionatan Wiznia Date: Tue Jan 24 19:41:45 2023 +0100 Merge pull request #14440 from Expensify/ionatan_fixcurrencysearch Fix currency search commit 25b47dadefb53a1863d2802f51105e20fede0654 Merge: 614da9552e 378dffcb94 Author: Jack Nam <30609178+thienlnam@users.noreply.github.com> Date: Tue Jan 24 10:35:53 2023 -0800 Merge pull request #14483 from abdulrahuman5196/add-payment-delay commit 614da9552ece2b7b8c2541906ef6b65de68d560d Merge: 4d86f17486 559df8b3fe Author: Yuwen Memon Date: Tue Jan 24 10:21:33 2023 -0800 Merge pull request #14400 from Ollyws/issue-14355 Fix for: App crashes when splitting a bill offline commit 4d86f174866f5c28ad6fce5beaa06e834760c0dd Merge: a10949decb bb3a7d1c61 Author: Cristi Paval Date: Tue Jan 24 18:33:28 2023 +0200 Merge pull request #14255 from Expensify/dangrous-embiggenavatars Make avatars in chat welcome messages always big commit 73d23d8240c8db4b51809b52bfbd6503c9261f6a Author: Ionatan Wiznia Date: Tue Jan 24 16:21:32 2023 +0100 Update src/pages/iou/IOUCurrencySelection.js Co-authored-by: Eugene Voloshchak commit a10949decb7fd1822a902eb24dfda2f204172894 Merge: 49ded4fea0 b545c9386e Author: Andre Fonseca Date: Tue Jan 24 12:21:49 2023 +0000 Merge pull request #14347 from Expensify/cmartins-fixMembersPage Fix Invite member checkbox selection behavior commit 49ded4fea0daf4f4843f59cf4e8ac102fb0517c5 Merge: 553916c715 373335f1a1 Author: OSBotify <76178356+OSBotify@users.noreply.github.com> Date: Tue Jan 24 05:53:50 2023 -0500 Merge pull request #14509 from Expensify/version-BUILD-1E53A036-DC71-4A10-A537-7FE462383690 Update version to 1.2.58-4 on main commit 373335f1a1fa6753153cb58beb6779bbac434644 Author: OSBotify Date: Tue Jan 24 10:53:22 2023 +0000 Update version to 1.2.58-4 commit 553916c715ce2f0bf5c549333212702f2539f5e0 Merge: ae66a7f019 82b52f1f60 Author: Maria D'Costa Date: Tue Jan 24 14:48:06 2023 +0400 Merge pull request #14508 from Expensify/nat-missingimport Fix missing import preventing opening Plaid modal commit 82b52f1f60db49b9082b803baa55e42a446d215c Author: Nathalie Kuoch Date: Tue Jan 24 10:58:00 2023 +0100 Fix missing import preventing opening Plaid modal commit 3392ff10265516b98655549a77dfa810cc8a0871 Merge: 63ff50a327 ae66a7f019 Author: Christoph Pader Date: Tue Jan 24 10:25:22 2023 +0100 Merge branch 'main' into fix/scroll-to-picker-regression commit 63ff50a32721a1d46eab5b5b8b623982a2e41c97 Author: Christoph Pader Date: Tue Jan 24 10:23:52 2023 +0100 fix: passed invalid ref to measureLayout commit c37e2796a2f79d2b31393796885aa9f3f043d15a Author: Christoph Pader Date: Tue Jan 24 10:12:20 2023 +0100 Update src/components/Form.js Co-authored-by: Sahil commit f133eb4b536cd0fc8d7476720ae3cb3785ba6beb Author: Abdelhafidh Belalia <16493223+s77rt@users.noreply.github.com> Date: Tue Jan 24 09:42:06 2023 +0100 Fixed regression on Hoverable blur event commit 6370512b7566571d8ad6f6c55d89a7055c42575c Author: Ionatan Wiznia Date: Mon Jan 23 18:03:35 2023 -0300 Use helper method commit 378dffcb943e2274961d07002a38b583668196ce Author: Abdul Rahuman Date: Tue Jan 24 02:15:46 2023 +0530 Adding UI filter to exclude delete pending items to be sent to FlatList when online Reference: https://github.com/Expensify/App/issues/14262 commit bf7f0da5abb2d19316b71614ec4672ac77d995c9 Author: Christoph Pader Date: Mon Jan 23 14:47:03 2023 +0100 update comment commit a0e957415cc9509da0991d097e39b9e93434a7db Author: Christoph Pader Date: Mon Jan 23 14:46:28 2023 +0100 fix: add scrollContextEnabled to missing screens commit 8c479d234383cb7e8ea3dcb500262d5f9f7cfb56 Author: Christoph Pader Date: Mon Jan 23 14:38:12 2023 +0100 Update contributingGuides/FORMS.md Co-authored-by: Carlos Martins commit b08dc2bcc4752dce9e8663dc7a7eb3ad6d51ad77 Author: Christoph Pader Date: Mon Jan 23 14:38:01 2023 +0100 Update src/components/Form.js Co-authored-by: Carlos Martins commit 7d59c4b14cfeec697efacfcd0dbc0072c290c785 Author: Christoph Pader Date: Mon Jan 23 14:37:45 2023 +0100 Update src/components/Form.js Co-authored-by: Carlos Martins commit 165af16adeb50a2f54639711d31b017f6a172d27 Merge: 27f5fea1c3 fd5e781707 Author: Christoph Pader Date: Mon Jan 23 14:33:37 2023 +0100 Merge branch 'main' into fix/scroll-to-picker-regression commit 93199c41a543a867d6ab54aadbd8cf61ff9e1451 Author: Vit Horacek Date: Fri Jan 20 22:59:15 2023 +0000 Update JSDoc of the build closed report action method commit 3574093c46e12e9da2ed1119369e165a471ab319 Author: Vit Horacek Date: Fri Jan 20 22:57:50 2023 +0000 Fix style commit f1ff02db7bdc239c0b7da84d2c0f59f97b20b79c Author: Vit Horacek Date: Fri Jan 20 22:57:18 2023 +0000 Fix the import commit a0bc6049db1f7162781c1d126c93c7222a181723 Author: Vit Horacek Date: Fri Jan 20 22:50:24 2023 +0000 Default to empty object in case report actions are missing commit bb3a7d1c61d8fa85b74eb463988d06360cc23c11 Author: Daniel Gale-Rosen Date: Fri Jan 20 16:52:06 2023 -0500 update overlay commit 54f17068ccda54a91014e5dff72ee077e186cd8b Merge: 742e4e7ba1 17edc8253c Author: Vit Horacek Date: Fri Jan 20 20:13:10 2023 +0000 Merge branch 'main' into vit-updateArchiveMessageForAdmin commit 90dcb3f0334c90618a4c3ef423ed0487fcfe67e8 Author: Ionatan Wiznia Date: Fri Jan 20 14:06:01 2023 -0300 Fix currency search commit 27f5fea1c3562a8cd30b9a2b5ecf4373f39e0140 Author: Christoph Pader Date: Fri Jan 20 11:11:28 2023 +0100 fix: add picker scroll functionality to (currently) unused screens commit 8cba0344764826a0042cab37464b78063bdc5257 Author: Christoph Pader Date: Fri Jan 20 11:07:34 2023 +0100 fix: add picker scroll functionality to AdditionalDetailsStep commit b7ff191bc5eed8a81208a86d18f7597469b6c9f4 Author: Christoph Pader Date: Fri Jan 20 10:57:46 2023 +0100 add picker scroll functionality to CompanyStep commit 3505fd92a064e0b9992da03c6cab590cf7ceba98 Author: Christoph Pader Date: Fri Jan 20 10:25:24 2023 +0100 doc: add docs on how to handle pickers in forms commit 8edc865a38183e0d9d8fa84cc13e8a97e6738250 Author: Christoph Pader Date: Fri Jan 20 10:06:48 2023 +0100 fix: add explanation for two Form props commit 8172dce64ce4891c3bae3eec491a93eb3055766e Merge: 7ba22bdc25 5aabd37b4f Author: Christoph Pader Date: Fri Jan 20 10:03:09 2023 +0100 Merge branch 'main' into fix/scroll-to-picker-regression commit 7ba22bdc256ad16f517102d8a12db7137c7a150a Merge: 65d5e9cc79 b197f265c6 Author: Christoph Pader Date: Thu Jan 19 16:48:27 2023 +0100 Merge branch 'main' into fix/scroll-to-picker-regression commit 65d5e9cc7952f1ac3b649d25a48a076d0c817566 Author: Christoph Pader Date: Thu Jan 19 13:02:18 2023 +0100 fix: usage of new ref in Form commit fe8d4cd403be716d54a4b86f8dcba2a792da06fc Author: Christoph Pader Date: Thu Jan 19 13:00:34 2023 +0100 fix: remove random string in Form commit 1cbeaa7604c6f570c79c7576b6cbe6c54b670f8b Author: Christoph Pader Date: Thu Jan 19 12:59:42 2023 +0100 Use scrollContext and overflow on AddDebitCardPage commit 384eedba5b6e551f5fb708996d458cd58a1977a7 Author: Christoph Pader Date: Thu Jan 19 12:58:51 2023 +0100 fix: use scrollToOverflowEnabled prop from passed down props commit 71a415aaf7b475eba0a31665cec61c3da5bd048e Author: Christoph Pader Date: Thu Jan 19 12:58:23 2023 +0100 feat: Introduce scrollContextEnabled and scrollToOverflowEnabled props on Form component commit c4e8ea8b02f7babc3a706d6f2f50c84824280a2c Author: Christoph Pader Date: Thu Jan 19 12:02:07 2023 +0100 fix: add missing forwardRef to ScrollViewWithContext commit 559df8b3fe23d5a0a2812d2e171acb543976336a Author: Oliver Wilks Date: Wed Jan 18 21:36:36 2023 +0000 Changed getIOUReportActions filter order commit b545c9386e5f9c320f1027789cdbedb72732ef74 Author: Carlos Martins Date: Tue Jan 17 17:00:26 2023 -0700 validate if preferred locale changes commit e9f4cd3f3232db549f0934d3d751a6fcc30778df Author: Carlos Martins Date: Tue Jan 17 16:54:01 2023 -0700 fix toggleAllusers logic commit 6ec1826da556bec4d02b5e61131cad8fd8205e9a Author: Carlos Martins Date: Tue Jan 17 16:38:05 2023 -0700 fix logic for select all commit b85e275de98b0e56dc4ba6001093230247f52d13 Author: Carlos Martins Date: Tue Jan 17 16:28:16 2023 -0700 keep select all checked if admin is selected commit 96afdf0941d4619dcc39cf7b9a0646698119a059 Author: Carlos Martins Date: Tue Jan 17 16:21:52 2023 -0700 display error message commit 6d0ef22f4b1fb9726d2c11e65d45d5680913bca6 Author: Carlos Martins Date: Tue Jan 17 16:07:02 2023 -0700 add early return for delete modal commit 52dd36fdf58543958d775cc7d2340da044ff22e0 Author: Carlos Martins Date: Tue Jan 17 16:00:07 2023 -0700 early return if errors are not empty commit 8cd37dbd1cc76a61abf61e3676b9e3838f240c2a Author: Carlos Martins Date: Tue Jan 17 15:58:16 2023 -0700 revert changes to select all checkbox commit 2237a6bc8189e8f768d2eff477dabc7bbb341f36 Author: Carlos Martins Date: Tue Jan 17 15:35:06 2023 -0700 rm setWorkspaceMemberErrors commit a3a73371656038cc8b7d0180f4e9d0b7d0bfec2b Author: Carlos Martins Date: Tue Jan 17 15:32:40 2023 -0700 fix setWorkspaceMemberErrors commit 689a4bc268bc69cbad758d36b30d461dd3da1189 Author: Carlos Martins Date: Tue Jan 17 15:05:57 2023 -0700 create setWorkspaceMemberErrors commit d31d4be0ea022970354cf2a94f43f47e25324d2d Author: Carlos Martins Date: Tue Jan 17 14:47:26 2023 -0700 rm comment and create validate commit b6d28d3ec914915ff057ac9908e59808c4e60f93 Author: Carlos Martins Date: Tue Jan 17 14:45:21 2023 -0700 rm filter in submit function commit e2a92560eacec717a1af228d3921acb84a9640f9 Author: Carlos Martins Date: Tue Jan 17 14:42:50 2023 -0700 fix select all logic commit 5be2153c25effef2966fcbd218c1df7166480661 Author: Carlos Martins Date: Tue Jan 17 14:38:52 2023 -0700 clean up removableMembers commit dcf6a1ddc363df4e0ddbd9188aa119fe6f3610f9 Author: Carlos Martins Date: Tue Jan 17 14:31:30 2023 -0700 clean up CheckboxWithTooltip commit 509be3f1e71e6ef653c0a07fed52967f13a3a3b9 Merge: be59dc3ec1 3636f1fb32 Author: Carlos Martins Date: Tue Jan 17 11:32:16 2023 -0700 Merge branch 'main' into cmartins-fixMembersPage commit be59dc3ec1b9b74f3ef43c9d621a82a116e99f9d Author: Carlos Martins Date: Mon Jan 16 17:23:03 2023 -0700 rm showTooltipForLogin state commit d177feb339207613d5bee3194dac33fcd722d1dd Author: Carlos Martins Date: Mon Jan 16 17:20:14 2023 -0700 rm willTooltipShowForLogin commit 0f7f6855193225af163e91793674a428e1157198 Author: Carlos Martins Date: Mon Jan 16 17:15:53 2023 -0700 rm canBeRemoved var commit 742e4e7ba1b85df06d6aff463fea0d436bffca66 Author: Vit Horacek Date: Tue Jan 17 00:36:09 2023 +0100 Clean up commit a84aab4322c6d6d0bd3e333e96b0f47b94a340e0 Author: Vit Horacek Date: Tue Jan 17 00:33:54 2023 +0100 Add a comment commit 55cbf0f6d21e4502e1d54bcb623a372af210bb6a Author: Vit Horacek Date: Mon Jan 16 22:23:54 2023 +0100 Build method to create closed optimistic actions commit 868fff627dbf8f5aa3a25943eddcc38410905b22 Author: Daniel Gale-Rosen Date: Fri Jan 13 17:36:47 2023 -0500 remove another shouldShowLargeAvatars commit 19c960247b4e749a646971491ad1f0bc755e55c3 Author: Daniel Gale-Rosen Date: Fri Jan 13 17:33:58 2023 -0500 remove unused variable commit e1e86b36ef442d77a63d81a7e5b9683ac1ae7e1a Author: Daniel Gale-Rosen Date: Fri Jan 13 17:32:01 2023 -0500 center number on mobile commit 84073680b3a29aa03f2d76bceee8d302914983b3 Author: Daniel Gale-Rosen Date: Fri Jan 13 17:05:58 2023 -0500 center number commit 4aee6b7b43cbbcf1b7efb04417c743c8255765bc Author: Daniel Gale-Rosen Date: Fri Jan 13 16:43:33 2023 -0500 remove shouldShowLargeAvatars commit 679476f71fcc4d5db1b3c38c555ed5821d62e965 Author: Daniel Gale-Rosen Date: Fri Jan 13 16:36:20 2023 -0500 remove console logs and add constant commit 0167179c487dea975c23251063d140094e8f4cce Author: Daniel Gale-Rosen Date: Thu Jan 12 17:39:39 2023 -0500 initial updates for new shared size avatars commit 8992e463e7845b418f8a0dba0642d939c448a046 Merge: 7a10eff4fb ae66a7f019 Author: Robert Daly Date: Mon Jan 23 17:55:31 2023 -0500 Merge branch 'Expensify:main' into arrow-feature-signed commit 7a10eff4fb8729f200e1c95150d1d89da97260da Merge: c2fb8f8555 e43bab50d8 Author: Robert Daly Date: Sun Jan 22 20:22:03 2023 -0500 Merge branch 'Expensify:main' into arrow-feature-signed commit c2fb8f8555312f11612c8952881cfa8435e97a15 Author: Robert Daly Date: Thu Jan 19 18:29:28 2023 -0500 fixed some minor issues commit 246073aced161c8bbaf66d88c5d27de2c65ed394 Author: Robert Daly Date: Thu Jan 19 18:10:34 2023 -0500 Update src/components/AttachmentCarousel/CarouselActions/index.native.js Co-authored-by: Santhoshkumar Sellavel <85645967+Santhosh-Sellavel@users.noreply.github.com> commit a8daa2be0fc2e099f1742fb250bef92b2e005717 Author: Robert Daly Date: Tue Jan 17 23:31:40 2023 -0500 minor fixes commit 9efe36105ebfb79d109a3feae7b10e6056d5132b Merge: 5684e41bf6 e62a79fa6d Author: Robert Daly Date: Tue Jan 17 23:27:36 2023 -0500 Merge branch 'main' into arrow-feature-signed commit 5684e41bf67aa7eea658dc3990f854d89b89bdb8 Merge: c97a7dcf62 8662d3d4bc Author: Robert Daly Date: Mon Jan 16 14:46:23 2023 -0500 Merge branch 'Expensify:main' into arrow-feature-signed commit c97a7dcf62dfc42b7c54a2e8808cd354331ffcd5 Author: Robert Daly Date: Mon Jan 16 14:45:07 2023 -0500 minor updates for comments commit 50143fb456336fd527b74417639c29e961bab78a Author: Robert Daly Date: Mon Jan 16 14:37:49 2023 -0500 Update src/components/AttachmentCarousel/index.js Co-authored-by: Carlos Martins commit aef4993404279ffceed875c8a7fcf2210a02a87d Author: Robert Daly Date: Mon Jan 16 14:37:14 2023 -0500 Update src/components/AttachmentCarousel/index.js Co-authored-by: Carlos Martins commit cb4ed59b4ab3a0caff39be57f9beb3995030b14f Author: Robert Daly Date: Mon Jan 16 00:04:40 2023 -0500 removed line commit 1ce9be679872ed845e646b025eead098c0c7bdba Author: Robert Daly Date: Sun Jan 15 23:59:55 2023 -0500 added comments, fixed linting commit e7ad0d374be73b8e7d821ac52ac20d4626de7de2 Author: Robert Daly Date: Sun Jan 15 23:40:27 2023 -0500 Update src/components/AttachmentCarousel/index.js Co-authored-by: Santhoshkumar Sellavel <85645967+Santhosh-Sellavel@users.noreply.github.com> commit 31e389b127fa97133870496d1dcf970a1bcd58d2 Author: Robert Daly Date: Sun Jan 15 23:39:54 2023 -0500 Update src/components/AttachmentCarousel/CarouselActions/index.native.js Co-authored-by: Santhoshkumar Sellavel <85645967+Santhosh-Sellavel@users.noreply.github.com> commit 77eb354001c15171a8427eb57eda722edd9de50d Merge: d286d16bca 7ca2979f55 Author: Robert Daly Date: Sat Jan 14 21:52:11 2023 -0500 Merge branch 'Expensify:main' into arrow-feature-signed commit d286d16bca36a3235976134276b6fa9597f8ef24 Author: Robert Daly Date: Sat Jan 14 21:48:18 2023 -0500 fixed issue with highlight commit 27c4f08de7b8734e8083c00bea55d87d98c70a1d Author: Robert Daly Date: Sat Jan 14 21:29:34 2023 -0500 Update src/components/AttachmentCarousel/index.js Co-authored-by: Carlos Martins commit f1e31af1d8b9e643d02d98c235a8ce31592d8aab Author: Robert Daly Date: Sat Jan 14 21:27:01 2023 -0500 Update src/components/AttachmentCarousel/index.js Co-authored-by: Carlos Martins commit 1c3c3f7409cf17b2063befa6deb66b4bb7e54785 Merge: bc8fc1a0fd 5a09253d1d Author: Robert Daly Date: Tue Jan 10 22:23:23 2023 -0500 Merge branch 'Expensify:main' into arrow-feature-signed commit bc8fc1a0fd66809c776b81458748ba989c921ca6 Author: Robert Daly Date: Tue Jan 10 22:22:21 2023 -0500 fixed up some code per comments, added debounce to image size commit 17fe0fcd8c0cf6b1afbf307144037160749b330e Merge: 2f73a45ed3 a53b274c70 Author: Robert Daly Date: Sun Jan 8 14:43:06 2023 -0500 Merge branch 'Expensify:main' into arrow-feature-signed commit 2f73a45ed35dd101918ced7c0239873dc330ee46 Author: Robert Daly Date: Sun Jan 8 13:49:02 2023 -0500 Update src/components/AttachmentCarousel/index.js Co-authored-by: Carlos Martins commit 2199eae81c4aca6eec1d5d5eea7d9f8549094cca Author: Robert Daly Date: Sun Jan 8 13:44:22 2023 -0500 Update src/components/AttachmentCarousel/CarouselActions/index.js Co-authored-by: Carlos Martins commit 65b694a42c712e71a60c2069b7db8f94e62fe408 Merge: ba8c0e9fe6 64b97170a8 Author: Robert Daly Date: Wed Jan 4 21:45:08 2023 -0500 Merge branch 'Expensify:main' into arrow-feature-signed commit ba8c0e9fe6944d50d5ca324b2c9fd74e8f4ccad5 Author: Robert Daly Date: Wed Jan 4 21:44:49 2023 -0500 changed prop type commit d9d1889104a52398b8410a91b2cedbcbadc61f61 Merge: d2d4e76eb0 5af5d3051b Author: Robert Daly Date: Tue Jan 3 20:58:04 2023 -0500 Merge branch 'main' into arrow-feature-signed commit d2d4e76eb03acfa25bd4055eb448f84b905c2d31 Author: Robert Daly Date: Thu Dec 29 19:28:27 2022 -0500 used replace for config env commit c0f4c12e3494585de782af5fd6a20f109ed57a63 Author: Robert Daly Date: Thu Dec 29 19:07:14 2022 -0500 Revert "added replace for ngrok url" This reverts commit 7b7a5a0a9f990a89b830751a6d4062f5f2038c37. commit 2180ca4d65f5d270359c033af4f8a9e7a16c29d2 Merge: 3738f1f706 0bde3f839a Author: Robert Daly Date: Thu Dec 29 19:05:58 2022 -0500 Merge branch 'Expensify:main' into arrow-feature-signed commit 3738f1f70693b3f46125d4366c202fdea4e33983 Merge: 7b7a5a0a9f 276f177f70 Author: Robert Daly Date: Mon Dec 26 19:38:09 2022 -0500 Merge branch 'Expensify:main' into arrow-feature-signed commit 7b7a5a0a9f990a89b830751a6d4062f5f2038c37 Author: Robert Daly Date: Mon Dec 26 15:28:37 2022 -0500 added replace for ngrok url commit 95069f2be6641428acb76156a509cdacfbf448ea Merge: c257f2c579 89e3eef3ff Author: Robert Daly Date: Wed Dec 21 18:46:21 2022 -0500 Merge branch 'main' into arrow-feature-signed commit c257f2c579e4d8ab4309082e5ccd785e0100a8e8 Merge: bfa027dfa8 5265b5b372 Author: Robert Daly Date: Tue Dec 20 22:41:33 2022 -0500 Merge branch 'Expensify:main' into arrow-feature-signed commit bfa027dfa8cfd9e4bb00d28b4e2dd8b427bfbbf3 Merge: 3465da8dd3 9a52f0237b Author: Robert Daly Date: Mon Dec 19 18:32:54 2022 -0500 Merge branch 'Expensify:main' into arrow-feature-signed commit 3465da8dd331c120311609f4fb5988141fb6e490 Merge: aab283fb8d 3620bf2fbe Author: Robert Daly Date: Thu Dec 15 18:32:12 2022 -0500 Merge branch 'Expensify:main' into arrow-feature-signed commit aab283fb8d6dcbb57f330875ea60fe2d971683da Author: Robert Daly Date: Thu Dec 15 18:30:06 2022 -0500 updating var names to explain their use better commit 3965cff98ad9f3bb4ebe0db729b6d816dc55f681 Author: Robert Daly Date: Wed Dec 14 18:26:41 2022 -0500 set dimension undefined to trigger spinner when fetching dimensions commit 9948fca6e3b6067364485195c43c733d5961bf64 Merge: 428aaabdfd 1a03ee3cd5 Author: Robert Daly Date: Wed Dec 14 17:01:52 2022 -0500 Merge branch 'Expensify:main' into arrow-feature-signed commit 428aaabdfd41b9f7ee37980a47f12c64b4688a41 Merge: 704753ad5e 11cf564282 Author: Robert Daly Date: Tue Dec 13 19:05:45 2022 -0500 Merge branch 'Expensify:main' into arrow-feature-signed commit 704753ad5ea4a2fe73fb2cfa363672c56281dbec Author: Robert Daly Date: Mon Dec 12 20:41:44 2022 -0500 Update src/components/PDFView/pdfViewPropTypes.js Co-authored-by: Carlos Martins commit e042066908456f37753c414764471a7568972436 Author: Robert Daly Date: Mon Dec 12 20:41:24 2022 -0500 Update src/components/ImageView/index.js Co-authored-by: Carlos Martins commit f148909a7bd3aec05f8e84d6d15c684c80f4ec7b Author: Robert Daly Date: Mon Dec 12 20:40:08 2022 -0500 Update src/components/AttachmentCarousel/index.js Co-authored-by: Carlos Martins commit 47ed2db202ec8b0c6037d05e79b173159d550fa8 Author: Robert Daly Date: Mon Dec 12 20:39:08 2022 -0500 Update src/components/AttachmentCarousel/index.js Co-authored-by: Carlos Martins commit 938addacf48669bc29394f50407bee753fd22c7b Author: Robert Daly Date: Mon Dec 12 20:37:14 2022 -0500 Update src/components/ImageView/index.native.js Co-authored-by: Carlos Martins commit e46566d70a567f0a0bde11739d6b9b0cfdbffc84 Author: Robert Daly Date: Sun Dec 11 18:00:15 2022 -0500 updating attachment download url commit f1dfd4c08f0a6a3bbd2f03cb0f688fbf52723eee Merge: 2e56ef80de 10dd188fea Author: Robert Daly Date: Sun Dec 11 16:54:35 2022 -0500 Merge branch 'main' into arrow-feature-signed commit 2e56ef80de41b1181a1358d8229b36d0b1d30d37 Author: Robert Daly Date: Wed Dec 7 22:28:11 2022 -0500 fixed sliding, set buttons to circles commit 4dd29c65220f990df639168917d10e3f6f5fe731 Merge: a895d00fbd 5501ff5c42 Author: Robert Daly Date: Wed Dec 7 20:27:44 2022 -0500 Merge branch 'main' into arrow-feature-signed commit a895d00fbd7b872e417d299a8e5286fa6625ab14 Author: Robert Daly Date: Tue Dec 6 19:32:14 2022 -0500 cleaned up some of the code in reduce commit cdd60bc0124644b4e8b8aafcb4fcfa5b713274c9 Author: Robert Daly Date: Tue Dec 6 19:25:35 2022 -0500 added comment to reducer commit c6e5b53c6b3e18466a84b2e83efc726717d60107 Author: Robert Daly Date: Tue Dec 6 19:15:55 2022 -0500 added comment, use full url commit 2226040e70fb9a18ce218712c7493b966bf1c0ff Author: Robert Daly Date: Tue Dec 6 17:25:55 2022 -0500 moved auth token method into render to prevent undefined page commit 337dbf26e157bd44b4fab0ec0a3b2734054d94d1 Author: Robert Daly Date: Tue Dec 6 16:27:20 2022 -0500 fixed keyboard inputs commit 8d05018336f95d1e3a2a7c92c56dc6eb05779a7c Merge: 70c9ac3f3d 5869c66fcb Author: Robert Daly Date: Tue Dec 6 16:12:33 2022 -0500 Merge branch 'Expensify:main' into arrow-feature-signed commit 70c9ac3f3d8b45c50058e26e5fe62f348f2d06dc Author: Robert Daly Date: Sun Dec 4 18:49:03 2022 -0500 fixed error with sorting values, fixing styles commit 480e550e405a7469081f31db6e8062095cff96c3 Merge: f738465fb7 01e7a70a6a Author: Robert Daly Date: Sun Dec 4 18:16:56 2022 -0500 Merge branch 'main' into arrow-feature-signed commit f738465fb7d344af23835fc7ca3d99c2cdf71512 Author: Robert Daly Date: Sat Nov 19 18:36:53 2022 -0500 cleaned up report actions, fixed issue with pagination commit 7abd76e78376e37771af2dedcdec9a96d89a07df Author: Robert Daly Date: Sat Nov 19 17:29:49 2022 -0500 updating comment, added required to props commit 3dd0e191bb39fe7b7f3c835bfe3fa074e86bd239 Merge: a873db7b8c cd83501733 Author: Robert Daly Date: Sat Nov 19 16:53:21 2022 -0500 Merge branch 'Expensify:main' into arrow-feature-signed commit a873db7b8cde8651f7c62bfb139993f06348e6f0 Merge: 6f02e04135 e09d22847b Author: Robert Daly Date: Mon Nov 14 08:04:46 2022 -0500 Merge branch 'Expensify:main' into arrow-feature-signed commit 6f02e04135f9cfbf6404aee248baf47c00ae7ff9 Merge: 5f49543480 0de35b977e Author: Robert Daly Date: Mon Nov 14 08:03:31 2022 -0500 Merge branch 'main' into arrow-feature-signed commit 5f49543480f4964bb2abb5c686443a704bc75295 Author: Robert Daly Date: Mon Nov 7 23:19:02 2022 -0500 removed console, removed string replace commit 2911b432eede3428564ebd570724c4bd384262d4 Author: Robert Daly Date: Mon Nov 7 22:13:24 2022 -0500 adding functionality to load more attachments as needed commit a083df25f66afa689221dca4ee2beb6d3e6136ad Merge: a7200ba8ce 91acada3b6 Author: Robert Daly Date: Mon Nov 7 20:49:00 2022 -0500 Merge branch 'Expensify:main' into arrow-feature-signed commit a7200ba8cecdd0b1405d393179a5298aa398e606 Merge: 05e862331a 63ccac8a5d Author: Robert Daly Date: Wed Nov 2 20:36:50 2022 -0400 Merge branch 'Expensify:main' into arrow-feature-signed commit 05e862331a518801ec2f156bf4e713a7644c7236 Merge: fad847fa3c 03d7e8f3fa Author: Robert Daly Date: Wed Oct 26 18:52:43 2022 -0400 Merge branch 'main' into arrow-feature-signed commit fad847fa3c41e9bd32d44adea2bd551285e076ae Author: Robert Daly Date: Wed Oct 26 18:38:42 2022 -0400 moved and renamed some files commit 7a7ae204f4b03ced5ba43bf1835508642105d5a0 Merge: f6e6b430ab 70efb00eeb Author: Robert Daly Date: Sat Oct 22 23:15:00 2022 -0400 Merge branch 'Expensify:main' into arrow-feature-signed commit f6e6b430aba6dc7f2f37ee2084e7e27e152f84a0 Author: Robert Daly Date: Sat Oct 22 23:14:10 2022 -0400 removed fix for something that was fixed elsewhere commit 962c5891142a73a78e17d9d77e5f4b0b2ff7d9ff Author: Robert Daly Date: Fri Oct 21 17:44:12 2022 -0400 fixes for comments commit 8bbf5a7487cd761115b5ed22ffe79071ff1f27eb Merge: 6b9accf34d b2acb8f48e Author: Robert Daly Date: Fri Oct 21 10:47:07 2022 -0400 Merge branch 'main' into arrow-feature-signed commit 6b9accf34d9edb4709b6145c38691d4b3663af66 Author: Robert Daly Date: Thu Oct 20 20:57:08 2022 -0400 fixed up some mobile issues from the move commit 799cf6cb5835cb84009341cc9c863a2acbbf0193 Merge: 0cd79cc4a0 fbf0334713 Author: Robert Daly Date: Wed Oct 19 20:09:57 2022 -0400 Merge branch 'Expensify:main' into arrow-feature-signed commit 0cd79cc4a02670a294c1aaf85affc8b4f511017b Author: Robert Daly Date: Tue Oct 18 21:26:07 2022 -0400 reverted back the swipeableview, move events with web-based carousel commit 5b303d044d9598efb780ecc3af3553f8fc569ceb Merge: 4c76f2e200 555a6794cc Author: Robert Daly Date: Tue Oct 18 20:09:35 2022 -0400 Merge branch 'main' into arrow-feature-signed commit 4c76f2e200312006424ad82a9eee493e47c489b1 Merge: 16531eb9c1 b2995036b8 Author: Robert Daly Date: Thu Sep 29 21:32:03 2022 -0400 Merge branch 'Expensify:main' into arrow-feature-signed commit 16531eb9c1ea39ee115f59a4b467bc4d4ae7a0e1 Merge: e327533d2d b75faf0f6f Author: Robert Daly Date: Sun Sep 25 09:02:49 2022 -0400 Merge branch 'Expensify:main' into arrow-feature-signed commit e327533d2dc4a84fdfbd3868eb4727281095e4ef Merge: f1e3411c84 09ff150d12 Author: Robert Daly Date: Wed Sep 21 18:31:08 2022 -0400 Merge branch 'main' into arrow-feature-signed commit f1e3411c8405f9eddfa9e3da710d7eef4baabec3 Merge: 468cba3e97 0302ce7096 Author: Robert Daly Date: Mon Sep 19 07:53:10 2022 -0400 Merge branch 'Expensify:main' into arrow-feature-signed commit 468cba3e978c60624f67d7d48091192407fbd0d5 Merge: 594ff07ec1 ca08fb0f88 Author: Robert Daly Date: Tue Sep 13 09:55:56 2022 -0400 Merge branch 'Expensify:main' into arrow-feature-signed commit 594ff07ec1903767e12917cc0f939e5d8f65f693 Merge: 59e461cef7 f95b761e11 Author: Robert Daly Date: Wed Sep 7 18:43:07 2022 -0400 Merge branch 'main' into arrow-feature-signed commit 59e461cef78946b3a9aa99ec453666e3b75bf472 Author: Robert Daly Date: Mon Sep 5 14:05:04 2022 -0400 set up attachment download to work commit 19d648a63b3fddb55c541c1116cfdb7be5ec4ba2 Merge: 240e1e387c 11761bea9d Author: Robert Daly Date: Mon Sep 5 11:44:04 2022 -0400 Merge branch 'main' into arrow-feature-signed commit 240e1e387c7ac7c9cfac319eb7ec163ea56f819f Author: Robert Daly Date: Tue Aug 30 19:22:53 2022 -0400 use shap instead of object for linting commit 9a9620e53ea6dd38c40756a8c1accaee205d922d Merge: 8aaf7fe4e4 41ec9bd371 Author: Robert Daly Date: Tue Aug 30 18:52:33 2022 -0400 Merge branch 'main' into arrow-feature-signed commit 8aaf7fe4e4e8706bc570e839e75c508b5194718a Author: Robert Daly Date: Sat Aug 13 19:41:04 2022 -0400 cleaned up code, fixed some arrow showing issues commit 91a5a05ab2da0f0da27e3ad2dfd1a52c45d59806 Author: Robert Daly Date: Sat Aug 13 16:52:18 2022 -0400 adding a native press event for pdfs commit 191d8d73ec24f91f4196e7507b0dea3970498b20 Merge: 0366275c12 a06358cef3 Author: Robert Daly Date: Sun Jul 31 13:34:12 2022 -0400 Merge branch 'main' into arrow-feature-signed commit 0366275c1248bc0b28ef8ea862d7d03b68be1007 Author: Robert Daly Date: Sun Jul 31 13:10:11 2022 -0400 fixed up some issues with pdf commit 199a8b17f09af907a10ea598ee6ec01ac97f20e4 Author: Robert Daly Date: Tue Jul 26 23:22:45 2022 -0400 Set up animation to swipe commit 69d6a97628e0bc4cf91533c904d89d2907a09aad Author: Robert Daly Date: Tue Jul 19 23:23:36 2022 -0400 added resize for cycling images commit 70d5d2967e11e41099e822896cd369ff8d320cc8 Author: Robert Daly Date: Tue Jul 19 23:13:37 2022 -0400 adding some logic to update the size of image when cycled commit e2e9633847b2f11e5035fa742c4307677398e2b9 Author: Robert Daly Date: Tue Jul 19 22:19:01 2022 -0400 finished with swiping to change images commit ad64a2fda81eb8d4ed59d1fee21697b30dc33135 Author: Robert Daly Date: Mon Jul 18 21:22:03 2022 -0400 moved everything into carousel commit b74161663daa2d6931a01bcb156b7ca39ebe78b4 Author: Robert Date: Sun Jul 17 19:45:51 2022 -0400 setting up show arrows with ios commit 656d0da77e5efc9c8ec2810c2f00cb27adfd770a Author: JediWattson Date: Sat Jul 2 13:27:56 2022 -0400 linting fixes commit e38f4a89d469c8c7e8e7b789beb14f12e898996b Author: JediWattson Date: Sat Jul 2 13:19:10 2022 -0400 set up event handlers and styling to show arrow on mouse over commit ecd267508f3ae3e4a73fec943aa46597bc44f902 Author: JediWattson Date: Sun Jun 26 17:48:36 2022 -0400 added arrow key handler, cleaned up function and helper text commit 5886c904d6c95960ff3b5faa3fbccce9667e5888 Author: JediWattson Date: Mon Jun 6 16:11:30 2022 -0400 reverting changes to image updates commit 225fbd37ccadb742e78b36bb4a453fb19ce90437 Author: JediWattson Date: Sun Jun 5 13:38:08 2022 -0400 removed unused state pieces commit bf7e03edf8a47d84d6921801973a821452c5da7a Author: JediWattson Date: Sun Jun 5 13:35:38 2022 -0400 removed styles commit b52ee9c5171e5c8cbeacb3aee8c001a53152cd97 Author: JediWattson Date: Sun Jun 5 13:25:03 2022 -0400 cleaned up styling of buttons commit 2e6ae8d22535274fde3f3648728fcb7d100b08a8 Author: JediWattson Date: Sun Jun 5 12:46:19 2022 -0400 wrong value passed commit 33a8e350bce5735537568ea6dea60822bbbf0ce4 Author: JediWattson Date: Sun Jun 5 12:18:56 2022 -0400 removed dry code commit 0e0cdf1b494cc88bdd1d86abcae3d8fa357d1d3e Author: JediWattson Date: Sun Jun 5 12:14:36 2022 -0400 use button for app default styles, added disable commit c2161645acff751082590b2f49e3b2760a1c70d1 Author: JediWattson Date: Wed Jun 1 15:27:47 2022 -0400 adding carousel to attachment modal --- src/CONST.js | 4 + .../CarouselActions/index.js | 64 +++++ .../CarouselActions/index.native.js | 78 ++++++ src/components/AttachmentCarousel/index.js | 246 ++++++++++++++++++ src/components/AttachmentModal.js | 58 +++-- src/components/AttachmentView.js | 5 + src/components/Image/index.js | 12 +- src/components/ImageView/index.js | 2 +- src/components/ImageView/index.native.js | 8 + src/components/PDFView/index.native.js | 1 + src/components/PDFView/pdfViewPropTypes.js | 4 + src/libs/actions/Report.js | 30 ++- src/pages/home/report/ReportActionsView.js | 15 +- src/styles/styles.js | 25 ++ 14 files changed, 512 insertions(+), 40 deletions(-) create mode 100644 src/components/AttachmentCarousel/CarouselActions/index.js create mode 100644 src/components/AttachmentCarousel/CarouselActions/index.native.js create mode 100644 src/components/AttachmentCarousel/index.js diff --git a/src/CONST.js b/src/CONST.js index 2d82c601f3cd..76d6138a32ba 100755 --- a/src/CONST.js +++ b/src/CONST.js @@ -770,6 +770,10 @@ const CONST = { EMOJIS: /[\p{Extended_Pictographic}\u200d\u{1f1e6}-\u{1f1ff}\u{1f3fb}-\u{1f3ff}\u{e0020}-\u{e007f}\u20E3\uFE0F]|[#*0-9]\uFE0F?\u20E3/gu, TAX_ID: /^\d{9}$/, NON_NUMERIC: /\D/g, + + // Extract attachment's source from the data's html string + ATTACHMENT_DATA: /(data-expensify-source|data-name)="([^"]+)"/g, + EMOJI_NAME: /:[\w+-]+:/g, EMOJI_SUGGESTIONS: /:[a-zA-Z0-9_+-]{1,40}$/, AFTER_FIRST_LINE_BREAK: /\n.*/g, diff --git a/src/components/AttachmentCarousel/CarouselActions/index.js b/src/components/AttachmentCarousel/CarouselActions/index.js new file mode 100644 index 000000000000..5cdb4529698a --- /dev/null +++ b/src/components/AttachmentCarousel/CarouselActions/index.js @@ -0,0 +1,64 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import {Pressable} from 'react-native'; + +const propTypes = { + /** Handles onPress events with a callback */ + onPress: PropTypes.func.isRequired, + + /** Callback to cycle through attachments */ + onCycleThroughAttachments: PropTypes.func.isRequired, + + /** Styles to be assigned to Carousel */ + styles: PropTypes.arrayOf(PropTypes.shape({})).isRequired, + + /** Children to render */ + children: PropTypes.oneOfType([ + PropTypes.func, + PropTypes.node, + ]).isRequired, +}; + +class Carousel extends React.Component { + constructor(props) { + super(props); + + this.handleKeyPress = this.handleKeyPress.bind(this); + } + + componentDidMount() { + document.addEventListener('keydown', this.handleKeyPress); + } + + componentWillUnmount() { + document.removeEventListener('keydown', this.handleKeyPress); + } + + /** + * Listens for keyboard shortcuts and applies the action + * + * @param {Object} e + */ + handleKeyPress(e) { + // prevents focus from highlighting around the modal + e.target.blur(); + if (e.key === 'ArrowLeft') { + this.props.onCycleThroughAttachments(1); + } + if (e.key === 'ArrowRight') { + this.props.onCycleThroughAttachments(-1); + } + } + + render() { + return ( + + {this.props.children} + + ); + } +} + +Carousel.propTypes = propTypes; + +export default Carousel; diff --git a/src/components/AttachmentCarousel/CarouselActions/index.native.js b/src/components/AttachmentCarousel/CarouselActions/index.native.js new file mode 100644 index 000000000000..d3f577054780 --- /dev/null +++ b/src/components/AttachmentCarousel/CarouselActions/index.native.js @@ -0,0 +1,78 @@ +import React, {Component} from 'react'; +import {PanResponder, Dimensions, Animated} from 'react-native'; +import PropTypes from 'prop-types'; +import styles from '../../../styles/styles'; + +const propTypes = { + children: PropTypes.element.isRequired, + + /** Callback to fire when swiping left or right */ + onCycleThroughAttachments: PropTypes.func.isRequired, + + /** Callback to handle a press event */ + onPress: PropTypes.func.isRequired, + + /** Boolean to prevent a left swipe action */ + canSwipeLeft: PropTypes.bool.isRequired, + + /** Boolean to prevent a right swipe action */ + canSwipeRight: PropTypes.bool.isRequired, +}; + +class Carousel extends Component { + constructor(props) { + super(props); + this.pan = new Animated.Value(0); + + this.panResponder = PanResponder.create({ + onStartShouldSetPanResponder: () => true, + + onPanResponderMove: (event, gestureState) => Animated.event([null, { + dx: this.pan, + }], {useNativeDriver: false})(event, gestureState), + + onPanResponderRelease: (event, gestureState) => { + if (gestureState.dx === 0 && gestureState.dy === 0) { + return this.props.onPress(); + } + + const deltaSlide = gestureState.dx > 0 ? 1 : -1; + if (Math.abs(gestureState.vx) < 1 || (deltaSlide === 1 && !this.props.canSwipeLeft) || (deltaSlide === -1 && !this.props.canSwipeRight)) { + return Animated.spring(this.pan, {useNativeDriver: false, toValue: 0}).start(); + } + + const width = Dimensions.get('window').width; + const slideLength = deltaSlide * ((3 / 4) * width); + Animated.timing(this.pan, {useNativeDriver: false, duration: 100, toValue: slideLength}).start(({finished}) => { + if (!finished) { + return; + } + + this.props.onCycleThroughAttachments(deltaSlide); + this.pan.setValue(-slideLength); + Animated.timing(this.pan, {useNativeDriver: false, duration: 100, toValue: 0}).start(); + }); + }, + }); + } + + render() { + return ( + + {this.props.children} + + ); + } +} + +Carousel.propTypes = propTypes; + +export default Carousel; diff --git a/src/components/AttachmentCarousel/index.js b/src/components/AttachmentCarousel/index.js new file mode 100644 index 000000000000..dbeb110411d8 --- /dev/null +++ b/src/components/AttachmentCarousel/index.js @@ -0,0 +1,246 @@ +import React from 'react'; +import {View} from 'react-native'; +import PropTypes from 'prop-types'; +import {withOnyx} from 'react-native-onyx'; +import _ from 'underscore'; +import * as Expensicons from '../Icon/Expensicons'; +import styles from '../../styles/styles'; +import themeColors from '../../styles/themes/default'; +import CarouselActions from './CarouselActions'; +import Button from '../Button'; +import * as ReportActionsUtils from '../../libs/ReportActionsUtils'; +import * as Report from '../../libs/actions/Report'; +import AttachmentView from '../AttachmentView'; +import addEncryptedAuthTokenToURL from '../../libs/addEncryptedAuthTokenToURL'; +import * as DeviceCapabilities from '../../libs/DeviceCapabilities'; +import Config from '../../CONFIG'; +import CONST from '../../CONST'; +import ONYXKEYS from '../../ONYXKEYS'; +import reportPropTypes from '../../pages/reportPropTypes'; +import reportActionPropTypes from '../../pages/home/report/reportActionPropTypes'; + +const propTypes = { + /** sourceUrl is used to determine the starting index in the array of attachments */ + sourceURL: PropTypes.string, + + /** Callback to update the parent modal's state with a sourceUrl and name from the attachments array */ + onNavigate: PropTypes.func, + + /** The report currently being looked at */ + report: reportPropTypes, + + /** Object of report actions for this report */ + reportActions: PropTypes.objectOf(PropTypes.shape(reportActionPropTypes)), +}; + +const defaultProps = { + sourceURL: '', + report: { + isLoadingMoreReportActions: false, + reportID: '', + }, + reportActions: {}, + onNavigate: () => {}, +}; + +class AttachmentCarousel extends React.Component { + constructor(props) { + super(props); + this.canUseTouchScreen = DeviceCapabilities.canUseTouchScreen(); + this.cycleThroughAttachments = this.cycleThroughAttachments.bind(this); + + this.state = { + shouldShowArrow: this.canUseTouchScreen, + isForwardDisabled: true, + isBackDisabled: true, + }; + } + + componentDidMount() { + this.makeStateWithReports(); + } + + componentDidUpdate(prevProps) { + const previousReportActionsCount = _.size(prevProps.reportActions); + const currentReportActionsCount = _.size(this.props.reportActions); + if (previousReportActionsCount === currentReportActionsCount) { + return; + } + this.makeStateWithReports(); + } + + /** + * Helps to navigate between next/previous attachments + * @param {Object} attachmentItem + * @returns {Object} + */ + getAttachment(attachmentItem) { + const sourceURL = _.get(attachmentItem, 'sourceURL', ''); + const file = _.get(attachmentItem, 'file', {name: ''}); + this.props.onNavigate({sourceURL: addEncryptedAuthTokenToURL(sourceURL), file}); + + return { + sourceURL, + file, + }; + } + + /** + * Toggles the visibility of the arrows + * @param {Boolean} shouldShowArrow + */ + toggleArrowsVisibility(shouldShowArrow) { + this.setState({shouldShowArrow}); + } + + /** + * This is called when there are new reports to set the state + */ + makeStateWithReports() { + let page; + const actions = ReportActionsUtils.getSortedReportActions(_.values(this.props.reportActions), true); + + // This is used to match the initial image URL from props in a config environment. + // Eg: while using Ngrok the image path is from an Ngrok URL and not an Expensify URL. + const propsSourceURL = this.props.sourceURL.replace( + Config.EXPENSIFY.EXPENSIFY_URL, + Config.EXPENSIFY.URL_API_ROOT, + ); + + /** + * Looping to filter out attachments and retrieve the src URL and name of attachments. + */ + const attachments = []; + _.forEach(actions, ({originalMessage}) => { + if (!originalMessage || !originalMessage.html) { + return; + } + const matches = [...originalMessage.html.matchAll(CONST.REGEX.ATTACHMENT_DATA)]; + + // matchAll captured both source url and name of the attachment + if (matches.length === 2) { + const [originalSourceURL, name] = _.map(matches, m => m[2]); + + // Update the image URL so the images can be accessed depending on the config environment. + // Eg: while using Ngrok the image path is from an Ngrok URL and not an Expensify URL. + const sourceURL = originalSourceURL.replace( + Config.EXPENSIFY.EXPENSIFY_URL, + Config.EXPENSIFY.URL_API_ROOT, + ); + + // Determine attachment index by matching source url with one that's used in state or props + if ((this.state.sourceURL && sourceURL.includes(this.state.sourceURL)) + || (!this.state.sourceURL && sourceURL.includes(propsSourceURL))) { + page = attachments.length; + } + + attachments.push({sourceURL, file: {name}}); + } + }); + + const {sourceURL, file} = this.getAttachment(attachments[page]); + this.setState({ + page, + attachments, + sourceURL, + file, + isForwardDisabled: page === 0, + isBackDisabled: page === attachments.length - 1, + }); + } + + /** + * Increments or decrements the index to get another selected item + * @param {Number} deltaSlide + */ + cycleThroughAttachments(deltaSlide) { + if ((deltaSlide < 0 && this.state.isForwardDisabled) || (deltaSlide > 0 && this.state.isBackDisabled)) { + return; + } + + this.setState(({attachments, page}) => { + const nextIndex = page + deltaSlide; + + // Check if index is near the end of the list to fetch more reports + if (attachments.length - nextIndex < 10) { + Report.loadMoreActions(this.props.report.reportID, this.props.reportActions, this.props.report.isLoadingMoreReportActions); + } + const {sourceURL, file} = this.getAttachment(attachments[nextIndex]); + return { + page: nextIndex, + sourceURL, + file, + isBackDisabled: nextIndex === attachments.length - 1, + isForwardDisabled: nextIndex === 0, + }; + }); + } + + render() { + if (!this.state.sourceURL) { + return null; + } + const authSourceURL = addEncryptedAuthTokenToURL(this.state.sourceURL); + return ( + this.toggleArrowsVisibility(true)} + onMouseLeave={() => this.toggleArrowsVisibility(false)} + > + {this.state.shouldShowArrow && ( + <> + {!this.state.isBackDisabled && ( +