-
Notifications
You must be signed in to change notification settings - Fork 3.7k
(1/2) Implement store/caching for attachments #65321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
180 commits
Select commit
Hold shift + click to select a range
2fe2027
feat: implement store/caching attachment for native
NJ-2020 5907988
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 5381d33
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 fc2382a
implement store/caching for web and fix some issues
NJ-2020 79f2ad2
remove unnecessary code
NJ-2020 11b7669
fix eslint errors
NJ-2020 78aaa7b
fix: eslint errors & store file path for native
NJ-2020 6ba6580
fix: remove attachment when deleting comment, improvements, eslint er…
NJ-2020 b690613
remove unnecessary changes
NJ-2020 ad8e005
fix: eslint errors
NJ-2020 041bcbc
fix: eslint errors
NJ-2020 393ad06
fix: attachmentID is returning undefined
NJ-2020 6b23b6f
fix: remove unnecessary code
NJ-2020 21f59ee
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 60ed019
add missing comments
NJ-2020 1e56909
revert showImagePicker changes
NJ-2020 efeee2b
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 1efadb4
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 e395df4
feat: add unit test file
NJ-2020 63ad3f7
fix some comments and improve the code
NJ-2020 70ff800
Merge remote-tracking branch 'origin' into new-feat/9402-1
NJ-2020 648c196
fix some comments & issues
NJ-2020 bf021da
remove unnecessary checks
NJ-2020 9dc2822
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 7f79697
refactor buildOptimisticAddCommentReportAction to use parameter object
NJ-2020 8b118a1
fix: getHtmlWithAttachmentID, some issues & errors
NJ-2020 6324aa1
fix: eslint error
NJ-2020 ce31649
Merge branch 'main' into new-feat/9402-1
NJ-2020 22ddea1
Merge branch 'main' into new-feat/9402-1
NJ-2020 0b9bde7
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 fe4a186
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 6010787
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 a0ec7de
fix: conflicts
NJ-2020 b57ce6f
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 aa88d66
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 667606f
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 dc1487b
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 7aad16a
fix get attachment return typo
NJ-2020 4655701
fix: remove unnecessary consoles
NJ-2020 1f9b280
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 6c74c33
fix: attachment test & add missing test case
NJ-2020 89ee558
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 57180af
fix getCachedAttachment for uncached attachment
NJ-2020 a588705
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 89ed3ba
fix getCachedAttachment native
NJ-2020 ca73324
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 5403b29
fix: migrate from Onyx.connect to useOnyx
NJ-2020 c9df3cd
fix attachment typo and issues
NJ-2020 e75db34
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 922776f
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 f502c26
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 282e4d4
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 062445b
fix: attachment test
NJ-2020 a2b1679
fix report action test
NJ-2020 0a6a928
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 6431283
Merge branch 'main' into new-feat/9402-1
NJ-2020 4fa8736
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 c8d0c38
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 7d93ed5
fix attachment picker & some improvements
NJ-2020 e66a8ef
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 54d1f51
fix cacheAttachment issue file path, some issue & improvements
NJ-2020 23ae3d2
fix RNFS cacheAttachment on native platform
NJ-2020 e08598d
fix attachment unit test & spell name error
NJ-2020 98a02e4
fix sepll name, eslint and jest unit test error
NJ-2020 fb95150
fix attachment test eslint errror
NJ-2020 19cc2f7
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 9b0fa1d
fix eslint error
NJ-2020 af6f48f
fix report action test
NJ-2020 4cd3348
fix: clean up the code
NJ-2020 f5a59b0
Merge remote-tracking branch 'origin' into new-feat/9402-1
NJ-2020 1983eca
remove unnecessary import
NJ-2020 42d72a2
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 09b69af
fix: getCachedAttachment error
NJ-2020 2cdf779
fix native: attachment file upload
NJ-2020 52f6e94
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 637f9b9
remove unnecessary code
NJ-2020 fe24a5c
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 bdc1a67
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 5fc46c2
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 33ffbd7
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 8ed26df
draft: use web worker when clearing CacheAPI on logout
NJ-2020 e21c68b
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 b3026be
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 9aa921a
revert: draft web worker
NJ-2020 948553f
fix: improve error handling
NJ-2020 4025551
remove unnecessary, fix some issues, improvements
NJ-2020 e407e58
fix eslint, ts check
NJ-2020 a439a87
fix attachment test workflow check
NJ-2020 fc9ef18
fix jest test, eslint errors
NJ-2020 18236aa
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 ef91e0c
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 0d220bd
fix: store/caching attachment issues
NJ-2020 26200d1
fix: eslint errors
NJ-2020 99a3fee
fix: jest unit test
NJ-2020 a9e3994
fix typo
NJ-2020 167ab16
fix: eslint error
NJ-2020 9e4196b
fix all issues store caching attachment both native + web
NJ-2020 d675c4b
fix: eslint error
NJ-2020 85e6a60
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 3344e95
fix: unbound eslint error
NJ-2020 776520f
fix: jest test
NJ-2020 1f89a0e
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 d1aed4a
fix: remove attachment unit test error
NJ-2020 565b52f
fix: eslint error
NJ-2020 226cc7a
add catch handler for RNFetchBlob
NJ-2020 a94aaac
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 f706bde
fix sourceID
NJ-2020 940cc42
fix all workflow failures
NJ-2020 81e448b
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 413ccc9
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 13049ef
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 953173d
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 e6a4d22
add more unit tests
NJ-2020 2ffa15a
Merge branch 'main' into new-feat/9402-1
NJ-2020 a64bbe0
fix failing tests
NJ-2020 d921958
Merge remote-tracking branch 'origin' into new-feat/9402-1
NJ-2020 1e104aa
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 6129f12
fix some errors, refactor buildOptimisticAddCommentReportAction
NJ-2020 cd6ef5b
only allow jpg/jpeg images
NJ-2020 9c29149
fix eslint error
NJ-2020 68bcbab
fix eslint errors, improvemance
NJ-2020 0a47103
fix: eslint error & remove attachment test
NJ-2020 91cce69
fix: missing global expression
NJ-2020 0879254
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 fc8d202
fix: getImageCacheFileExtension, jest error & improvemance
NJ-2020 ecb35d7
fix: revert ReportTest
NJ-2020 0468734
fix: jest error
NJ-2020 f835fae
fix: error, issues & improvemance
NJ-2020 d78e136
fix: regex matching & improvemance
NJ-2020 ce92bcc
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 94f6fd9
Merge branch 'main' into new-feat/9402-1
NJ-2020 422abba
fix: error
NJ-2020 5eea5cf
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 3c6a540
fix: only re-cache for outdated attachment
NJ-2020 0adbfe8
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 cd344ec
fix: regex issues
NJ-2020 dfe2134
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 066e0a4
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 a1c473e
fix: prettier error
NJ-2020 93372c4
fix: eslint error
NJ-2020 8b0b584
feat: create attachment test
NJ-2020 c9cd99d
fix: update IMAGE_CACHE_FILE_TYPES
NJ-2020 388a061
Merge remote-tracking branch 'origin' into new-feat/9402-1
NJ-2020 a37771e
fix: CacheAPI initialization
NJ-2020 a08f268
fix: IMAGE_CACHE_FILE_TYPES & improvemance
NJ-2020 81220cd
Merge remote-tracking branch 'origin' into new-feat/9402-1
NJ-2020 69bc7be
fix: error & unnecessary code
NJ-2020 1bcf986
fix: clear cached attachments on signout
NJ-2020 088a6fb
remove unnecessary comment
NJ-2020 7737911
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 73d137e
fix: prettier
NJ-2020 22d3d80
fix: missing return statement
NJ-2020 152854b
Merge remote-tracking branch 'origin' into new-feat/9402-1
NJ-2020 ec20fa7
fix: add HEIC file caching support & improvemance
NJ-2020 28077cb
fix
NJ-2020 6cdeaa9
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 7f41b0b
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 4d4dcea
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 527fda6
fix: attachmentID loading/flickering bug
NJ-2020 a461ac7
Merge remote-tracking branch 'origin' into new-feat/9402-1
NJ-2020 e3825c4
fix: typecheck
NJ-2020 d75bc1e
fix prettier
NJ-2020 14632eb
fix: add missing dependency variable
NJ-2020 e49303a
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 249d692
fix: invalid reportActionID & missing trailing space
NJ-2020 6f8d25d
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 9f629d7
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 a8393a6
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 22bb13a
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 947f13b
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 d958da0
Merge remote-tracking branch 'origin' into new-feat/9402-1
NJ-2020 7f6e8a6
fix: add comment explanation
NJ-2020 6d45e3c
fix: spelling
NJ-2020 89c4410
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 9daa004
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 a83f371
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 e724bce
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 349a02a
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 7d7092f
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 f7a8da4
Merge branch 'Expensify:main' into new-feat/9402-1
NJ-2020 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| // Cache API only works for web, so we will return empty function here | ||
| function init() {} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add comment on why we are not implementing here.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
| function put() {} | ||
| function get() {} | ||
| function remove() {} | ||
| function clear() {} | ||
|
|
||
| export default { | ||
| init, | ||
| put, | ||
| get, | ||
| remove, | ||
| clear, | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| import type {ValueOf} from 'type-fest'; | ||
| import Log from '@libs/Log'; | ||
| import CONST from '@src/CONST'; | ||
|
|
||
| type CacheNameType = ValueOf<typeof CONST.CACHE_API_KEYS>; | ||
|
|
||
| function init() { | ||
| // Exit early if the Cache API is not supported in the current browser. | ||
| if (!('caches' in window)) { | ||
| Log.warn('Cache API is not supported'); | ||
| return; | ||
| } | ||
| const keys = Object.values(CONST.CACHE_API_KEYS); | ||
| for (const key of keys) { | ||
| caches.has(key).then((isExist) => { | ||
| if (isExist) { | ||
| return; | ||
| } | ||
| caches.open(key); | ||
| }); | ||
| } | ||
| } | ||
|
|
||
| function put(cacheName: CacheNameType, key: string, value: Response) { | ||
| return caches.open(cacheName).then((cache) => cache.put(key, value)); | ||
| } | ||
|
|
||
| function get(cacheName: CacheNameType, key: string) { | ||
| return caches.open(cacheName).then((cache) => cache.match(key)); | ||
| } | ||
|
|
||
| function remove(cacheName: CacheNameType, key: string) { | ||
| return caches.open(cacheName).then((cache) => cache.delete(key)); | ||
| } | ||
|
|
||
| function clear(cacheName?: CacheNameType) { | ||
| // If a cache name is provided, delete only that key. | ||
| if (cacheName) { | ||
| return caches.delete(cacheName); | ||
| } | ||
|
|
||
| const keys = Object.values(CONST.CACHE_API_KEYS); | ||
| const deletePromises = keys.map((key) => caches.delete(key)); | ||
|
|
||
| return Promise.all(deletePromises); | ||
| } | ||
|
|
||
| export default { | ||
| init, | ||
| put, | ||
| get, | ||
| remove, | ||
| clear, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.