chore: Release v0.3.3-beta.0 (#2654)
This commit is contained in:
+65
-1
@@ -1,6 +1,6 @@
|
||||
# CHANGELOG
|
||||
|
||||
## [0.3.2-beta.0](https://github.com/RSSNext/follow/compare/v0.2.7-beta.0...v0.3.2-beta.0) (2025-01-17)
|
||||
## [0.3.3-beta.0](https://github.com/RSSNext/follow/compare/v0.2.7-beta.0...v0.3.3-beta.0) (2025-01-24)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
@@ -24,8 +24,10 @@
|
||||
* add turbo build in ci ([7b848cd](https://github.com/RSSNext/follow/commit/7b848cd08aa4f97b1df35666166561d6fc30c5c9))
|
||||
* add type checking to test script ([#1666](https://github.com/RSSNext/follow/issues/1666)) ([518a32f](https://github.com/RSSNext/follow/commit/518a32f2ce1498f21cff87e0b95d0a4fd0a0f4a0))
|
||||
* adjust activation toast style ([e81245e](https://github.com/RSSNext/follow/commit/e81245e395ce1829f0c185a5a184c4cba8f8406c))
|
||||
* adjust ios styles ([585aa03](https://github.com/RSSNext/follow/commit/585aa03b238f4f451849eaad8098dcf08ad9405e))
|
||||
* adjust padding based on FeedViewType in EntryList component ([f3f86b7](https://github.com/RSSNext/follow/commit/f3f86b7c0ddc1cae0c26246bc8e91cbb79e64189))
|
||||
* adjust ScrollView padding to accommodate safe area insets in FollowFeed component ([de3a625](https://github.com/RSSNext/follow/commit/de3a625db513f559ad2e8d6e86b1af2798b88a37))
|
||||
* adjust SwipeableItem friction and improve loading indicator display in Lists screen ([43bebd7](https://github.com/RSSNext/follow/commit/43bebd7c41ec7dcc1ba4967fecbc4de6708a31a3))
|
||||
* ai daily report layout in mobile ([64c7df1](https://github.com/RSSNext/follow/commit/64c7df1dda3e4a30a6152b24bcea0dd135e12ca9))
|
||||
* ai entry actions with user role checks, close [#2591](https://github.com/RSSNext/follow/issues/2591) ([7129db7](https://github.com/RSSNext/follow/commit/7129db766c5ed2e7257f59bc914c1b56a27cc6a3))
|
||||
* align notification skeleton to left ([fa08d1a](https://github.com/RSSNext/follow/commit/fa08d1a0cb8421ca40e38dddd0d74415389f7a80)), closes [#1672](https://github.com/RSSNext/follow/issues/1672)
|
||||
@@ -33,6 +35,7 @@
|
||||
* allow collect entry from list ([706f484](https://github.com/RSSNext/follow/commit/706f4847576fbb0237925434d4dace5c22fdbf93))
|
||||
* allow select one feed ([3c21d92](https://github.com/RSSNext/follow/commit/3c21d92baf0a03373224ac9d5a7a416947788388)), closes [#1512](https://github.com/RSSNext/follow/issues/1512)
|
||||
* allow selecting when meta key is pressed ([6b8572c](https://github.com/RSSNext/follow/commit/6b8572c37aa287aa544e6ddb2847693ba597b0be))
|
||||
* allow set cookie on verify-totp ([6b884d1](https://github.com/RSSNext/follow/commit/6b884d1fd7e6eb6045856b60701979c298ecd8b4))
|
||||
* always exclude routeParams ([1466886](https://github.com/RSSNext/follow/commit/1466886c426095aa59bbc06f93a44245bfa3b480))
|
||||
* **animation:** preserve exit transition for smoother animations ([#2237](https://github.com/RSSNext/follow/issues/2237)) ([aab23d3](https://github.com/RSSNext/follow/commit/aab23d3a347ee445f9a53d4053624e9daad4662c))
|
||||
* app notification font size ([1b5f944](https://github.com/RSSNext/follow/commit/1b5f9448062bde224770dfe5129304d7a812585d))
|
||||
@@ -49,10 +52,12 @@
|
||||
* auth in electron ([405ee42](https://github.com/RSSNext/follow/commit/405ee42e8a1232424bb667cd56fffd3d0b463a4e))
|
||||
* authentication style on mobile ([58e796e](https://github.com/RSSNext/follow/commit/58e796e3df1844ccb2c4cadb6578051d1114c628))
|
||||
* **auth:** handle optional icon class names for providers in login components ([de8d337](https://github.com/RSSNext/follow/commit/de8d3376713be0b696579e16395b887b2658d59f))
|
||||
* **auth:** only set status as unauthenticated when there is no session ([bc9a9d4](https://github.com/RSSNext/follow/commit/bc9a9d4310fdb5f0d51f7f512c47c96f95318f74)), closes [#2473](https://github.com/RSSNext/follow/issues/2473)
|
||||
* **auth:** redirect url ([e7d5576](https://github.com/RSSNext/follow/commit/e7d5576b63a77cd4f4e25a3124f9685f408a73de))
|
||||
* auto archived list flash ([#1269](https://github.com/RSSNext/follow/issues/1269)) ([8d2478c](https://github.com/RSSNext/follow/commit/8d2478c6a93aa9f5a99fddc55bbb8e532e1a0fe1))
|
||||
* auto load achieved entries when show achieved button is available ([074a60d](https://github.com/RSSNext/follow/commit/074a60d3cf93bcede88ea4d70b07cf7480be4229))
|
||||
* back to previous entry list will refresh data ([84a188a](https://github.com/RSSNext/follow/commit/84a188a8e1fa88df18b9bd4d5f0bea1fc92f9394))
|
||||
* blurhash size ([4696ac6](https://github.com/RSSNext/follow/commit/4696ac6d47be38a8ec3d0cf20b63273ca24d7960))
|
||||
* **boost:** card text align center ([632d5d4](https://github.com/RSSNext/follow/commit/632d5d42d67999523e602fb18f59ca72543b7d7a))
|
||||
* break hono types ([bb529c4](https://github.com/RSSNext/follow/commit/bb529c498a7e2d0408b7de9e1d2f78db9a8b0d0f))
|
||||
* **bridge:** window call should catch error ([7bdf100](https://github.com/RSSNext/follow/commit/7bdf10050cef7f39b0f485b89ca0445c49116d81))
|
||||
@@ -70,6 +75,7 @@
|
||||
* center dialog ([4a1ae06](https://github.com/RSSNext/follow/commit/4a1ae0668855b24513cf85b2a6527edf20c2da47))
|
||||
* change invitation code placeholder font to theme font ([#1978](https://github.com/RSSNext/follow/issues/1978)) ([d78f7cd](https://github.com/RSSNext/follow/commit/d78f7cdc178388f5e0c83be4ce49e32f68863efa))
|
||||
* changelog ([f84aa0b](https://github.com/RSSNext/follow/commit/f84aa0b0cfdc350f26e79ce68c75788cc090321d))
|
||||
* check view ([f52338c](https://github.com/RSSNext/follow/commit/f52338ce331293411038fb4660f7bb0d635c8401))
|
||||
* ci ([#1943](https://github.com/RSSNext/follow/issues/1943)) ([f7eca73](https://github.com/RSSNext/follow/commit/f7eca73f5b2a5f1d3d24a3189fd4708da282b45b))
|
||||
* **ci:** concurrency group ([fb0152e](https://github.com/RSSNext/follow/commit/fb0152eaec76b28ed9fc26381917ca7ec2aecb0b))
|
||||
* **ci:** forge build error ([#1500](https://github.com/RSSNext/follow/issues/1500)) ([a5e3e02](https://github.com/RSSNext/follow/commit/a5e3e0228c7088e78061801466267ebdbd288e2c))
|
||||
@@ -91,6 +97,7 @@
|
||||
* content ([5a30f38](https://github.com/RSSNext/follow/commit/5a30f384082949f17a71f6d1f837b30966368157))
|
||||
* context menu for multi select ([d68de79](https://github.com/RSSNext/follow/commit/d68de7933235351d64df68e3e2c49623184f4284))
|
||||
* corner player style on safari ([e740d4d](https://github.com/RSSNext/follow/commit/e740d4da78032547c48014a31a25968fe1ad192f))
|
||||
* correct ModalHeaderSubmitButton naming and enhance UI components ([55dcfb0](https://github.com/RSSNext/follow/commit/55dcfb06df5cdf520cb316b3af6e73650063e52f))
|
||||
* correct visibility logic for entry read command ([bdad091](https://github.com/RSSNext/follow/commit/bdad0915995fd4853db49a257a5bd1f13ad092be))
|
||||
* correct z-index in toast ([6507744](https://github.com/RSSNext/follow/commit/6507744847b6ceee093adb17076292993d525313))
|
||||
* crash when using Google Translate, close [#2121](https://github.com/RSSNext/follow/issues/2121) ([4ae7290](https://github.com/RSSNext/follow/commit/4ae7290de115e6d352d84282b8470bcd15a115c4))
|
||||
@@ -105,6 +112,7 @@
|
||||
* debug proxy page ([#1439](https://github.com/RSSNext/follow/issues/1439)) ([c8d1230](https://github.com/RSSNext/follow/commit/c8d1230be753109bd7eaef45e7d0ad0399d8bd4d))
|
||||
* debugger network ([a76814d](https://github.com/RSSNext/follow/commit/a76814ddfc5a019564bfc1980572157e1a30d776))
|
||||
* **debug:** inject `import.env` ([810516a](https://github.com/RSSNext/follow/commit/810516ae7d9b4196c047249cb0f889de8b012b99))
|
||||
* delay the setVoice until before starting play tts, close [#2042](https://github.com/RSSNext/follow/issues/2042) ([e64da25](https://github.com/RSSNext/follow/commit/e64da259e7aa0247904d42b39a5a63e8d869f4c3))
|
||||
* delete condition item ([8b9750d](https://github.com/RSSNext/follow/commit/8b9750da1219f3d046b78c70c1966e284b086348))
|
||||
* delete last condition ([72d894a](https://github.com/RSSNext/follow/commit/72d894a754ba3a0c3b6c4e030b3b274dc98de6b6))
|
||||
* detecting windows11 ([#1170](https://github.com/RSSNext/follow/issues/1170)) ([2813f1d](https://github.com/RSSNext/follow/commit/2813f1d6540fcb215287dd32cbc0f8cf87cb1cb0))
|
||||
@@ -159,6 +167,7 @@
|
||||
* feed column pb in mobile ([4035a6b](https://github.com/RSSNext/follow/commit/4035a6b7b839a284e452f51e75c759f25136784a))
|
||||
* feed icon fallback delay ms ([89239d8](https://github.com/RSSNext/follow/commit/89239d89aa52429eef348e500c7ed7d6170c766a))
|
||||
* feed icon margin right ([0f32364](https://github.com/RSSNext/follow/commit/0f3236406dc354adc9830c51e73f9fb4790f159a))
|
||||
* **feed-column:** correct sorting icon status ([#2652](https://github.com/RSSNext/follow/issues/2652)) ([4045251](https://github.com/RSSNext/follow/commit/404525196763501d2bf315ed68c7f3aaac7a4683))
|
||||
* feedIcon margin ([03ce13d](https://github.com/RSSNext/follow/commit/03ce13d45bd89908bd9bcb06484a07873b6388f5))
|
||||
* fill height when zooming ([75e0da2](https://github.com/RSSNext/follow/commit/75e0da2a866a7789606bd40d484fc29973fd9e0a))
|
||||
* fill missing userId when open tip modal, close [#2248](https://github.com/RSSNext/follow/issues/2248) ([53ad291](https://github.com/RSSNext/follow/commit/53ad291820ccefc6badee8d3dc6af276c31c3cc6))
|
||||
@@ -191,11 +200,13 @@
|
||||
* **i18n:** update label for notification badge settings in zh-CN locale and others ([#1455](https://github.com/RSSNext/follow/issues/1455)) ([ec82f03](https://github.com/RSSNext/follow/commit/ec82f036b44a3d0d463c48c1d793fc517def1d07))
|
||||
* ignore `file` and editor protocols ([2badb9b](https://github.com/RSSNext/follow/commit/2badb9b1c0bf6628d2a2fc177063fd0c7c7fb08b))
|
||||
* ignore `node_modules` for tailwindcss to avoid warning ([#2425](https://github.com/RSSNext/follow/issues/2425)) ([1e8f80e](https://github.com/RSSNext/follow/commit/1e8f80ef158ce1e59af7ae106b871a60742038f3))
|
||||
* ignore customize toolbar in EntryItem context menu ([79daad4](https://github.com/RSSNext/follow/commit/79daad4db321f8ca76c9db503f15e951c640e5fb))
|
||||
* image blurhash out when image loaded ([5b237ca](https://github.com/RSSNext/follow/commit/5b237caf803ed5a2cb95a7fb6e0f2fb7940f5da9))
|
||||
* image blurhash placeholder ([3ca9b5a](https://github.com/RSSNext/follow/commit/3ca9b5a65978e854dafdfe73d81c873379c82c42))
|
||||
* image error ui ([#2124](https://github.com/RSSNext/follow/issues/2124)) ([008cc98](https://github.com/RSSNext/follow/commit/008cc98f8a2624d4360e7c6bb8ba7176436f8579))
|
||||
* immer object extensible ([6ad35ad](https://github.com/RSSNext/follow/commit/6ad35ad6712a68db9e231bf5733a2956ccecda90))
|
||||
* import ([9d6e7d4](https://github.com/RSSNext/follow/commit/9d6e7d44363efc50a592e13e7c20aa6eca2e03d0))
|
||||
* improve image style ([8e0915a](https://github.com/RSSNext/follow/commit/8e0915a6f6eac3f68c382758c71dcc0a4e478687))
|
||||
* improve Markdown rendering and UI adjustments in various components ([1439d87](https://github.com/RSSNext/follow/commit/1439d87f071dd6153519f56091e73f3fabf817b4))
|
||||
* improve multi select behavior ([24017df](https://github.com/RSSNext/follow/commit/24017dfb3190c91969ec68d3d88544e051880469))
|
||||
* improve perform for feed column ([#1708](https://github.com/RSSNext/follow/issues/1708)) ([1f349ed](https://github.com/RSSNext/follow/commit/1f349ed73e912825fb34877f5db9df13c6c6f879))
|
||||
@@ -223,6 +234,7 @@
|
||||
* md lint ([c8e556a](https://github.com/RSSNext/follow/commit/c8e556a3ac861cab4a4a7aff1aa2fa51aaca1f42))
|
||||
* media item dot position on mobile ([c67248f](https://github.com/RSSNext/follow/commit/c67248ffc8d77cbdeac289f5ed398248dff41cb3))
|
||||
* **media:** adjust inline media size and alignment for better display [#2251](https://github.com/RSSNext/follow/issues/2251) ([#2254](https://github.com/RSSNext/follow/issues/2254)) ([86b5712](https://github.com/RSSNext/follow/commit/86b57120fca3aadcead672fb6e9ea470045b4759))
|
||||
* missing runtime option, close [#2630](https://github.com/RSSNext/follow/issues/2630) ([500f0ba](https://github.com/RSSNext/follow/commit/500f0ba260556923beead33c67989bd05b3a1d4d))
|
||||
* missing site url in feed selector ([ea677ac](https://github.com/RSSNext/follow/commit/ea677ac6a3a43489a9508a32ecb22fa38ecf4f27))
|
||||
* missing translation in pitcure masonry ([902d681](https://github.com/RSSNext/follow/commit/902d68180d1cc872cbe4435efbcae108f0d732b5))
|
||||
* mobile need login modal ([0fb16f2](https://github.com/RSSNext/follow/commit/0fb16f2352e9776731522204b838be59f66127a4))
|
||||
@@ -241,6 +253,7 @@
|
||||
* motion button motion style in mobile ([611d2cf](https://github.com/RSSNext/follow/commit/611d2cf0349be360aa86601ed4eb0522118bad49))
|
||||
* multi select state ([f476483](https://github.com/RSSNext/follow/commit/f476483fe3b944371c0327495d53ec3d42006dda))
|
||||
* nightly auto updater ([27b3bf4](https://github.com/RSSNext/follow/commit/27b3bf4f50badb8fac4b497d18a25002ed3b1981))
|
||||
* no password hint when enable 2fa ([dbd238a](https://github.com/RSSNext/follow/commit/dbd238a0f93abe13af5dd70c96d2922f89537fc4))
|
||||
* not showing feed certification icon on the sidebar ([#1442](https://github.com/RSSNext/follow/issues/1442)) ([b395891](https://github.com/RSSNext/follow/commit/b395891b66a581254f24aae75d0d61869fb6fb33))
|
||||
* omit cacheDimensions from img attributes in MediaImpl ([ec12b35](https://github.com/RSSNext/follow/commit/ec12b3538f42c8596c4e700ae2284a02b4d7791e))
|
||||
* only remove background color on electron ([5d244d4](https://github.com/RSSNext/follow/commit/5d244d4a335ad448ab9596fd704d05867f1ce7c3))
|
||||
@@ -255,6 +268,9 @@
|
||||
* package export path for tsconfig ([#1690](https://github.com/RSSNext/follow/issues/1690)) ([00826ae](https://github.com/RSSNext/follow/commit/00826aecccac8dfcedba571ac02af1e3e1911c31))
|
||||
* parse auth cookie ([626db9a](https://github.com/RSSNext/follow/commit/626db9a7edf0d42208861c31c2083ab89a6e32c9))
|
||||
* pass a component for Trans ([7d38cb6](https://github.com/RSSNext/follow/commit/7d38cb6d2f814d3b6012b66ba6024c05b6edcf2d))
|
||||
* pass callbackURL, close [#2630](https://github.com/RSSNext/follow/issues/2630) ([85b00f7](https://github.com/RSSNext/follow/commit/85b00f79db988ba4352122dcb70b059f1ffccb95))
|
||||
* pass in otp code ([ac29a18](https://github.com/RSSNext/follow/commit/ac29a18135147de63ac0b58ceefd6a5ca111e8cf))
|
||||
* pass token when resetting password ([eb47ec2](https://github.com/RSSNext/follow/commit/eb47ec2ccaa9a4300ad8b5078bbf6c048d6f84a3))
|
||||
* player cover height ([5486edd](https://github.com/RSSNext/follow/commit/5486eddd640bd5b72a174946ff804531e6e4b3d3))
|
||||
* player margin safe ([1182497](https://github.com/RSSNext/follow/commit/1182497f6becb14a2954b079d9b47440ed071ef1))
|
||||
* player show state ([7d034e0](https://github.com/RSSNext/follow/commit/7d034e0d355a02c14c368bb0f8a4737b5219cfc7))
|
||||
@@ -262,6 +278,7 @@
|
||||
* polling unread and add ua for electron api client ([549f10d](https://github.com/RSSNext/follow/commit/549f10d7ebb9e0eca9faa4d9cb27b7e448a8af0f))
|
||||
* power icon align ([11059f6](https://github.com/RSSNext/follow/commit/11059f639ee955a0f10cbd97cb6eed85e335fed7))
|
||||
* preferred title not working in entry column ([#1268](https://github.com/RSSNext/follow/issues/1268)) ([4bdf28e](https://github.com/RSSNext/follow/commit/4bdf28ea766242c74af051e36a9ef205f02eb874))
|
||||
* prefetch category ([e0d6746](https://github.com/RSSNext/follow/commit/e0d67465a8ba48ba84a5673effc5daf56b95aa28))
|
||||
* prevent default click behavior in Media ([#1905](https://github.com/RSSNext/follow/issues/1905)) ([97dee6e](https://github.com/RSSNext/follow/commit/97dee6eda40e63dec2e66aa20da31a5d1ceed875))
|
||||
* prevent default for cmd+k ([81d49f0](https://github.com/RSSNext/follow/commit/81d49f0893100de85a22d114765f76e7c9dea36c))
|
||||
* prevent default scrolling behavior while using arrow keys to switch between entries ([#1447](https://github.com/RSSNext/follow/issues/1447)) ([ed5ee50](https://github.com/RSSNext/follow/commit/ed5ee50fe2676309e5451d73531baf59bbf0d746))
|
||||
@@ -270,6 +287,7 @@
|
||||
* prevent right cilck on content menu ([#1525](https://github.com/RSSNext/follow/issues/1525)) ([ca6428f](https://github.com/RSSNext/follow/commit/ca6428f21926524d08c8aae121e9c705a147540e))
|
||||
* prevent withdrawal of zero amount to avoid unnecessary fees ([#1422](https://github.com/RSSNext/follow/issues/1422)) ([6584526](https://github.com/RSSNext/follow/commit/65845268f9940247d3b645b1588d1564ec0b4cff))
|
||||
* **profile-menu:** limit max-char ([8a72a97](https://github.com/RSSNext/follow/commit/8a72a97c0ce145a65583fafe792ae99a634c52c3))
|
||||
* **Profile:** replace Fragment with View for better layout structure in SubscriptionList ([b2ffd5d](https://github.com/RSSNext/follow/commit/b2ffd5dd1acd634bcb6b0c07f441b3213e20f554))
|
||||
* reduce timeline refresh, fixed [#1474](https://github.com/RSSNext/follow/issues/1474) ([6fc9d09](https://github.com/RSSNext/follow/commit/6fc9d09c586618efb2d1b62b062fa04e26dc7986))
|
||||
* reduce upgrade toast duration and disable prompt on nightly version, fixed 1450 ([7f2ac96](https://github.com/RSSNext/follow/commit/7f2ac967ebc900e57b09bf4c945412e84943ebb2))
|
||||
* refetch wallet data on mount ([2d11eb2](https://github.com/RSSNext/follow/commit/2d11eb2d92fb57222b14df987b57a75eb9262fc5))
|
||||
@@ -291,17 +309,22 @@
|
||||
* remove vercel header rewrite for assets ([79e6f48](https://github.com/RSSNext/follow/commit/79e6f483265216773e0ccf5ac0690d06300d3e80))
|
||||
* remove wdyr in prod ([70e3b72](https://github.com/RSSNext/follow/commit/70e3b72b0ae88a722e2ff9e7d6027003f88829e2))
|
||||
* replace Avatar component with UserAvatar in ranking and transaction sections ([#1759](https://github.com/RSSNext/follow/issues/1759)) ([52c3695](https://github.com/RSSNext/follow/commit/52c3695355ed3962d9ad53e61a612d88c54ab650))
|
||||
* reset tts when play again, close [#2054](https://github.com/RSSNext/follow/issues/2054) ([d6b3a8c](https://github.com/RSSNext/follow/commit/d6b3a8cdc5170bd6b7297cab38ac60d9250788aa))
|
||||
* response error toast style ([7748588](https://github.com/RSSNext/follow/commit/77485886089e9faea54cf80a96a48a0bedd2a39e))
|
||||
* restore BlurEffect in SearchHeader and enhance refresh control in search tabs ([180aa66](https://github.com/RSSNext/follow/commit/180aa667d50c18ed978e4b227b5f03347025775a))
|
||||
* revalidate when switch from subscription startupScreen ([e63c12c](https://github.com/RSSNext/follow/commit/e63c12c27227341a2477eb06fa039e2b0a2a00e5))
|
||||
* revert electron bump ([#1991](https://github.com/RSSNext/follow/issues/1991)) ([200415c](https://github.com/RSSNext/follow/commit/200415c77f52d11a43c2610c5c58c61fbbfb23f8))
|
||||
* revert merge chunk ([4a9679b](https://github.com/RSSNext/follow/commit/4a9679bad109a786b80939ca9ead32f1505be186))
|
||||
* **rn-base:** fix `SafeNavigationScrollView` and impl blur effect header ([437a790](https://github.com/RSSNext/follow/commit/437a790994eb7c9a0546795c322ae7d7220bd081))
|
||||
* **rn-baseline:** sync with uikit color and update list ([91f5340](https://github.com/RSSNext/follow/commit/91f53404071c609a77b8ff809ea2cbb7748cb1c5))
|
||||
* **rn-base:** Switch component flex ([7365eb5](https://github.com/RSSNext/follow/commit/7365eb5e38de5080d655cd49ed1080b73b949086))
|
||||
* **rn-tabbar:** calc tab bar indicator position ([e625ada](https://github.com/RSSNext/follow/commit/e625adaf162cdd2962900d1104541f9cc6365af5))
|
||||
* **rn:** adjust ui colors ([33d9e14](https://github.com/RSSNext/follow/commit/33d9e14d7c377c76dc349c1fc6ae901da2fe30c7))
|
||||
* **rn:** check tab current index frequency ([fc3a3ce](https://github.com/RSSNext/follow/commit/fc3a3cef23532143853625a1af6cc2bbe3c28a3d))
|
||||
* **rn:** delete subscribe in db persist ([e2c9459](https://github.com/RSSNext/follow/commit/e2c9459db8cc0137bb63ea83b1cd7f2cb2a3dab4))
|
||||
* **rn:** discover form ([4f3d990](https://github.com/RSSNext/follow/commit/4f3d9902af372dd849f02a20dc1ae644d309fd73))
|
||||
* **rn:** flashlist insets and navigation padding ([041318a](https://github.com/RSSNext/follow/commit/041318ab7e3699da143fccdc60b6dc6645ffb100))
|
||||
* **rn:** follow feed modal style ([a03dcd9](https://github.com/RSSNext/follow/commit/a03dcd9ee9881281bb784fd6aef824134777875a))
|
||||
* **rn:** hide tabbar when push to other setting page ([c47905b](https://github.com/RSSNext/follow/commit/c47905b70fb188acdae48f27a93822ccd20a944c))
|
||||
* **rn:** login email ([8a1ff73](https://github.com/RSSNext/follow/commit/8a1ff735bd0451e2586b99299cf67fa25ad05c64))
|
||||
* **rn:** login redirection ([9efbe79](https://github.com/RSSNext/follow/commit/9efbe79961b3dba138b9553d131b73c94c3a8cdf))
|
||||
@@ -309,6 +332,7 @@
|
||||
* rsshub link in mobile ([ac76cde](https://github.com/RSSNext/follow/commit/ac76cde0ca99e3f9ca842be84603f5bd6e5a0ad4))
|
||||
* **rsshub:** adjust table cell width ([ca8d19d](https://github.com/RSSNext/follow/commit/ca8d19dc394d7f9907a40834abcdd0e14ddc2b47))
|
||||
* scroll bar z index ([5057999](https://github.com/RSSNext/follow/commit/50579995367b871e84768c5983b3302f75f8e077)), closes [#1233](https://github.com/RSSNext/follow/issues/1233)
|
||||
* scroll header height ([c9bae94](https://github.com/RSSNext/follow/commit/c9bae9404beb0be74ffc7cfb1165f926a2af7174))
|
||||
* scroll out mark read logic ([eaecb25](https://github.com/RSSNext/follow/commit/eaecb252d322b5f2e8e89873523dfbe8d213848c))
|
||||
* scroll out to mark read in mobile ([a44d598](https://github.com/RSSNext/follow/commit/a44d59820ba7e62b5db9de478f813cd9f287f670))
|
||||
* scroll state for mobile float bar ([126206b](https://github.com/RSSNext/follow/commit/126206b995f47c17ed60c2a07296987dd0b8dc95))
|
||||
@@ -343,6 +367,7 @@
|
||||
* showArchivedButton in PictureMasonry ([07b075a](https://github.com/RSSNext/follow/commit/07b075ad4587919729790ca5747ba32d5e833cc1)), closes [#1583](https://github.com/RSSNext/follow/issues/1583)
|
||||
* sidebar copy feed url, fixed [#1361](https://github.com/RSSNext/follow/issues/1361) ([4e84196](https://github.com/RSSNext/follow/commit/4e841964e6573fa20ae214538b04dd0dc18a6f5e))
|
||||
* smooth step ([f32cda6](https://github.com/RSSNext/follow/commit/f32cda6240d474a51bbaaf0efc1baf2fe5f36d03))
|
||||
* sort action button position and select status ([1ec6c87](https://github.com/RSSNext/follow/commit/1ec6c8718aab9f6da0c8543f28d3bf4a13c26044))
|
||||
* **ssr-server:** fix hydrate data ([185bbe1](https://github.com/RSSNext/follow/commit/185bbe1dd9dd34335b3021766559338539b344a7))
|
||||
* **ssr-server:** minify code result should await ([1c5cd04](https://github.com/RSSNext/follow/commit/1c5cd0484636f1415c99c17feb39af2584486ee8))
|
||||
* **ssr-server:** try to hydrate date charset ([f21f3ee](https://github.com/RSSNext/follow/commit/f21f3ee33b82404ac6ffbecb2ef6542430ebbc3d))
|
||||
@@ -354,6 +379,7 @@
|
||||
* style for audio item ([7e4653f](https://github.com/RSSNext/follow/commit/7e4653f01cc987614843db06871b2d3bd30221f5))
|
||||
* **style:** add missing sticky border ([cff217a](https://github.com/RSSNext/follow/commit/cff217aeead10622e0982a7668f7d14eab53e1a7))
|
||||
* **styles:** radio group label margin ([c6deefc](https://github.com/RSSNext/follow/commit/c6deefc66167b7e8eb91bd565c2bac86eb8662a2))
|
||||
* support multiple route path, close [#2638](https://github.com/RSSNext/follow/issues/2638) ([bc88121](https://github.com/RSSNext/follow/commit/bc881218ade9fd9461e95034a84da8c3767aab3f))
|
||||
* sw register ([5bbfb2d](https://github.com/RSSNext/follow/commit/5bbfb2d4e23fb49dde949cbeffe2a2c748e21595))
|
||||
* sync active view after close sheet ([6f751a4](https://github.com/RSSNext/follow/commit/6f751a4a21796652d8cfc38b6209d7bfb4016ade))
|
||||
* sync unread when fetch unread ([196b717](https://github.com/RSSNext/follow/commit/196b717a7fbdd362d9c2128223272c6616363bc5))
|
||||
@@ -364,6 +390,7 @@
|
||||
* **tip-modal:** radio cards align center ([6f041f9](https://github.com/RSSNext/follow/commit/6f041f9ef9099090d9f995d152a4adb32a8e8848))
|
||||
* **toc:** fix text truncate in title line ([f9b1a61](https://github.com/RSSNext/follow/commit/f9b1a61c0185b449184b34df5f3a3869a4e722a4))
|
||||
* **toc:** should focus when toc item clicked ([f51dfdd](https://github.com/RSSNext/follow/commit/f51dfddc9ef40f4a7f226f32f9357e03a04f6ee0))
|
||||
* **TOTPForm:** focus to code after fail ([8be6c13](https://github.com/RSSNext/follow/commit/8be6c13a768eedfabd4a03edca7049a23c72ce2c))
|
||||
* translate form style ([6f3bb61](https://github.com/RSSNext/follow/commit/6f3bb61023dde1d58164425d8649c90bb4f680c6)), closes [#1184](https://github.com/RSSNext/follow/issues/1184)
|
||||
* **translations:** update zh-CN locale files for accuracy ([#1739](https://github.com/RSSNext/follow/issues/1739)) ([83c9f71](https://github.com/RSSNext/follow/commit/83c9f717dd7092dc4a4b1106961d746988066fd9))
|
||||
* tray icon appears small and blurry on Windows, Close [#2077](https://github.com/RSSNext/follow/issues/2077) ([#2461](https://github.com/RSSNext/follow/issues/2461)) ([b4edc42](https://github.com/RSSNext/follow/commit/b4edc426df34549dbb870b13ab3a8ca949eedd6b))
|
||||
@@ -388,6 +415,7 @@
|
||||
* **ui:** resolve conflict between video progress bar and swiper drag … ([#1337](https://github.com/RSSNext/follow/issues/1337)) ([aa9206f](https://github.com/RSSNext/follow/commit/aa9206f5b1e3ea0c008f912ef22cdaa406546251))
|
||||
* **ui:** use safe inset top to fix windows overlays, fixed [#1184](https://github.com/RSSNext/follow/issues/1184) ([dc85570](https://github.com/RSSNext/follow/commit/dc855703289ac98db76f4a57760fcd66047b8dd1))
|
||||
* **ui:** user profile follow button style ([d629215](https://github.com/RSSNext/follow/commit/d629215305a0ec9323dea0db929582e9609a82f6))
|
||||
* unescape, close [#2276](https://github.com/RSSNext/follow/issues/2276) ([e7e19a5](https://github.com/RSSNext/follow/commit/e7e19a5aa8689098d53d5901b1d51b368e5111f4))
|
||||
* update ([8dbd700](https://github.com/RSSNext/follow/commit/8dbd7003d3261d6a229ddfe627cb0bbd6bef217c))
|
||||
* update class names for responsive design and modify zh-HK ([#1782](https://github.com/RSSNext/follow/issues/1782)) ([70b46f5](https://github.com/RSSNext/follow/commit/70b46f57bf476df15216efd440899798e0e1fa0b))
|
||||
* update daily claim amount reference in tooltip ([#1487](https://github.com/RSSNext/follow/issues/1487)) ([3792c2d](https://github.com/RSSNext/follow/commit/3792c2d850d9fc3f96ea4591784b61c631ee7e86))
|
||||
@@ -397,6 +425,7 @@
|
||||
* update Japanese translations for user actions and login prompts ([#2188](https://github.com/RSSNext/follow/issues/2188)) ([88458bd](https://github.com/RSSNext/follow/commit/88458bd7a3e32854cd5b7b93f36c72f6cf3abac5))
|
||||
* update linkedom to version 0.18.6 ([#2185](https://github.com/RSSNext/follow/issues/2185)) ([faebe6c](https://github.com/RSSNext/follow/commit/faebe6c819cd0742470f8aebe9be5f978d3827e6))
|
||||
* update query key in SearchList component for improved data fetching ([77d73c2](https://github.com/RSSNext/follow/commit/77d73c2843c7d6e819177b67717da113dc81bac4))
|
||||
* update ScrollArea className for better width handling ([#2616](https://github.com/RSSNext/follow/issues/2616)) ([ca47409](https://github.com/RSSNext/follow/commit/ca47409a113b86dbc008c684ef19e14e544a4257))
|
||||
* update SupportCreator component styles for better layout ([351f342](https://github.com/RSSNext/follow/commit/351f34289fab89f9866405f8910e6226cb88ec87))
|
||||
* update tray icon path for windows and improve tray behavior ([#1511](https://github.com/RSSNext/follow/issues/1511)) ([3706874](https://github.com/RSSNext/follow/commit/3706874e42c215a84df71eae1c135a114be8985a))
|
||||
* update type ([5958ec1](https://github.com/RSSNext/follow/commit/5958ec18d81030ae8f9bb579df613a18689ac929))
|
||||
@@ -405,6 +434,7 @@
|
||||
* update zh-CN translations and remove unused setting ([#2132](https://github.com/RSSNext/follow/issues/2132)) ([0dcfde5](https://github.com/RSSNext/follow/commit/0dcfde5ea40d688eaf8acc9f15f7a298421a12f0))
|
||||
* **upgrade:** changelog container should w-full ([1551bf6](https://github.com/RSSNext/follow/commit/1551bf648c511cbf615f515b2e2d93077b0e42b4))
|
||||
* use babel to resolve ([045d6c7](https://github.com/RSSNext/follow/commit/045d6c7d069f0d4a56c1e399cd3c2aa0e9bd2721))
|
||||
* use electron store ([#2644](https://github.com/RSSNext/follow/issues/2644)) ([9f30194](https://github.com/RSSNext/follow/commit/9f30194db59e6be9f418e2ec63d5aeef8f9aac38))
|
||||
* use external link for login button ([d1975c2](https://github.com/RSSNext/follow/commit/d1975c20217290b2b7dc39866826c99f803dbd57))
|
||||
* use replace for discover form navigation ([63602f2](https://github.com/RSSNext/follow/commit/63602f266390781a3552a14eefa35455f19c92b6))
|
||||
* use turbo run concurrently task ([742f915](https://github.com/RSSNext/follow/commit/742f91517d87d136bc8dc6ee65008e9b6880d435))
|
||||
@@ -435,7 +465,9 @@
|
||||
* add confirmation for opening external apps ([#1618](https://github.com/RSSNext/follow/issues/1618)) ([08a1e76](https://github.com/RSSNext/follow/commit/08a1e76247b3c7ddeb7ef906a27f149e1a46e3d6))
|
||||
* add cookie to api fetch ([f5e1d33](https://github.com/RSSNext/follow/commit/f5e1d33e2a42f1ce44788ec65d51d54f66056f29))
|
||||
* add custom app delegate for tint color configuration ([#2579](https://github.com/RSSNext/follow/issues/2579)) ([6c28b4f](https://github.com/RSSNext/follow/commit/6c28b4f56ec2742b3e969a87750183e261f65d3d))
|
||||
* add default value for VITE_WEB_URL and remove VITE_IMGPROXY_URL ([8bbd8bf](https://github.com/RSSNext/follow/commit/8bbd8bf856c1a37e30978535aa597b44434fdf62))
|
||||
* add entry conditions for actions ([53810ba](https://github.com/RSSNext/follow/commit/53810badc1a7b37be6fd5c187c7a97428e85405f))
|
||||
* add entry list ([c052749](https://github.com/RSSNext/follow/commit/c0527491624305dc397d3b0c16b95efa99900f91))
|
||||
* add feed booster achievement with localization ([#1561](https://github.com/RSSNext/follow/issues/1561)) ([e769852](https://github.com/RSSNext/follow/commit/e7698526c2d51232cbdcb279aead6e473b7507a9))
|
||||
* add follow user button in profile modal ([#1147](https://github.com/RSSNext/follow/issues/1147)) ([7c60d5e](https://github.com/RSSNext/follow/commit/7c60d5e91dd4a21872217427bd99fe8eae688ce1))
|
||||
* add hydrate data type-safe helper ([cb6a65b](https://github.com/RSSNext/follow/commit/cb6a65b7cc1651d86b83b5b4089a7145cd59b0be))
|
||||
@@ -466,9 +498,15 @@
|
||||
* **app:** support cache limit and clean cache ([dee294d](https://github.com/RSSNext/follow/commit/dee294dda589ca9e2eaee8a7e55197635b6323c7))
|
||||
* **auth:** add credential provider icon and update email translation in login flow ([d9a2638](https://github.com/RSSNext/follow/commit/d9a26387c5a5715dee6512a1d2f2aad92bf0e0eb))
|
||||
* **auth:** enhance login modal with email login ([8bf9dd0](https://github.com/RSSNext/follow/commit/8bf9dd07e52e7188abfce7de990fb8b93d45711c))
|
||||
* basic entry data sync ([#2597](https://github.com/RSSNext/follow/issues/2597)) ([3479a89](https://github.com/RSSNext/follow/commit/3479a89b1faefc5a4bcac47d71716a80ede259ef))
|
||||
* basic masonry entry list and entry content view ([#2493](https://github.com/RSSNext/follow/issues/2493)) ([e569681](https://github.com/RSSNext/follow/commit/e569681198cabbfeb4c8133e421533c37b1fd96d))
|
||||
* bigger font size in mobile ([3e9a92d](https://github.com/RSSNext/follow/commit/3e9a92d16a80139c851671748367f009a3af4de9))
|
||||
* bigger view selector ([973c0d2](https://github.com/RSSNext/follow/commit/973c0d214d13313372c4ced0c68ec3c85db4ef4b))
|
||||
* bring rehypeUrlToAnchor back ([6f0cc4d](https://github.com/RSSNext/follow/commit/6f0cc4d566c9f2f552f0fedf1a8e570a817e0f56)), closes [#1373](https://github.com/RSSNext/follow/issues/1373)
|
||||
* checkLanguage utils ([225e470](https://github.com/RSSNext/follow/commit/225e470db84649bd23657d82b3c6a71b94cccc5f))
|
||||
* collection panel active button status ([a1676fc](https://github.com/RSSNext/follow/commit/a1676fc535430c3bd4c614a5261e3152e1bf2561))
|
||||
* collection panel active indicator ([c38677b](https://github.com/RSSNext/follow/commit/c38677bebf7e2874dc1d0c62f3a4333a988d033e))
|
||||
* collection panel styles ([9b5f4c2](https://github.com/RSSNext/follow/commit/9b5f4c27134e33fdc66a8158da2b3f8df1ffde99))
|
||||
* copy button for ai summary ([b3ee572](https://github.com/RSSNext/follow/commit/b3ee5727e29d809092a8f4631d3e13c8d81095b9))
|
||||
* copy profile email ([1e12588](https://github.com/RSSNext/follow/commit/1e1258811163d72ae36f29714eef5d50834c348b))
|
||||
* customizable columns for masonry view, closed [#1749](https://github.com/RSSNext/follow/issues/1749) ([0e0ce84](https://github.com/RSSNext/follow/commit/0e0ce843235f01f33f4c5b9708aa67dac5901b46))
|
||||
@@ -476,6 +514,7 @@
|
||||
* disable more line clamp for translation ([3c5dba4](https://github.com/RSSNext/follow/commit/3c5dba4d7aee870d1594e39a6e185622dff46abe))
|
||||
* discover rsshub card background use single color ([7eeea5e](https://github.com/RSSNext/follow/commit/7eeea5e694c142803a37564ef8886d4fc4d2dab4))
|
||||
* **discover:** enhance RSSHub recommendations with filters ([#1481](https://github.com/RSSNext/follow/issues/1481)) ([eb70126](https://github.com/RSSNext/follow/commit/eb70126b8283b6e0b246f86751e588a37cb34902))
|
||||
* **discover:** implement localized search results ([#2623](https://github.com/RSSNext/follow/issues/2623)) ([166e095](https://github.com/RSSNext/follow/commit/166e09563df97b0d23b495dbec38162f37e63083))
|
||||
* **discover:** implement searchable header and enhance UI with animated search bar ([2300996](https://github.com/RSSNext/follow/commit/2300996b87c2850f8f496bdd982e7ca8e5938d7f))
|
||||
* **discover:** improve trending style and discover no image placeholer ([86be1a2](https://github.com/RSSNext/follow/commit/86be1a2e46d3298157cece0731e687a462f833d5))
|
||||
* dnd ([#1471](https://github.com/RSSNext/follow/issues/1471)) ([c9333d5](https://github.com/RSSNext/follow/commit/c9333d5004c170955ab96b9f7f5a2825e1042271))
|
||||
@@ -488,6 +527,7 @@
|
||||
* enhance input fields for numeric entry ([00a0764](https://github.com/RSSNext/follow/commit/00a07647f830cb3cbb4acd5234d25d45d08298cb))
|
||||
* enhance SocialMediaItem component with dynamic title styling and action bar positioning ([5d2fe70](https://github.com/RSSNext/follow/commit/5d2fe70b52a857c16ed7220fc36ecd5111f8cd4d))
|
||||
* enhance tab layout and settings screen functionality ([f17446d](https://github.com/RSSNext/follow/commit/f17446d027f5528c1258a38de6cfc10d3fed43c8))
|
||||
* enhance tab screen with blur effect and update action buttons ([13cdee0](https://github.com/RSSNext/follow/commit/13cdee04dc6c99b875be2a5262ff941af59f83f2))
|
||||
* enhance table with new translations and tooltip for descriptions ([#2471](https://github.com/RSSNext/follow/issues/2471)) ([99011eb](https://github.com/RSSNext/follow/commit/99011ebcf2cd3c4096520394537bb97b5ea08865))
|
||||
* entry image gallery modal ([e0d3e17](https://github.com/RSSNext/follow/commit/e0d3e17da4ee17217d7b78871b546f43af87d893))
|
||||
* export database ([85b4502](https://github.com/RSSNext/follow/commit/85b4502f9c113b8de73ccf4a167aa514a3c149ea))
|
||||
@@ -499,7 +539,9 @@
|
||||
* fold the long text content of social media ([e46b30a](https://github.com/RSSNext/follow/commit/e46b30a07fe74e1bacb234962b1542c849d2177d))
|
||||
* folder mode option for export, close [#874](https://github.com/RSSNext/follow/issues/874) ([db3db14](https://github.com/RSSNext/follow/commit/db3db14e5dc5e4e7b132b2aa6b47d375eb789d3a))
|
||||
* full width rsshub page ([f9c7e55](https://github.com/RSSNext/follow/commit/f9c7e55ef9411cb5021ffd81bf6aeb9bfe132ab3))
|
||||
* get video preview url from attachments ([127ccae](https://github.com/RSSNext/follow/commit/127ccae3f7698af3c33f0c4f2145480ca27024a0))
|
||||
* hide trend ([2b92599](https://github.com/RSSNext/follow/commit/2b92599e18d3d33fd0371d4d3a5f3e3a6d94aeb6))
|
||||
* hideable header bottom ([b0012c1](https://github.com/RSSNext/follow/commit/b0012c1d913925c84aa969c3a13766fe7d90fe5b))
|
||||
* html render for native ([#2346](https://github.com/RSSNext/follow/issues/2346)) ([313ad9b](https://github.com/RSSNext/follow/commit/313ad9b7db7bbcf47be78b127c866849a61b1c8d))
|
||||
* **i18n:** added multiple text translations (zh-TW) ([#1621](https://github.com/RSSNext/follow/issues/1621)) ([a15f23a](https://github.com/RSSNext/follow/commit/a15f23a5c7bb697c75c7fecf8603612b2584baa8))
|
||||
* **i18n:** discover categories and mark all read undo button ([#1506](https://github.com/RSSNext/follow/issues/1506)) ([06bdf6c](https://github.com/RSSNext/follow/commit/06bdf6cfb90b03e1624189ebc05a389495e8bedc))
|
||||
@@ -511,6 +553,7 @@
|
||||
* improve email verification display ([#2424](https://github.com/RSSNext/follow/issues/2424)) ([ebc6c4f](https://github.com/RSSNext/follow/commit/ebc6c4fdb6773f2b7d94b81b839a3a338787c4b3))
|
||||
* **infra:** electron app can hot update renderer layer ([#1209](https://github.com/RSSNext/follow/issues/1209)) ([ca4751a](https://github.com/RSSNext/follow/commit/ca4751acd275579614a477d133ed643fca3fbf1a))
|
||||
* integrate LoadingContainer ([834dff8](https://github.com/RSSNext/follow/commit/834dff8d91406eeb56b035e2da9f9d6e3a853850))
|
||||
* integrate react-native-uikit-colors for improved theming and UI consistency ([f947bd1](https://github.com/RSSNext/follow/commit/f947bd1d1ec2d91e05264c77c5c03f9de5fec6fb))
|
||||
* integrate react-query for fetching unread feed items by view ([d4dd4fb](https://github.com/RSSNext/follow/commit/d4dd4fb68d5a1cebdaeeea1aff88c2fbe2fba5e9))
|
||||
* **integration:** add outline integration ([#1229](https://github.com/RSSNext/follow/issues/1229)) ([0d0266b](https://github.com/RSSNext/follow/commit/0d0266b25189a74efdc63ce0062f3a379d4a0729))
|
||||
* **integration:** Add readeck integration ([#1972](https://github.com/RSSNext/follow/issues/1972)) ([1ce3f5b](https://github.com/RSSNext/follow/commit/1ce3f5b8ba95b16ad1b12e702027cede3590491a))
|
||||
@@ -521,12 +564,15 @@
|
||||
* **locales:** enhance zh-HK locale with new user prompts ([#2556](https://github.com/RSSNext/follow/issues/2556)) ([6828606](https://github.com/RSSNext/follow/commit/6828606cc42445f46df9fddb9b547fd1e05e68f6))
|
||||
* **locales:** enhance zh-HK translations ([#2208](https://github.com/RSSNext/follow/issues/2208)) ([2ecd89f](https://github.com/RSSNext/follow/commit/2ecd89ffde7a24580fb879192abdfa7ff95c6988))
|
||||
* **locales:** update Japanese translations for RSSHub and related settings ([#2474](https://github.com/RSSNext/follow/issues/2474)) ([6ed05ce](https://github.com/RSSNext/follow/commit/6ed05cea8bff558930a94c0742abb3d350580e54))
|
||||
* **locales:** update Japanese translations for search results and two-factor authentication ([#2628](https://github.com/RSSNext/follow/issues/2628)) ([6fae018](https://github.com/RSSNext/follow/commit/6fae0189f2bdcc73991fcee94595d94712bbaa2b))
|
||||
* **locales:** update zh-TW translations ([#2290](https://github.com/RSSNext/follow/issues/2290)) ([f734e6c](https://github.com/RSSNext/follow/commit/f734e6cfa3348f8906b48cbae8188531fd266e5e))
|
||||
* **locales:** update zh-TW translations ([#2446](https://github.com/RSSNext/follow/issues/2446)) ([dbae887](https://github.com/RSSNext/follow/commit/dbae887df1fd23a92593682d74907d3851fdf183))
|
||||
* **locales:** update zh-TW translations ([#2522](https://github.com/RSSNext/follow/issues/2522)) ([5780aea](https://github.com/RSSNext/follow/commit/5780aea3a4f1d2da1389a1140008a402498db82c))
|
||||
* **locales:** update zh-TW translations ([#2621](https://github.com/RSSNext/follow/issues/2621)) ([11828ea](https://github.com/RSSNext/follow/commit/11828ea9276e5cbbf77f4a4c5538fc865abb2872))
|
||||
* manual action ([#1867](https://github.com/RSSNext/follow/issues/1867)) ([0eedbba](https://github.com/RSSNext/follow/commit/0eedbbadc263b474e2d4bfd5b6c498ac39c16c34))
|
||||
* manually link social account ([fd373fb](https://github.com/RSSNext/follow/commit/fd373fb5271e4d9a31e37d49830d3fe3d4927922))
|
||||
* **mark-all-button:** add countdown to auto-confirm message ([#1414](https://github.com/RSSNext/follow/issues/1414)) ([e1a5fc6](https://github.com/RSSNext/follow/commit/e1a5fc63f20c941140071789c9b67685da19ea5c))
|
||||
* merge actions for toggling state ([#2617](https://github.com/RSSNext/follow/issues/2617)) ([364d23f](https://github.com/RSSNext/follow/commit/364d23f7294826c4af4d8c2ff150862e33b21028))
|
||||
* merge redirect page into login page ([2fa16b7](https://github.com/RSSNext/follow/commit/2fa16b75d376fe04472e6c91675c67e725da8633))
|
||||
* migrate to better auth ([#1951](https://github.com/RSSNext/follow/issues/1951)) ([9102203](https://github.com/RSSNext/follow/commit/910220395631bcf86f56bfc2b2168ac95852444c))
|
||||
* mobile app architecture and initial screens ([#2144](https://github.com/RSSNext/follow/issues/2144)) ([4b6a0fc](https://github.com/RSSNext/follow/commit/4b6a0fca2e3243061c7befc837e705262f17b664))
|
||||
@@ -563,14 +609,26 @@
|
||||
* reset feed ([#1419](https://github.com/RSSNext/follow/issues/1419)) ([9066758](https://github.com/RSSNext/follow/commit/9066758c322b8b31c1a9a137be017283fa92bea8))
|
||||
* **rn-component:** implement toast manager ([950b5af](https://github.com/RSSNext/follow/commit/950b5af8ec0316875ed3ce5a99baaaecb56c6d37))
|
||||
* **rn-component:** refactor context menu for ios ([4bae36a](https://github.com/RSSNext/follow/commit/4bae36ae70e5ce7c60eec385873f943976e798f1))
|
||||
* **rn-list:** manage list ([e3baee3](https://github.com/RSSNext/follow/commit/e3baee39865adb7960c07b648bcb3a22651d4af8))
|
||||
* **rn-list:** support list delete ([44c6fd0](https://github.com/RSSNext/follow/commit/44c6fd04c1c997c75a9bd7d39c7a02accd762d93))
|
||||
* **rn-modal:** apply modal header blur effect ([ccd1978](https://github.com/RSSNext/follow/commit/ccd19789064e31c3b1f979f516795172a2e787e6))
|
||||
* **rn-profile:** update profile share ([7c1fa69](https://github.com/RSSNext/follow/commit/7c1fa69d91fc0d1713051c541f788762f6cbbbdc))
|
||||
* **rn-search:** impl search feeds and list view ([f747882](https://github.com/RSSNext/follow/commit/f747882565fd474c0bf9cbab7b4a08a033e6386f))
|
||||
* **rn-settings:** impl about page ([fd042e9](https://github.com/RSSNext/follow/commit/fd042e93cba16582e6029d680cf2bc2229ef9d5b))
|
||||
* **rn-settings:** impl data settings ([a031ac3](https://github.com/RSSNext/follow/commit/a031ac3f5ea70a11d6c3604f11b608f9155b165d))
|
||||
* **rn-settings:** impl gerenate settings ([203c253](https://github.com/RSSNext/follow/commit/203c253522be14016b335ae3e8598f39de809eb6))
|
||||
* **rn-settings:** impl ui settings ([3475b74](https://github.com/RSSNext/follow/commit/3475b740d5861d9024dadf27a9306d03dfb607f6))
|
||||
* **rn-settings:** Improve UI settings, modify the style of the setting lists ([eddc7cd](https://github.com/RSSNext/follow/commit/eddc7cde21d6a3252227899d77251ee752fc9f13))
|
||||
* **rn/search:** implement search tabview ([0ab3ba9](https://github.com/RSSNext/follow/commit/0ab3ba9a3eff93cee0983928a66467a327a7d3b9))
|
||||
* **rn:** add login teams ([aef9406](https://github.com/RSSNext/follow/commit/aef9406defdde43874945fd92ed422f53ed669fc))
|
||||
* **rn:** adjust login page styles ([0fc90c7](https://github.com/RSSNext/follow/commit/0fc90c7c280e8d1eb170a5aca2374d1bd29d3b97))
|
||||
* **rn:** feed form and subscribe ([f9d5d76](https://github.com/RSSNext/follow/commit/f9d5d7698c0a3b498684468abf4ce50b3c223390))
|
||||
* **rn:** fix dismiss modal when follow done ([468a3e4](https://github.com/RSSNext/follow/commit/468a3e490a7c0c3424b721011f2dc72503ba479f))
|
||||
* **rn:** follow modal form ([9beff37](https://github.com/RSSNext/follow/commit/9beff379f621e7756d55c4b6b7c0d3a9a6b1fecd))
|
||||
* **rn:** impl ios style SwipeableItem ([6025f8a](https://github.com/RSSNext/follow/commit/6025f8a6c142783757cf2d6d32f3f43c2330c00b))
|
||||
* **rn:** impl list setting pages ([c18da69](https://github.com/RSSNext/follow/commit/c18da69de1208f717fdb7fc4764d8057e72050e6))
|
||||
* **rn:** impl markdown component for rn ([93b38a7](https://github.com/RSSNext/follow/commit/93b38a7c70dda2e934a424995bb07e24bdefd2ac))
|
||||
* **rn:** impl user profile page ([676f971](https://github.com/RSSNext/follow/commit/676f9718fba55f6e78c8c3477c3ab4f16d14ed4d))
|
||||
* **rn:** implement feed drawer ([#2443](https://github.com/RSSNext/follow/issues/2443)) ([b581393](https://github.com/RSSNext/follow/commit/b581393c9aeccb15f1c3e7265273538eb055d140))
|
||||
* **rn:** implement search list ([01122c9](https://github.com/RSSNext/follow/commit/01122c9480a56b5bd3a90d347d787f080ff6d754))
|
||||
* **rn:** implements discover page ([#2385](https://github.com/RSSNext/follow/issues/2385)) ([66f97c0](https://github.com/RSSNext/follow/commit/66f97c0057f571717b3b33929baf5a13fc7e677c))
|
||||
@@ -591,11 +649,13 @@
|
||||
* rsshub logo ([7233a58](https://github.com/RSSNext/follow/commit/7233a58ca7d08635e3aab07c7b7dd6201d128425))
|
||||
* rsshub status api ([38a6f99](https://github.com/RSSNext/follow/commit/38a6f990e922e0010ea48ea7be743f06cd7ed7ca))
|
||||
* rsshub use modal ([5252f97](https://github.com/RSSNext/follow/commit/5252f97617d9ff31b99b4923f57b96b100436332))
|
||||
* **rsshub:** add minimum value to input field ([#2572](https://github.com/RSSNext/follow/issues/2572)) ([4d6a5a2](https://github.com/RSSNext/follow/commit/4d6a5a2acac43f5dee31623e76c78bc5c8e40043))
|
||||
* Scroll to top when re-navigating to Discover page while already on it ([#2371](https://github.com/RSSNext/follow/issues/2371)) ([a59cf4a](https://github.com/RSSNext/follow/commit/a59cf4a4cffa51edd5e8da5008e38d8476535404))
|
||||
* **search:** enhance search components with new styles and functionality ([0227427](https://github.com/RSSNext/follow/commit/0227427d295cf8f7e8a5b04ff396929b3d18e052))
|
||||
* separate packaging for macOS x64 and arm64 architectures ([#1389](https://github.com/RSSNext/follow/issues/1389)) ([3e8de30](https://github.com/RSSNext/follow/commit/3e8de308a3b3a07c58ab3fd7d26aad5aa2328c99))
|
||||
* set default unreadOnly to true ([8c8c765](https://github.com/RSSNext/follow/commit/8c8c765ff518b6ccc6457959fdf3fe8a4ddeee22))
|
||||
* **settings:** clean web app service worker cache ([8ad40c0](https://github.com/RSSNext/follow/commit/8ad40c004ef2bf8924e2362729f42be83c09d102))
|
||||
* **settings:** enhance settings screen with animated header and blur effect ([0014aeb](https://github.com/RSSNext/follow/commit/0014aebd4e84b9ae440f8b9b2af838ccf7ad951d))
|
||||
* show progress in searching ([e592e97](https://github.com/RSSNext/follow/commit/e592e97c9e0e6da8451c09b9b5f27612e6dbb971)), closes [#1457](https://github.com/RSSNext/follow/issues/1457)
|
||||
* smaller debug button ([3ef5dea](https://github.com/RSSNext/follow/commit/3ef5dea5d190ef81e91ae936f3d6c84898c569ac))
|
||||
* **social:** improve image gallery grid ([5dc6d9e](https://github.com/RSSNext/follow/commit/5dc6d9ee227fa714f39957ff6e744e3079a3e57d))
|
||||
@@ -623,6 +683,8 @@
|
||||
* use FeedTitle ([73d2c30](https://github.com/RSSNext/follow/commit/73d2c30416ad3f2da626db003996c0fb036025ac))
|
||||
* use non https debug host ([61d3ed4](https://github.com/RSSNext/follow/commit/61d3ed49b817997b8e7876efda2c0e29b08f9c4b))
|
||||
* **ux:** support native space key to page down, fixed [#1121](https://github.com/RSSNext/follow/issues/1121) ([baa66fe](https://github.com/RSSNext/follow/commit/baa66feaf19416d2b9e5efe6b79f6af1b3966404))
|
||||
* view selector ([0c29f27](https://github.com/RSSNext/follow/commit/0c29f278e6ea42d36f6f9bc22ea368144e7361dc))
|
||||
* view selector in entry list ([d565cb8](https://github.com/RSSNext/follow/commit/d565cb80c53ffc14e51f7bab27d721610b40de79))
|
||||
* web push ([cd32115](https://github.com/RSSNext/follow/commit/cd3211587109d0bf3e762df128356708fcea24b1))
|
||||
* withdraw as rss3 ([5af9cf5](https://github.com/RSSNext/follow/commit/5af9cf5ec7767ea440b85afbc8ad46dd283c4dc6))
|
||||
* zen mode and hide extra badge ([7ba07ad](https://github.com/RSSNext/follow/commit/7ba07adff1e7cd3292cc308f3e70803fe11fb8ce))
|
||||
@@ -636,6 +698,7 @@
|
||||
* enable router navigation transition ([24e1aea](https://github.com/RSSNext/follow/commit/24e1aead5e9bbb98b59194166fa4fd07eb167353))
|
||||
* **external:** hydrate auth providers ([e0661ff](https://github.com/RSSNext/follow/commit/e0661ff2b9cc76f1a86ba6f293c0c37b5ad8d789))
|
||||
* **external:** hydrate auth providers ([efcbecb](https://github.com/RSSNext/follow/commit/efcbecbd94dc7009364f59c8945d08dc3ecc47b0))
|
||||
* improve header blur effect ([527f6ac](https://github.com/RSSNext/follow/commit/527f6ac8b5efdbf17c189bc82bee197bb9c25370))
|
||||
* lazy show action, reduce lcp time ([fcf775c](https://github.com/RSSNext/follow/commit/fcf775c976591258f83dea6e34ca3161b539b15e))
|
||||
* modify some animations to CSS animations ([9ec3fe5](https://github.com/RSSNext/follow/commit/9ec3fe562bf3527ad4279a9a57c0b0bb5934dba1))
|
||||
* optimize dnd re-render ([12bd659](https://github.com/RSSNext/follow/commit/12bd6594585fda9f7b83daad7f6eebae3059d985))
|
||||
@@ -649,6 +712,7 @@
|
||||
|
||||
### Reverts
|
||||
|
||||
* Revert "chore: update" ([8a13db9](https://github.com/RSSNext/follow/commit/8a13db9d6d8169ff14ae597068e74375a2dcc1aa))
|
||||
* Revert "docs: fix video preview" ([8499079](https://github.com/RSSNext/follow/commit/8499079e503ad8cfc35e390755cec159f9eb3b7a))
|
||||
* Revert "build: use pnpm catalogs" ([37164a3](https://github.com/RSSNext/follow/commit/37164a3674fa0bdf5b10919e788142a3d1b1cce3))
|
||||
* Revert "perf: reduce the number of items rendered on the first render" ([9e45d04](https://github.com/RSSNext/follow/commit/9e45d0441ef16fb334af555c22276f7d77a72733)), closes [#1659](https://github.com/RSSNext/follow/issues/1659)
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
"electron-context-menu": "4.0.4",
|
||||
"electron-log": "5.2.4",
|
||||
"electron-squirrel-startup": "1.0.1",
|
||||
"electron-store": "^10.0.0",
|
||||
"electron-updater": "^6.3.9",
|
||||
"es-toolkit": "1.29.0",
|
||||
"fast-folder-size": "2.3.0",
|
||||
@@ -53,6 +54,7 @@
|
||||
"vscode-languagedetection": "npm:@vscode/vscode-languagedetection@^1.0.22"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@follow/types": "workspace:*",
|
||||
"@types/js-yaml": "4.0.9",
|
||||
"@types/node": "^22.10.1",
|
||||
"electron": "33.2.0",
|
||||
|
||||
@@ -18,8 +18,8 @@ const detectingWindows11 = () => {
|
||||
if (!isWindows) return false
|
||||
|
||||
const release = os.release()
|
||||
const majorVersion = Number.parseInt(release.split(".")[0])
|
||||
const buildNumber = Number.parseInt(release.split(".")[2])
|
||||
const majorVersion = Number.parseInt(release.split(".")[0]!)
|
||||
const buildNumber = Number.parseInt(release.split(".")[2]!)
|
||||
|
||||
return majorVersion === 10 && buildNumber >= 22000
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@ const detectingWindows11 = () => {
|
||||
if (!isWindows) return false
|
||||
|
||||
const release = os.release()
|
||||
const majorVersion = Number.parseInt(release.split(".")[0])
|
||||
const buildNumber = Number.parseInt(release.split(".")[2])
|
||||
const majorVersion = Number.parseInt(release.split(".")[0]!)
|
||||
const buildNumber = Number.parseInt(release.split(".")[2]!)
|
||||
|
||||
return majorVersion === 10 && buildNumber >= 22000
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import { env } from "@follow/shared/env"
|
||||
import { imageRefererMatches, selfRefererMatches } from "@follow/shared/image"
|
||||
import { parse } from "cookie-es"
|
||||
import { app, BrowserWindow, session } from "electron"
|
||||
import type { Cookie } from "electron/main"
|
||||
import squirrelStartup from "electron-squirrel-startup"
|
||||
|
||||
import { DEVICE_ID } from "./constants/system"
|
||||
@@ -77,7 +76,7 @@ function bootstrap() {
|
||||
mainWindow = createMainWindow()
|
||||
|
||||
// restore cookies
|
||||
const cookies = store.get("cookies") as Cookie[]
|
||||
const cookies = store.get("cookies")
|
||||
if (cookies) {
|
||||
Promise.all(
|
||||
cookies.map((cookie) => {
|
||||
@@ -109,7 +108,7 @@ function bootstrap() {
|
||||
userAgent = userAgent.replace(/\s?Electron\/[\d.]+/, "")
|
||||
userAgent = userAgent.replace(/\s?Follow\/[\d.a-zA-Z-]+/, "")
|
||||
}
|
||||
details.requestHeaders["User-Agent"] = userAgent
|
||||
details.requestHeaders["User-Agent"] = userAgent!
|
||||
|
||||
// set referer and origin
|
||||
if (selfRefererMatches.some((item) => details.url.startsWith(item))) {
|
||||
|
||||
@@ -20,7 +20,7 @@ import { initializeSentry } from "./sentry"
|
||||
import { router } from "./tipc"
|
||||
import { createMainWindow, getMainWindow } from "./window"
|
||||
|
||||
if (process.argv.length === 3 && process.argv[2].startsWith("follow-dev:")) {
|
||||
if (process.argv.length === 3 && process.argv[2]!.startsWith("follow-dev:")) {
|
||||
process.env.NODE_ENV = "development"
|
||||
}
|
||||
const isDev = process.env.NODE_ENV === "development"
|
||||
@@ -36,7 +36,7 @@ export const initializeAppStage1 = () => {
|
||||
if (process.defaultApp) {
|
||||
if (process.argv.length >= 2) {
|
||||
app.setAsDefaultProtocolClient(APP_PROTOCOL, process.execPath, [
|
||||
path.resolve(process.argv[1]),
|
||||
path.resolve(process.argv[1]!),
|
||||
])
|
||||
}
|
||||
} else {
|
||||
@@ -150,7 +150,7 @@ const registerPushNotifications = async () => {
|
||||
debug: true,
|
||||
firebase: JSON.parse(env.VITE_FIREBASE_CONFIG),
|
||||
persistentIds: persistentIds || [],
|
||||
credentials: credentials || null,
|
||||
credentials: credentials || undefined,
|
||||
bundleId: "is.follow",
|
||||
chromeId: "is.follow",
|
||||
})
|
||||
|
||||
@@ -25,7 +25,7 @@ export const setProxyConfig = (inputProxy: string) => {
|
||||
}
|
||||
|
||||
export const getProxyConfig = () => {
|
||||
const proxyConfig = store.get("proxy") as string | undefined
|
||||
const proxyConfig = store.get("proxy")
|
||||
if (!proxyConfig) {
|
||||
return
|
||||
}
|
||||
@@ -40,7 +40,7 @@ const normalizeProxyUri = (userProxy: string) => {
|
||||
return
|
||||
}
|
||||
// Only use the first proxy if there are multiple urls
|
||||
const firstInput = userProxy.split(",")[0]
|
||||
const firstInput = userProxy.split(",")[0]!
|
||||
|
||||
try {
|
||||
const proxyUrl = new URL(firstInput)
|
||||
|
||||
+21
-33
@@ -1,39 +1,27 @@
|
||||
import { resolve } from "node:path"
|
||||
import type { Credentials } from "@eneris/push-receiver/dist/types"
|
||||
import type { Cookie } from "electron"
|
||||
import Store from "electron-store"
|
||||
|
||||
import { app } from "electron"
|
||||
import { JSONFileSyncPreset } from "lowdb/node"
|
||||
|
||||
let db: {
|
||||
data: Record<string, unknown>
|
||||
write: () => void
|
||||
read: () => void
|
||||
}
|
||||
|
||||
const createOrGetDb = () => {
|
||||
if (!db) {
|
||||
db = JSONFileSyncPreset(resolve(app.getPath("userData"), "db.json"), {}) as typeof db
|
||||
}
|
||||
return db
|
||||
// @keep-sorted
|
||||
type StoreData = {
|
||||
"notifications-credentials"?: Credentials | null
|
||||
"notifications-persistent-ids"?: string[] | null
|
||||
appearance?: "light" | "dark" | "system" | null
|
||||
betterAuthSessionCookie?: string | null
|
||||
cacheSizeLimit?: number | null
|
||||
cookies?: Cookie[] | null
|
||||
minimizeToTray?: boolean | null
|
||||
proxy?: string | null
|
||||
user?: string | null
|
||||
windowState?: {
|
||||
height: number
|
||||
width: number
|
||||
x: number
|
||||
y: number
|
||||
} | null
|
||||
}
|
||||
export const store = new Store<StoreData>({ name: "db" })
|
||||
|
||||
export enum StoreKey {
|
||||
CacheSizeLimit = "cacheSizeLimit",
|
||||
}
|
||||
|
||||
export const store = {
|
||||
get: (key: string) => {
|
||||
const db = createOrGetDb()
|
||||
|
||||
return db.data[key] as any
|
||||
},
|
||||
set: (key: string, value: any) => {
|
||||
const db = createOrGetDb()
|
||||
db.data[key] = value
|
||||
db.write()
|
||||
},
|
||||
delete: (key: string) => {
|
||||
const db = createOrGetDb()
|
||||
delete db.data[key]
|
||||
db.write()
|
||||
},
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ const destroyAppTray = () => {
|
||||
|
||||
const DEFAULT_MINIMIZE_TO_TRAY = isMacOS ? false : true
|
||||
|
||||
export const getTrayConfig = (): boolean => store.get("minimizeToTray") ?? DEFAULT_MINIMIZE_TO_TRAY
|
||||
export const getTrayConfig = () => store.get("minimizeToTray") ?? DEFAULT_MINIMIZE_TO_TRAY
|
||||
|
||||
export const setTrayConfig = (input: boolean) => {
|
||||
store.set("minimizeToTray", input)
|
||||
|
||||
@@ -8,7 +8,7 @@ import { store } from "./store"
|
||||
|
||||
const BetterAuthKey = "betterAuthSessionCookie"
|
||||
export const setBetterAuthSessionCookie = (cookie: string) => store.set(BetterAuthKey, cookie)
|
||||
export const getBetterAuthSessionCookie = (): string | null => store.get(BetterAuthKey)
|
||||
export const getBetterAuthSessionCookie = () => store.get(BetterAuthKey)
|
||||
export const cleanBetterAuthSessionCookie = () => store.set(BetterAuthKey, null)
|
||||
|
||||
const UserKey = "user"
|
||||
|
||||
@@ -7,7 +7,7 @@ export function refreshBound(window: BrowserWindow, timeout = 0) {
|
||||
setTimeout(() => {
|
||||
// FIXME: workaround for theme bug in full screen mode
|
||||
const size = window?.getSize()
|
||||
window?.setSize(size[0] + 1, size[1] + 1)
|
||||
window?.setSize(size[0], size[1])
|
||||
window?.setSize(size[0]! + 1, size[1]! + 1)
|
||||
window?.setSize(size[0]!, size[1]!)
|
||||
}, timeout)
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ export const detectCodeStringLanguage = async function* (codeString: string) {
|
||||
logger.debug("no model results", codeString)
|
||||
return
|
||||
}
|
||||
const firstModelResult = adjustLanguageConfidence(modelResults[0])
|
||||
const firstModelResult = adjustLanguageConfidence(modelResults[0]!)
|
||||
if (firstModelResult.confidence < expectedRelativeConfidence) {
|
||||
logger.debug("first model result confidence is less than expected relative confidence")
|
||||
return
|
||||
|
||||
@@ -29,14 +29,32 @@ export const readerRoute = {
|
||||
.input<{
|
||||
id: string
|
||||
text: string
|
||||
voice: string
|
||||
}>()
|
||||
.action(async ({ input }) => {
|
||||
const { id, text } = input
|
||||
|
||||
.action(async ({ input, context: { sender } }) => {
|
||||
const { id, text, voice } = input
|
||||
if (!text) {
|
||||
return null
|
||||
}
|
||||
|
||||
const window = BrowserWindow.fromWebContents(sender)
|
||||
if (!window) return
|
||||
|
||||
// It's ok to set voice every time, because it will be cached by msedge-tts
|
||||
await tts
|
||||
.setMetadata(voice, OUTPUT_FORMAT.WEBM_24KHZ_16BIT_MONO_OPUS)
|
||||
.catch((error: unknown) => {
|
||||
console.error("Failed to set voice", error)
|
||||
if (error instanceof Error) {
|
||||
return callWindowExpose(window).toast.error(error.message, {
|
||||
duration: 1000,
|
||||
})
|
||||
}
|
||||
return callWindowExpose(window).toast.error("Failed to set voice", {
|
||||
duration: 1000,
|
||||
})
|
||||
})
|
||||
|
||||
const filePath = path.join(app.getPath("userData"), `${id}.webm`)
|
||||
if (fs.existsSync(filePath)) {
|
||||
return filePath
|
||||
@@ -62,25 +80,6 @@ export const readerRoute = {
|
||||
}
|
||||
}),
|
||||
|
||||
setVoice: t.procedure.input<string>().action(async ({ input, context: { sender } }) => {
|
||||
const window = BrowserWindow.fromWebContents(sender)
|
||||
if (!window) return
|
||||
|
||||
await tts
|
||||
.setMetadata(input, OUTPUT_FORMAT.WEBM_24KHZ_16BIT_MONO_OPUS)
|
||||
.catch((error: unknown) => {
|
||||
console.error("Failed to set voice", error)
|
||||
if (error instanceof Error) {
|
||||
return callWindowExpose(window).toast.error(error.message, {
|
||||
duration: 1000,
|
||||
})
|
||||
}
|
||||
return callWindowExpose(window).toast.error("Failed to set voice", {
|
||||
duration: 1000,
|
||||
})
|
||||
})
|
||||
}),
|
||||
|
||||
detectCodeStringLanguage: t.procedure
|
||||
.input<{ codeString: string }>()
|
||||
.action(async ({ input }) => {
|
||||
|
||||
@@ -87,7 +87,7 @@ export class CustomGitHubProvider extends BaseGitHubProvider<GithubUpdateInfo> {
|
||||
if (hrefElement === null) continue
|
||||
|
||||
// This Release's Tag
|
||||
const hrefTag = hrefElement[1]
|
||||
const hrefTag = hrefElement[1]!
|
||||
// Get Channel from this release's tag
|
||||
// If it is null, we believe it is stable version
|
||||
const hrefChannel = (semver.prerelease(hrefTag)?.[0] as string) || "stable"
|
||||
|
||||
@@ -40,7 +40,7 @@ const getLatestReleaseTag = async () => {
|
||||
|
||||
// Search the top nightly release
|
||||
const nightlyRelease = json.find((item) => item.prerelease)
|
||||
if (!nightlyRelease) return json[0].tag_name
|
||||
if (!nightlyRelease) return json[0]!.tag_name
|
||||
return nightlyRelease.tag_name
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,12 +222,7 @@ export function createWindow(
|
||||
}
|
||||
export const windowStateStoreKey = "windowState"
|
||||
export const createMainWindow = () => {
|
||||
const windowState = store.get(windowStateStoreKey) as {
|
||||
height: number
|
||||
width: number
|
||||
x: number
|
||||
y: number
|
||||
} | null
|
||||
const windowState = store.get(windowStateStoreKey)
|
||||
const primaryDisplay = screen.getPrimaryDisplay()
|
||||
const { workArea } = primaryDisplay
|
||||
|
||||
|
||||
@@ -3,11 +3,13 @@
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"outDir": "dist",
|
||||
"types": ["electron-vite/node"],
|
||||
"types": ["electron-vite/node", "@follow/types/vite"],
|
||||
"moduleResolution": "Bundler",
|
||||
"noImplicitReturns": false,
|
||||
"noUnusedLocals": false,
|
||||
"noUnusedParameters": false,
|
||||
"noUncheckedIndexedAccess": true,
|
||||
"noImplicitOverride": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@pkg": ["../../package.json"],
|
||||
|
||||
@@ -2,12 +2,14 @@ import { resolve } from "node:path"
|
||||
|
||||
import type { ConfigContext, ExpoConfig } from "expo/config"
|
||||
|
||||
import PKG from "./package.json"
|
||||
|
||||
// const roundedIconPath = resolve(__dirname, "../../resources/icon.png")
|
||||
const iconPath = resolve(__dirname, "./assets/icon.png")
|
||||
const adaptiveIconPath = resolve(__dirname, "./assets/adaptive-icon.png")
|
||||
|
||||
export default ({ config }: ConfigContext): ExpoConfig => ({
|
||||
...config,
|
||||
|
||||
extra: {
|
||||
eas: {
|
||||
projectId: "a6335b14-fb84-45aa-ba80-6f6ab8926920",
|
||||
@@ -23,7 +25,7 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
|
||||
|
||||
name: "Follow",
|
||||
slug: "follow",
|
||||
version: "1.0.0",
|
||||
version: process.env.NODE_ENV === "development" ? "dev" : PKG.version,
|
||||
orientation: "portrait",
|
||||
icon: iconPath,
|
||||
scheme: "follow",
|
||||
@@ -50,6 +52,13 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
|
||||
favicon: iconPath,
|
||||
},
|
||||
plugins: [
|
||||
[
|
||||
"expo-document-picker",
|
||||
{
|
||||
iCloudContainerEnvironment: "Production",
|
||||
},
|
||||
],
|
||||
"expo-localization",
|
||||
[
|
||||
"expo-router",
|
||||
{
|
||||
@@ -65,6 +74,8 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
|
||||
},
|
||||
},
|
||||
],
|
||||
"expo-build-properties",
|
||||
"expo-sqlite",
|
||||
[
|
||||
"expo-font",
|
||||
{
|
||||
@@ -89,6 +100,7 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
|
||||
},
|
||||
],
|
||||
"expo-apple-authentication",
|
||||
"expo-av",
|
||||
[require("./scripts/with-follow-assets.js")],
|
||||
[require("./scripts/with-follow-app-delegate.js")],
|
||||
"expo-secure-store",
|
||||
|
||||
Vendored
+2
-1
@@ -1,7 +1,8 @@
|
||||
import type { DOMProps } from "expo/dom"
|
||||
import type { FC } from "react"
|
||||
import type WebView from "react-native-webview"
|
||||
|
||||
declare global {
|
||||
export type WebComponent<P = object> = FC<P & { dom?: DOMProps }>
|
||||
export type WebComponent<P = object> = FC<P & { dom?: DOMProps } & React.RefAttributes<WebView>>
|
||||
}
|
||||
export {}
|
||||
|
||||
+53
-34
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@follow/mobile",
|
||||
"version": "1.0.0",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"main": "src/main.tsx",
|
||||
"scripts": {
|
||||
@@ -11,10 +11,12 @@
|
||||
"ios:device": "expo run:ios --device",
|
||||
"lint": "expo lint",
|
||||
"start": "expo start --dev-client",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"web": "expo start --web"
|
||||
},
|
||||
"dependencies": {
|
||||
"@better-auth/expo": "1.1.9-beta.1",
|
||||
"@expo/react-native-action-sheet": "4.1.0",
|
||||
"@expo/vector-icons": "^14.0.2",
|
||||
"@follow/components": "workspace:*",
|
||||
"@follow/constants": "workspace:*",
|
||||
@@ -24,8 +26,6 @@
|
||||
"@follow/utils": "workspace:*",
|
||||
"@gorhom/portal": "1.0.14",
|
||||
"@hookform/resolvers": "3.9.1",
|
||||
"@infinite-list/data-model": "2.2.10",
|
||||
"@infinite-list/react-native": "2.2.10",
|
||||
"@react-native-picker/picker": "2.9.0",
|
||||
"@react-navigation/bottom-tabs": "^7.0.0",
|
||||
"@react-navigation/drawer": "^7.1.1",
|
||||
@@ -35,30 +35,34 @@
|
||||
"better-auth": "1.1.9-beta.1",
|
||||
"cookie-es": "^1.2.2",
|
||||
"dayjs": "1.11.13",
|
||||
"dnum": "^2.14.0",
|
||||
"es-toolkit": "1.29.0",
|
||||
"expo": "52.0.18",
|
||||
"expo-apple-authentication": "~7.1.2",
|
||||
"expo-blur": "~14.0.1",
|
||||
"expo-build-properties": "^0.13.1",
|
||||
"expo-clipboard": "~7.0.0",
|
||||
"expo-constants": "~17.0.3",
|
||||
"expo-dev-client": "^5.0.9",
|
||||
"expo-file-system": "~18.0.6",
|
||||
"expo-font": "~13.0.1",
|
||||
"expo-haptics": "~14.0.0",
|
||||
"expo-image": "~2.0.3",
|
||||
"expo-linear-gradient": "~14.0.1",
|
||||
"expo-linking": "~7.0.3",
|
||||
"expo-router": "4.0.11",
|
||||
"expo": "52.0.27",
|
||||
"expo-apple-authentication": "~7.1.3",
|
||||
"expo-av": "~15.0.2",
|
||||
"expo-blur": "~14.0.3",
|
||||
"expo-build-properties": "^0.13.2",
|
||||
"expo-clipboard": "~7.0.1",
|
||||
"expo-constants": "~17.0.4",
|
||||
"expo-dev-client": "^5.0.10",
|
||||
"expo-document-picker": "~13.0.2",
|
||||
"expo-file-system": "~18.0.7",
|
||||
"expo-font": "~13.0.3",
|
||||
"expo-haptics": "~14.0.1",
|
||||
"expo-image": "~2.0.4",
|
||||
"expo-linear-gradient": "~14.0.2",
|
||||
"expo-linking": "~7.0.4",
|
||||
"expo-localization": "~16.0.1",
|
||||
"expo-router": "4.0.17",
|
||||
"expo-secure-store": "^14.0.1",
|
||||
"expo-sharing": "~13.0.0",
|
||||
"expo-splash-screen": "~0.29.18",
|
||||
"expo-sqlite": "15.0.3",
|
||||
"expo-status-bar": "~2.0.0",
|
||||
"expo-symbols": "~0.2.0",
|
||||
"expo-system-ui": "~4.0.6",
|
||||
"expo-updates": "~0.26.10",
|
||||
"expo-web-browser": "~14.0.1",
|
||||
"expo-sharing": "~13.0.1",
|
||||
"expo-splash-screen": "~0.29.21",
|
||||
"expo-sqlite": "15.0.6",
|
||||
"expo-status-bar": "~2.0.1",
|
||||
"expo-symbols": "~0.2.1",
|
||||
"expo-system-ui": "~4.0.7",
|
||||
"expo-updates": "~0.26.13",
|
||||
"expo-web-browser": "~14.0.2",
|
||||
"hono": "4.6.13",
|
||||
"immer": "10.1.1",
|
||||
"jotai": "2.10.3",
|
||||
@@ -68,25 +72,28 @@
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
"react-hook-form": "7.54.0",
|
||||
"react-native": "0.76.5",
|
||||
"react-native": "0.77.0",
|
||||
"react-native-bouncy-checkbox": "4.1.2",
|
||||
"react-native-color-matrix-image-filters": "^7.0.2",
|
||||
"react-native-context-menu-view": "1.16.0",
|
||||
"react-native-gesture-handler": "~2.20.2",
|
||||
"react-native-gesture-handler": "~2.22.0",
|
||||
"react-native-image-colors": "2.4.0",
|
||||
"react-native-ios-context-menu": "3.1.0",
|
||||
"react-native-ios-utilities": "5.1.0",
|
||||
"react-native-ios-utilities": "5.1.1",
|
||||
"react-native-keyboard-controller": "^1.15.0",
|
||||
"react-native-pager-view": "6.6.1",
|
||||
"react-native-reanimated": "~3.16.5",
|
||||
"react-native-pager-view": "6.5.1",
|
||||
"react-native-reanimated": "~3.16.7",
|
||||
"react-native-root-siblings": "5.0.1",
|
||||
"react-native-safe-area-context": "4.12.0",
|
||||
"react-native-screens": "~4.1.0",
|
||||
"react-native-safe-area-context": "5.1.0",
|
||||
"react-native-screens": "~4.5.0",
|
||||
"react-native-svg": "15.8.0",
|
||||
"react-native-uikit-colors": "0.1.2",
|
||||
"react-native-web": "~0.19.13",
|
||||
"react-native-webview": "13.12.5",
|
||||
"swiftui-react-native": "6.3.3",
|
||||
"react-native-webview": "13.13.1",
|
||||
"shiki": "1.24.1",
|
||||
"tailwindcss": "3.4.16",
|
||||
"usehooks-ts": "3.1.0",
|
||||
"zeego": "2.0.4",
|
||||
"zod": "3.24.1",
|
||||
"zustand": "5.0.2"
|
||||
},
|
||||
@@ -101,5 +108,17 @@
|
||||
"expo-drizzle-studio-plugin": "0.1.1",
|
||||
"postcss": "8.4.49",
|
||||
"react-test-renderer": "18.3.1"
|
||||
},
|
||||
"expo": {
|
||||
"install": {
|
||||
"exclude": [
|
||||
"react-native@~0.77.0",
|
||||
"react-native-reanimated@~3.16.7",
|
||||
"react-native-gesture-handler@~2.22.0",
|
||||
"react-native-screens@~4.5.0",
|
||||
"react-native-safe-area-context@~5.1.0",
|
||||
"react-native-webview@~13.12.5"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import type { DataSettings } from "@/src/interfaces/settings/data"
|
||||
|
||||
import { createSettingAtom } from "./internal/helper"
|
||||
|
||||
export const createDefaultSettings = (): DataSettings => ({
|
||||
sendAnonymousData: true,
|
||||
})
|
||||
|
||||
export const {
|
||||
useSettingKey: useDataSettingKey,
|
||||
useSettingSelector: useDataSettingSelector,
|
||||
useSettingKeys: useDataSettingKeys,
|
||||
setSetting: setDataSetting,
|
||||
clearSettings: clearDataSettings,
|
||||
initializeDefaultSettings: initializeDefaultDataSettings,
|
||||
getSettings: getDataSettings,
|
||||
useSettingValue: useDataSettingValue,
|
||||
} = createSettingAtom("data", createDefaultSettings)
|
||||
@@ -0,0 +1,44 @@
|
||||
import type { GeneralSettings } from "@/src/interfaces/settings/general"
|
||||
|
||||
import { createSettingAtom } from "./internal/helper"
|
||||
|
||||
const createDefaultSettings = (): GeneralSettings => ({
|
||||
// App
|
||||
|
||||
language: "en",
|
||||
translationLanguage: "zh-CN",
|
||||
|
||||
// Data control
|
||||
|
||||
sendAnonymousData: true,
|
||||
|
||||
autoGroup: true,
|
||||
|
||||
// view
|
||||
unreadOnly: true,
|
||||
// mark unread
|
||||
scrollMarkUnread: true,
|
||||
|
||||
renderMarkUnread: false,
|
||||
// UX
|
||||
groupByDate: true,
|
||||
autoExpandLongSocialMedia: false,
|
||||
|
||||
// Secure
|
||||
jumpOutLinkWarn: true,
|
||||
// TTS
|
||||
voice: "en-US-AndrewMultilingualNeural",
|
||||
})
|
||||
|
||||
export const {
|
||||
useSettingKey: useGeneralSettingKey,
|
||||
useSettingSelector: useGeneralSettingSelector,
|
||||
useSettingKeys: useGeneralSettingKeys,
|
||||
setSetting: setGeneralSetting,
|
||||
clearSettings: clearGeneralSettings,
|
||||
initializeDefaultSettings: initializeDefaultGeneralSettings,
|
||||
getSettings: getGeneralSettings,
|
||||
useSettingValue: useGeneralSettingValue,
|
||||
|
||||
settingAtom: __generalSettingAtom,
|
||||
} = createSettingAtom("general", createDefaultSettings)
|
||||
@@ -0,0 +1,160 @@
|
||||
import { useRefValue } from "@follow/hooks"
|
||||
import { createAtomHooks } from "@follow/utils"
|
||||
import type { SetStateAction, WritableAtom } from "jotai"
|
||||
import { atom as jotaiAtom, useAtomValue } from "jotai"
|
||||
import { atomWithStorage, selectAtom } from "jotai/utils"
|
||||
import { useMemo } from "react"
|
||||
import { shallow } from "zustand/shallow"
|
||||
|
||||
import { JotaiPersistSyncStorage } from "@/src/lib/jotai"
|
||||
|
||||
const getStorageNS = (settingKey: string) => `follow-rn-${settingKey}`
|
||||
type Nullable<T> = T | null | undefined
|
||||
|
||||
export const createSettingAtom = <T extends object>(
|
||||
settingKey: string,
|
||||
createDefaultSettings: () => T,
|
||||
) => {
|
||||
const atom = atomWithStorage(
|
||||
getStorageNS(settingKey),
|
||||
createDefaultSettings(),
|
||||
JotaiPersistSyncStorage,
|
||||
{
|
||||
getOnInit: true,
|
||||
},
|
||||
) as WritableAtom<T, [SetStateAction<T>], void>
|
||||
|
||||
const [, , useSettingValue, , getSettings, setSettings] = createAtomHooks(atom)
|
||||
|
||||
const initializeDefaultSettings = () => {
|
||||
const currentSettings = getSettings()
|
||||
const defaultSettings = createDefaultSettings()
|
||||
if (typeof currentSettings !== "object") setSettings(defaultSettings)
|
||||
const newSettings = { ...defaultSettings, ...currentSettings }
|
||||
setSettings(newSettings)
|
||||
}
|
||||
|
||||
const selectAtomCacheMap = {} as Record<keyof ReturnType<typeof getSettings>, any>
|
||||
|
||||
const noopAtom = jotaiAtom(null)
|
||||
|
||||
const useMaybeSettingKey = <T extends keyof ReturnType<typeof getSettings>>(key: Nullable<T>) => {
|
||||
// @ts-expect-error
|
||||
let selectedAtom: Record<keyof T, any>[T] | null = null
|
||||
if (key) {
|
||||
selectedAtom = selectAtomCacheMap[key]
|
||||
if (!selectedAtom) {
|
||||
selectedAtom = selectAtom(atom, (s) => s[key])
|
||||
selectAtomCacheMap[key] = selectedAtom
|
||||
}
|
||||
} else {
|
||||
selectedAtom = noopAtom
|
||||
}
|
||||
|
||||
return useAtomValue(selectedAtom) as ReturnType<typeof getSettings>[T]
|
||||
}
|
||||
|
||||
const useSettingKey = <T extends keyof ReturnType<typeof getSettings>>(key: T) => {
|
||||
return useMaybeSettingKey(key) as ReturnType<typeof getSettings>[T]
|
||||
}
|
||||
|
||||
function useSettingKeys<
|
||||
T extends keyof ReturnType<typeof getSettings>,
|
||||
K1 extends T,
|
||||
K2 extends T,
|
||||
K3 extends T,
|
||||
K4 extends T,
|
||||
K5 extends T,
|
||||
K6 extends T,
|
||||
K7 extends T,
|
||||
K8 extends T,
|
||||
K9 extends T,
|
||||
K10 extends T,
|
||||
>(keys: [K1, K2?, K3?, K4?, K5?, K6?, K7?, K8?, K9?, K10?]) {
|
||||
return [
|
||||
useMaybeSettingKey(keys[0]),
|
||||
useMaybeSettingKey(keys[1]),
|
||||
useMaybeSettingKey(keys[2]),
|
||||
useMaybeSettingKey(keys[3]),
|
||||
useMaybeSettingKey(keys[4]),
|
||||
useMaybeSettingKey(keys[5]),
|
||||
useMaybeSettingKey(keys[6]),
|
||||
useMaybeSettingKey(keys[7]),
|
||||
useMaybeSettingKey(keys[8]),
|
||||
useMaybeSettingKey(keys[9]),
|
||||
] as [
|
||||
ReturnType<typeof getSettings>[K1],
|
||||
ReturnType<typeof getSettings>[K2],
|
||||
ReturnType<typeof getSettings>[K3],
|
||||
ReturnType<typeof getSettings>[K4],
|
||||
ReturnType<typeof getSettings>[K5],
|
||||
ReturnType<typeof getSettings>[K6],
|
||||
ReturnType<typeof getSettings>[K7],
|
||||
ReturnType<typeof getSettings>[K8],
|
||||
ReturnType<typeof getSettings>[K9],
|
||||
ReturnType<typeof getSettings>[K10],
|
||||
]
|
||||
}
|
||||
|
||||
const useSettingSelector = <
|
||||
T extends keyof ReturnType<typeof getSettings>,
|
||||
S extends ReturnType<typeof getSettings>,
|
||||
R = S[T],
|
||||
>(
|
||||
selector: (s: S) => R,
|
||||
): R => {
|
||||
const stableSelector = useRefValue(selector)
|
||||
|
||||
return useAtomValue(
|
||||
// @ts-expect-error
|
||||
useMemo(() => selectAtom(atom, stableSelector.current, shallow), [stableSelector]),
|
||||
)
|
||||
}
|
||||
|
||||
const setSetting = <K extends keyof ReturnType<typeof getSettings>>(
|
||||
key: K,
|
||||
value: ReturnType<typeof getSettings>[K],
|
||||
) => {
|
||||
const updated = Date.now()
|
||||
setSettings({
|
||||
...getSettings(),
|
||||
[key]: value,
|
||||
|
||||
updated,
|
||||
})
|
||||
}
|
||||
|
||||
const clearSettings = () => {
|
||||
setSettings(createDefaultSettings())
|
||||
}
|
||||
|
||||
Object.defineProperty(useSettingValue, "select", {
|
||||
value: useSettingSelector,
|
||||
})
|
||||
|
||||
return {
|
||||
useSettingKey,
|
||||
useSettingSelector,
|
||||
setSetting,
|
||||
clearSettings,
|
||||
initializeDefaultSettings,
|
||||
|
||||
useSettingValue,
|
||||
useSettingKeys,
|
||||
getSettings,
|
||||
|
||||
settingAtom: atom,
|
||||
} as {
|
||||
useSettingKey: typeof useSettingKey
|
||||
useSettingSelector: typeof useSettingSelector
|
||||
setSetting: typeof setSetting
|
||||
clearSettings: typeof clearSettings
|
||||
initializeDefaultSettings: typeof initializeDefaultSettings
|
||||
useSettingValue: typeof useSettingValue & {
|
||||
select: <T extends keyof ReturnType<() => T>>(key: T) => Awaited<T[T]>
|
||||
}
|
||||
useSettingKeys: typeof useSettingKeys
|
||||
getSettings: typeof getSettings
|
||||
settingAtom: typeof atom
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import type { UISettings } from "@/src/interfaces/settings/ui"
|
||||
|
||||
import { createSettingAtom } from "./internal/helper"
|
||||
|
||||
export const createDefaultSettings = (): UISettings => ({
|
||||
// Subscription
|
||||
|
||||
hideExtraBadge: false,
|
||||
|
||||
subscriptionShowUnreadCount: true,
|
||||
thumbnailRatio: "square",
|
||||
|
||||
// Content
|
||||
readerRenderInlineStyle: false,
|
||||
codeHighlightThemeLight: "github-light",
|
||||
codeHighlightThemeDark: "github-dark",
|
||||
guessCodeLanguage: true,
|
||||
hideRecentReader: false,
|
||||
customCSS: "",
|
||||
|
||||
// View
|
||||
|
||||
pictureViewFilterNoImage: false,
|
||||
})
|
||||
|
||||
export const {
|
||||
useSettingKey: useUISettingKey,
|
||||
useSettingSelector: useUISettingSelector,
|
||||
useSettingKeys: useUISettingKeys,
|
||||
setSetting: setUISetting,
|
||||
clearSettings: clearUISettings,
|
||||
initializeDefaultSettings: initializeDefaultUISettings,
|
||||
getSettings: getUISettings,
|
||||
useSettingValue: useUISettingValue,
|
||||
settingAtom: __uiSettingAtom,
|
||||
} = createSettingAtom("ui", createDefaultSettings)
|
||||
@@ -1,3 +1,4 @@
|
||||
import { Image as ExpoImage } from "expo-image"
|
||||
import { Animated, FlatList, Pressable, ScrollView, TouchableOpacity } from "react-native"
|
||||
import Reanimated from "react-native-reanimated"
|
||||
|
||||
@@ -5,6 +6,7 @@ export const AnimatedScrollView = Animated.createAnimatedComponent(ScrollView)
|
||||
export const AnimatedFlatList = Animated.createAnimatedComponent(FlatList)
|
||||
export const AnimatedTouchableOpacity = Animated.createAnimatedComponent(TouchableOpacity)
|
||||
|
||||
export const ReAnimatedExpoImage = Reanimated.createAnimatedComponent(ExpoImage)
|
||||
export const ReAnimatedPressable = Reanimated.createAnimatedComponent(Pressable)
|
||||
export const ReAnimatedScrollView = Reanimated.createAnimatedComponent(ScrollView)
|
||||
export const ReAnimatedTouchableOpacity = Reanimated.createAnimatedComponent(TouchableOpacity)
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
import { cn, toScientificNotation } from "@follow/utils"
|
||||
import { Text } from "react-native"
|
||||
|
||||
export const Balance = ({
|
||||
children,
|
||||
|
||||
className,
|
||||
precision = 2,
|
||||
}: {
|
||||
/** The token balance in wei. */
|
||||
children: bigint
|
||||
|
||||
className?: string
|
||||
precision?: number
|
||||
}) => {
|
||||
const n = BigInt(children || 0n)
|
||||
const formatted = format(n, { digits: precision, trailingZeros: true })
|
||||
|
||||
return <Text className={cn("tabular-nums", className)}>{formatted}</Text>
|
||||
}
|
||||
|
||||
function format(
|
||||
value: bigint,
|
||||
options:
|
||||
| number
|
||||
| {
|
||||
digits?: number
|
||||
compact?: boolean
|
||||
trailingZeros?: boolean
|
||||
locale?: string
|
||||
decimalsRounding?: "ROUND_HALF" | "ROUND_UP" | "ROUND_DOWN"
|
||||
signDisplay?: "auto" | "always" | "exceptZero" | "negative" | "never"
|
||||
} = {},
|
||||
): string {
|
||||
// Normalize options
|
||||
const opts = typeof options === "number" ? { digits: options } : options
|
||||
const {
|
||||
digits,
|
||||
compact = false,
|
||||
trailingZeros = false,
|
||||
locale = "en-US",
|
||||
|
||||
signDisplay = "auto",
|
||||
} = opts
|
||||
|
||||
// Convert bigint to number for formatting
|
||||
const num = Number(value) / 1e18 // Assuming 18 decimals (wei to ether conversion)
|
||||
|
||||
if (compact) {
|
||||
return new Intl.NumberFormat(locale, {
|
||||
notation: "compact",
|
||||
maximumFractionDigits: digits,
|
||||
minimumFractionDigits: trailingZeros ? digits : 0,
|
||||
signDisplay,
|
||||
}).format(num)
|
||||
}
|
||||
|
||||
// For very large or small numbers, use scientific notation
|
||||
if (Math.abs(num) > 1e9 || (Math.abs(num) < 1e-9 && num !== 0)) {
|
||||
return toScientificNotation(num.toString(), 10)
|
||||
}
|
||||
|
||||
return new Intl.NumberFormat(locale, {
|
||||
maximumFractionDigits: digits,
|
||||
minimumFractionDigits: trailingZeros ? digits : 0,
|
||||
signDisplay,
|
||||
useGrouping: true,
|
||||
}).format(num)
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import { StyleSheet } from "react-native"
|
||||
import { useColor } from "react-native-uikit-colors"
|
||||
|
||||
import { ThemedBlurView } from "@/src/components/common/ThemedBlurView"
|
||||
|
||||
const node = (
|
||||
<ThemedBlurView
|
||||
style={{
|
||||
...StyleSheet.absoluteFillObject,
|
||||
overflow: "hidden",
|
||||
backgroundColor: "transparent",
|
||||
}}
|
||||
/>
|
||||
)
|
||||
export const BlurEffect = () => {
|
||||
return node
|
||||
}
|
||||
|
||||
const InternalBlurEffectWithBottomBorder = () => {
|
||||
const border = useColor("opaqueSeparator")
|
||||
return (
|
||||
<ThemedBlurView
|
||||
style={{
|
||||
...StyleSheet.absoluteFillObject,
|
||||
overflow: "hidden",
|
||||
backgroundColor: "transparent",
|
||||
borderBottomWidth: StyleSheet.hairlineWidth,
|
||||
borderBottomColor: border,
|
||||
}}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export const BlurEffectWithBottomBorder = () => <InternalBlurEffectWithBottomBorder />
|
||||
@@ -1,14 +1,13 @@
|
||||
import { callWebviewExpose } from "@follow/shared"
|
||||
import { parseSafeUrl, transformVideoUrl } from "@follow/utils"
|
||||
import * as Linking from "expo-linking"
|
||||
import type { RefObject } from "react"
|
||||
import { useCallback, useEffect, useState } from "react"
|
||||
import { Platform } from "react-native"
|
||||
import type { WebViewNavigation, WebViewProps } from "react-native-webview"
|
||||
import type { WebViewProps } from "react-native-webview"
|
||||
import { WebView } from "react-native-webview"
|
||||
|
||||
import { useWebViewNavigation } from "@/src/hooks/useWebViewNavigation"
|
||||
import { signOut } from "@/src/lib/auth"
|
||||
import { useOpenLink } from "@/src/lib/hooks/use-open-link"
|
||||
|
||||
const presetUri = Platform.select({
|
||||
ios: "rn-web/index.html",
|
||||
@@ -16,8 +15,6 @@ const presetUri = Platform.select({
|
||||
default: "https://app.follow.is",
|
||||
})
|
||||
|
||||
const allowHosts = new Set(["app.follow.is"])
|
||||
|
||||
interface FollowWebViewProps extends WebViewProps {
|
||||
customUrl?: string
|
||||
}
|
||||
@@ -80,32 +77,6 @@ export const FollowWebView = ({
|
||||
)
|
||||
}
|
||||
|
||||
const useWebViewNavigation = ({ webViewRef }: { webViewRef: RefObject<WebView> }) => {
|
||||
const openLink = useOpenLink()
|
||||
|
||||
const onNavigationStateChange = useCallback(
|
||||
(newNavState: WebViewNavigation) => {
|
||||
const { url: urlStr } = newNavState
|
||||
const url = parseSafeUrl(urlStr)
|
||||
if (!url) return
|
||||
if (url.protocol === "file:") return
|
||||
if (allowHosts.has(url.host)) return
|
||||
|
||||
webViewRef.current?.stopLoading()
|
||||
|
||||
const formattedUrl = transformVideoUrl({ url: urlStr })
|
||||
if (formattedUrl) {
|
||||
openLink(formattedUrl)
|
||||
return
|
||||
}
|
||||
openLink(urlStr)
|
||||
},
|
||||
[openLink, webViewRef],
|
||||
)
|
||||
|
||||
return { onNavigationStateChange }
|
||||
}
|
||||
|
||||
// We only need to handle deep link at the first time the app is opened
|
||||
let lastInitialUrl: string | null = null
|
||||
const useDeepLink = ({
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
import { StyleSheet } from "react-native"
|
||||
|
||||
import { ThemedBlurView } from "@/src/components/common/ThemedBlurView"
|
||||
|
||||
const node = (
|
||||
<ThemedBlurView
|
||||
style={{
|
||||
...StyleSheet.absoluteFillObject,
|
||||
overflow: "hidden",
|
||||
backgroundColor: "transparent",
|
||||
}}
|
||||
/>
|
||||
)
|
||||
export const BlurEffect = () => {
|
||||
return node
|
||||
}
|
||||
@@ -30,16 +30,16 @@ const ModalHeaderCloseButtonImpl = () => {
|
||||
)
|
||||
}
|
||||
|
||||
export interface ModalHeaderShubmitButtonProps {
|
||||
export interface ModalHeaderSubmitButtonProps {
|
||||
isValid: boolean
|
||||
onPress: () => void
|
||||
isLoading?: boolean
|
||||
}
|
||||
export const ModalHeaderShubmitButton = ({
|
||||
export const ModalHeaderSubmitButton = ({
|
||||
isValid,
|
||||
onPress,
|
||||
isLoading,
|
||||
}: ModalHeaderShubmitButtonProps) => {
|
||||
}: ModalHeaderSubmitButtonProps) => {
|
||||
return <ModalHeaderShubmitButtonImpl isValid={isValid} onPress={onPress} isLoading={isLoading} />
|
||||
}
|
||||
|
||||
@@ -47,8 +47,9 @@ const ModalHeaderShubmitButtonImpl = ({
|
||||
isValid,
|
||||
onPress,
|
||||
isLoading,
|
||||
}: ModalHeaderShubmitButtonProps) => {
|
||||
}: ModalHeaderSubmitButtonProps) => {
|
||||
const label = useColor("label")
|
||||
|
||||
return (
|
||||
<TouchableOpacity onPress={onPress} disabled={!isValid || isLoading}>
|
||||
{isLoading ? (
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* @description only for iOS modal
|
||||
*
|
||||
* ```
|
||||
* Set screen options:
|
||||
* + headerTransparent: true,
|
||||
* + headerBackground: BlurEffectWithBottomBorder,
|
||||
* ```
|
||||
*/
|
||||
import { useHeaderHeight } from "@react-navigation/elements"
|
||||
import type { KeyboardAwareScrollViewProps } from "react-native-keyboard-controller"
|
||||
import { KeyboardAwareScrollView } from "react-native-keyboard-controller"
|
||||
import { useSafeAreaInsets } from "react-native-safe-area-context"
|
||||
|
||||
interface SafeModalScrollViewProps extends KeyboardAwareScrollViewProps {}
|
||||
export const SafeModalScrollView = (props: SafeModalScrollViewProps) => {
|
||||
const headerHeight = useHeaderHeight()
|
||||
const insets = useSafeAreaInsets()
|
||||
return (
|
||||
<KeyboardAwareScrollView
|
||||
{...props}
|
||||
scrollIndicatorInsets={{ top: headerHeight, bottom: insets.bottom }}
|
||||
contentContainerStyle={{ paddingTop: headerHeight, paddingBottom: insets.bottom }}
|
||||
>
|
||||
{props.children}
|
||||
</KeyboardAwareScrollView>
|
||||
)
|
||||
}
|
||||
@@ -1,20 +1,170 @@
|
||||
import { useBottomTabBarHeight } from "@react-navigation/bottom-tabs"
|
||||
import { useHeaderHeight } from "@react-navigation/elements"
|
||||
import type { FC } from "react"
|
||||
import { Header, useHeaderHeight } from "@react-navigation/elements"
|
||||
import type { NativeStackNavigationOptions } from "@react-navigation/native-stack"
|
||||
import { router, Stack, useNavigation } from "expo-router"
|
||||
import type { FC, PropsWithChildren } from "react"
|
||||
import { createContext, useContext, useEffect, useMemo, useRef } from "react"
|
||||
import type { ScrollViewProps } from "react-native"
|
||||
import { ScrollView, View } from "react-native"
|
||||
import {
|
||||
Animated as RNAnimated,
|
||||
StyleSheet,
|
||||
TouchableOpacity,
|
||||
useAnimatedValue,
|
||||
View,
|
||||
} from "react-native"
|
||||
import Animated, { useAnimatedStyle, useSharedValue, withTiming } from "react-native-reanimated"
|
||||
import type { ReanimatedScrollEvent } from "react-native-reanimated/lib/typescript/hook/commonTypes"
|
||||
import { useSafeAreaInsets } from "react-native-safe-area-context"
|
||||
import { useColor } from "react-native-uikit-colors"
|
||||
|
||||
export const SafeNavigationScrollView: FC<ScrollViewProps> = ({ children, ...props }) => {
|
||||
const headerHeight = useHeaderHeight()
|
||||
const tabBarHeight = useBottomTabBarHeight()
|
||||
import { useDefaultHeaderHeight } from "@/src/hooks/useDefaultHeaderHeight"
|
||||
import { MingcuteLeftLineIcon } from "@/src/icons/mingcute_left_line"
|
||||
|
||||
import { AnimatedScrollView } from "./AnimatedComponents"
|
||||
import { ThemedBlurView } from "./ThemedBlurView"
|
||||
|
||||
type SafeNavigationScrollViewProps = Omit<ScrollViewProps, "onScroll"> & {
|
||||
withHeaderBlur?: boolean
|
||||
onScroll?: (e: ReanimatedScrollEvent) => void
|
||||
|
||||
// For scroll view content adjustment behavior
|
||||
withTopInset?: boolean
|
||||
withBottomInset?: boolean
|
||||
} & PropsWithChildren
|
||||
export const NavigationContext = createContext<{
|
||||
scrollY: RNAnimated.Value
|
||||
} | null>(null)
|
||||
|
||||
export const SafeNavigationScrollView: FC<SafeNavigationScrollViewProps> = ({
|
||||
children,
|
||||
|
||||
withHeaderBlur = true,
|
||||
onScroll,
|
||||
|
||||
withBottomInset = false,
|
||||
withTopInset = false,
|
||||
|
||||
...props
|
||||
}) => {
|
||||
const insets = useSafeAreaInsets()
|
||||
const tabBarHeight = useBottomTabBarHeight()
|
||||
const headerHeight = useHeaderHeight()
|
||||
|
||||
const scrollY = useAnimatedValue(0)
|
||||
|
||||
return (
|
||||
<ScrollView contentInsetAdjustmentBehavior="automatic" {...props}>
|
||||
<View style={{ height: headerHeight - insets.top }} />
|
||||
<View>{children}</View>
|
||||
<View style={{ height: tabBarHeight - insets.bottom }} />
|
||||
</ScrollView>
|
||||
<NavigationContext.Provider value={useMemo(() => ({ scrollY }), [scrollY])}>
|
||||
{withHeaderBlur && <NavigationBlurEffectHeader />}
|
||||
<AnimatedScrollView
|
||||
onScroll={RNAnimated.event([{ nativeEvent: { contentOffset: { y: scrollY } } }], {
|
||||
useNativeDriver: true,
|
||||
})}
|
||||
{...props}
|
||||
>
|
||||
<View style={{ height: headerHeight - (withTopInset ? insets.top : 0) }} />
|
||||
<View>{children}</View>
|
||||
<View style={{ height: tabBarHeight - (withBottomInset ? insets.bottom : 0) }} />
|
||||
</AnimatedScrollView>
|
||||
</NavigationContext.Provider>
|
||||
)
|
||||
}
|
||||
|
||||
export const NavigationBlurEffectHeader = ({
|
||||
blurThreshold = 0,
|
||||
headerHideableBottomHeight = 50,
|
||||
headerHideableBottom,
|
||||
...props
|
||||
}: NativeStackNavigationOptions & {
|
||||
blurThreshold?: number
|
||||
headerHideableBottomHeight?: number
|
||||
headerHideableBottom?: () => React.ReactNode
|
||||
}) => {
|
||||
const label = useColor("label")
|
||||
|
||||
const canBack = useNavigation().canGoBack()
|
||||
|
||||
const { scrollY } = useContext(NavigationContext)!
|
||||
|
||||
const border = useColor("opaqueSeparator")
|
||||
|
||||
const opacityAnimated = useSharedValue(0)
|
||||
|
||||
const originalDefaultHeaderHeight = useDefaultHeaderHeight()
|
||||
const largeDefaultHeaderHeight = originalDefaultHeaderHeight + headerHideableBottomHeight
|
||||
|
||||
const largeHeaderHeight = useSharedValue(largeDefaultHeaderHeight)
|
||||
|
||||
const lastScrollY = useRef(0)
|
||||
|
||||
useEffect(() => {
|
||||
const id = scrollY.addListener(({ value }) => {
|
||||
opacityAnimated.value = Math.max(0, Math.min(1, (value + blurThreshold) / 10))
|
||||
if (headerHideableBottom && value > 0) {
|
||||
if (value > lastScrollY.current) {
|
||||
largeHeaderHeight.value = withTiming(originalDefaultHeaderHeight)
|
||||
} else {
|
||||
largeHeaderHeight.value = withTiming(largeDefaultHeaderHeight)
|
||||
}
|
||||
lastScrollY.current = value
|
||||
}
|
||||
})
|
||||
|
||||
return () => {
|
||||
scrollY.removeListener(id)
|
||||
}
|
||||
}, [
|
||||
blurThreshold,
|
||||
scrollY,
|
||||
headerHideableBottom,
|
||||
largeHeaderHeight,
|
||||
originalDefaultHeaderHeight,
|
||||
largeDefaultHeaderHeight,
|
||||
opacityAnimated,
|
||||
])
|
||||
|
||||
const style = useAnimatedStyle(() => ({
|
||||
opacity: opacityAnimated.value,
|
||||
...StyleSheet.absoluteFillObject,
|
||||
borderBottomWidth: StyleSheet.hairlineWidth,
|
||||
borderBottomColor: border,
|
||||
}))
|
||||
|
||||
const hideableBottom = headerHideableBottom?.()
|
||||
|
||||
return (
|
||||
<Stack.Screen
|
||||
options={{
|
||||
headerBackground: () => (
|
||||
<Animated.View style={style}>
|
||||
<ThemedBlurView className="flex-1" />
|
||||
</Animated.View>
|
||||
),
|
||||
headerTransparent: true,
|
||||
|
||||
headerLeft: canBack
|
||||
? () => (
|
||||
<TouchableOpacity hitSlop={10} onPress={() => router.back()}>
|
||||
<MingcuteLeftLineIcon height={20} width={20} color={label} />
|
||||
</TouchableOpacity>
|
||||
)
|
||||
: undefined,
|
||||
|
||||
header: headerHideableBottom
|
||||
? ({ options }) => {
|
||||
return (
|
||||
<Animated.View style={{ height: largeHeaderHeight }} className="overflow-hidden">
|
||||
<View pointerEvents="box-none" style={[StyleSheet.absoluteFill]}>
|
||||
{options.headerBackground?.()}
|
||||
</View>
|
||||
<Header title={options.title ?? ""} {...options} headerBackground={() => null} />
|
||||
{hideableBottom}
|
||||
</Animated.View>
|
||||
)
|
||||
}
|
||||
: undefined,
|
||||
|
||||
...props,
|
||||
}}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,302 @@
|
||||
import { useTypeScriptHappyCallback } from "@follow/hooks"
|
||||
import { impactAsync, ImpactFeedbackStyle } from "expo-haptics"
|
||||
import { atom, useAtomValue, useSetAtom } from "jotai"
|
||||
import { selectAtom } from "jotai/utils"
|
||||
import * as React from "react"
|
||||
import { Animated, StyleSheet, Text, View } from "react-native"
|
||||
import { RectButton, Swipeable } from "react-native-gesture-handler"
|
||||
|
||||
interface Action {
|
||||
label: string
|
||||
icon?: React.ReactNode
|
||||
backgroundColor?: string
|
||||
onPress?: () => void
|
||||
color?: string
|
||||
}
|
||||
|
||||
interface SwipeableItemProps {
|
||||
children: React.ReactNode
|
||||
leftActions?: Action[]
|
||||
rightActions?: Action[]
|
||||
disabled?: boolean
|
||||
|
||||
swipeRightToCallAction?: boolean
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
absoluteFill: {
|
||||
...StyleSheet.absoluteFillObject,
|
||||
},
|
||||
actionContainer: {
|
||||
flex: 1,
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
},
|
||||
animatedContainer: {
|
||||
position: "absolute",
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
},
|
||||
actionsWrapper: {
|
||||
flexDirection: "row",
|
||||
},
|
||||
actionText: {
|
||||
color: "#fff",
|
||||
},
|
||||
})
|
||||
|
||||
const rectButtonWidth = 74
|
||||
|
||||
export const SwipeableItem: React.FC<SwipeableItemProps> = ({
|
||||
children,
|
||||
leftActions,
|
||||
rightActions,
|
||||
disabled,
|
||||
|
||||
swipeRightToCallAction,
|
||||
}) => {
|
||||
const itemRef = React.useRef<Swipeable | null>(null)
|
||||
|
||||
const endDragCallerRef = React.useRef<() => void>(() => {})
|
||||
|
||||
const renderLeftActions = (progress: Animated.AnimatedInterpolation<number>) => {
|
||||
const width = leftActions?.length ? leftActions.length * rectButtonWidth : rectButtonWidth
|
||||
|
||||
return (
|
||||
<>
|
||||
<View
|
||||
style={[
|
||||
styles.absoluteFill,
|
||||
{
|
||||
backgroundColor: leftActions?.[0]?.backgroundColor ?? "#fff",
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<Animated.View style={[styles.actionsWrapper, { width }]}>
|
||||
{leftActions?.map((action, index) => {
|
||||
const trans = progress.interpolate({
|
||||
inputRange: [0, 1],
|
||||
outputRange: [-rectButtonWidth * (leftActions?.length ?? 1), 0],
|
||||
})
|
||||
|
||||
return (
|
||||
<Animated.View
|
||||
key={index}
|
||||
style={[
|
||||
styles.animatedContainer,
|
||||
{
|
||||
transform: [{ translateX: trans }],
|
||||
width: rectButtonWidth,
|
||||
left: index * rectButtonWidth,
|
||||
},
|
||||
]}
|
||||
>
|
||||
<RectButton
|
||||
style={[
|
||||
styles.actionContainer,
|
||||
{
|
||||
backgroundColor: action.backgroundColor ?? "#fff",
|
||||
},
|
||||
]}
|
||||
onPress={action.onPress}
|
||||
>
|
||||
{action.icon}
|
||||
<Text style={[styles.actionText, { color: action.color ?? "#fff" }]}>
|
||||
{action.label}
|
||||
</Text>
|
||||
</RectButton>
|
||||
</Animated.View>
|
||||
)
|
||||
})}
|
||||
</Animated.View>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
const renderRightActions = (progress: Animated.AnimatedInterpolation<number>) => {
|
||||
const width = rightActions?.length ? rightActions.length * rectButtonWidth : rectButtonWidth
|
||||
|
||||
return (
|
||||
<>
|
||||
<View
|
||||
style={[
|
||||
styles.absoluteFill,
|
||||
{
|
||||
backgroundColor: rightActions?.at(-1)?.backgroundColor ?? "#fff",
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<Animated.View style={[styles.actionsWrapper, { width }]}>
|
||||
{rightActions?.map((action, index) => {
|
||||
return (
|
||||
<RightRectButton
|
||||
endDragCallerRef={endDragCallerRef}
|
||||
key={index}
|
||||
index={index}
|
||||
action={action}
|
||||
length={rightActions?.length ?? 1}
|
||||
progress={progress}
|
||||
swipeRightToCallAction={
|
||||
swipeRightToCallAction && index === rightActions?.length - 1
|
||||
}
|
||||
/>
|
||||
)
|
||||
})}
|
||||
</Animated.View>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
const id = React.useId()
|
||||
const { swipeableOpenedId } = React.useContext(SwipeableGroupContext)
|
||||
|
||||
const setAtom = useSetAtom(swipeableOpenedId)
|
||||
const isOpened = useAtomValue(
|
||||
React.useMemo(
|
||||
() => selectAtom(swipeableOpenedId, (value) => value === id),
|
||||
[id, swipeableOpenedId],
|
||||
),
|
||||
)
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!isOpened) {
|
||||
itemRef.current?.close()
|
||||
}
|
||||
}, [isOpened])
|
||||
|
||||
return (
|
||||
<Swipeable
|
||||
ref={itemRef}
|
||||
enabled={!disabled}
|
||||
friction={1}
|
||||
onSwipeableWillOpen={() => {
|
||||
setAtom(id)
|
||||
}}
|
||||
leftThreshold={37}
|
||||
rightThreshold={37}
|
||||
enableTrackpadTwoFingerGesture
|
||||
useNativeAnimations
|
||||
onEnded={useTypeScriptHappyCallback(() => {
|
||||
if (swipeRightToCallAction && endDragCallerRef.current) {
|
||||
endDragCallerRef.current()
|
||||
}
|
||||
}, [swipeRightToCallAction, endDragCallerRef])}
|
||||
renderLeftActions={leftActions?.length ? renderLeftActions : undefined}
|
||||
renderRightActions={rightActions?.length ? renderRightActions : undefined}
|
||||
overshootLeft={leftActions?.length ? leftActions?.length >= 1 : undefined}
|
||||
overshootRight={rightActions?.length ? rightActions?.length >= 1 : undefined}
|
||||
overshootFriction={swipeRightToCallAction ? 1 : 10}
|
||||
>
|
||||
{children}
|
||||
</Swipeable>
|
||||
)
|
||||
}
|
||||
|
||||
const SwipeableGroupContext = React.createContext({
|
||||
swipeableOpenedId: atom(""),
|
||||
})
|
||||
|
||||
export const SwipeableGroupProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
const ctx = React.useMemo(
|
||||
() => ({
|
||||
swipeableOpenedId: atom(""),
|
||||
}),
|
||||
[],
|
||||
)
|
||||
|
||||
return <SwipeableGroupContext.Provider value={ctx}>{children}</SwipeableGroupContext.Provider>
|
||||
}
|
||||
|
||||
const rightActionThreshold = -100
|
||||
const RightRectButton = React.memo(
|
||||
({
|
||||
index,
|
||||
action,
|
||||
length = 1,
|
||||
progress,
|
||||
swipeRightToCallAction,
|
||||
endDragCallerRef,
|
||||
}: {
|
||||
progress: Animated.AnimatedInterpolation<number>
|
||||
index: number
|
||||
action: Action
|
||||
length: number
|
||||
swipeRightToCallAction?: boolean
|
||||
endDragCallerRef: React.MutableRefObject<() => void>
|
||||
}) => {
|
||||
const trans = React.useMemo(
|
||||
() =>
|
||||
progress.interpolate({
|
||||
inputRange: [0, 1, 1.2],
|
||||
outputRange: [rectButtonWidth * length, 0, -40],
|
||||
}),
|
||||
[progress, length],
|
||||
)
|
||||
const parallaxX = React.useMemo(
|
||||
() =>
|
||||
progress.interpolate({
|
||||
inputRange: [0, 1, 1.2],
|
||||
outputRange: [0, 0, 10],
|
||||
}),
|
||||
[progress],
|
||||
)
|
||||
|
||||
const hapticOnce = React.useRef(false)
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!swipeRightToCallAction) return
|
||||
const id = trans.addListener(({ value }) => {
|
||||
if (value <= rightActionThreshold) {
|
||||
if (hapticOnce.current) return
|
||||
hapticOnce.current = true
|
||||
impactAsync(ImpactFeedbackStyle.Light)
|
||||
endDragCallerRef.current = () => {
|
||||
action.onPress?.()
|
||||
}
|
||||
} else {
|
||||
hapticOnce.current = false
|
||||
endDragCallerRef.current = () => {}
|
||||
}
|
||||
})
|
||||
|
||||
return () => {
|
||||
trans.removeListener(id)
|
||||
}
|
||||
}, [action, endDragCallerRef, swipeRightToCallAction, trans])
|
||||
|
||||
return (
|
||||
<Animated.View
|
||||
key={index}
|
||||
style={[
|
||||
styles.animatedContainer,
|
||||
{
|
||||
transform: [{ translateX: trans }],
|
||||
width: rectButtonWidth,
|
||||
left: index * rectButtonWidth,
|
||||
},
|
||||
]}
|
||||
>
|
||||
<RectButton
|
||||
style={[
|
||||
styles.actionContainer,
|
||||
{
|
||||
backgroundColor: action.backgroundColor ?? "#fff",
|
||||
},
|
||||
]}
|
||||
onPress={action.onPress}
|
||||
>
|
||||
{action.icon}
|
||||
<Animated.Text
|
||||
style={[
|
||||
styles.actionText,
|
||||
{ color: action.color ?? "#fff" },
|
||||
{ transform: [{ translateX: parallaxX }] },
|
||||
]}
|
||||
>
|
||||
{action.label}
|
||||
</Animated.Text>
|
||||
</RectButton>
|
||||
</Animated.View>
|
||||
)
|
||||
},
|
||||
)
|
||||
@@ -5,10 +5,12 @@ import { forwardRef } from "react"
|
||||
|
||||
export const ThemedBlurView = forwardRef<BlurView, BlurViewProps>(({ tint, ...rest }, ref) => {
|
||||
const { colorScheme } = useColorScheme()
|
||||
|
||||
return (
|
||||
<BlurView
|
||||
ref={ref}
|
||||
tint={colorScheme === "light" ? "systemMaterialLight" : "systemMaterialDark"}
|
||||
intensity={100}
|
||||
tint={colorScheme === "light" ? "systemChromeMaterialLight" : "systemChromeMaterialDark"}
|
||||
{...rest}
|
||||
/>
|
||||
)
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
import type { NativeSyntheticEvent } from "react-native"
|
||||
import type { ContextMenuOnPressNativeEvent } from "react-native-context-menu-view"
|
||||
import ContextMenu from "react-native-context-menu-view"
|
||||
|
||||
interface DropdownMenuAction<T> {
|
||||
title: string
|
||||
actions?: DropdownMenuAction<T>[]
|
||||
selected?: boolean
|
||||
}
|
||||
|
||||
interface DropdownMenuSelector<T> {
|
||||
label: string
|
||||
value: T
|
||||
}
|
||||
|
||||
export function DropdownMenu<T>({
|
||||
options,
|
||||
currentValue,
|
||||
handleChangeValue,
|
||||
handlePress,
|
||||
children,
|
||||
}: {
|
||||
options: DropdownMenuSelector<T>[] | DropdownMenuAction<T>[]
|
||||
currentValue?: T
|
||||
handleChangeValue?: (value: T) => void
|
||||
handlePress?: (e: NativeSyntheticEvent<ContextMenuOnPressNativeEvent>) => void
|
||||
children: React.ReactNode
|
||||
}) {
|
||||
const isActionMenu = options.every((option) => "title" in option)
|
||||
return (
|
||||
<ContextMenu
|
||||
style={{ flex: 1 }}
|
||||
dropdownMenuMode
|
||||
actions={
|
||||
isActionMenu
|
||||
? options
|
||||
: options.map((option) => ({
|
||||
title: option.label,
|
||||
selected: option.value === currentValue,
|
||||
disabled: option.value === currentValue,
|
||||
}))
|
||||
}
|
||||
onPress={(e) => {
|
||||
if (!isActionMenu) {
|
||||
const { index } = e.nativeEvent
|
||||
handleChangeValue?.(options[index]!.value)
|
||||
}
|
||||
handlePress?.(e)
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</ContextMenu>
|
||||
)
|
||||
}
|
||||
@@ -11,7 +11,7 @@ import { useEventCallback } from "usehooks-ts"
|
||||
import { MingcuteDownLineIcon } from "@/src/icons/mingcute_down_line"
|
||||
import { useColor } from "@/src/theme/colors"
|
||||
|
||||
import { BlurEffect } from "../../common/HeaderBlur"
|
||||
import { BlurEffect } from "../../common/BlurEffect"
|
||||
|
||||
interface PickerIosProps<T> {
|
||||
options: { label: string; value: T }[]
|
||||
@@ -33,7 +33,7 @@ export function PickerIos<T>({
|
||||
|
||||
const [currentValue, setCurrentValue] = useState(() => {
|
||||
if (!value) {
|
||||
return options[0].value
|
||||
return options[0]!.value
|
||||
}
|
||||
return value
|
||||
})
|
||||
|
||||
@@ -2,12 +2,12 @@ import { cn } from "@follow/utils"
|
||||
import { useEffect, useMemo, useState } from "react"
|
||||
import type { StyleProp, ViewStyle } from "react-native"
|
||||
import { Text, View } from "react-native"
|
||||
import ContextMenu from "react-native-context-menu-view"
|
||||
import { useEventCallback } from "usehooks-ts"
|
||||
|
||||
import { MingcuteDownLineIcon } from "@/src/icons/mingcute_down_line"
|
||||
import { accentColor } from "@/src/theme/colors"
|
||||
|
||||
import { DropdownMenu } from "../dropdown/DropdownMenu"
|
||||
import { FormLabel } from "./Label"
|
||||
|
||||
interface SelectProps<T> {
|
||||
@@ -31,7 +31,7 @@ export function Select<T>({
|
||||
}: SelectProps<T>) {
|
||||
const [currentValue, setCurrentValue] = useState(() => {
|
||||
if (!value) {
|
||||
return options[0].value
|
||||
return options[0]!.value
|
||||
}
|
||||
return value
|
||||
})
|
||||
@@ -52,36 +52,47 @@ export function Select<T>({
|
||||
onValueChange(currentValue)
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<View className="w-full flex-1 flex-row items-center">
|
||||
{!!label && <FormLabel className="pl-2" label={label} />}
|
||||
<View className="flex-1" />
|
||||
{/* Trigger */}
|
||||
<ContextMenu
|
||||
dropdownMenuMode
|
||||
actions={options.map((option) => ({
|
||||
title: option.label,
|
||||
selected: option.value === currentValue,
|
||||
}))}
|
||||
onPress={(e) => {
|
||||
const { index } = e.nativeEvent
|
||||
handleChangeValue(options[index].value)
|
||||
}}
|
||||
const Trigger = (
|
||||
<DropdownMenu<T>
|
||||
options={options.map((option) => ({
|
||||
label: option.label,
|
||||
value: option.value,
|
||||
}))}
|
||||
currentValue={currentValue}
|
||||
handleChangeValue={handleChangeValue}
|
||||
>
|
||||
<View
|
||||
className={cn(
|
||||
"flex-1 shrink flex-row items-center rounded-lg pl-3",
|
||||
|
||||
wrapperClassName,
|
||||
)}
|
||||
style={wrapperStyle}
|
||||
>
|
||||
<View
|
||||
className={cn(
|
||||
"h-8 flex-row items-center rounded-lg pl-3 pr-2",
|
||||
"min-w-[80px]",
|
||||
wrapperClassName,
|
||||
)}
|
||||
style={wrapperStyle}
|
||||
<Text
|
||||
className="min-w-0 flex-1 text-right font-semibold text-accent"
|
||||
ellipsizeMode="middle"
|
||||
numberOfLines={1}
|
||||
>
|
||||
<Text className="font-semibold text-accent">{valueToLabelMap.get(currentValue)}</Text>
|
||||
<View className="ml-auto shrink-0 pl-1">
|
||||
<MingcuteDownLineIcon color={accentColor} height={18} width={18} />
|
||||
</View>
|
||||
{valueToLabelMap.get(currentValue)}
|
||||
</Text>
|
||||
<View className="ml-auto shrink-0 pl-1">
|
||||
<MingcuteDownLineIcon color={accentColor} height={18} width={18} />
|
||||
</View>
|
||||
</ContextMenu>
|
||||
</View>
|
||||
</DropdownMenu>
|
||||
)
|
||||
|
||||
if (!label) {
|
||||
return Trigger
|
||||
}
|
||||
|
||||
return (
|
||||
<View className="flex-1 flex-row items-center">
|
||||
<FormLabel className="pl-2" label={label} />
|
||||
<View className="flex-1" />
|
||||
|
||||
{Trigger}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { forwardRef } from "react"
|
||||
import type { StyleProp, SwitchProps, ViewStyle } from "react-native"
|
||||
import { Switch, Text, View } from "react-native"
|
||||
|
||||
import { accentColor } from "@/src/theme/colors"
|
||||
import type { StyleProp, ViewStyle } from "react-native"
|
||||
import { Text, View } from "react-native"
|
||||
|
||||
import type { SwitchProps, SwitchRef } from "../switch/Switch"
|
||||
import { Switch } from "../switch/Switch"
|
||||
import { FormLabel } from "./Label"
|
||||
|
||||
interface Props {
|
||||
@@ -12,19 +12,26 @@ interface Props {
|
||||
|
||||
label?: string
|
||||
description?: string
|
||||
|
||||
size?: "sm" | "default"
|
||||
}
|
||||
|
||||
export const FormSwitch = forwardRef<Switch, Props & SwitchProps>(
|
||||
({ wrapperClassName, wrapperStyle, label, description, ...rest }, ref) => {
|
||||
export const FormSwitch = forwardRef<SwitchRef, Props & SwitchProps>(
|
||||
({ wrapperClassName, wrapperStyle, label, description, size = "default", ...rest }, ref) => {
|
||||
const Trigger = <Switch size={size} ref={ref} {...rest} />
|
||||
|
||||
if (!label) {
|
||||
return Trigger
|
||||
}
|
||||
return (
|
||||
<View className={"w-full flex-row"}>
|
||||
<View className="flex-1">
|
||||
{!!label && <FormLabel className="pl-1" label={label} optional />}
|
||||
<FormLabel className="pl-1" label={label} optional />
|
||||
{!!description && (
|
||||
<Text className="text-secondary-label mb-1 pl-1 text-sm">{description}</Text>
|
||||
)}
|
||||
</View>
|
||||
<Switch trackColor={{ true: accentColor }} ref={ref} {...rest} />
|
||||
{Trigger}
|
||||
</View>
|
||||
)
|
||||
},
|
||||
|
||||
@@ -7,25 +7,36 @@ import { accentColor } from "@/src/theme/colors"
|
||||
|
||||
import { FormLabel } from "./Label"
|
||||
|
||||
interface TextFieldProps {
|
||||
interface BaseFieldProps {
|
||||
wrapperClassName?: string
|
||||
wrapperStyle?: StyleProp<ViewStyle>
|
||||
|
||||
label?: string
|
||||
description?: string
|
||||
required?: boolean
|
||||
|
||||
inputPostfixElement?: React.ReactNode
|
||||
}
|
||||
|
||||
export const TextField = forwardRef<TextInput, TextInputProps & TextFieldProps>(
|
||||
const BaseField = forwardRef<TextInput, TextInputProps & BaseFieldProps>(
|
||||
(
|
||||
{ className, style, wrapperClassName, wrapperStyle, label, description, required, ...rest },
|
||||
{
|
||||
className,
|
||||
style,
|
||||
wrapperClassName,
|
||||
wrapperStyle,
|
||||
label,
|
||||
description,
|
||||
required,
|
||||
inputPostfixElement,
|
||||
...rest
|
||||
},
|
||||
ref,
|
||||
) => {
|
||||
return (
|
||||
<>
|
||||
{!!label && <FormLabel className="pl-1" label={label} optional={!required} />}
|
||||
<View className="flex-1">
|
||||
{!!label && <FormLabel className="pl-2.5" label={label} optional={!required} />}
|
||||
{!!description && (
|
||||
<Text className="text-secondary-label mb-1 pl-1 text-sm">{description}</Text>
|
||||
<Text className="text-secondary-label mb-1 pl-2.5 text-sm">{description}</Text>
|
||||
)}
|
||||
<View
|
||||
className={cn(
|
||||
@@ -37,16 +48,42 @@ export const TextField = forwardRef<TextInput, TextInputProps & TextFieldProps>(
|
||||
<TextInput
|
||||
selectionColor={accentColor}
|
||||
ref={ref}
|
||||
className={cn("text-text placeholder:text-secondary-label w-full flex-1", className)}
|
||||
className={cn("text-label placeholder:text-secondary-label w-full flex-1", className)}
|
||||
style={StyleSheet.flatten([styles.textField, style])}
|
||||
{...rest}
|
||||
/>
|
||||
{inputPostfixElement}
|
||||
</View>
|
||||
</>
|
||||
</View>
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
export const TextField = forwardRef<TextInput, TextInputProps & BaseFieldProps>((props, ref) => (
|
||||
<BaseField {...props} ref={ref} />
|
||||
))
|
||||
|
||||
interface NumberFieldProps extends BaseFieldProps {
|
||||
value?: number
|
||||
onChangeNumber?: (value: number) => void
|
||||
defaultValue?: number
|
||||
}
|
||||
|
||||
export const NumberField = forwardRef<
|
||||
TextInput,
|
||||
Omit<TextInputProps, "keyboardType" | "value" | "onChangeText" | "defaultValue"> &
|
||||
NumberFieldProps
|
||||
>(({ value, onChangeNumber, defaultValue, ...rest }, ref) => (
|
||||
<BaseField
|
||||
{...rest}
|
||||
ref={ref}
|
||||
keyboardType="number-pad"
|
||||
value={value?.toString()}
|
||||
onChangeText={(text) => onChangeNumber?.(Math.min(Number(text), Number.MAX_SAFE_INTEGER))}
|
||||
defaultValue={defaultValue?.toString()}
|
||||
/>
|
||||
))
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
textField: {
|
||||
fontSize: 16,
|
||||
|
||||
@@ -5,26 +5,47 @@ import { Fragment } from "react"
|
||||
import type { ViewProps } from "react-native"
|
||||
import { Pressable, StyleSheet, Text, View } from "react-native"
|
||||
|
||||
import { RightCuteReIcon } from "@/src/icons/right_cute_re"
|
||||
import { MingcuteRightLine } from "@/src/icons/mingcute_right_line"
|
||||
import { useColor } from "@/src/theme/colors"
|
||||
|
||||
export const GroupedInsetListCard: FC<PropsWithChildren> = ({ children }) => {
|
||||
type GroupedInsetListCardProps = {
|
||||
showSeparator?: boolean
|
||||
}
|
||||
|
||||
export const GroupedInsetListCard: FC<
|
||||
PropsWithChildren & ViewProps & GroupedInsetListCardProps
|
||||
> = ({ children, className, showSeparator = true, ...props }) => {
|
||||
return (
|
||||
<View className="bg-secondary-system-grouped-background mx-4 flex-1 overflow-hidden rounded-[10px]">
|
||||
{React.Children.map(children, (child, index) => {
|
||||
const isLast = index === React.Children.count(children) - 1
|
||||
return (
|
||||
<Fragment key={index}>
|
||||
{child}
|
||||
{!isLast && (
|
||||
<View
|
||||
className="bg-opaque-separator ml-16"
|
||||
style={{ height: StyleSheet.hairlineWidth }}
|
||||
/>
|
||||
)}
|
||||
</Fragment>
|
||||
)
|
||||
})}
|
||||
<View
|
||||
{...props}
|
||||
className={cn(
|
||||
"bg-secondary-system-grouped-background mx-4 flex-1 overflow-hidden rounded-[10px]",
|
||||
className,
|
||||
)}
|
||||
>
|
||||
{showSeparator
|
||||
? React.Children.map(children, (child, index) => {
|
||||
const isLast = index === React.Children.count(children) - 1
|
||||
|
||||
if (child === null) return null
|
||||
const isNavigationLink =
|
||||
React.isValidElement(child) &&
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
||||
(child.type as Function).name === GroupedInsetListNavigationLink.name
|
||||
|
||||
return (
|
||||
<Fragment key={index}>
|
||||
{child}
|
||||
{!isLast && (
|
||||
<View
|
||||
className={cn("bg-opaque-separator", isNavigationLink ? "ml-16" : "mx-4")}
|
||||
style={{ height: StyleSheet.hairlineWidth }}
|
||||
/>
|
||||
)}
|
||||
</Fragment>
|
||||
)
|
||||
})
|
||||
: children}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
@@ -41,9 +62,15 @@ export const GroupedInsetListSectionHeader: FC<{
|
||||
)
|
||||
}
|
||||
|
||||
export const GroupedInsetListItem: FC<PropsWithChildren & ViewProps> = ({ children, ...props }) => {
|
||||
export const GroupedInsetListBaseCell: FC<PropsWithChildren & ViewProps> = ({
|
||||
children,
|
||||
...props
|
||||
}) => {
|
||||
return (
|
||||
<View {...props} className={cn("px-5 py-4", props.className)}>
|
||||
<View
|
||||
{...props}
|
||||
className={cn("flex-row items-center justify-between px-5 py-4", props.className)}
|
||||
>
|
||||
{children}
|
||||
</View>
|
||||
)
|
||||
@@ -53,24 +80,141 @@ export const GroupedInsetListNavigationLink: FC<{
|
||||
label: string
|
||||
icon?: React.ReactNode
|
||||
onPress: () => void
|
||||
}> = ({ label, icon, onPress }) => {
|
||||
const tertiaryLabelColor = useColor("tertiaryLabel")
|
||||
disabled?: boolean
|
||||
}> = ({ label, icon, onPress, disabled }) => {
|
||||
const rightIconColor = useColor("tertiaryLabel")
|
||||
|
||||
return (
|
||||
<Pressable onPress={onPress}>
|
||||
<Pressable onPress={onPress} disabled={disabled}>
|
||||
{({ pressed }) => (
|
||||
<GroupedInsetListItem className={cn(pressed && "bg-system-fill")}>
|
||||
<View className={"flex-row items-center"}>
|
||||
<GroupedInsetListBaseCell
|
||||
className={cn(pressed ? "bg-system-fill" : undefined, disabled && "opacity-40")}
|
||||
>
|
||||
<View className={"flex-1 flex-row items-center justify-between"}>
|
||||
<View className="flex-row items-center">
|
||||
{icon}
|
||||
<Text className="text-[16px]">{label}</Text>
|
||||
<Text className={"text-label text-[16px]"}>{label}</Text>
|
||||
</View>
|
||||
<View className="-mr-2 ml-auto">
|
||||
<RightCuteReIcon height={18} width={18} color={tertiaryLabelColor} />
|
||||
<View className="-mr-2 ml-4">
|
||||
<MingcuteRightLine height={18} width={18} color={rightIconColor} />
|
||||
</View>
|
||||
</View>
|
||||
</GroupedInsetListItem>
|
||||
</GroupedInsetListBaseCell>
|
||||
)}
|
||||
</Pressable>
|
||||
)
|
||||
}
|
||||
|
||||
export const GroupedInsetListNavigationLinkIcon: FC<
|
||||
{
|
||||
backgroundColor: string
|
||||
} & PropsWithChildren
|
||||
> = ({ backgroundColor, children }) => {
|
||||
return (
|
||||
<View
|
||||
className="mr-4 items-center justify-center rounded-[5px] p-1"
|
||||
style={{
|
||||
backgroundColor,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
export const GroupedInsetListCell: FC<{
|
||||
label: string
|
||||
description?: string
|
||||
children?: React.ReactNode
|
||||
}> = ({ label, description, children }) => {
|
||||
return (
|
||||
<GroupedInsetListBaseCell className="flex-1">
|
||||
<View className="flex-1">
|
||||
<Text className="text-label">{label}</Text>
|
||||
{!!description && (
|
||||
<Text className="text-secondary-label text-sm leading-tight">{description}</Text>
|
||||
)}
|
||||
</View>
|
||||
|
||||
<View className="mb-auto ml-4 shrink-0">{children}</View>
|
||||
</GroupedInsetListBaseCell>
|
||||
)
|
||||
}
|
||||
|
||||
export const GroupedInsetListActionCell: FC<{
|
||||
label: string
|
||||
description?: string
|
||||
onPress: () => void
|
||||
disabled?: boolean
|
||||
}> = ({ label, description, onPress, disabled }) => {
|
||||
const rightIconColor = useColor("tertiaryLabel")
|
||||
return (
|
||||
<Pressable onPress={onPress} disabled={disabled}>
|
||||
{({ pressed }) => (
|
||||
<GroupedInsetListBaseCell
|
||||
className={cn(pressed ? "bg-system-fill" : undefined, disabled && "opacity-40")}
|
||||
>
|
||||
<View className="flex-1">
|
||||
<Text>{label}</Text>
|
||||
{!!description && (
|
||||
<Text className="text-secondary-label text-sm leading-tight">{description}</Text>
|
||||
)}
|
||||
</View>
|
||||
|
||||
<View className="-mr-2 ml-4">
|
||||
<MingcuteRightLine height={18} width={18} color={rightIconColor} />
|
||||
</View>
|
||||
</GroupedInsetListBaseCell>
|
||||
)}
|
||||
</Pressable>
|
||||
)
|
||||
}
|
||||
|
||||
export const GroupedInsetButtonCell: FC<{
|
||||
label: string
|
||||
onPress: () => void
|
||||
disabled?: boolean
|
||||
style?: "destructive" | "primary"
|
||||
}> = ({ label, onPress, disabled, style = "primary" }) => {
|
||||
return (
|
||||
<Pressable onPress={onPress} disabled={disabled}>
|
||||
{({ pressed }) => (
|
||||
<GroupedInsetListBaseCell
|
||||
className={cn(pressed ? "bg-system-fill" : undefined, disabled && "opacity-40")}
|
||||
>
|
||||
<View className="flex-1 items-center justify-center">
|
||||
<Text className={`${style === "destructive" ? "text-red" : "text-label"}`}>
|
||||
{label}
|
||||
</Text>
|
||||
</View>
|
||||
</GroupedInsetListBaseCell>
|
||||
)}
|
||||
</Pressable>
|
||||
)
|
||||
}
|
||||
|
||||
export const GroupedInformationCell: FC<{
|
||||
title: string
|
||||
description?: string
|
||||
icon?: React.ReactNode
|
||||
iconBackgroundColor?: string
|
||||
}> = ({ title, description, icon, iconBackgroundColor }) => {
|
||||
return (
|
||||
<GroupedInsetListBaseCell className="flex-1 flex-col items-center justify-center rounded-[16px] p-6">
|
||||
{!!icon && (
|
||||
<View
|
||||
className="mb-3 size-[64px] items-center justify-center rounded-xl p-1"
|
||||
style={{ backgroundColor: iconBackgroundColor }}
|
||||
>
|
||||
{icon}
|
||||
</View>
|
||||
)}
|
||||
<Text className="text-label text-3xl font-bold">{title}</Text>
|
||||
{!!description && (
|
||||
<Text className="text-label mt-3 text-balance text-center text-base leading-tight">
|
||||
{description}
|
||||
</Text>
|
||||
)}
|
||||
</GroupedInsetListBaseCell>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -2,8 +2,9 @@ import { getBackgroundGradient, isCJKChar } from "@follow/utils"
|
||||
import { Image } from "expo-image"
|
||||
import { LinearGradient } from "expo-linear-gradient"
|
||||
import { useMemo, useState } from "react"
|
||||
import type { StyleProp, TextStyle, ViewStyle } from "react-native"
|
||||
import type { DimensionValue, StyleProp, TextStyle, ViewStyle } from "react-native"
|
||||
import { StyleSheet, Text, View } from "react-native"
|
||||
import { useColor } from "react-native-uikit-colors"
|
||||
|
||||
export const FallbackIcon = ({
|
||||
title,
|
||||
@@ -13,14 +14,16 @@ export const FallbackIcon = ({
|
||||
style,
|
||||
textClassName,
|
||||
textStyle,
|
||||
gray,
|
||||
}: {
|
||||
title: string
|
||||
url?: string
|
||||
size: number
|
||||
size: DimensionValue
|
||||
className?: string
|
||||
style?: StyleProp<ViewStyle>
|
||||
textClassName?: string
|
||||
textStyle?: StyleProp<TextStyle>
|
||||
gray?: boolean
|
||||
}) => {
|
||||
const colors = useMemo(() => getBackgroundGradient(title || url || ""), [title, url])
|
||||
const sizeStyle = useMemo(() => ({ width: size, height: size }), [size])
|
||||
@@ -28,7 +31,7 @@ export const FallbackIcon = ({
|
||||
const [, , , bgAccent, bgAccentLight, bgAccentUltraLight] = colors
|
||||
|
||||
const renderedText = useMemo(() => {
|
||||
const isCJK = isCJKChar(title[0])
|
||||
const isCJK = isCJKChar(title[0]!)
|
||||
return (
|
||||
<Text style={StyleSheet.flatten([styles.text, textStyle])} className={textClassName}>
|
||||
{isCJK ? title[0] : title.slice(0, 2)}
|
||||
@@ -36,10 +39,14 @@ export const FallbackIcon = ({
|
||||
)
|
||||
}, [title, textStyle, textClassName])
|
||||
|
||||
const grayColor = useColor("gray2")
|
||||
|
||||
return (
|
||||
<LinearGradient
|
||||
className={className}
|
||||
colors={[bgAccent, bgAccentLight, bgAccentUltraLight]}
|
||||
colors={
|
||||
gray ? [grayColor, grayColor, grayColor] : [bgAccent!, bgAccentLight!, bgAccentUltraLight!]
|
||||
}
|
||||
locations={[0, 0.99, 1]}
|
||||
style={[sizeStyle, styles.container, style]}
|
||||
>
|
||||
|
||||
@@ -20,7 +20,7 @@ export const LoadingIndicator: FC<
|
||||
color?: string
|
||||
className?: string
|
||||
} & PropsWithChildren
|
||||
> = ({ size = 60, color, children, className }) => {
|
||||
> = ({ size = 36, color, children, className }) => {
|
||||
const rotateValue = useSharedValue(0)
|
||||
|
||||
const rotation = useDerivedValue(() => {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { useTypeScriptHappyCallback } from "@follow/hooks"
|
||||
import { cn, composeEventHandlers } from "@follow/utils"
|
||||
import { memo, useEffect, useState } from "react"
|
||||
import { Fragment, memo, useEffect, useState } from "react"
|
||||
import type { Pressable } from "react-native"
|
||||
import { StyleSheet } from "react-native"
|
||||
import {
|
||||
import Animated, {
|
||||
Easing,
|
||||
interpolateColor,
|
||||
useAnimatedStyle,
|
||||
@@ -49,13 +49,20 @@ export const ItemPressable: typeof Pressable = memo(({ children, ...props }) =>
|
||||
onPressOut={composeEventHandlers(props.onPressOut, () => setIsPressing(false))}
|
||||
onHoverIn={composeEventHandlers(props.onHoverIn, () => setIsPressing(true))}
|
||||
onHoverOut={composeEventHandlers(props.onHoverOut, () => setIsPressing(false))}
|
||||
className={cn(
|
||||
// isPressing ? "bg-system-fill" : "bg-secondary-system-grouped-background",
|
||||
props.className,
|
||||
)}
|
||||
style={StyleSheet.flatten([colorStyle, props.style])}
|
||||
className={cn(props.className, "bg-secondary-system-background relative")}
|
||||
style={props.style}
|
||||
>
|
||||
{children}
|
||||
{useTypeScriptHappyCallback(
|
||||
(props) => {
|
||||
return (
|
||||
<Fragment>
|
||||
<Animated.View className="absolute inset-0" style={colorStyle} />
|
||||
{typeof children === "function" ? children(props) : children}
|
||||
</Fragment>
|
||||
)
|
||||
},
|
||||
[children, colorStyle],
|
||||
)}
|
||||
</ReAnimatedPressable>
|
||||
)
|
||||
})
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
import { forwardRef, useEffect, useImperativeHandle } from "react"
|
||||
import type { SwitchChangeEvent } from "react-native"
|
||||
import { Pressable, StyleSheet, View } from "react-native"
|
||||
import Animated, {
|
||||
interpolate,
|
||||
interpolateColor,
|
||||
useAnimatedStyle,
|
||||
useSharedValue,
|
||||
withSpring,
|
||||
withTiming,
|
||||
} from "react-native-reanimated"
|
||||
|
||||
import { accentColor, useColor } from "@/src/theme/colors"
|
||||
|
||||
export interface SwitchProps {
|
||||
onChange?: ((event: SwitchChangeEvent) => Promise<void> | void) | null | undefined
|
||||
|
||||
/**
|
||||
* Invoked with the new value when the value changes.
|
||||
*/
|
||||
onValueChange?: ((value: boolean) => Promise<void> | void) | null | undefined
|
||||
|
||||
/**
|
||||
* The value of the switch. If true the switch will be turned on.
|
||||
* Default value is false.
|
||||
*/
|
||||
value?: boolean | undefined
|
||||
|
||||
size?: "sm" | "default"
|
||||
}
|
||||
|
||||
export type SwitchRef = {
|
||||
value: boolean
|
||||
}
|
||||
export const Switch = forwardRef<SwitchRef, SwitchProps>(
|
||||
({ value, onValueChange, onChange, size = "default" }, ref) => {
|
||||
const progress = useSharedValue(value ? 1 : 0)
|
||||
const scale = useSharedValue(1)
|
||||
const translateX = useSharedValue(0)
|
||||
|
||||
const onTouchStart = () => {
|
||||
scale.value = withSpring(1.1)
|
||||
if (value) {
|
||||
translateX.value = withSpring(size === "sm" ? -4 : -7)
|
||||
}
|
||||
}
|
||||
|
||||
const onTouchEnd = () => {
|
||||
scale.value = withSpring(1)
|
||||
translateX.value = withSpring(0)
|
||||
}
|
||||
|
||||
useImperativeHandle(ref, () => ({
|
||||
value: !!value,
|
||||
}))
|
||||
|
||||
const activeBgColor = accentColor
|
||||
const inactiveBgColor = useColor("secondarySystemFill")
|
||||
|
||||
const toggleStyle = useAnimatedStyle(() => {
|
||||
const backgroundColor = interpolateColor(
|
||||
progress.value,
|
||||
[0, 1],
|
||||
[inactiveBgColor, activeBgColor],
|
||||
)
|
||||
|
||||
return {
|
||||
backgroundColor,
|
||||
}
|
||||
})
|
||||
|
||||
const circleStyle = useAnimatedStyle(() => {
|
||||
const marginLeft = interpolate(progress.value, [0, 1], size === "sm" ? [2, 20] : [2.3, 22])
|
||||
|
||||
const width = interpolate(scale.value, [1, 1.1], size === "sm" ? [18, 21] : [27.8, 35])
|
||||
|
||||
return {
|
||||
marginLeft,
|
||||
width,
|
||||
transform: [{ translateX: translateX.value }, { translateY: -0.4 }, { scale: scale.value }],
|
||||
}
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
// Update progress when value changes
|
||||
if (value && progress.value === 0) {
|
||||
progress.value = withTiming(1)
|
||||
} else if (!value && progress.value === 1) {
|
||||
progress.value = withTiming(0)
|
||||
}
|
||||
}, [progress, value])
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<Pressable
|
||||
onTouchStart={onTouchStart}
|
||||
onTouchEnd={onTouchEnd}
|
||||
onPress={() => {
|
||||
onValueChange?.(!value)
|
||||
onChange?.({ target: { value: !value } as any } as SwitchChangeEvent)
|
||||
}}
|
||||
>
|
||||
<Animated.View
|
||||
style={[size === "sm" ? styles.toggleContainerSm : styles.toggleContainer, toggleStyle]}
|
||||
>
|
||||
<Animated.View
|
||||
style={[
|
||||
size === "sm" ? styles.toggleWheelStyleSm : styles.toggleWheelStyle,
|
||||
circleStyle,
|
||||
]}
|
||||
/>
|
||||
</Animated.View>
|
||||
</Pressable>
|
||||
</View>
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: { display: "flex", justifyContent: "space-between" },
|
||||
toggleContainer: {
|
||||
width: 52,
|
||||
height: 32.7,
|
||||
borderRadius: 4000,
|
||||
justifyContent: "center",
|
||||
},
|
||||
toggleContainerSm: {
|
||||
width: 40,
|
||||
height: 24,
|
||||
borderRadius: 4000,
|
||||
justifyContent: "center",
|
||||
},
|
||||
toggleWheelStyle: {
|
||||
height: 28.5,
|
||||
backgroundColor: "#ffffff",
|
||||
borderRadius: 200,
|
||||
shadowColor: "#515151",
|
||||
shadowOffset: {
|
||||
width: 0,
|
||||
height: 0,
|
||||
},
|
||||
shadowOpacity: 0.2,
|
||||
shadowRadius: 2.5,
|
||||
elevation: 1.5,
|
||||
},
|
||||
toggleWheelStyleSm: {
|
||||
height: 20,
|
||||
backgroundColor: "#ffffff",
|
||||
borderRadius: 200,
|
||||
shadowColor: "#515151",
|
||||
shadowOffset: {
|
||||
width: 0,
|
||||
height: 0,
|
||||
},
|
||||
shadowOpacity: 0.2,
|
||||
shadowRadius: 2.5,
|
||||
elevation: 1.5,
|
||||
},
|
||||
})
|
||||
@@ -20,7 +20,7 @@ import type {
|
||||
import { Pressable, ScrollView, StyleSheet, Text, View } from "react-native"
|
||||
import Animated, { useAnimatedStyle, useSharedValue, withSpring } from "react-native-reanimated"
|
||||
|
||||
import { accentColor } from "@/src/theme/colors"
|
||||
import { accentColor, useColor } from "@/src/theme/colors"
|
||||
|
||||
import type { Tab } from "./types"
|
||||
|
||||
@@ -110,20 +110,39 @@ export const TabBar = forwardRef<ScrollView, TabBarProps>(
|
||||
useEffect(() => {
|
||||
if (tabWidths.length > 0) {
|
||||
indicatorPosition.value = withSpring(tabPositions[currentTab] || 0, springConfig)
|
||||
}
|
||||
}, [currentTab, indicatorPosition, tabPositions, tabWidths.length])
|
||||
|
||||
if (tabRef.current) {
|
||||
const x = currentTab > 0 ? tabPositions[currentTab - 1] + tabWidths[currentTab - 1] : 0
|
||||
const tabBarScrollX = useRef(0)
|
||||
useEffect(() => {
|
||||
// If the current tab is not within the visible range of the scrollview, then scroll the scrollview to the visible area.
|
||||
if (tabRef.current && tabPositions[currentTab] !== undefined && tabWidths[currentTab]) {
|
||||
const tabPosition = tabPositions[currentTab]
|
||||
const tabWidth = tabWidths[currentTab]
|
||||
|
||||
const isCurrentTabVisible =
|
||||
sharedPagerOffsetX.value < tabPositions[currentTab] &&
|
||||
sharedPagerOffsetX.value + tabWidths[currentTab] > tabPositions[currentTab]
|
||||
// Get the current scroll position and visible width of the ScrollView
|
||||
const scrollView = tabRef.current
|
||||
const currentScrollX = tabBarScrollX.current
|
||||
|
||||
if (!isCurrentTabVisible) {
|
||||
tabRef.current.scrollTo({ x, y: 0, animated: true })
|
||||
}
|
||||
const visibleWidth = tabBarWidth
|
||||
|
||||
// Check if the tab is outside the visible area
|
||||
const isTabOutsideView =
|
||||
tabPosition < currentScrollX || // tab is to the left of visible area
|
||||
tabPosition + tabWidth > currentScrollX + visibleWidth // tab is to the right
|
||||
|
||||
if (isTabOutsideView) {
|
||||
// Add some padding to ensure the tab isn't right at the edge
|
||||
const padding = 16
|
||||
|
||||
scrollView.scrollTo({
|
||||
x: Math.max(0, tabPosition - padding),
|
||||
animated: true,
|
||||
})
|
||||
}
|
||||
}
|
||||
}, [currentTab, indicatorPosition, sharedPagerOffsetX.value, tabPositions, tabWidths])
|
||||
}, [currentTab, sharedPagerOffsetX.value, tabPositions, tabWidths, tabBarWidth])
|
||||
|
||||
const handleTabItemLayout = useCallback((event: LayoutChangeEvent, index: number) => {
|
||||
const { width, x } = event.nativeEvent.layout
|
||||
setTabWidths((prev) => {
|
||||
@@ -146,17 +165,17 @@ export const TabBar = forwardRef<ScrollView, TabBarProps>(
|
||||
|
||||
// Interpolate between current and next tab positions
|
||||
const xPosition =
|
||||
tabPositions[currentIndex] +
|
||||
(tabPositions[nextIndex] - tabPositions[currentIndex]) * progress
|
||||
tabPositions[currentIndex]! +
|
||||
(tabPositions[nextIndex]! - tabPositions[currentIndex]!) * progress
|
||||
|
||||
// Interpolate between current and next tab widths
|
||||
const width =
|
||||
tabWidths[currentIndex] + (tabWidths[nextIndex] - tabWidths[currentIndex]) * progress
|
||||
tabWidths[currentIndex]! + (tabWidths[nextIndex]! - tabWidths[currentIndex]!) * progress
|
||||
|
||||
return {
|
||||
transform: [{ translateX: Math.max(xPosition, 0) }],
|
||||
width,
|
||||
backgroundColor: tabs[currentTab].activeColor || accentColor,
|
||||
backgroundColor: tabs[currentTab]!.activeColor || accentColor,
|
||||
}
|
||||
})
|
||||
|
||||
@@ -165,6 +184,9 @@ export const TabBar = forwardRef<ScrollView, TabBarProps>(
|
||||
onLayout={(event) => {
|
||||
setTabBarWidth(event.nativeEvent.layout.width)
|
||||
}}
|
||||
onScroll={(event) => {
|
||||
tabBarScrollX.current = event.nativeEvent.contentOffset.x
|
||||
}}
|
||||
showsHorizontalScrollIndicator={false}
|
||||
className={cn(
|
||||
"border-tertiary-system-background relative shrink-0 grow-0",
|
||||
@@ -210,9 +232,12 @@ const styles = StyleSheet.create({
|
||||
})
|
||||
|
||||
const TabItemInner = ({ tab, isSelected }: { tab: Tab; isSelected: boolean }) => {
|
||||
const gray = useColor("gray")
|
||||
return (
|
||||
<View className="p-2">
|
||||
<Text style={{ color: isSelected ? accentColor : "gray" }}>{tab.name}</Text>
|
||||
<Text style={{ color: isSelected ? accentColor : gray }} className="text-[15px] leading-none">
|
||||
{tab.name}
|
||||
</Text>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -64,14 +64,14 @@ export class ToastManager {
|
||||
}
|
||||
|
||||
private scheduleDismiss(index: number) {
|
||||
const props = this.propsMap[index]
|
||||
const props = this.propsMap[index]!
|
||||
|
||||
if (props.duration === Infinity) {
|
||||
return
|
||||
}
|
||||
|
||||
setTimeout(async () => {
|
||||
await this.toastRefs[index].dimiss()
|
||||
await this.toastRefs[index]!.dimiss()
|
||||
this.remove(index)
|
||||
}, props.duration)
|
||||
}
|
||||
|
||||
@@ -4,11 +4,47 @@ import "@follow/components/assets/tailwind.css"
|
||||
|
||||
import type { HtmlProps } from "@follow/components"
|
||||
import { Html } from "@follow/components"
|
||||
import { useEffect } from "react"
|
||||
|
||||
function useSize(callback: (size: [number, number]) => void) {
|
||||
useEffect(() => {
|
||||
const lastSize = [document.body.clientWidth, document.body.clientHeight] as [number, number]
|
||||
|
||||
// Observe window size changes
|
||||
const observer = new ResizeObserver((entries) => {
|
||||
for (const entry of entries) {
|
||||
const { width, height } = entry.contentRect
|
||||
|
||||
if (
|
||||
width.toFixed(0) !== lastSize[0].toFixed(0) ||
|
||||
height.toFixed(0) !== lastSize[1].toFixed(0)
|
||||
) {
|
||||
lastSize[0] = width
|
||||
lastSize[1] = height
|
||||
callback([width, height])
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
observer.observe(document.body)
|
||||
|
||||
callback([document.body.clientWidth, document.body.clientHeight])
|
||||
|
||||
return () => {
|
||||
observer.disconnect()
|
||||
}
|
||||
}, [callback])
|
||||
}
|
||||
|
||||
export default function HtmlWeb({
|
||||
content,
|
||||
dom,
|
||||
onLayout,
|
||||
...options
|
||||
}: { dom?: import("expo/dom").DOMProps } & HtmlProps) {
|
||||
}: {
|
||||
dom?: import("expo/dom").DOMProps
|
||||
onLayout: (size: [number, number]) => void
|
||||
} & HtmlProps) {
|
||||
useSize(onLayout)
|
||||
return <Html content={content} {...options} />
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
import type { FC } from "react"
|
||||
import { useRef } from "react"
|
||||
import { Linking } from "react-native"
|
||||
import type { WebView } from "react-native-webview"
|
||||
|
||||
import MarkdownWeb from "./MarkdownWeb"
|
||||
|
||||
export const Markdown: FC<{
|
||||
value: string
|
||||
style?: React.CSSProperties
|
||||
className?: string
|
||||
|
||||
webViewProps?: import("expo/dom").DOMProps
|
||||
}> = ({ value, style, className, webViewProps }) => {
|
||||
const ref = useRef<WebView>(null)
|
||||
|
||||
return (
|
||||
<MarkdownWeb
|
||||
value={value}
|
||||
ref={ref}
|
||||
style={style}
|
||||
className={className}
|
||||
dom={{
|
||||
...webViewProps,
|
||||
|
||||
onMessage: (event) => {
|
||||
const { type, url } = JSON.parse(event.nativeEvent.data)
|
||||
if (type === "openLinkInModal") {
|
||||
Linking.openURL(url)
|
||||
}
|
||||
},
|
||||
injectedJavaScriptBeforeContentLoaded: `window.openLinkInModal = (url) => {
|
||||
window.ReactNativeWebView.postMessage(JSON.stringify({
|
||||
type: "openLinkInModal",
|
||||
url,
|
||||
}))
|
||||
}`,
|
||||
}}
|
||||
/>
|
||||
)
|
||||
}
|
||||
@@ -8,19 +8,58 @@ import { useDarkMode } from "usehooks-ts"
|
||||
|
||||
import { useCSSInjection } from "@/src/theme/web"
|
||||
|
||||
const MarkdownWeb: WebComponent<{ value: string; style?: React.CSSProperties }> = ({
|
||||
value,
|
||||
style,
|
||||
}) => {
|
||||
declare const window: {
|
||||
openLinkInModal: (url: string) => void
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
const MarkdownWeb: WebComponent<{
|
||||
value: string
|
||||
style?: React.CSSProperties
|
||||
className?: string
|
||||
}> = ({ value, style, className }) => {
|
||||
useCSSInjection()
|
||||
|
||||
const { isDarkMode } = useDarkMode()
|
||||
return (
|
||||
<div
|
||||
className={cn("text-text prose min-w-0", isDarkMode ? "prose-invert" : "prose")}
|
||||
className={cn("text-text prose min-w-0", isDarkMode ? "prose-invert" : "prose", className)}
|
||||
style={style}
|
||||
>
|
||||
{useMemo(() => parseMarkdown(value).content, [value])}
|
||||
<style
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `
|
||||
:root {
|
||||
overscroll-behavior: none;
|
||||
}
|
||||
body, html {
|
||||
overflow-y: hidden;
|
||||
}
|
||||
`,
|
||||
}}
|
||||
/>
|
||||
{useMemo(
|
||||
() =>
|
||||
parseMarkdown(value, {
|
||||
components: {
|
||||
a: ({ children, ...props }) => (
|
||||
<a
|
||||
onClick={(e) => {
|
||||
if (!props.href) return
|
||||
|
||||
e.preventDefault()
|
||||
window.openLinkInModal(props.href)
|
||||
}}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
</a>
|
||||
),
|
||||
},
|
||||
}).content,
|
||||
[value],
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ let db: ExpoSQLiteDatabase<typeof schema> & {
|
||||
export function initializeDb() {
|
||||
db = drizzle(sqlite, {
|
||||
schema,
|
||||
logger: true,
|
||||
logger: false,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
// https://github.com/react-navigation/react-navigation/blob/main/packages/native-stack/src/views/NativeStackView.native.tsx
|
||||
|
||||
import { getDefaultHeaderHeight } from "@react-navigation/elements"
|
||||
import { Platform } from "react-native"
|
||||
import { useSafeAreaFrame, useSafeAreaInsets } from "react-native-safe-area-context"
|
||||
|
||||
export const useDefaultHeaderHeight = () => {
|
||||
const insets = useSafeAreaInsets()
|
||||
const frame = useSafeAreaFrame()
|
||||
|
||||
const isIPhone = Platform.OS === "ios" && !(Platform.isPad || Platform.isTV)
|
||||
const isLandscape = frame.width > frame.height
|
||||
const topInset = isIPhone && isLandscape ? 0 : insets.top
|
||||
const ANDROID_DEFAULT_HEADER_HEIGHT = 56
|
||||
|
||||
const defaultHeaderHeight = Platform.select({
|
||||
android: ANDROID_DEFAULT_HEADER_HEIGHT + topInset,
|
||||
default: getDefaultHeaderHeight(frame, false, topInset),
|
||||
})
|
||||
|
||||
return defaultHeaderHeight
|
||||
}
|
||||
@@ -4,7 +4,7 @@ export const useIsRouteOnlyOne = () => {
|
||||
const navigation = useNavigation()
|
||||
const state = navigation.getState()
|
||||
|
||||
const routeOnlyOne = state.routes.length === 1
|
||||
const routeOnlyOne = state?.routes.length === 1
|
||||
|
||||
return routeOnlyOne
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import { parseSafeUrl, transformVideoUrl } from "@follow/utils"
|
||||
import type { RefObject } from "react"
|
||||
import { useCallback } from "react"
|
||||
import type WebView from "react-native-webview"
|
||||
import type { WebViewNavigation } from "react-native-webview"
|
||||
|
||||
import { useOpenLink } from "../lib/hooks/use-open-link"
|
||||
|
||||
const allowHosts = new Set(["app.follow.is"])
|
||||
export function useWebViewNavigation({ webViewRef }: { webViewRef: RefObject<WebView> }) {
|
||||
const openLink = useOpenLink()
|
||||
|
||||
const onNavigationStateChange = useCallback(
|
||||
(newNavState: WebViewNavigation) => {
|
||||
const { url: urlStr } = newNavState
|
||||
const url = parseSafeUrl(urlStr)
|
||||
if (!url) return
|
||||
if (url.protocol === "file:") return
|
||||
if (allowHosts.has(url.host)) return
|
||||
|
||||
webViewRef.current?.stopLoading()
|
||||
|
||||
const formattedUrl = transformVideoUrl({ url: urlStr })
|
||||
if (formattedUrl) {
|
||||
openLink(formattedUrl)
|
||||
return
|
||||
}
|
||||
openLink(urlStr)
|
||||
},
|
||||
[openLink, webViewRef],
|
||||
)
|
||||
|
||||
return { onNavigationStateChange }
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import * as React from "react"
|
||||
import Svg, { Path } from "react-native-svg"
|
||||
|
||||
interface ExitCuteFiIconProps {
|
||||
width?: number
|
||||
height?: number
|
||||
color?: string
|
||||
}
|
||||
|
||||
export const ExitCuteFiIcon = ({
|
||||
width = 24,
|
||||
height = 24,
|
||||
color = "#10161F",
|
||||
}: ExitCuteFiIconProps) => {
|
||||
return (
|
||||
<Svg width={width} height={height} fill="none" viewBox="0 0 24 24">
|
||||
<Path fill="#fff" fillOpacity={0.01} d="M24 0v24H0V0z" />
|
||||
<Path
|
||||
stroke={color}
|
||||
strokeLinecap="round"
|
||||
strokeWidth={3}
|
||||
d="M12.5 12H20m-2.5-2.828a8.616 8.616 0 0 1 2.478 2.307.89.89 0 0 1 0 1.042A8.631 8.631 0 0 1 17.5 14.83M12.5 3.5c-3.44.002-5.21.053-6.328 1.171C5 5.843 5 7.73 5 11.5v1c0 3.771 0 5.657 1.172 6.828C7.29 20.447 9.06 20.498 12.5 20.5"
|
||||
/>
|
||||
</Svg>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import * as React from "react"
|
||||
import Svg, { Path } from "react-native-svg"
|
||||
|
||||
interface UserAdd2CuteFiIconProps {
|
||||
width?: number
|
||||
height?: number
|
||||
color?: string
|
||||
}
|
||||
|
||||
export const UserAdd2CuteFiIcon = ({
|
||||
width = 24,
|
||||
height = 24,
|
||||
color = "#10161F",
|
||||
}: UserAdd2CuteFiIconProps) => {
|
||||
return (
|
||||
<Svg width={width} height={height} fill="none" viewBox="0 0 24 24">
|
||||
<Path fill="#fff" fillOpacity={0.01} d="M24 0v24H0V0z" />
|
||||
<Path
|
||||
fill={color}
|
||||
d="M6 7a5 5 0 1 1 10 0A5 5 0 0 1 6 7M4.822 14.672C6.425 13.694 8.605 13 11 13c.447 0 .887.024 1.316.07a1 1 0 0 1 .72 1.557A5.968 5.968 0 0 0 12 18c0 .92.207 1.79.575 2.567a1 1 0 0 1-.89 1.428c-.226.003-.455.005-.685.005-2.229 0-4.335-.14-5.913-.558-.785-.208-1.524-.506-2.084-.956C2.41 20.01 2 19.345 2 18.5c0-.787.358-1.523.844-2.139.494-.625 1.177-1.2 1.978-1.69M18 14a1 1 0 0 1 1 1v2h2a1 1 0 1 1 0 2h-2v2a1 1 0 1 1-2 0v-2h-2a1 1 0 1 1 0-2h2v-2a1 1 0 0 1 1-1"
|
||||
/>
|
||||
</Svg>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import * as React from "react"
|
||||
import Svg, { Path } from "react-native-svg"
|
||||
|
||||
interface Wallet2CuteFiIconProps {
|
||||
width?: number
|
||||
height?: number
|
||||
color?: string
|
||||
}
|
||||
|
||||
export const Wallet2CuteFiIcon = ({
|
||||
width = 24,
|
||||
height = 24,
|
||||
color = "#10161F",
|
||||
}: Wallet2CuteFiIconProps) => {
|
||||
return (
|
||||
<Svg width={width} height={height} fill="none" viewBox="0 0 24 24">
|
||||
<Path fill="#fff" fillOpacity={0.01} d="M24 0v24H0V0z" />
|
||||
<Path
|
||||
fill={color}
|
||||
fillRule="evenodd"
|
||||
d="M9.06 4.647a.31.31 0 0 0-.06.069c0 .01.008.086.137.231.14.157.375.335.702.504.66.342 1.503.549 2.161.549.658 0 1.502-.207 2.161-.549.327-.169.561-.347.702-.504.129-.145.136-.22.137-.231a.309.309 0 0 0-.06-.069c-.106-.094-.31-.213-.639-.325C13.647 4.102 12.765 4 12 4c-.765 0-1.647.101-2.301.322-.33.112-.533.23-.638.325m6.63 2.214c.242-.17.469-.363.663-.58.353-.395.647-.925.647-1.567 0-.666-.317-1.188-.723-1.553-.386-.348-.872-.577-1.336-.733C14.01 2.113 12.892 2 12 2c-.892 0-2.01.113-2.941.428-.464.156-.95.385-1.336.733C7.317 3.526 7 4.048 7 4.714c0 .642.294 1.172.647 1.566.194.218.42.411.663.581C5.325 8.284 3 11.335 3 15c0 2.556 1.02 4.386 2.766 5.525C7.441 21.617 9.67 22 12 22s4.56-.383 6.234-1.475C19.98 19.386 21 17.555 21 15c0-3.665-2.325-6.716-5.31-8.139m-4.296 4.192a1 1 0 1 0-1.788.894L10.132 13H10a1 1 0 1 0 0 2h1v.5h-1a1 1 0 1 0 0 2h1v.5a1 1 0 1 0 2 0v-.5h1a1 1 0 1 0 0-2h-1V15h1a1 1 0 1 0 0-2h-.132l.526-1.053a1 1 0 1 0-1.788-.894L12 12.263z"
|
||||
clipRule="evenodd"
|
||||
/>
|
||||
</Svg>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export interface DataSettings {
|
||||
sendAnonymousData: boolean
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
export interface GeneralSettings {
|
||||
language: string
|
||||
translationLanguage: string
|
||||
|
||||
sendAnonymousData: boolean
|
||||
unreadOnly: boolean
|
||||
scrollMarkUnread: boolean
|
||||
|
||||
renderMarkUnread: boolean
|
||||
groupByDate: boolean
|
||||
jumpOutLinkWarn: boolean
|
||||
// TTS
|
||||
voice: string
|
||||
autoGroup: boolean
|
||||
|
||||
/**
|
||||
* Auto expand long social media
|
||||
*/
|
||||
autoExpandLongSocialMedia: boolean
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
export interface UISettings {
|
||||
subscriptionShowUnreadCount: boolean
|
||||
hideExtraBadge: boolean
|
||||
thumbnailRatio: "square" | "original"
|
||||
|
||||
// Content
|
||||
readerRenderInlineStyle: boolean
|
||||
codeHighlightThemeLight: string
|
||||
codeHighlightThemeDark: string
|
||||
guessCodeLanguage: boolean
|
||||
hideRecentReader: boolean
|
||||
customCSS: string
|
||||
|
||||
// view
|
||||
|
||||
pictureViewFilterNoImage: boolean
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable no-console */
|
||||
import type { AppType } from "@follow/shared"
|
||||
import { router } from "expo-router"
|
||||
import { ofetch } from "ofetch"
|
||||
import { FetchError, ofetch } from "ofetch"
|
||||
|
||||
import { getCookie } from "./auth"
|
||||
import { getApiUrl } from "./env"
|
||||
@@ -12,11 +12,16 @@ export const apiFetch = ofetch.create({
|
||||
retry: false,
|
||||
|
||||
baseURL: getApiUrl(),
|
||||
onRequest: async ({ options, request }) => {
|
||||
onRequest: async (ctx) => {
|
||||
const { options, request } = ctx
|
||||
if (__DEV__) {
|
||||
// Logger
|
||||
console.log(`---> ${options.method} ${request as string}`)
|
||||
}
|
||||
|
||||
// add cookie
|
||||
options.headers = options.headers || new Headers()
|
||||
options.headers.set("cookie", getCookie())
|
||||
},
|
||||
onRequestError: ({ error, request, options }) => {
|
||||
if (__DEV__) {
|
||||
@@ -54,3 +59,19 @@ export const apiClient = hc<AppType>(getApiUrl(), {
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
export const getBizFetchErrorMessage = (error: Error) => {
|
||||
if (error instanceof FetchError && error.response) {
|
||||
try {
|
||||
const data = JSON.parse(error.response._data)
|
||||
|
||||
if (data.message && data.code) {
|
||||
// TODO i18n handle by code
|
||||
return data.message
|
||||
}
|
||||
} catch {
|
||||
return error.message
|
||||
}
|
||||
}
|
||||
return error.message
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import type { languageSchema } from "@follow/shared/src/hono"
|
||||
import type { z } from "zod"
|
||||
|
||||
export type SupportedLanguages = z.infer<typeof languageSchema>
|
||||
export const LanguageMap: Record<
|
||||
SupportedLanguages,
|
||||
{
|
||||
label: string
|
||||
value: string
|
||||
code: string
|
||||
}
|
||||
> = {
|
||||
en: {
|
||||
value: "en",
|
||||
label: "English",
|
||||
code: "eng",
|
||||
},
|
||||
ja: {
|
||||
value: "ja",
|
||||
label: "Japanese",
|
||||
code: "jpn",
|
||||
},
|
||||
"zh-CN": {
|
||||
value: "zh-CN",
|
||||
label: "Simplified Chinese",
|
||||
code: "cmn",
|
||||
},
|
||||
"zh-TW": {
|
||||
value: "zh-TW",
|
||||
label: "Traditional Chinese (Taiwan)",
|
||||
code: "cmn",
|
||||
},
|
||||
}
|
||||
@@ -1,12 +1,16 @@
|
||||
import "@expo/metro-runtime"
|
||||
|
||||
import { registerRootComponent } from "expo"
|
||||
import { Image } from "expo-image"
|
||||
import { App } from "expo-router/build/qualified-entry"
|
||||
import { cssInterop } from "nativewind"
|
||||
import { RootSiblingParent } from "react-native-root-siblings"
|
||||
|
||||
// import { renderRootComponent } from "expo"
|
||||
import { initializeApp } from "./initialize"
|
||||
|
||||
cssInterop(Image, { className: "style" })
|
||||
|
||||
initializeApp().then(() => {
|
||||
// This file should only import and register the root. No components or exports
|
||||
// should be added here.
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import type { PrimitiveAtom } from "jotai"
|
||||
import { createContext } from "react"
|
||||
import type { Animated } from "react-native"
|
||||
|
||||
export const DiscoverContext = createContext<{
|
||||
animatedX: Animated.Value
|
||||
currentTabAtom: PrimitiveAtom<number>
|
||||
|
||||
headerHeightAtom: PrimitiveAtom<number>
|
||||
}>(null!)
|
||||
@@ -25,7 +25,7 @@ export const RecommendationListItem: FC<{
|
||||
const maintainers = new Set<string>()
|
||||
const categories = new Set<string>()
|
||||
for (const route in data.routes) {
|
||||
const routeData = data.routes[route]
|
||||
const routeData = data.routes[route]!
|
||||
if (routeData.maintainers) {
|
||||
routeData.maintainers.forEach((m) => maintainers.add(m))
|
||||
}
|
||||
@@ -120,7 +120,7 @@ export const RecommendationListItem: FC<{
|
||||
/>
|
||||
<View className="absolute inset-2 items-center justify-center" pointerEvents="none">
|
||||
<Text ellipsizeMode="middle" numberOfLines={1} className="text-text whitespace-pre">
|
||||
{data.routes[route].name}
|
||||
{data.routes[route]!.name}
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -2,36 +2,66 @@ import { RSSHubCategories } from "@follow/constants"
|
||||
import type { RSSHubRouteDeclaration } from "@follow/models/src/rsshub"
|
||||
import { isASCII } from "@follow/utils"
|
||||
import { useBottomTabBarHeight } from "@react-navigation/bottom-tabs"
|
||||
import { useHeaderHeight } from "@react-navigation/elements"
|
||||
import { FlashList } from "@shopify/flash-list"
|
||||
import { useQuery } from "@tanstack/react-query"
|
||||
import { useAtomValue } from "jotai"
|
||||
import type { FC } from "react"
|
||||
import { memo, useCallback, useMemo, useRef } from "react"
|
||||
import { Text, TouchableOpacity, View } from "react-native"
|
||||
import { memo, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react"
|
||||
import type { ScrollView } from "react-native"
|
||||
import { Animated, Text, TouchableOpacity, useWindowDimensions, View } from "react-native"
|
||||
import type { PanGestureHandlerGestureEvent } from "react-native-gesture-handler"
|
||||
import { PanGestureHandler } from "react-native-gesture-handler"
|
||||
import { useSafeAreaInsets } from "react-native-safe-area-context"
|
||||
|
||||
import { AnimatedScrollView } from "@/src/components/common/AnimatedComponents"
|
||||
import type { TabComponent } from "@/src/components/ui/tabview/TabView"
|
||||
import { TabView } from "@/src/components/ui/tabview/TabView"
|
||||
import { apiClient } from "@/src/lib/api-fetch"
|
||||
|
||||
import { RSSHubCategoryCopyMap } from "./copy"
|
||||
import { DiscoverContext } from "./DiscoverContext"
|
||||
import { RecommendationListItem } from "./RecommendationListItem"
|
||||
|
||||
export const Recommendations = () => {
|
||||
const headerHeight = useHeaderHeight()
|
||||
const { animatedX, currentTabAtom } = useContext(DiscoverContext)
|
||||
const currentTab = useAtomValue(currentTabAtom)
|
||||
|
||||
const windowWidth = useWindowDimensions().width
|
||||
const contentScrollerRef = useRef<ScrollView>(null)
|
||||
|
||||
useEffect(() => {
|
||||
contentScrollerRef.current?.scrollTo({ x: currentTab * windowWidth, y: 0, animated: true })
|
||||
}, [currentTab, windowWidth])
|
||||
|
||||
const [loadedTabIndex, setLoadedTabIndex] = useState(() => new Set())
|
||||
useEffect(() => {
|
||||
setLoadedTabIndex((prev) => {
|
||||
prev.add(currentTab)
|
||||
return new Set(prev)
|
||||
})
|
||||
}, [currentTab])
|
||||
return (
|
||||
<TabView
|
||||
lazyOnce
|
||||
lazyTab
|
||||
Tab={Tab}
|
||||
tabbarStyle={{ paddingTop: headerHeight }}
|
||||
tabs={RSSHubCategories.map((category) => ({
|
||||
name: RSSHubCategoryCopyMap[category],
|
||||
value: category,
|
||||
}))}
|
||||
/>
|
||||
<AnimatedScrollView
|
||||
onScroll={Animated.event([{ nativeEvent: { contentOffset: { x: animatedX } } }], {
|
||||
useNativeDriver: true,
|
||||
})}
|
||||
ref={contentScrollerRef}
|
||||
horizontal
|
||||
pagingEnabled
|
||||
showsHorizontalScrollIndicator={false}
|
||||
nestedScrollEnabled
|
||||
>
|
||||
{RSSHubCategories.map((category, index) => (
|
||||
<View className="flex-1" style={{ width: windowWidth }} key={category}>
|
||||
{loadedTabIndex.has(index) && (
|
||||
<Tab
|
||||
key={category}
|
||||
tab={{ name: RSSHubCategoryCopyMap[category], value: category }}
|
||||
isSelected={currentTab === index}
|
||||
/>
|
||||
)}
|
||||
</View>
|
||||
))}
|
||||
</AnimatedScrollView>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -75,11 +105,11 @@ const Tab: TabComponent = ({ tab, ...rest }) => {
|
||||
return []
|
||||
}
|
||||
return Object.keys(data).sort((a, b) => {
|
||||
const aname = data[a].name
|
||||
const bname = data[b].name
|
||||
const aname = data[a]!.name
|
||||
const bname = data[b]!.name
|
||||
|
||||
const aRouteName = data[a].routes[Object.keys(data[a].routes)[0]].name
|
||||
const bRouteName = data[b].routes[Object.keys(data[b].routes)[0]].name
|
||||
const aRouteName = data[a]!.routes[Object.keys(data[a]!.routes)[0]!]!.name
|
||||
const bRouteName = data[b]!.routes[Object.keys(data[b]!.routes)[0]!]!.name
|
||||
|
||||
const ia = isASCII(aname) && isASCII(aRouteName)
|
||||
const ib = isASCII(bname) && isASCII(bRouteName)
|
||||
@@ -98,7 +128,7 @@ const Tab: TabComponent = ({ tab, ...rest }) => {
|
||||
const groups = keys.reduce(
|
||||
(acc, key) => {
|
||||
// A-Z -> A-Z, 0-9 -> #, other -> #, # push to the end
|
||||
const firstChar = key[0].toUpperCase()
|
||||
const firstChar = key[0]!.toUpperCase()
|
||||
if (/[A-Z]/.test(firstChar)) {
|
||||
acc[firstChar] = acc[firstChar] || []
|
||||
acc[firstChar].push(key)
|
||||
@@ -127,7 +157,7 @@ const Tab: TabComponent = ({ tab, ...rest }) => {
|
||||
if (!data) {
|
||||
continue
|
||||
}
|
||||
result.push({ key: item, data: data[item] })
|
||||
result.push({ key: item, data: data[item]! })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,6 +175,10 @@ const Tab: TabComponent = ({ tab, ...rest }) => {
|
||||
return typeof item === "string" ? item : item.key
|
||||
}, [])
|
||||
|
||||
const { headerHeightAtom } = useContext(DiscoverContext)
|
||||
const headerHeight = useAtomValue(headerHeightAtom)
|
||||
|
||||
const insets = useSafeAreaInsets()
|
||||
if (isLoading) {
|
||||
return null
|
||||
}
|
||||
@@ -158,8 +192,12 @@ const Tab: TabComponent = ({ tab, ...rest }) => {
|
||||
keyExtractor={keyExtractor}
|
||||
getItemType={getItemType}
|
||||
renderItem={ItemRenderer}
|
||||
scrollIndicatorInsets={{ right: -2 }}
|
||||
contentContainerStyle={{ paddingBottom: tabHeight }}
|
||||
scrollIndicatorInsets={{
|
||||
right: -2,
|
||||
top: headerHeight - insets.top,
|
||||
bottom: tabHeight - insets.bottom,
|
||||
}}
|
||||
contentContainerStyle={{ paddingBottom: tabHeight, paddingTop: headerHeight }}
|
||||
removeClippedSubviews
|
||||
/>
|
||||
{/* Right Sidebar */}
|
||||
@@ -198,7 +236,7 @@ const NavigationSidebar: FC<{
|
||||
(letter: string, animated = true) => {
|
||||
const index = alphabetGroups.findIndex((group) => {
|
||||
if (typeof group !== "string") return false
|
||||
const firstChar = group[0].toUpperCase()
|
||||
const firstChar = group[0]!.toUpperCase()
|
||||
const firstCharIsAlphabet = /[A-Z]/.test(firstChar)
|
||||
if (firstCharIsAlphabet) {
|
||||
return firstChar === letter
|
||||
@@ -233,7 +271,7 @@ const NavigationSidebar: FC<{
|
||||
return
|
||||
}
|
||||
|
||||
const firstChar = letter[0].toUpperCase()
|
||||
const firstChar = letter[0]!.toUpperCase()
|
||||
const firstCharIsAlphabet = /[A-Z]/.test(firstChar)
|
||||
if (firstCharIsAlphabet) {
|
||||
scrollToLetter(letter, false)
|
||||
@@ -244,8 +282,15 @@ const NavigationSidebar: FC<{
|
||||
[scrollToLetter, titles],
|
||||
)
|
||||
|
||||
const { headerHeightAtom } = useContext(DiscoverContext)
|
||||
const headerHeight = useAtomValue(headerHeightAtom)
|
||||
const tabHeight = useBottomTabBarHeight()
|
||||
|
||||
return (
|
||||
<View className="absolute inset-y-0 right-1 h-full items-center justify-center">
|
||||
<View
|
||||
className="absolute inset-y-0 right-1 h-full items-center justify-center"
|
||||
style={{ paddingTop: headerHeight, paddingBottom: tabHeight }}
|
||||
>
|
||||
<PanGestureHandler onGestureEvent={handleGesture}>
|
||||
<View className="gap-0.5">
|
||||
{titles.map((title) => (
|
||||
|
||||
@@ -20,7 +20,7 @@ export const SearchTabBar: FC<{
|
||||
tabs={SearchTabs}
|
||||
currentTab={SearchTabs.findIndex((tab) => tab.value === searchType)}
|
||||
onTabItemPress={(index) => {
|
||||
setSearchType(SearchTabs[index].value as SearchType)
|
||||
setSearchType(SearchTabs[index]!.value as SearchType)
|
||||
}}
|
||||
/>
|
||||
)
|
||||
|
||||
@@ -47,7 +47,6 @@ export const SearchFeed = () => {
|
||||
refreshing={isLoading}
|
||||
onRefresh={refetch}
|
||||
keyExtractor={keyExtractor}
|
||||
contentContainerClassName={"-mt-4"}
|
||||
renderScrollComponent={RenderScrollComponent}
|
||||
data={data?.data}
|
||||
renderItem={renderItem}
|
||||
@@ -68,7 +67,7 @@ const SearchFeedItem: FC<ListRenderItemInfo<SearchResultItem>> = ({ item }) => {
|
||||
return (
|
||||
<Animated.View entering={FadeInUp}>
|
||||
<ItemPressable
|
||||
className="py-6"
|
||||
className="py-4"
|
||||
onPress={() => {
|
||||
if (item.feed?.id) {
|
||||
router.push(`/follow?id=${item.feed.id}`)
|
||||
|
||||
@@ -15,7 +15,7 @@ export const useDataSkeleton = (isLoading: boolean, data: any) => {
|
||||
return (
|
||||
<BaseSearchPageRootView className="items-center justify-center">
|
||||
<View className="-mt-72" />
|
||||
<LoadingIndicator color={withOpacity(textColor, 0.7)} size={32} />
|
||||
<LoadingIndicator color={withOpacity(textColor, 0.7)} />
|
||||
</BaseSearchPageRootView>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { RSSHubCategories } from "@follow/constants"
|
||||
import { getDefaultHeaderHeight } from "@react-navigation/elements"
|
||||
import { router } from "expo-router"
|
||||
import { useAtom, useAtomValue, useSetAtom } from "jotai"
|
||||
import type { FC } from "react"
|
||||
import { useEffect, useRef, useState } from "react"
|
||||
import { useContext, useEffect, useRef, useState } from "react"
|
||||
import type { LayoutChangeEvent } from "react-native"
|
||||
import {
|
||||
Animated,
|
||||
@@ -17,11 +18,14 @@ import {
|
||||
} from "react-native"
|
||||
import { useSafeAreaFrame, useSafeAreaInsets } from "react-native-safe-area-context"
|
||||
|
||||
import { BlurEffect } from "@/src/components/common/HeaderBlur"
|
||||
import { BlurEffect } from "@/src/components/common/BlurEffect"
|
||||
import { TabBar } from "@/src/components/ui/tabview/TabBar"
|
||||
import { Search2CuteReIcon } from "@/src/icons/search_2_cute_re"
|
||||
import { accentColor, useColor } from "@/src/theme/colors"
|
||||
|
||||
import { RSSHubCategoryCopyMap } from "./copy"
|
||||
import { useSearchPageContext } from "./ctx"
|
||||
import { DiscoverContext } from "./DiscoverContext"
|
||||
import { SearchTabBar } from "./SearchTabBar"
|
||||
|
||||
export const SearchHeader: FC<{
|
||||
@@ -54,13 +58,33 @@ const DiscoverHeaderImpl = () => {
|
||||
const frame = useSafeAreaFrame()
|
||||
const insets = useSafeAreaInsets()
|
||||
const headerHeight = getDefaultHeaderHeight(frame, false, insets.top)
|
||||
const { animatedX, currentTabAtom, headerHeightAtom } = useContext(DiscoverContext)
|
||||
const setCurrentTab = useSetAtom(currentTabAtom)
|
||||
const setHeaderHeight = useSetAtom(headerHeightAtom)
|
||||
|
||||
return (
|
||||
<View style={{ height: headerHeight, paddingTop: insets.top }} className="relative">
|
||||
<View
|
||||
style={{ minHeight: headerHeight, paddingTop: insets.top }}
|
||||
className="relative"
|
||||
onLayout={(e) => {
|
||||
setHeaderHeight(e.nativeEvent.layout.height)
|
||||
}}
|
||||
>
|
||||
<BlurEffect />
|
||||
<View style={styles.header}>
|
||||
<PlaceholerSearchBar />
|
||||
</View>
|
||||
|
||||
<TabBar
|
||||
tabs={RSSHubCategories.map((category) => ({
|
||||
name: RSSHubCategoryCopyMap[category],
|
||||
value: category,
|
||||
}))}
|
||||
tabScrollContainerAnimatedX={animatedX}
|
||||
onTabItemPress={(index) => {
|
||||
setCurrentTab(index)
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
import { Link } from "expo-router"
|
||||
import { TouchableOpacity, View } from "react-native"
|
||||
import { useSafeAreaInsets } from "react-native-safe-area-context"
|
||||
|
||||
import { AddCuteReIcon } from "@/src/icons/add_cute_re"
|
||||
import { LayoutLeftbarOpenCuteReIcon } from "@/src/icons/layout_leftbar_open_cute_re"
|
||||
import { accentColor } from "@/src/theme/colors"
|
||||
|
||||
import { useFeedDrawer } from "../feed-drawer/atoms"
|
||||
|
||||
const useActionPadding = () => {
|
||||
const insets = useSafeAreaInsets()
|
||||
return { paddingLeft: insets.left + 12, paddingRight: insets.right + 12 }
|
||||
}
|
||||
|
||||
export function LeftAction() {
|
||||
const { openDrawer } = useFeedDrawer()
|
||||
|
||||
const insets = useActionPadding()
|
||||
|
||||
return (
|
||||
<TouchableOpacity
|
||||
onPress={openDrawer}
|
||||
className="flex-row items-center"
|
||||
style={{ paddingLeft: insets.paddingLeft }}
|
||||
>
|
||||
<LayoutLeftbarOpenCuteReIcon color={accentColor} />
|
||||
</TouchableOpacity>
|
||||
)
|
||||
}
|
||||
|
||||
export function RightAction() {
|
||||
const insets = useActionPadding()
|
||||
|
||||
return (
|
||||
<View className="flex-row items-center" style={{ paddingRight: insets.paddingRight }}>
|
||||
<Link asChild href="/add">
|
||||
<TouchableOpacity className="size-6">
|
||||
<AddCuteReIcon color={accentColor} />
|
||||
</TouchableOpacity>
|
||||
</Link>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
import { FeedViewType } from "@follow/constants"
|
||||
import { useTypeScriptHappyCallback } from "@follow/hooks"
|
||||
import { useBottomTabBarHeight } from "@react-navigation/bottom-tabs"
|
||||
import { useHeaderHeight } from "@react-navigation/elements"
|
||||
import type { MasonryFlashListProps } from "@shopify/flash-list"
|
||||
import { MasonryFlashList } from "@shopify/flash-list"
|
||||
import { Image } from "expo-image"
|
||||
import { Link } from "expo-router"
|
||||
import { useContext } from "react"
|
||||
import { Pressable, View } from "react-native"
|
||||
import { useSafeAreaInsets } from "react-native-safe-area-context"
|
||||
|
||||
import { NavigationContext } from "@/src/components/common/SafeNavigationScrollView"
|
||||
import { ThemedText } from "@/src/components/common/ThemedText"
|
||||
import { ItemPressable } from "@/src/components/ui/pressable/item-pressable"
|
||||
import { useEntry } from "@/src/store/entry/hooks"
|
||||
|
||||
import { useSelectedFeed } from "../feed-drawer/atoms"
|
||||
|
||||
export function EntryListContentGrid({
|
||||
entryIds,
|
||||
...rest
|
||||
}: {
|
||||
entryIds: string[]
|
||||
} & Omit<MasonryFlashListProps<string>, "data" | "renderItem">) {
|
||||
const insets = useSafeAreaInsets()
|
||||
const tabBarHeight = useBottomTabBarHeight()
|
||||
const headerHeight = useHeaderHeight()
|
||||
const { scrollY } = useContext(NavigationContext)!
|
||||
return (
|
||||
<MasonryFlashList
|
||||
data={entryIds}
|
||||
renderItem={useTypeScriptHappyCallback(({ item }) => {
|
||||
return <RenderEntryItem id={item} />
|
||||
}, [])}
|
||||
numColumns={2}
|
||||
onScroll={useTypeScriptHappyCallback(
|
||||
(e) => {
|
||||
scrollY.setValue(e.nativeEvent.contentOffset.y)
|
||||
},
|
||||
[scrollY],
|
||||
)}
|
||||
scrollIndicatorInsets={{
|
||||
top: headerHeight - insets.top,
|
||||
bottom: tabBarHeight - insets.bottom,
|
||||
}}
|
||||
estimatedItemSize={100}
|
||||
contentContainerStyle={{
|
||||
paddingTop: headerHeight,
|
||||
paddingBottom: tabBarHeight,
|
||||
}}
|
||||
{...rest}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function RenderEntryItem({ id }: { id: string }) {
|
||||
const selectedFeed = useSelectedFeed()
|
||||
const view = selectedFeed.type === "view" ? selectedFeed.viewId : null
|
||||
const item = useEntry(id)
|
||||
if (!item) {
|
||||
return null
|
||||
}
|
||||
const photo = item.media?.find((media) => media.type === "photo")
|
||||
const video = item.media?.find((media) => media.type === "video")
|
||||
const imageUrl = photo?.url || video?.preview_image_url
|
||||
const blurhash = photo?.blurhash || video?.blurhash
|
||||
const aspectRatio =
|
||||
view === FeedViewType.Pictures && photo?.height && photo.width
|
||||
? photo.width / photo.height
|
||||
: 16 / 9
|
||||
|
||||
return (
|
||||
<ItemPressable className="m-1 overflow-hidden rounded-md">
|
||||
<Link href={`/entries/${item.id}`} asChild>
|
||||
<Pressable>
|
||||
{imageUrl ? (
|
||||
<Image
|
||||
source={{ uri: imageUrl }}
|
||||
placeholder={{
|
||||
blurhash,
|
||||
}}
|
||||
style={{
|
||||
width: "100%",
|
||||
aspectRatio,
|
||||
}}
|
||||
placeholderContentFit="cover"
|
||||
recyclingKey={imageUrl}
|
||||
/>
|
||||
) : (
|
||||
<View className="aspect-video w-full items-center justify-center">
|
||||
<ThemedText className="text-center">No media available</ThemedText>
|
||||
</View>
|
||||
)}
|
||||
</Pressable>
|
||||
</Link>
|
||||
|
||||
<ThemedText className="p-2">{item.title}</ThemedText>
|
||||
</ItemPressable>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
import { FeedViewType } from "@follow/constants"
|
||||
import { useTypeScriptHappyCallback } from "@follow/hooks"
|
||||
import { useBottomTabBarHeight } from "@react-navigation/bottom-tabs"
|
||||
import { FlashList } from "@shopify/flash-list"
|
||||
import { Image } from "expo-image"
|
||||
import { router } from "expo-router"
|
||||
import { useCallback, useContext, useMemo } from "react"
|
||||
import { StyleSheet, Text, useAnimatedValue, View } from "react-native"
|
||||
import { useSafeAreaInsets } from "react-native-safe-area-context"
|
||||
|
||||
import {
|
||||
NavigationBlurEffectHeader,
|
||||
NavigationContext,
|
||||
} from "@/src/components/common/SafeNavigationScrollView"
|
||||
import { ItemPressable } from "@/src/components/ui/pressable/item-pressable"
|
||||
import { useDefaultHeaderHeight } from "@/src/hooks/useDefaultHeaderHeight"
|
||||
import { useSelectedFeed, useSelectedFeedTitle } from "@/src/modules/feed-drawer/atoms"
|
||||
import { useEntry } from "@/src/store/entry/hooks"
|
||||
|
||||
import { ViewSelector } from "../feed-drawer/view-selector"
|
||||
import { LeftAction, RightAction } from "./action"
|
||||
import { EntryListContentGrid } from "./entry-list-gird"
|
||||
|
||||
const headerHideableBottomHeight = 58
|
||||
|
||||
export function EntryListScreen({ entryIds }: { entryIds: string[] }) {
|
||||
const scrollY = useAnimatedValue(0)
|
||||
const selectedFeed = useSelectedFeed()
|
||||
const view = selectedFeed.type === "view" ? selectedFeed.viewId : null
|
||||
const viewTitle = useSelectedFeedTitle()
|
||||
|
||||
return (
|
||||
<NavigationContext.Provider value={useMemo(() => ({ scrollY }), [scrollY])}>
|
||||
<NavigationBlurEffectHeader
|
||||
headerShown
|
||||
headerTitle={viewTitle}
|
||||
headerLeft={useCallback(
|
||||
() => (
|
||||
<LeftAction />
|
||||
),
|
||||
[],
|
||||
)}
|
||||
headerRight={useCallback(
|
||||
() => (
|
||||
<RightAction />
|
||||
),
|
||||
[],
|
||||
)}
|
||||
headerHideableBottomHeight={headerHideableBottomHeight}
|
||||
headerHideableBottom={ViewSelector}
|
||||
/>
|
||||
{view === FeedViewType.Pictures || view === FeedViewType.Videos ? (
|
||||
<EntryListContentGrid entryIds={entryIds} />
|
||||
) : (
|
||||
<EntryListContent entryIds={entryIds} />
|
||||
)}
|
||||
</NavigationContext.Provider>
|
||||
)
|
||||
}
|
||||
|
||||
function EntryListContent({ entryIds }: { entryIds: string[] }) {
|
||||
const insets = useSafeAreaInsets()
|
||||
const tabBarHeight = useBottomTabBarHeight()
|
||||
const originalDefaultHeaderHeight = useDefaultHeaderHeight()
|
||||
const headerHeight = originalDefaultHeaderHeight + headerHideableBottomHeight
|
||||
const { scrollY } = useContext(NavigationContext)!
|
||||
return (
|
||||
<FlashList
|
||||
onScroll={useTypeScriptHappyCallback(
|
||||
(e) => {
|
||||
scrollY.setValue(e.nativeEvent.contentOffset.y)
|
||||
},
|
||||
[scrollY],
|
||||
)}
|
||||
data={entryIds}
|
||||
renderItem={useTypeScriptHappyCallback(
|
||||
({ item: id }) => (
|
||||
<EntryItem key={id} entryId={id} />
|
||||
),
|
||||
[],
|
||||
)}
|
||||
scrollIndicatorInsets={{
|
||||
top: headerHeight - insets.top,
|
||||
bottom: tabBarHeight - insets.bottom,
|
||||
}}
|
||||
estimatedItemSize={100}
|
||||
contentContainerStyle={{
|
||||
paddingTop: headerHeight,
|
||||
paddingBottom: tabBarHeight,
|
||||
}}
|
||||
ItemSeparatorComponent={ItemSeparator}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
const ItemSeparator = () => {
|
||||
return (
|
||||
<View
|
||||
className="bg-opaque-separator mx-4"
|
||||
style={{
|
||||
height: StyleSheet.hairlineWidth,
|
||||
}}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function EntryItem({ entryId }: { entryId: string }) {
|
||||
const entry = useEntry(entryId)
|
||||
|
||||
const handlePress = useCallback(() => {
|
||||
router.push(`/entries/${entryId}`)
|
||||
}, [entryId])
|
||||
|
||||
if (!entry) return <EntryItemSkeleton />
|
||||
const { title, description, publishedAt, media } = entry
|
||||
const image = media?.[0]?.url
|
||||
const blurhash = media?.[0]?.blurhash
|
||||
|
||||
return (
|
||||
<ItemPressable className="flex flex-row items-center p-4" onPress={handlePress}>
|
||||
<View className="flex-1 space-y-2">
|
||||
<Text numberOfLines={2} className="text-lg font-semibold text-zinc-900 dark:text-zinc-100">
|
||||
{title}
|
||||
</Text>
|
||||
<Text className="line-clamp-2 text-sm text-zinc-600 dark:text-zinc-400">{description}</Text>
|
||||
<Text className="text-xs text-zinc-500 dark:text-zinc-500">
|
||||
{publishedAt.toLocaleString()}
|
||||
</Text>
|
||||
</View>
|
||||
{image && (
|
||||
<Image
|
||||
source={{ uri: image }}
|
||||
placeholder={{ blurhash }}
|
||||
className="ml-2 size-20 rounded-md bg-zinc-200 dark:bg-zinc-800"
|
||||
contentFit="cover"
|
||||
/>
|
||||
)}
|
||||
</ItemPressable>
|
||||
)
|
||||
}
|
||||
|
||||
function EntryItemSkeleton() {
|
||||
return (
|
||||
<View className="bg-secondary-system-grouped-background flex flex-row items-center p-4">
|
||||
<View className="flex flex-1 flex-col justify-between">
|
||||
{/* Title skeleton */}
|
||||
<View className="h-6 w-3/4 animate-pulse rounded-md bg-zinc-200 dark:bg-zinc-800" />
|
||||
{/* Description skeleton */}
|
||||
<View className="mt-2 w-full flex-1 animate-pulse rounded-md bg-zinc-200 dark:bg-zinc-800" />
|
||||
</View>
|
||||
|
||||
{/* Image skeleton */}
|
||||
<View className="ml-2 size-20 animate-pulse rounded-md bg-zinc-200 dark:bg-zinc-800" />
|
||||
</View>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
import type { FeedViewType } from "@follow/constants"
|
||||
import { useIsFocused } from "@react-navigation/native"
|
||||
import { useEffect } from "react"
|
||||
|
||||
import { useSelectedFeed, useSetDrawerSwipeDisabled } from "@/src/modules/feed-drawer/atoms"
|
||||
import {
|
||||
useEntryIdsByCategory,
|
||||
useEntryIdsByFeedId,
|
||||
useEntryIdsByInboxId,
|
||||
useEntryIdsByView,
|
||||
} from "@/src/store/entry/hooks"
|
||||
import { useList } from "@/src/store/list/hooks"
|
||||
|
||||
import { EntryListScreen } from "./entry-list"
|
||||
|
||||
export function EntryList() {
|
||||
const setDrawerSwipeDisabled = useSetDrawerSwipeDisabled()
|
||||
const isFocused = useIsFocused()
|
||||
useEffect(() => {
|
||||
if (isFocused) {
|
||||
setDrawerSwipeDisabled(false)
|
||||
} else {
|
||||
setDrawerSwipeDisabled(true)
|
||||
}
|
||||
}, [setDrawerSwipeDisabled, isFocused])
|
||||
|
||||
const selectedFeed = useSelectedFeed()
|
||||
|
||||
switch (selectedFeed.type) {
|
||||
case "view": {
|
||||
return <ViewEntryList viewId={selectedFeed.viewId} />
|
||||
}
|
||||
case "feed": {
|
||||
return <FeedEntryList feedId={selectedFeed.feedId} />
|
||||
}
|
||||
case "category": {
|
||||
return <CategoryEntryList categoryName={selectedFeed.categoryName} />
|
||||
}
|
||||
case "list": {
|
||||
return <ListEntryList listId={selectedFeed.listId} />
|
||||
}
|
||||
case "inbox": {
|
||||
return <InboxEntryList inboxId={selectedFeed.inboxId} />
|
||||
}
|
||||
// No default
|
||||
}
|
||||
}
|
||||
|
||||
function ViewEntryList({ viewId }: { viewId: FeedViewType }) {
|
||||
const entryIds = useEntryIdsByView(viewId)
|
||||
return <EntryListScreen entryIds={entryIds} />
|
||||
}
|
||||
|
||||
function FeedEntryList({ feedId }: { feedId: string }) {
|
||||
const entryIds = useEntryIdsByFeedId(feedId)
|
||||
return <EntryListScreen entryIds={entryIds} />
|
||||
}
|
||||
|
||||
function CategoryEntryList({ categoryName }: { categoryName: string }) {
|
||||
const entryIds = useEntryIdsByCategory(categoryName)
|
||||
return <EntryListScreen entryIds={entryIds} />
|
||||
}
|
||||
|
||||
function ListEntryList({ listId }: { listId: string }) {
|
||||
const list = useList(listId)
|
||||
if (!list) return null
|
||||
|
||||
return <EntryListScreen entryIds={list.entryIds ?? []} />
|
||||
}
|
||||
|
||||
function InboxEntryList({ inboxId }: { inboxId: string }) {
|
||||
const entryIds = useEntryIdsByInboxId(inboxId)
|
||||
return <EntryListScreen entryIds={entryIds} />
|
||||
}
|
||||
@@ -4,6 +4,13 @@ import { atom, useAtom, useAtomValue, useSetAtom } from "jotai"
|
||||
import { useCallback, useMemo } from "react"
|
||||
|
||||
import { views } from "@/src/constants/views"
|
||||
import { usePrefetchEntries } from "@/src/store/entry/hooks"
|
||||
import type { FetchEntriesProps } from "@/src/store/entry/types"
|
||||
import { FEED_COLLECTION_LIST } from "@/src/store/entry/utils"
|
||||
import { useFeed } from "@/src/store/feed/hooks"
|
||||
import { useInbox } from "@/src/store/inbox/hooks"
|
||||
import { useList } from "@/src/store/list/hooks"
|
||||
import { getSubscriptionByCategory } from "@/src/store/subscription/getter"
|
||||
|
||||
// drawer open state
|
||||
|
||||
@@ -20,6 +27,8 @@ export function useFeedDrawer() {
|
||||
}
|
||||
}
|
||||
|
||||
export const closeDrawer = () => jotaiStore.set(drawerOpenAtom, false)
|
||||
|
||||
// is drawer swipe disabled
|
||||
|
||||
const isDrawerSwipeDisabledAtom = atom<boolean>(true)
|
||||
@@ -54,12 +63,101 @@ export function useSelectedCollection() {
|
||||
}
|
||||
export const selectCollection = (state: CollectionPanelState) => {
|
||||
jotaiStore.set(collectionPanelStateAtom, state)
|
||||
if (state.type === "view" || state.type === "list") {
|
||||
jotaiStore.set(selectedFeedAtom, state)
|
||||
}
|
||||
}
|
||||
|
||||
export const useViewDefinition = (view: FeedViewType) => {
|
||||
const viewDef = useMemo(() => views.find((v) => v.view === view), [view])
|
||||
if (!viewDef) {
|
||||
throw new Error(`View ${view} not found`)
|
||||
// feed panel selected state
|
||||
|
||||
export type SelectedFeed =
|
||||
| {
|
||||
type: "view"
|
||||
viewId: FeedViewType
|
||||
}
|
||||
| {
|
||||
type: "feed"
|
||||
feedId: string
|
||||
}
|
||||
| {
|
||||
type: "category"
|
||||
categoryName: string
|
||||
}
|
||||
| {
|
||||
type: "list"
|
||||
listId: string
|
||||
}
|
||||
| {
|
||||
type: "inbox"
|
||||
inboxId: string
|
||||
}
|
||||
|
||||
const selectedFeedAtom = atom<SelectedFeed>({
|
||||
type: "view",
|
||||
viewId: FeedViewType.Articles,
|
||||
})
|
||||
|
||||
export function useSelectedFeed() {
|
||||
const selectedFeed = useAtomValue(selectedFeedAtom)
|
||||
let payload: FetchEntriesProps = {}
|
||||
switch (selectedFeed.type) {
|
||||
case "view": {
|
||||
payload = { view: selectedFeed.viewId }
|
||||
break
|
||||
}
|
||||
case "feed": {
|
||||
payload = { feedId: selectedFeed.feedId }
|
||||
break
|
||||
}
|
||||
case "category": {
|
||||
payload = { feedId: getSubscriptionByCategory(selectedFeed.categoryName).join(",") }
|
||||
break
|
||||
}
|
||||
case "list": {
|
||||
payload = { listId: selectedFeed.listId }
|
||||
break
|
||||
}
|
||||
case "inbox": {
|
||||
payload = { inboxId: selectedFeed.inboxId }
|
||||
break
|
||||
}
|
||||
// No default
|
||||
}
|
||||
usePrefetchEntries(payload)
|
||||
return selectedFeed
|
||||
}
|
||||
|
||||
export const useSelectedFeedTitle = () => {
|
||||
const selectedFeed = useSelectedFeed()
|
||||
const viewDef = useViewDefinition(selectedFeed.type === "view" ? selectedFeed.viewId : undefined)
|
||||
const feed = useFeed(selectedFeed.type === "feed" ? selectedFeed.feedId : "")
|
||||
const list = useList(selectedFeed.type === "list" ? selectedFeed.listId : "")
|
||||
const inbox = useInbox(selectedFeed.type === "inbox" ? selectedFeed.inboxId : "")
|
||||
|
||||
switch (selectedFeed.type) {
|
||||
case "view": {
|
||||
return viewDef?.name
|
||||
}
|
||||
case "feed": {
|
||||
return selectedFeed.feedId === FEED_COLLECTION_LIST ? "Collections" : (feed?.title ?? "")
|
||||
}
|
||||
case "category": {
|
||||
return selectedFeed.categoryName
|
||||
}
|
||||
case "list": {
|
||||
return list?.title
|
||||
}
|
||||
case "inbox": {
|
||||
return inbox?.title ?? "Inbox"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const selectFeed = (state: SelectedFeed) => {
|
||||
jotaiStore.set(selectedFeedAtom, state)
|
||||
}
|
||||
|
||||
export const useViewDefinition = (view?: FeedViewType) => {
|
||||
const viewDef = useMemo(() => views.find((v) => v.view === view), [view])
|
||||
return viewDef
|
||||
}
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
import { cn } from "@follow/utils"
|
||||
import {
|
||||
Image,
|
||||
ScrollView,
|
||||
StyleSheet,
|
||||
TouchableOpacity,
|
||||
useWindowDimensions,
|
||||
View,
|
||||
} from "react-native"
|
||||
import type { PropsWithChildren } from "react"
|
||||
import { useEffect } from "react"
|
||||
import { Image, ScrollView, StyleSheet, TouchableOpacity, View } from "react-native"
|
||||
import Animated, { useAnimatedStyle, useSharedValue, withTiming } from "react-native-reanimated"
|
||||
import { useSafeAreaInsets } from "react-native-safe-area-context"
|
||||
|
||||
import { FallbackIcon } from "@/src/components/ui/icon/fallback-icon"
|
||||
import { Logo } from "@/src/components/ui/logo"
|
||||
import type { ViewDefinition } from "@/src/constants/views"
|
||||
import { views } from "@/src/constants/views"
|
||||
import { useList } from "@/src/store/list/hooks"
|
||||
@@ -18,23 +14,26 @@ import { useAllListSubscription } from "@/src/store/subscription/hooks"
|
||||
import { selectCollection, useSelectedCollection } from "./atoms"
|
||||
|
||||
export const CollectionPanel = () => {
|
||||
const winDim = useWindowDimensions()
|
||||
const lists = useAllListSubscription()
|
||||
|
||||
const insets = useSafeAreaInsets()
|
||||
return (
|
||||
<View
|
||||
className="bg-tertiary-system-background"
|
||||
style={{ width: Math.max(50, winDim.width * 0.15) }}
|
||||
className="bg-secondary-system-fill dark:bg-tertiary-system-background"
|
||||
style={{ width: 65 }}
|
||||
>
|
||||
<ScrollView
|
||||
contentContainerClassName="flex py-3 gap-3"
|
||||
contentContainerStyle={{ paddingTop: insets.top, paddingBottom: insets.bottom }}
|
||||
contentContainerClassName="flex gap-4 px-3.5"
|
||||
contentContainerStyle={{ marginTop: insets.top + 10, paddingBottom: insets.bottom }}
|
||||
>
|
||||
<View className="flex-1 items-center">
|
||||
<Logo width={37} height={37} color="#222" />
|
||||
</View>
|
||||
<View style={styles.hairline} className="bg-opaque-separator mx-1" />
|
||||
{views.map((viewDef) => (
|
||||
<ViewButton key={viewDef.name} viewDef={viewDef} />
|
||||
))}
|
||||
<View style={styles.hairline} className="bg-opaque-separator mx-4" />
|
||||
<View style={styles.hairline} className="bg-opaque-separator mx-1" />
|
||||
{lists.map((listId) => (
|
||||
<ListButton key={listId} listId={listId} />
|
||||
))}
|
||||
@@ -49,25 +48,84 @@ const styles = StyleSheet.create({
|
||||
},
|
||||
})
|
||||
|
||||
const Item = ({
|
||||
isActive,
|
||||
onPress,
|
||||
children,
|
||||
}: { isActive: boolean; onPress: () => void } & PropsWithChildren) => {
|
||||
const scaleY = useSharedValue(21)
|
||||
|
||||
useEffect(() => {
|
||||
if (isActive) {
|
||||
scaleY.value = withTiming(15, { duration: 200 })
|
||||
} else {
|
||||
scaleY.value = withTiming(21, { duration: 200 })
|
||||
}
|
||||
}, [isActive, scaleY])
|
||||
|
||||
const animatedStyle = useAnimatedStyle(() => {
|
||||
return {
|
||||
borderRadius: scaleY.value,
|
||||
}
|
||||
})
|
||||
|
||||
return (
|
||||
<TouchableOpacity
|
||||
className="relative flex aspect-square items-center justify-center rounded-full"
|
||||
onPress={onPress}
|
||||
>
|
||||
<ActiveIndicator isActive={isActive} />
|
||||
<Animated.View
|
||||
className="flex size-full items-center justify-center overflow-hidden"
|
||||
style={animatedStyle}
|
||||
>
|
||||
{children}
|
||||
</Animated.View>
|
||||
</TouchableOpacity>
|
||||
)
|
||||
}
|
||||
|
||||
const ActiveIndicator = ({ isActive }: { isActive: boolean }) => {
|
||||
const scaleY = useSharedValue(1)
|
||||
|
||||
useEffect(() => {
|
||||
if (isActive) {
|
||||
scaleY.value = withTiming(1, { duration: 200 })
|
||||
} else {
|
||||
scaleY.value = withTiming(0, { duration: 200 })
|
||||
}
|
||||
}, [isActive, scaleY])
|
||||
|
||||
const animatedStyle = useAnimatedStyle(() => {
|
||||
return {
|
||||
transform: [{ scaleY: scaleY.value }],
|
||||
}
|
||||
})
|
||||
|
||||
return (
|
||||
<Animated.View
|
||||
className="absolute -left-3.5 h-9 w-1 rounded-r-xl bg-black"
|
||||
style={animatedStyle}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
const ViewButton = ({ viewDef }: { viewDef: ViewDefinition }) => {
|
||||
const selectedCollection = useSelectedCollection()
|
||||
const isActive = selectedCollection.type === "view" && selectedCollection.viewId === viewDef.view
|
||||
|
||||
return (
|
||||
<TouchableOpacity
|
||||
className={cn(
|
||||
"mx-3 flex aspect-square items-center justify-center rounded-lg p-3",
|
||||
isActive ? "bg-secondary-system-fill" : "bg-system-background",
|
||||
)}
|
||||
onPress={() =>
|
||||
selectCollection({
|
||||
type: "view",
|
||||
viewId: viewDef.view,
|
||||
})
|
||||
}
|
||||
<Item
|
||||
isActive={isActive}
|
||||
onPress={() => selectCollection({ type: "view", viewId: viewDef.view })}
|
||||
>
|
||||
<viewDef.icon key={viewDef.name} color={viewDef.activeColor} />
|
||||
</TouchableOpacity>
|
||||
<View
|
||||
className="flex size-full items-center justify-center"
|
||||
style={{ backgroundColor: viewDef.activeColor }}
|
||||
>
|
||||
<viewDef.icon key={viewDef.name} color={"#fff"} />
|
||||
</View>
|
||||
</Item>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -78,11 +136,8 @@ const ListButton = ({ listId }: { listId: string }) => {
|
||||
if (!list) return null
|
||||
|
||||
return (
|
||||
<TouchableOpacity
|
||||
className={cn(
|
||||
"mx-3 flex aspect-square items-center justify-center rounded-lg p-3",
|
||||
isActive ? "bg-system-fill" : "bg-system-background",
|
||||
)}
|
||||
<Item
|
||||
isActive={isActive}
|
||||
onPress={() =>
|
||||
selectCollection({
|
||||
type: "list",
|
||||
@@ -90,13 +145,11 @@ const ListButton = ({ listId }: { listId: string }) => {
|
||||
})
|
||||
}
|
||||
>
|
||||
<View className="overflow-hidden rounded">
|
||||
{list.image ? (
|
||||
<Image source={{ uri: list.image, width: 24, height: 24 }} resizeMode="cover" />
|
||||
) : (
|
||||
<FallbackIcon title={list.title} size={24} />
|
||||
)}
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
{list.image ? (
|
||||
<Image source={{ uri: list.image }} resizeMode="cover" className="size-full" />
|
||||
) : (
|
||||
<FallbackIcon title={list.title} size="100%" />
|
||||
)}
|
||||
</Item>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ export const FeedDrawer = ({ children }: PropsWithChildren) => {
|
||||
return (
|
||||
<Drawer
|
||||
open={isDrawerOpen}
|
||||
drawerStyle={{ width: Math.min(400, winDim.width * 0.85) }}
|
||||
drawerStyle={{ width: winDim.width }}
|
||||
onOpen={openDrawer}
|
||||
onClose={closeDrawer}
|
||||
renderDrawerContent={renderDrawerContent}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { cn } from "@follow/utils"
|
||||
import { BottomTabBarHeightContext } from "@react-navigation/bottom-tabs"
|
||||
import { HeaderHeightContext } from "@react-navigation/elements"
|
||||
import { router } from "expo-router"
|
||||
import type { FC } from "react"
|
||||
import { createContext, memo, useContext, useState } from "react"
|
||||
import {
|
||||
@@ -33,7 +32,7 @@ import {
|
||||
import { useCurrentView, useFeedListSortMethod, useFeedListSortOrder } from "../subscription/atoms"
|
||||
import { ViewPageCurrentViewProvider } from "../subscription/ctx"
|
||||
import { SubscriptionList } from "../subscription/SubscriptionLists"
|
||||
import { useSelectedCollection } from "./atoms"
|
||||
import { closeDrawer, selectFeed, useSelectedCollection } from "./atoms"
|
||||
import { ListHeaderComponent, ViewHeaderComponent } from "./header"
|
||||
|
||||
export const FeedPanel = () => {
|
||||
@@ -150,7 +149,11 @@ const CategoryGrouped = memo(
|
||||
>
|
||||
<ItemPressable
|
||||
onPress={() => {
|
||||
// TODO navigate to category
|
||||
selectFeed({
|
||||
type: "category",
|
||||
categoryName: category,
|
||||
})
|
||||
closeDrawer()
|
||||
}}
|
||||
className="h-12 flex-row items-center px-3"
|
||||
>
|
||||
@@ -199,7 +202,7 @@ const CategoryGrouped = memo(
|
||||
const SubscriptionItem = memo(({ id, className }: { id: string; className?: string }) => {
|
||||
const subscription = useSubscription(id)
|
||||
const unreadCount = useUnreadCount(id)
|
||||
const feed = useFeed(id)
|
||||
const feed = useFeed(id)!
|
||||
const inGrouped = !!useContext(GroupedContext)
|
||||
const view = useCurrentView()
|
||||
const { isLoading } = usePrefetchFeed(id, { enabled: !feed })
|
||||
@@ -207,7 +210,7 @@ const SubscriptionItem = memo(({ id, className }: { id: string; className?: stri
|
||||
if (isLoading) {
|
||||
return (
|
||||
<View className="mt-24 flex-1 flex-row items-start justify-center">
|
||||
<LoadingIndicator size={36} />
|
||||
<LoadingIndicator />
|
||||
</View>
|
||||
)
|
||||
}
|
||||
@@ -223,12 +226,11 @@ const SubscriptionItem = memo(({ id, className }: { id: string; className?: stri
|
||||
className,
|
||||
)}
|
||||
onPress={() => {
|
||||
router.push({
|
||||
pathname: `/feeds/[feedId]`,
|
||||
params: {
|
||||
feedId: id,
|
||||
},
|
||||
selectFeed({
|
||||
type: "feed",
|
||||
feedId: id,
|
||||
})
|
||||
closeDrawer()
|
||||
}}
|
||||
>
|
||||
<View className="dark:border-tertiary-system-background mr-3 size-5 items-center justify-center overflow-hidden rounded-full border border-transparent dark:bg-[#222]">
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { LayoutChangeEvent } from "react-native"
|
||||
import { Text, View } from "react-native"
|
||||
import { useSafeAreaInsets } from "react-native-safe-area-context"
|
||||
|
||||
import { BlurEffect } from "@/src/components/common/HeaderBlur"
|
||||
import { BlurEffect } from "@/src/components/common/BlurEffect"
|
||||
import { useList } from "@/src/store/list/hooks"
|
||||
|
||||
import { SortActionButton } from "../subscription/header-actions"
|
||||
@@ -26,7 +26,7 @@ export const ViewHeaderComponent = ({
|
||||
style={{ paddingTop: insets.top }}
|
||||
>
|
||||
<BlurEffect />
|
||||
<Text className="text-text my-4 text-2xl font-bold">{viewDef.name}</Text>
|
||||
<Text className="text-text my-4 text-2xl font-bold">{viewDef?.name}</Text>
|
||||
<SortActionButton />
|
||||
</View>
|
||||
)
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
import { Image } from "expo-image"
|
||||
import { ScrollView, TouchableOpacity, View } from "react-native"
|
||||
import { Grayscale } from "react-native-color-matrix-image-filters"
|
||||
|
||||
import { FallbackIcon } from "@/src/components/ui/icon/fallback-icon"
|
||||
import type { ViewDefinition } from "@/src/constants/views"
|
||||
import { views } from "@/src/constants/views"
|
||||
import { useList } from "@/src/store/list/hooks"
|
||||
import { useAllListSubscription } from "@/src/store/subscription/hooks"
|
||||
import { useColor } from "@/src/theme/colors"
|
||||
|
||||
import { selectFeed, useSelectedFeed } from "../feed-drawer/atoms"
|
||||
|
||||
export function ViewSelector() {
|
||||
const lists = useAllListSubscription()
|
||||
|
||||
return (
|
||||
<View className="flex items-center justify-between py-2">
|
||||
<ScrollView
|
||||
horizontal
|
||||
contentContainerClassName="flex-row gap-3 items-center px-3"
|
||||
showsHorizontalScrollIndicator={false}
|
||||
>
|
||||
{views.map((view) => (
|
||||
<ViewItem key={view.name} view={view} />
|
||||
))}
|
||||
{lists.map((listId) => (
|
||||
<ListItem key={listId} listId={listId} />
|
||||
))}
|
||||
</ScrollView>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
function ViewItem({ view }: { view: ViewDefinition }) {
|
||||
const selectedFeed = useSelectedFeed()
|
||||
const isActive = selectedFeed.type === "view" && selectedFeed.viewId === view.view
|
||||
|
||||
const bgColor = useColor("gray2")
|
||||
|
||||
return (
|
||||
<TouchableOpacity
|
||||
className="relative flex size-12 items-center justify-center overflow-hidden rounded-full"
|
||||
onPress={() => selectFeed({ type: "view", viewId: view.view })}
|
||||
style={{
|
||||
backgroundColor: isActive ? view.activeColor : bgColor,
|
||||
}}
|
||||
>
|
||||
<view.icon color={"#fff"} height={21} width={21} />
|
||||
</TouchableOpacity>
|
||||
)
|
||||
}
|
||||
|
||||
function ListItem({ listId }: { listId: string }) {
|
||||
const list = useList(listId)
|
||||
const selectedFeed = useSelectedFeed()
|
||||
const isActive = selectedFeed.type === "list" && selectedFeed.listId === listId
|
||||
|
||||
if (!list) return null
|
||||
|
||||
return (
|
||||
<TouchableOpacity
|
||||
className="relative flex size-12 items-center justify-center overflow-hidden rounded-full"
|
||||
onPress={() => selectFeed({ type: "list", listId })}
|
||||
>
|
||||
{list.image ? (
|
||||
isActive ? (
|
||||
<Image source={list.image} contentFit="cover" className="size-12" />
|
||||
) : (
|
||||
<Grayscale>
|
||||
<Image source={list.image} contentFit="cover" className="size-12" />
|
||||
</Grayscale>
|
||||
)
|
||||
) : (
|
||||
<FallbackIcon title={list.title} size="100%" gray={!isActive} />
|
||||
)}
|
||||
</TouchableOpacity>
|
||||
)
|
||||
}
|
||||
@@ -10,12 +10,13 @@ import { z } from "zod"
|
||||
|
||||
import {
|
||||
ModalHeaderCloseButton,
|
||||
ModalHeaderShubmitButton,
|
||||
ModalHeaderSubmitButton,
|
||||
} from "@/src/components/common/ModalSharedComponents"
|
||||
import { FormProvider } from "@/src/components/ui/form/FormProvider"
|
||||
import { FormLabel } from "@/src/components/ui/form/Label"
|
||||
import { FormSwitch } from "@/src/components/ui/form/Switch"
|
||||
import { TextField } from "@/src/components/ui/form/TextField"
|
||||
import { GroupedInsetListCard } from "@/src/components/ui/grouped/GroupedList"
|
||||
import { FeedIcon } from "@/src/components/ui/icon/feed-icon"
|
||||
import { LoadingIndicator } from "@/src/components/ui/loading"
|
||||
import { useIsRouteOnlyOne } from "@/src/hooks/useIsRouteOnlyOne"
|
||||
@@ -40,7 +41,7 @@ export function FollowFeed(props: { id: string }) {
|
||||
if (isLoading) {
|
||||
return (
|
||||
<View className="mt-24 flex-1 flex-row items-start justify-center">
|
||||
<LoadingIndicator size={36} />
|
||||
<LoadingIndicator />
|
||||
</View>
|
||||
)
|
||||
}
|
||||
@@ -50,7 +51,7 @@ export function FollowFeed(props: { id: string }) {
|
||||
function FollowImpl() {
|
||||
const { id } = useLocalSearchParams()
|
||||
|
||||
const feed = useFeed(id as string)
|
||||
const feed = useFeed(id as string)!
|
||||
const isSubscribed = useSubscriptionByFeedId(feed?.id || "")
|
||||
|
||||
const form = useForm<z.infer<typeof formSchema>>({
|
||||
@@ -92,12 +93,13 @@ function FollowImpl() {
|
||||
const { isValid, isDirty } = form.formState
|
||||
|
||||
if (!feed?.id) {
|
||||
return <Text className="text-text">Feed ({id}) not found</Text>
|
||||
return <Text className="text-label">Feed ({id}) not found</Text>
|
||||
}
|
||||
|
||||
return (
|
||||
<ScrollView
|
||||
contentContainerClassName="px-2 pt-4 gap-y-4"
|
||||
className="bg-system-grouped-background"
|
||||
contentContainerClassName="pt-4 gap-y-4"
|
||||
contentContainerStyle={{ paddingBottom: insets.bottom }}
|
||||
>
|
||||
<Stack.Screen
|
||||
@@ -106,7 +108,7 @@ function FollowImpl() {
|
||||
headerLeft: ModalHeaderCloseButton,
|
||||
gestureEnabled: !isDirty,
|
||||
headerRight: () => (
|
||||
<ModalHeaderShubmitButton
|
||||
<ModalHeaderSubmitButton
|
||||
isValid={isValid}
|
||||
onPress={form.handleSubmit(submit)}
|
||||
isLoading={isLoading}
|
||||
@@ -116,7 +118,7 @@ function FollowImpl() {
|
||||
/>
|
||||
|
||||
{/* Group 1 */}
|
||||
<View className="bg-secondary-system-grouped-background rounded-lg p-4">
|
||||
<GroupedInsetListCard className="px-5 py-4">
|
||||
<View className="flex flex-row gap-4">
|
||||
<View className="size-[50px] overflow-hidden rounded-lg">
|
||||
<FeedIcon feed={feed} size={50} />
|
||||
@@ -126,9 +128,9 @@ function FollowImpl() {
|
||||
<Text className="text-secondary-label text-sm">{feed?.description}</Text>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</GroupedInsetListCard>
|
||||
{/* Group 2 */}
|
||||
<View className="bg-secondary-system-grouped-background gap-y-4 rounded-lg p-4">
|
||||
<GroupedInsetListCard className="gap-y-4 px-5 py-4">
|
||||
<FormProvider form={form}>
|
||||
<View>
|
||||
<Controller
|
||||
@@ -189,7 +191,7 @@ function FollowImpl() {
|
||||
/>
|
||||
</View>
|
||||
</FormProvider>
|
||||
</View>
|
||||
</GroupedInsetListCard>
|
||||
</ScrollView>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { FeedViewType } from "@follow/constants"
|
||||
import { cn } from "@follow/utils"
|
||||
import { Text, TouchableOpacity, View } from "react-native"
|
||||
|
||||
import { Grid } from "@/src/components/ui/grid"
|
||||
@@ -34,10 +33,10 @@ export const FeedViewSelector = ({ value, onChange, className, readOnly }: Props
|
||||
width={18}
|
||||
/>
|
||||
<Text
|
||||
className={cn(
|
||||
"mt-1 whitespace-nowrap text-[8px] font-medium",
|
||||
isSelected ? "text-accent" : "text-secondary-label",
|
||||
)}
|
||||
className={"mt-1 whitespace-nowrap text-[8px] font-medium"}
|
||||
style={{
|
||||
color: isSelected ? view.activeColor : secondaryLabelColor,
|
||||
}}
|
||||
>
|
||||
{view.name}
|
||||
</Text>
|
||||
|
||||
@@ -8,12 +8,13 @@ import { z } from "zod"
|
||||
|
||||
import {
|
||||
ModalHeaderCloseButton,
|
||||
ModalHeaderShubmitButton,
|
||||
ModalHeaderSubmitButton,
|
||||
} from "@/src/components/common/ModalSharedComponents"
|
||||
import { FormProvider } from "@/src/components/ui/form/FormProvider"
|
||||
import { FormLabel } from "@/src/components/ui/form/Label"
|
||||
import { FormSwitch } from "@/src/components/ui/form/Switch"
|
||||
import { TextField } from "@/src/components/ui/form/TextField"
|
||||
import { GroupedInsetListCard } from "@/src/components/ui/grouped/GroupedList"
|
||||
import { IconWithFallback } from "@/src/components/ui/icon/fallback-icon"
|
||||
import { LoadingIndicator } from "@/src/components/ui/loading"
|
||||
import { PowerIcon } from "@/src/icons/power"
|
||||
@@ -38,7 +39,7 @@ export const FollowList = (props: { id: string }) => {
|
||||
if (isLoading) {
|
||||
return (
|
||||
<View className="mt-24 flex-1 flex-row items-start justify-center">
|
||||
<LoadingIndicator size={36} />
|
||||
<LoadingIndicator />
|
||||
</View>
|
||||
)
|
||||
}
|
||||
@@ -110,14 +111,14 @@ const Impl = (props: { id: string }) => {
|
||||
const isLoading = false
|
||||
|
||||
return (
|
||||
<ScrollView contentContainerClassName="px-2 pt-4 gap-y-4">
|
||||
<ScrollView className="bg-system-grouped-background" contentContainerClassName="pt-4 gap-y-4">
|
||||
<Stack.Screen
|
||||
options={{
|
||||
title: `${isSubscribed ? "Edit" : "Follow"} - ${list?.title}`,
|
||||
headerLeft: ModalHeaderCloseButton,
|
||||
gestureEnabled: !isDirty,
|
||||
headerRight: () => (
|
||||
<ModalHeaderShubmitButton
|
||||
<ModalHeaderSubmitButton
|
||||
isValid={isValid}
|
||||
onPress={form.handleSubmit(submit)}
|
||||
isLoading={isLoading}
|
||||
@@ -126,7 +127,7 @@ const Impl = (props: { id: string }) => {
|
||||
}}
|
||||
/>
|
||||
|
||||
<View className="bg-secondary-system-grouped-background rounded-lg p-4">
|
||||
<GroupedInsetListCard className="px-5 py-4">
|
||||
<View className="flex flex-row gap-4">
|
||||
<View className="size-[50px] overflow-hidden rounded-lg">
|
||||
<IconWithFallback
|
||||
@@ -142,9 +143,9 @@ const Impl = (props: { id: string }) => {
|
||||
<Text className="text-secondary-label text-sm">{list?.description}</Text>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</GroupedInsetListCard>
|
||||
|
||||
<View className="bg-secondary-system-grouped-background gap-y-4 rounded-lg p-4">
|
||||
<GroupedInsetListCard className="gap-y-6 px-5 py-4">
|
||||
<FormProvider form={form}>
|
||||
<View className="-mx-4">
|
||||
<FormLabel className="mb-4 pl-5" label="View" optional />
|
||||
@@ -178,6 +179,7 @@ const Impl = (props: { id: string }) => {
|
||||
label="Private"
|
||||
description="Private feeds are only visible to you."
|
||||
onValueChange={onChange}
|
||||
size="sm"
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
@@ -198,7 +200,7 @@ const Impl = (props: { id: string }) => {
|
||||
</View>
|
||||
)}
|
||||
</FormProvider>
|
||||
</View>
|
||||
</GroupedInsetListCard>
|
||||
</ScrollView>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ export function EmailLogin() {
|
||||
<ReAnimatedPressable
|
||||
disabled={submitMutation.isPending || !formState.isValid}
|
||||
onPress={login}
|
||||
className="mt-8 h-10 flex-row items-center justify-center rounded-lg"
|
||||
className="mt-8 h-10 flex-row items-center justify-center rounded-3xl"
|
||||
style={buttonStyle}
|
||||
>
|
||||
{submitMutation.isPending ? (
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
} from "@/src/contexts/LoginTeamsContext"
|
||||
import { isIOS } from "@/src/lib/platform"
|
||||
import { toast } from "@/src/lib/toast"
|
||||
import { TeamsMarkdown } from "@/src/screens/(headless)/teams"
|
||||
import { TeamsMarkdown } from "@/src/screens/(headless)/terms"
|
||||
|
||||
import { EmailLogin } from "./email"
|
||||
import { SocialLogin } from "./social"
|
||||
@@ -96,7 +96,7 @@ const TeamsCheckBox = forwardRef<
|
||||
const runAnimation = (index: number) => {
|
||||
"worklet"
|
||||
if (index < animations.length) {
|
||||
shakeSharedValue.value = withTiming(animations[index], { duration: 100 }, () => {
|
||||
shakeSharedValue.value = withTiming(animations[index]!, { duration: 100 }, () => {
|
||||
runAnimation(index + 1)
|
||||
})
|
||||
}
|
||||
@@ -115,7 +115,7 @@ const TeamsCheckBox = forwardRef<
|
||||
textComponent={<TeamsText />}
|
||||
onLongPress={() => {
|
||||
if (!isIOS) {
|
||||
router.push("/teams")
|
||||
router.push("/terms")
|
||||
}
|
||||
}}
|
||||
/>
|
||||
@@ -130,7 +130,7 @@ const TeamsText = () => {
|
||||
config={{ items: [] }}
|
||||
onPressMenuItem={noop}
|
||||
onPressPreview={() => {
|
||||
router.push("/teams")
|
||||
router.push("/terms")
|
||||
}}
|
||||
renderPreview={() => (
|
||||
<View className="flex-1">
|
||||
|
||||
@@ -48,7 +48,7 @@ export function SocialLogin() {
|
||||
{Object.keys(provider)
|
||||
.filter((key) => key !== "apple" || (Platform.OS === "ios" && key === "apple"))
|
||||
.map((key) => {
|
||||
const providerInfo = provider[key]
|
||||
const providerInfo = provider[key]!
|
||||
return (
|
||||
<TouchableOpacity
|
||||
key={key}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
import type { FC, PropsWithChildren } from "react"
|
||||
import { View } from "react-native"
|
||||
|
||||
export const SettingNavigationLinkIcon: FC<
|
||||
{
|
||||
backgroundColor: string
|
||||
} & PropsWithChildren
|
||||
> = ({ backgroundColor, children }) => {
|
||||
return (
|
||||
<View
|
||||
className="mr-4 items-center justify-center rounded-[5px] p-1"
|
||||
style={{
|
||||
backgroundColor,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
@@ -1,19 +1,23 @@
|
||||
import { useBottomTabBarHeight } from "@react-navigation/bottom-tabs"
|
||||
import { useIsFocused } from "@react-navigation/native"
|
||||
import * as FileSystem from "expo-file-system"
|
||||
import type { FC, RefObject } from "react"
|
||||
import { useContext, useEffect } from "react"
|
||||
import { Fragment, useContext, useEffect } from "react"
|
||||
import type { ScrollView } from "react-native"
|
||||
import { View } from "react-native"
|
||||
import { Alert, View } from "react-native"
|
||||
import { useSafeAreaInsets } from "react-native-safe-area-context"
|
||||
|
||||
import {
|
||||
GroupedInsetListCard,
|
||||
GroupedInsetListNavigationLink,
|
||||
GroupedInsetListNavigationLinkIcon,
|
||||
} from "@/src/components/ui/grouped/GroupedList"
|
||||
import { SetBottomTabBarVisibleContext } from "@/src/contexts/BottomTabBarVisibleContext"
|
||||
import { getDbPath } from "@/src/database"
|
||||
import { BellRingingCuteFiIcon } from "@/src/icons/bell_ringing_cute_fi"
|
||||
import { CertificateCuteFiIcon } from "@/src/icons/certificate_cute_fi"
|
||||
import { DatabaseIcon } from "@/src/icons/database"
|
||||
import { ExitCuteFiIcon } from "@/src/icons/exit_cute_fi"
|
||||
import { Magic2CuteFiIcon } from "@/src/icons/magic_2_cute_fi"
|
||||
import { PaletteCuteFiIcon } from "@/src/icons/palette_cute_fi"
|
||||
import { RadaCuteFiIcon } from "@/src/icons/rada_cute_fi"
|
||||
@@ -22,9 +26,9 @@ import { Settings7CuteFiIcon } from "@/src/icons/settings_7_cute_fi"
|
||||
import { StarCuteFiIcon } from "@/src/icons/star_cute_fi"
|
||||
import { TrophyCuteFiIcon } from "@/src/icons/trophy_cute_fi"
|
||||
import { User3CuteFiIcon } from "@/src/icons/user_3_cute_fi"
|
||||
import { signOut } from "@/src/lib/auth"
|
||||
|
||||
import { useSettingsNavigation } from "./hooks"
|
||||
import { SettingNavigationLinkIcon } from "./SettingNavigationLink"
|
||||
|
||||
interface GroupNavigationLink {
|
||||
label: string
|
||||
@@ -34,6 +38,8 @@ interface GroupNavigationLink {
|
||||
scrollRef: RefObject<ScrollView>,
|
||||
) => void
|
||||
iconBackgroundColor: string
|
||||
|
||||
todo?: boolean
|
||||
}
|
||||
const UserGroupNavigationLinks: GroupNavigationLink[] = [
|
||||
{
|
||||
@@ -54,6 +60,7 @@ const UserGroupNavigationLinks: GroupNavigationLink[] = [
|
||||
navigation.navigate("Achievement")
|
||||
},
|
||||
iconBackgroundColor: "#6366F1",
|
||||
todo: true,
|
||||
},
|
||||
]
|
||||
|
||||
@@ -73,6 +80,7 @@ const SettingGroupNavigationLinks: GroupNavigationLink[] = [
|
||||
navigation.navigate("Notifications")
|
||||
},
|
||||
iconBackgroundColor: "#FBBF24",
|
||||
todo: true,
|
||||
},
|
||||
{
|
||||
label: "Appearance",
|
||||
@@ -88,7 +96,7 @@ const SettingGroupNavigationLinks: GroupNavigationLink[] = [
|
||||
onPress: (navigation) => {
|
||||
navigation.navigate("Data")
|
||||
},
|
||||
iconBackgroundColor: "#F59E0B",
|
||||
iconBackgroundColor: "#CBAD6D",
|
||||
},
|
||||
]
|
||||
|
||||
@@ -100,6 +108,17 @@ const DataGroupNavigationLinks: GroupNavigationLink[] = [
|
||||
navigation.navigate("Actions")
|
||||
},
|
||||
iconBackgroundColor: "#059669",
|
||||
todo: true,
|
||||
},
|
||||
|
||||
{
|
||||
label: "Feeds",
|
||||
icon: CertificateCuteFiIcon,
|
||||
onPress: (navigation) => {
|
||||
navigation.navigate("Feeds")
|
||||
},
|
||||
iconBackgroundColor: "#10B981",
|
||||
todo: true,
|
||||
},
|
||||
{
|
||||
label: "Lists",
|
||||
@@ -107,15 +126,8 @@ const DataGroupNavigationLinks: GroupNavigationLink[] = [
|
||||
onPress: (navigation) => {
|
||||
navigation.navigate("Lists")
|
||||
},
|
||||
iconBackgroundColor: "#10B981",
|
||||
},
|
||||
{
|
||||
label: "Feeds",
|
||||
icon: CertificateCuteFiIcon,
|
||||
onPress: (navigation) => {
|
||||
navigation.navigate("Feeds")
|
||||
},
|
||||
iconBackgroundColor: "#34D399",
|
||||
// todo: true,
|
||||
},
|
||||
]
|
||||
|
||||
@@ -138,6 +150,68 @@ const PrivacyGroupNavigationLinks: GroupNavigationLink[] = [
|
||||
},
|
||||
]
|
||||
|
||||
const ActionGroupNavigationLinks: GroupNavigationLink[] = [
|
||||
{
|
||||
label: "Sign out",
|
||||
icon: ExitCuteFiIcon,
|
||||
onPress: () => {
|
||||
Alert.alert("Sign out", "Are you sure you want to sign out?", [
|
||||
{
|
||||
text: "Cancel",
|
||||
style: "cancel",
|
||||
},
|
||||
{
|
||||
text: "Sign out",
|
||||
style: "destructive",
|
||||
onPress: async () => {
|
||||
// sign out
|
||||
await signOut()
|
||||
const dbPath = getDbPath()
|
||||
await FileSystem.deleteAsync(dbPath)
|
||||
await expo.reloadAppAsync("User sign out")
|
||||
},
|
||||
},
|
||||
])
|
||||
},
|
||||
iconBackgroundColor: "#F87181",
|
||||
},
|
||||
]
|
||||
|
||||
const NavigationLinkGroup: FC<{
|
||||
links: GroupNavigationLink[]
|
||||
navigation: ReturnType<typeof useSettingsNavigation>
|
||||
scrollRef: RefObject<ScrollView>
|
||||
}> = ({ links, navigation, scrollRef }) => (
|
||||
<GroupedInsetListCard>
|
||||
{links.map((link) => (
|
||||
<GroupedInsetListNavigationLink
|
||||
key={link.label}
|
||||
label={link.label + (link.todo ? " (Coming Soon)" : "")}
|
||||
disabled={link.todo}
|
||||
icon={
|
||||
<GroupedInsetListNavigationLinkIcon backgroundColor={link.iconBackgroundColor}>
|
||||
<link.icon height={18} width={18} color="#fff" />
|
||||
</GroupedInsetListNavigationLinkIcon>
|
||||
}
|
||||
onPress={() => {
|
||||
if (link.todo) {
|
||||
return
|
||||
}
|
||||
link.onPress(navigation, scrollRef)
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
</GroupedInsetListCard>
|
||||
)
|
||||
|
||||
const navigationGroups = [
|
||||
UserGroupNavigationLinks,
|
||||
DataGroupNavigationLinks,
|
||||
SettingGroupNavigationLinks,
|
||||
PrivacyGroupNavigationLinks,
|
||||
ActionGroupNavigationLinks,
|
||||
] as const
|
||||
|
||||
export const SettingsList: FC<{ scrollRef: RefObject<ScrollView> }> = ({ scrollRef }) => {
|
||||
const navigation = useSettingsNavigation()
|
||||
|
||||
@@ -156,68 +230,17 @@ export const SettingsList: FC<{ scrollRef: RefObject<ScrollView> }> = ({ scrollR
|
||||
className="bg-system-grouped-background flex-1 py-4"
|
||||
style={{ paddingBottom: insets.bottom + tabBarHeight }}
|
||||
>
|
||||
<GroupedInsetListCard>
|
||||
{UserGroupNavigationLinks.map((link) => (
|
||||
<GroupedInsetListNavigationLink
|
||||
key={link.label}
|
||||
label={link.label}
|
||||
icon={
|
||||
<SettingNavigationLinkIcon backgroundColor={link.iconBackgroundColor}>
|
||||
<link.icon height={18} width={18} color="#fff" />
|
||||
</SettingNavigationLinkIcon>
|
||||
}
|
||||
onPress={() => link.onPress(navigation, scrollRef)}
|
||||
{navigationGroups.map((group, index) => (
|
||||
<Fragment key={`nav-group-${index}`}>
|
||||
<NavigationLinkGroup
|
||||
key={`nav-group-${index}`}
|
||||
links={group}
|
||||
navigation={navigation}
|
||||
scrollRef={scrollRef}
|
||||
/>
|
||||
))}
|
||||
</GroupedInsetListCard>
|
||||
|
||||
<View className="h-8" />
|
||||
<GroupedInsetListCard>
|
||||
{DataGroupNavigationLinks.map((link) => (
|
||||
<GroupedInsetListNavigationLink
|
||||
key={link.label}
|
||||
label={link.label}
|
||||
icon={
|
||||
<SettingNavigationLinkIcon backgroundColor={link.iconBackgroundColor}>
|
||||
<link.icon height={18} width={18} color="#fff" />
|
||||
</SettingNavigationLinkIcon>
|
||||
}
|
||||
onPress={() => link.onPress(navigation, scrollRef)}
|
||||
/>
|
||||
))}
|
||||
</GroupedInsetListCard>
|
||||
<View className="h-8" />
|
||||
|
||||
<GroupedInsetListCard>
|
||||
{SettingGroupNavigationLinks.map((link) => (
|
||||
<GroupedInsetListNavigationLink
|
||||
key={link.label}
|
||||
label={link.label}
|
||||
icon={
|
||||
<SettingNavigationLinkIcon backgroundColor={link.iconBackgroundColor}>
|
||||
<link.icon height={18} width={18} color="#fff" />
|
||||
</SettingNavigationLinkIcon>
|
||||
}
|
||||
onPress={() => link.onPress(navigation, scrollRef)}
|
||||
/>
|
||||
))}
|
||||
</GroupedInsetListCard>
|
||||
|
||||
<View className="h-8" />
|
||||
<GroupedInsetListCard>
|
||||
{PrivacyGroupNavigationLinks.map((link) => (
|
||||
<GroupedInsetListNavigationLink
|
||||
key={link.label}
|
||||
label={link.label}
|
||||
icon={
|
||||
<SettingNavigationLinkIcon backgroundColor={link.iconBackgroundColor}>
|
||||
<link.icon height={18} width={18} color="#fff" />
|
||||
</SettingNavigationLinkIcon>
|
||||
}
|
||||
onPress={() => link.onPress(navigation, scrollRef)}
|
||||
/>
|
||||
))}
|
||||
</GroupedInsetListCard>
|
||||
{index < navigationGroups.length - 1 && <View className="h-8" />}
|
||||
</Fragment>
|
||||
))}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,9 +1,98 @@
|
||||
import { Text, View } from "react-native"
|
||||
import Constants from "expo-constants"
|
||||
import { Link } from "expo-router"
|
||||
import { Linking, Text, View } from "react-native"
|
||||
|
||||
import {
|
||||
NavigationBlurEffectHeader,
|
||||
SafeNavigationScrollView,
|
||||
} from "@/src/components/common/SafeNavigationScrollView"
|
||||
import {
|
||||
GroupedInsetListCard,
|
||||
GroupedInsetListNavigationLink,
|
||||
GroupedInsetListNavigationLinkIcon,
|
||||
GroupedInsetListSectionHeader,
|
||||
} from "@/src/components/ui/grouped/GroupedList"
|
||||
import { Logo } from "@/src/components/ui/logo"
|
||||
import { DiscordCuteFiIcon } from "@/src/icons/discord_cute_fi"
|
||||
import { Github2CuteFiIcon } from "@/src/icons/github_2_cute_fi"
|
||||
import { SocialXCuteReIcon } from "@/src/icons/social_x_cute_re"
|
||||
|
||||
const links = [
|
||||
{
|
||||
title: "Github",
|
||||
icon: Github2CuteFiIcon,
|
||||
url: "https://github.com/RSSNext/follow",
|
||||
iconBackgroundColor: "#000000",
|
||||
iconColor: "#FFFFFF",
|
||||
},
|
||||
{
|
||||
title: "X",
|
||||
icon: SocialXCuteReIcon,
|
||||
url: "https://x.com/follow_app_",
|
||||
iconBackgroundColor: "#000000",
|
||||
iconColor: "#FFFFFF",
|
||||
},
|
||||
{
|
||||
title: "Discord",
|
||||
icon: DiscordCuteFiIcon,
|
||||
url: "https://discord.gg/followapp",
|
||||
iconBackgroundColor: "#5865F2",
|
||||
iconColor: "#FFFFFF",
|
||||
},
|
||||
]
|
||||
|
||||
export const AboutScreen = () => {
|
||||
const buildId = Constants.expoConfig?.extra?.eas?.buildId || "Development"
|
||||
const appVersion = Constants.expoConfig?.version || "0.0.0"
|
||||
|
||||
return (
|
||||
<View className="flex-1 items-center justify-center">
|
||||
<Text>About</Text>
|
||||
</View>
|
||||
<SafeNavigationScrollView className="bg-system-grouped-background">
|
||||
<NavigationBlurEffectHeader title="About" />
|
||||
<View className="mt-8 flex-1 items-center justify-center">
|
||||
<Logo height={80} width={80} />
|
||||
<Text className="text-label font-sn mt-4 text-2xl font-semibold">Follow</Text>
|
||||
<Text className="text-tertiary-label font-mono text-sm">
|
||||
{appVersion} ({buildId})
|
||||
</Text>
|
||||
</View>
|
||||
<View className="mt-6 flex-1 px-9">
|
||||
<Text className="text-label text-[15px]">
|
||||
Follow is in the early stages of development. If you have any feedback or suggestions,
|
||||
please feel free to open an issue on the{" "}
|
||||
<Link className="text-accent" href="https://github.com/RSSNext/follow">
|
||||
GitHub repository
|
||||
</Link>
|
||||
</Text>
|
||||
|
||||
<Text className="text-label mt-4 text-[15px]">
|
||||
The icon library used is copyrighted by{" "}
|
||||
<Link className="text-accent" href="https://mgc.mingcute.com/">
|
||||
https://mgc.mingcute.com/
|
||||
</Link>{" "}
|
||||
and cannot be redistributed.
|
||||
</Text>
|
||||
|
||||
<Text className="text-label mt-4 text-[15px]">
|
||||
Copyright © 2025 Follow. All rights reserved.
|
||||
</Text>
|
||||
</View>
|
||||
<View className="mt-10">
|
||||
<GroupedInsetListSectionHeader label="Social Links" />
|
||||
<GroupedInsetListCard>
|
||||
{links.map((link) => (
|
||||
<GroupedInsetListNavigationLink
|
||||
key={link.title}
|
||||
label={link.title}
|
||||
icon={
|
||||
<GroupedInsetListNavigationLinkIcon backgroundColor={link.iconBackgroundColor}>
|
||||
<link.icon color={link.iconColor} height={18} width={18} />
|
||||
</GroupedInsetListNavigationLinkIcon>
|
||||
}
|
||||
onPress={() => Linking.openURL(link.url)}
|
||||
/>
|
||||
))}
|
||||
</GroupedInsetListCard>
|
||||
</View>
|
||||
</SafeNavigationScrollView>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,9 +1,129 @@
|
||||
import { Text, View } from "react-native"
|
||||
import { useColorScheme, View } from "react-native"
|
||||
import { bundledThemesInfo } from "shiki/dist/themes.mjs"
|
||||
|
||||
import { setUISetting, useUISettingKey } from "@/src/atoms/settings/ui"
|
||||
import {
|
||||
NavigationBlurEffectHeader,
|
||||
SafeNavigationScrollView,
|
||||
} from "@/src/components/common/SafeNavigationScrollView"
|
||||
import { Select } from "@/src/components/ui/form/Select"
|
||||
import {
|
||||
GroupedInsetListCard,
|
||||
GroupedInsetListCell,
|
||||
GroupedInsetListSectionHeader,
|
||||
} from "@/src/components/ui/grouped/GroupedList"
|
||||
import { Switch } from "@/src/components/ui/switch/Switch"
|
||||
|
||||
export const AppearanceScreen = () => {
|
||||
const showUnreadCount = useUISettingKey("subscriptionShowUnreadCount")
|
||||
const hideExtraBadge = useUISettingKey("hideExtraBadge")
|
||||
const thumbnailRatio = useUISettingKey("thumbnailRatio")
|
||||
|
||||
const codeThemeLight = useUISettingKey("codeHighlightThemeLight")
|
||||
const codeThemeDark = useUISettingKey("codeHighlightThemeDark")
|
||||
|
||||
const colorScheme = useColorScheme()
|
||||
const readerRenderInlineStyle = useUISettingKey("readerRenderInlineStyle")
|
||||
const hideRecentReader = useUISettingKey("hideRecentReader")
|
||||
|
||||
return (
|
||||
<View className="flex-1 items-center justify-center">
|
||||
<Text>Appearance Settings</Text>
|
||||
</View>
|
||||
<SafeNavigationScrollView className="bg-system-grouped-background">
|
||||
<NavigationBlurEffectHeader title="Appearance" />
|
||||
<View className="mt-6">
|
||||
<GroupedInsetListSectionHeader label="Subscription" />
|
||||
<GroupedInsetListCard>
|
||||
<GroupedInsetListCell
|
||||
label="Show unread count"
|
||||
description="Show unread count in the subscription list"
|
||||
>
|
||||
<Switch
|
||||
size="sm"
|
||||
value={showUnreadCount}
|
||||
onValueChange={(val) => {
|
||||
setUISetting("subscriptionShowUnreadCount", val)
|
||||
}}
|
||||
/>
|
||||
</GroupedInsetListCell>
|
||||
|
||||
<GroupedInsetListCell
|
||||
label="Hide special badge"
|
||||
description="Hide the special badge of the feed in the sidebar, e.g. Boost, Claimed"
|
||||
>
|
||||
<Switch
|
||||
size="sm"
|
||||
value={hideExtraBadge}
|
||||
onValueChange={(val) => {
|
||||
setUISetting("hideExtraBadge", val)
|
||||
}}
|
||||
/>
|
||||
</GroupedInsetListCell>
|
||||
<GroupedInsetListCell
|
||||
label="Thumbnail ratio"
|
||||
description="The ratio of the thumbnail in the entry list."
|
||||
>
|
||||
<View className="w-[100px]">
|
||||
<Select
|
||||
options={[
|
||||
{ label: "Square", value: "square" },
|
||||
{ label: "Original", value: "original" },
|
||||
]}
|
||||
value={thumbnailRatio}
|
||||
onValueChange={(val) => {
|
||||
setUISetting("thumbnailRatio", val as "square" | "original")
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
</GroupedInsetListCell>
|
||||
</GroupedInsetListCard>
|
||||
|
||||
<View className="mt-6">
|
||||
<GroupedInsetListSectionHeader label="Content" />
|
||||
<GroupedInsetListCard>
|
||||
<GroupedInsetListCell label="Code highlight theme">
|
||||
<Select
|
||||
wrapperClassName="w-[120px]"
|
||||
options={bundledThemesInfo.map((theme) => ({
|
||||
label: theme.displayName,
|
||||
value: theme.id,
|
||||
}))}
|
||||
value={colorScheme === "dark" ? codeThemeDark : codeThemeLight}
|
||||
onValueChange={(val) => {
|
||||
setUISetting(
|
||||
`codeHighlightTheme${colorScheme === "dark" ? "Dark" : "Light"}`,
|
||||
val,
|
||||
)
|
||||
}}
|
||||
/>
|
||||
</GroupedInsetListCell>
|
||||
|
||||
<GroupedInsetListCell
|
||||
label="Render inline style"
|
||||
description="Allows rendering of the inline style of the original HTML."
|
||||
>
|
||||
<Switch
|
||||
size="sm"
|
||||
value={readerRenderInlineStyle}
|
||||
onValueChange={(val) => {
|
||||
setUISetting("readerRenderInlineStyle", val)
|
||||
}}
|
||||
/>
|
||||
</GroupedInsetListCell>
|
||||
|
||||
<GroupedInsetListCell
|
||||
label="Hide recent reader"
|
||||
description="Hide the recent reader in the entry header."
|
||||
>
|
||||
<Switch
|
||||
size="sm"
|
||||
value={hideRecentReader}
|
||||
onValueChange={(val) => {
|
||||
setUISetting("hideRecentReader", val)
|
||||
}}
|
||||
/>
|
||||
</GroupedInsetListCell>
|
||||
</GroupedInsetListCard>
|
||||
</View>
|
||||
</View>
|
||||
</SafeNavigationScrollView>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,9 +1,199 @@
|
||||
import { Text, View } from "react-native"
|
||||
import * as DocumentPicker from "expo-document-picker"
|
||||
import * as FileSystem from "expo-file-system"
|
||||
import * as Sharing from "expo-sharing"
|
||||
import { Alert, View } from "react-native"
|
||||
|
||||
import { setDataSetting, useDataSettingKey } from "@/src/atoms/settings/data"
|
||||
import {
|
||||
NavigationBlurEffectHeader,
|
||||
SafeNavigationScrollView,
|
||||
} from "@/src/components/common/SafeNavigationScrollView"
|
||||
import {
|
||||
GroupedInsetListActionCell,
|
||||
GroupedInsetListCard,
|
||||
GroupedInsetListCell,
|
||||
GroupedInsetListSectionHeader,
|
||||
} from "@/src/components/ui/grouped/GroupedList"
|
||||
import { Switch } from "@/src/components/ui/switch/Switch"
|
||||
import { getDbPath } from "@/src/database"
|
||||
import { apiFetch, getBizFetchErrorMessage } from "@/src/lib/api-fetch"
|
||||
import { toast } from "@/src/lib/toast"
|
||||
|
||||
type FeedResponseList = {
|
||||
id: string
|
||||
url: string
|
||||
title: string | null
|
||||
}[]
|
||||
|
||||
type FileUpload = {
|
||||
uri: string
|
||||
name: string
|
||||
type: string
|
||||
}
|
||||
|
||||
export const DataScreen = () => {
|
||||
const sendAnonymousData = useDataSettingKey("sendAnonymousData")
|
||||
return (
|
||||
<View className="flex-1 items-center justify-center">
|
||||
<Text>Data Management</Text>
|
||||
</View>
|
||||
<SafeNavigationScrollView className="bg-system-grouped-background">
|
||||
<NavigationBlurEffectHeader title="Data" />
|
||||
<View className="mt-6">
|
||||
<GroupedInsetListSectionHeader label="Privacy" />
|
||||
|
||||
<GroupedInsetListCard>
|
||||
<GroupedInsetListCell
|
||||
label="Send anonymous data"
|
||||
description="By opting to send anonymized telemetry data, you contribute to improving the overall user experience of Follow."
|
||||
>
|
||||
<Switch
|
||||
size="sm"
|
||||
value={sendAnonymousData}
|
||||
onValueChange={(val) => {
|
||||
setDataSetting("sendAnonymousData", val)
|
||||
}}
|
||||
/>
|
||||
</GroupedInsetListCell>
|
||||
</GroupedInsetListCard>
|
||||
</View>
|
||||
|
||||
{/* Data Sources */}
|
||||
<View className="mt-6">
|
||||
<GroupedInsetListSectionHeader label="Data Sources" />
|
||||
<GroupedInsetListCard>
|
||||
<GroupedInsetListActionCell
|
||||
onPress={async () => {
|
||||
const result = await DocumentPicker.getDocumentAsync({
|
||||
type: ["application/octet-stream", "text/x-opml"],
|
||||
})
|
||||
if (result.canceled) {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const formData = new FormData()
|
||||
const file = result.assets[0]
|
||||
|
||||
if (!file) {
|
||||
toast.error("No file selected")
|
||||
return
|
||||
}
|
||||
|
||||
formData.append("file", {
|
||||
uri: file.uri,
|
||||
type: file.mimeType || "application/octet-stream",
|
||||
name: file.name,
|
||||
} as FileUpload as any)
|
||||
|
||||
const { data } = await apiFetch<{
|
||||
data: {
|
||||
successfulItems: FeedResponseList
|
||||
conflictItems: FeedResponseList
|
||||
parsedErrorItems: FeedResponseList
|
||||
}
|
||||
}>("/subscriptions/import", {
|
||||
method: "POST",
|
||||
body: formData,
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data",
|
||||
},
|
||||
})
|
||||
|
||||
const { successfulItems, conflictItems, parsedErrorItems } = data
|
||||
toast.info(
|
||||
`Import successful, ${successfulItems.length} feeds were imported, ${conflictItems.length} feeds were already subscribed, and ${parsedErrorItems.length} feeds failed to import.`,
|
||||
)
|
||||
} catch (error) {
|
||||
const bizError = getBizFetchErrorMessage(error as Error)
|
||||
toast.error(`Import failed${bizError ? `: ${bizError}` : ""}`)
|
||||
console.error(error)
|
||||
}
|
||||
}}
|
||||
label="Import subscriptions from OPML"
|
||||
/>
|
||||
|
||||
<GroupedInsetListActionCell
|
||||
onPress={async () => {
|
||||
const dbPath = getDbPath()
|
||||
try {
|
||||
const destinationUri = `${FileSystem.documentDirectory}follow.db`
|
||||
await FileSystem.copyAsync({
|
||||
from: dbPath,
|
||||
to: destinationUri,
|
||||
})
|
||||
|
||||
await FileSystem.getInfoAsync(destinationUri)
|
||||
await Sharing.shareAsync(destinationUri, {
|
||||
UTI: "public.database",
|
||||
mimeType: "application/x-sqlite3",
|
||||
dialogTitle: "Export Database",
|
||||
})
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
toast.error("Failed to export database")
|
||||
}
|
||||
}}
|
||||
label="Export local database"
|
||||
/>
|
||||
</GroupedInsetListCard>
|
||||
</View>
|
||||
|
||||
{/* Utils */}
|
||||
|
||||
<View className="mt-6">
|
||||
<GroupedInsetListSectionHeader label="Utils" />
|
||||
|
||||
<GroupedInsetListCard>
|
||||
<GroupedInsetListActionCell
|
||||
onPress={() => {
|
||||
Alert.alert(
|
||||
"Rebuild database?",
|
||||
"This will delete all your offline cached data and rebuild the database, and after that the app will reload.",
|
||||
[
|
||||
{
|
||||
text: "Cancel",
|
||||
style: "cancel",
|
||||
},
|
||||
{
|
||||
text: "Rebuild",
|
||||
style: "destructive",
|
||||
onPress: async () => {
|
||||
const dbPath = getDbPath()
|
||||
await FileSystem.deleteAsync(dbPath)
|
||||
await expo.reloadAppAsync("Clear Sqlite Data")
|
||||
},
|
||||
},
|
||||
],
|
||||
)
|
||||
}}
|
||||
label="Rebuild database"
|
||||
description="If you are experiencing rendering issues, rebuilding the database may solve them."
|
||||
/>
|
||||
|
||||
<GroupedInsetListActionCell
|
||||
onPress={() => {
|
||||
Alert.alert("Clear cache?", "This will clear all temporary files and cached data.", [
|
||||
{
|
||||
text: "Cancel",
|
||||
style: "cancel",
|
||||
},
|
||||
{
|
||||
text: "Clear",
|
||||
|
||||
isPreferred: true,
|
||||
onPress: async () => {
|
||||
const cacheDir = FileSystem.cacheDirectory
|
||||
if (cacheDir) {
|
||||
await FileSystem.deleteAsync(cacheDir, { idempotent: true })
|
||||
}
|
||||
toast.success("Cache cleared")
|
||||
},
|
||||
},
|
||||
])
|
||||
}}
|
||||
label="Clear cache"
|
||||
description="Clear temporary files and cached data to free up storage space."
|
||||
/>
|
||||
</GroupedInsetListCard>
|
||||
</View>
|
||||
</SafeNavigationScrollView>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,9 +1,141 @@
|
||||
import { useLocales } from "expo-localization"
|
||||
import { Text, View } from "react-native"
|
||||
|
||||
import { setGeneralSetting, useGeneralSettingKey } from "@/src/atoms/settings/general"
|
||||
import {
|
||||
NavigationBlurEffectHeader,
|
||||
SafeNavigationScrollView,
|
||||
} from "@/src/components/common/SafeNavigationScrollView"
|
||||
import { Select } from "@/src/components/ui/form/Select"
|
||||
import {
|
||||
GroupedInsetListBaseCell,
|
||||
GroupedInsetListCard,
|
||||
GroupedInsetListCell,
|
||||
GroupedInsetListSectionHeader,
|
||||
} from "@/src/components/ui/grouped/GroupedList"
|
||||
import { Switch } from "@/src/components/ui/switch/Switch"
|
||||
import { LanguageMap } from "@/src/lib/language"
|
||||
|
||||
export const GeneralScreen = () => {
|
||||
const locales = useLocales()
|
||||
const translationLanguage = useGeneralSettingKey("translationLanguage")
|
||||
const autoGroup = useGeneralSettingKey("autoGroup")
|
||||
const showUnreadOnLaunch = useGeneralSettingKey("unreadOnly")
|
||||
const groupByDate = useGeneralSettingKey("groupByDate")
|
||||
const expandLongSocialMedia = useGeneralSettingKey("autoExpandLongSocialMedia")
|
||||
const markAsReadWhenScrolling = useGeneralSettingKey("scrollMarkUnread")
|
||||
const markAsReadWhenInView = useGeneralSettingKey("renderMarkUnread")
|
||||
|
||||
return (
|
||||
<View className="flex-1 items-center justify-center">
|
||||
<Text>General Settings</Text>
|
||||
</View>
|
||||
<SafeNavigationScrollView className="bg-system-grouped-background">
|
||||
<NavigationBlurEffectHeader title="General" />
|
||||
{/* Language */}
|
||||
<View className="mt-6">
|
||||
<GroupedInsetListSectionHeader label="Language" />
|
||||
<GroupedInsetListCard>
|
||||
<GroupedInsetListBaseCell>
|
||||
<Text className="text-label">Language</Text>
|
||||
|
||||
<Text className="text-label">{locales[0]?.languageTag}</Text>
|
||||
</GroupedInsetListBaseCell>
|
||||
|
||||
<GroupedInsetListBaseCell>
|
||||
<Text className="text-label">Translation Language</Text>
|
||||
|
||||
<Select
|
||||
value={translationLanguage}
|
||||
onValueChange={(value) => {
|
||||
setGeneralSetting("translationLanguage", value)
|
||||
}}
|
||||
options={Object.values(LanguageMap)}
|
||||
/>
|
||||
</GroupedInsetListBaseCell>
|
||||
</GroupedInsetListCard>
|
||||
</View>
|
||||
|
||||
{/* Subscriptions */}
|
||||
<View className="mt-8">
|
||||
<GroupedInsetListSectionHeader label="Subscriptions" />
|
||||
<GroupedInsetListCard>
|
||||
<GroupedInsetListCell
|
||||
label="Auto Group"
|
||||
description="Automatically group feeds by site domain."
|
||||
>
|
||||
<Switch
|
||||
size="sm"
|
||||
value={autoGroup}
|
||||
onValueChange={(value) => {
|
||||
setGeneralSetting("autoGroup", value)
|
||||
}}
|
||||
/>
|
||||
</GroupedInsetListCell>
|
||||
|
||||
<GroupedInsetListCell label="Show unread content on launch">
|
||||
<Switch
|
||||
size="sm"
|
||||
value={showUnreadOnLaunch}
|
||||
onValueChange={(value) => {
|
||||
setGeneralSetting("unreadOnly", value)
|
||||
}}
|
||||
/>
|
||||
</GroupedInsetListCell>
|
||||
|
||||
<GroupedInsetListCell label="Group by date" description="Group entries by date.">
|
||||
<Switch
|
||||
size="sm"
|
||||
value={groupByDate}
|
||||
onValueChange={(value) => {
|
||||
setGeneralSetting("groupByDate", value)
|
||||
}}
|
||||
/>
|
||||
</GroupedInsetListCell>
|
||||
|
||||
<GroupedInsetListCell
|
||||
label="Expand long social media"
|
||||
description="Automatically expand social media entries containing long text."
|
||||
>
|
||||
<Switch
|
||||
size="sm"
|
||||
value={expandLongSocialMedia}
|
||||
onValueChange={(value) => {
|
||||
setGeneralSetting("autoExpandLongSocialMedia", value)
|
||||
}}
|
||||
/>
|
||||
</GroupedInsetListCell>
|
||||
</GroupedInsetListCard>
|
||||
|
||||
{/* Unread */}
|
||||
<View className="mt-8">
|
||||
<GroupedInsetListSectionHeader label="Unread" />
|
||||
<GroupedInsetListCard>
|
||||
<GroupedInsetListCell
|
||||
label="Mark as read when scrolling"
|
||||
description="Automatically mark entries as read when scrolled out of the view."
|
||||
>
|
||||
<Switch
|
||||
size="sm"
|
||||
value={markAsReadWhenScrolling}
|
||||
onValueChange={(value) => {
|
||||
setGeneralSetting("scrollMarkUnread", value)
|
||||
}}
|
||||
/>
|
||||
</GroupedInsetListCell>
|
||||
|
||||
<GroupedInsetListCell
|
||||
label="Mark as read when in the view"
|
||||
description="Automatically mark single-level entries (e.g. social media posts, pictures, video views) as read when they enter the view."
|
||||
>
|
||||
<Switch
|
||||
size="sm"
|
||||
value={markAsReadWhenInView}
|
||||
onValueChange={(value) => {
|
||||
setGeneralSetting("renderMarkUnread", value)
|
||||
}}
|
||||
/>
|
||||
</GroupedInsetListCell>
|
||||
</GroupedInsetListCard>
|
||||
</View>
|
||||
</View>
|
||||
</SafeNavigationScrollView>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,9 +1,216 @@
|
||||
import { Text, View } from "react-native"
|
||||
import { router } from "expo-router"
|
||||
import { createContext, createElement, useCallback, useContext, useMemo } from "react"
|
||||
import type { ListRenderItem } from "react-native"
|
||||
import { Image, StyleSheet, Text, TouchableOpacity, View } from "react-native"
|
||||
import Animated, { LinearTransition } from "react-native-reanimated"
|
||||
import { useColor } from "react-native-uikit-colors"
|
||||
|
||||
import { Balance } from "@/src/components/common/Balance"
|
||||
import {
|
||||
NavigationBlurEffectHeader,
|
||||
SafeNavigationScrollView,
|
||||
} from "@/src/components/common/SafeNavigationScrollView"
|
||||
import {
|
||||
GroupedInformationCell,
|
||||
GroupedInsetListCard,
|
||||
} from "@/src/components/ui/grouped/GroupedList"
|
||||
import { FallbackIcon } from "@/src/components/ui/icon/fallback-icon"
|
||||
import { LoadingIndicator } from "@/src/components/ui/loading"
|
||||
import { ItemPressable } from "@/src/components/ui/pressable/item-pressable"
|
||||
import { views } from "@/src/constants/views"
|
||||
import { AddCuteReIcon } from "@/src/icons/add_cute_re"
|
||||
import { PowerIcon } from "@/src/icons/power"
|
||||
import { RadaCuteFiIcon } from "@/src/icons/rada_cute_fi"
|
||||
import { UserAdd2CuteFiIcon } from "@/src/icons/user_add_2_cute_fi"
|
||||
import { Wallet2CuteFiIcon } from "@/src/icons/wallet_2_cute_fi"
|
||||
import type { HonoApiClient } from "@/src/morph/types"
|
||||
import { useOwnedLists, usePrefetchOwnedLists } from "@/src/store/list/hooks"
|
||||
import type { ListModel } from "@/src/store/list/store"
|
||||
import { accentColor } from "@/src/theme/colors"
|
||||
|
||||
import { SwipeableGroupProvider, SwipeableItem } from "../../../components/common/SwipeableItem"
|
||||
import { useSettingsNavigation } from "../hooks"
|
||||
|
||||
const ListContext = createContext({} as Record<string, HonoApiClient.List_List_Get>)
|
||||
export const ListsScreen = () => {
|
||||
const { isLoading, data } = usePrefetchOwnedLists()
|
||||
const lists = useOwnedLists()
|
||||
|
||||
return (
|
||||
<View className="flex-1 items-center justify-center">
|
||||
<Text>Lists Settings</Text>
|
||||
</View>
|
||||
<SafeNavigationScrollView nestedScrollEnabled className="bg-system-grouped-background">
|
||||
<NavigationBlurEffectHeader
|
||||
title="Lists"
|
||||
headerRight={useCallback(
|
||||
() => (
|
||||
<AddListButton />
|
||||
),
|
||||
[],
|
||||
)}
|
||||
/>
|
||||
|
||||
<View className="mt-6">
|
||||
<GroupedInsetListCard>
|
||||
<GroupedInformationCell
|
||||
title="Lists"
|
||||
description="Lists are collections of feeds that you can share or sell for others to subscribe to. Subscribers will synchronize and access all feeds in the list."
|
||||
icon={<RadaCuteFiIcon height={40} width={40} color="#fff" />}
|
||||
iconBackgroundColor="#34D399"
|
||||
/>
|
||||
</GroupedInsetListCard>
|
||||
</View>
|
||||
<ListContext.Provider
|
||||
value={useMemo(
|
||||
() =>
|
||||
data?.reduce(
|
||||
(acc, list) => {
|
||||
acc[list.id] = list
|
||||
return acc
|
||||
},
|
||||
{} as Record<string, HonoApiClient.List_List_Get>,
|
||||
) ?? {},
|
||||
[data],
|
||||
)}
|
||||
>
|
||||
<View className="mt-6">
|
||||
<GroupedInsetListCard>
|
||||
{lists.length > 0 && (
|
||||
<SwipeableGroupProvider>
|
||||
<Animated.FlatList
|
||||
keyExtractor={keyExtractor}
|
||||
itemLayoutAnimation={LinearTransition}
|
||||
scrollEnabled={false}
|
||||
data={lists}
|
||||
renderItem={ListItemCell}
|
||||
ItemSeparatorComponent={ItemSeparatorComponent}
|
||||
/>
|
||||
</SwipeableGroupProvider>
|
||||
)}
|
||||
{isLoading && lists.length === 0 && (
|
||||
<View className="mt-1">
|
||||
<LoadingIndicator />
|
||||
</View>
|
||||
)}
|
||||
</GroupedInsetListCard>
|
||||
</View>
|
||||
</ListContext.Provider>
|
||||
</SafeNavigationScrollView>
|
||||
)
|
||||
}
|
||||
|
||||
const AddListButton = () => {
|
||||
const labelColor = useColor("label")
|
||||
return (
|
||||
<TouchableOpacity hitSlop={10} onPress={() => router.push("/list")}>
|
||||
<AddCuteReIcon height={20} width={20} color={labelColor} />
|
||||
</TouchableOpacity>
|
||||
)
|
||||
}
|
||||
|
||||
const ItemSeparatorComponent = () => {
|
||||
return (
|
||||
<View
|
||||
className="bg-opaque-separator ml-24 flex-1"
|
||||
style={{ height: StyleSheet.hairlineWidth }}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
const keyExtractor = (item: ListModel) => item.id
|
||||
|
||||
const ListItemCell: ListRenderItem<ListModel> = (props) => {
|
||||
return <ListItemCellImpl {...props} />
|
||||
}
|
||||
const ListItemCellImpl: ListRenderItem<ListModel> = ({ item: list }) => {
|
||||
const { title, description } = list
|
||||
const listData = useContext(ListContext)[list.id]
|
||||
const navigation = useSettingsNavigation()
|
||||
return (
|
||||
<SwipeableItem
|
||||
swipeRightToCallAction
|
||||
rightActions={[
|
||||
{
|
||||
label: "Manage",
|
||||
onPress: () => {
|
||||
navigation.navigate("ManageList", { id: list.id })
|
||||
},
|
||||
backgroundColor: accentColor,
|
||||
},
|
||||
{
|
||||
label: "Edit",
|
||||
onPress: () => {
|
||||
router.push(`/list?id=${list.id}`)
|
||||
},
|
||||
backgroundColor: "#0ea5e9",
|
||||
},
|
||||
]}
|
||||
>
|
||||
<ItemPressable
|
||||
className="flex-row p-4"
|
||||
onPress={() => navigation.navigate("ManageList", { id: list.id })}
|
||||
>
|
||||
<View className="size-16 overflow-hidden rounded-lg">
|
||||
{list.image ? (
|
||||
<Image source={{ uri: list.image }} resizeMode="cover" className="size-full" />
|
||||
) : (
|
||||
<FallbackIcon title={list.title || ""} size="100%" textStyle={styles.title} />
|
||||
)}
|
||||
</View>
|
||||
<View className="ml-4 flex-1">
|
||||
<Text
|
||||
className="text-label text-lg font-semibold leading-tight"
|
||||
numberOfLines={1}
|
||||
ellipsizeMode="middle"
|
||||
>
|
||||
{title}
|
||||
</Text>
|
||||
{!!description && (
|
||||
<Text className="text-secondary-label text-base" numberOfLines={4}>
|
||||
{description}
|
||||
</Text>
|
||||
)}
|
||||
<View className="flex-row items-center gap-1">
|
||||
{!!views[list.view]?.icon &&
|
||||
createElement(views[list.view]!.icon, {
|
||||
color: views[list.view]!.activeColor,
|
||||
height: 16,
|
||||
width: 16,
|
||||
})}
|
||||
<Text className="text-secondary-label text-base">{views[list.view]?.name}</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View
|
||||
className="bg-opaque-separator mx-4 h-full"
|
||||
style={{ width: StyleSheet.hairlineWidth }}
|
||||
/>
|
||||
<View className="w-16 gap-1">
|
||||
<View className="flex-row items-center gap-1">
|
||||
<PowerIcon height={16} width={16} color={accentColor} />
|
||||
<Text className="text-secondary-label text-sm">{list.fee}</Text>
|
||||
</View>
|
||||
|
||||
<View className="flex-row items-center gap-1">
|
||||
<UserAdd2CuteFiIcon height={16} width={16} color={accentColor} />
|
||||
<Text className="text-secondary-label text-sm">{listData?.subscriptionCount || 0}</Text>
|
||||
</View>
|
||||
|
||||
{!!listData?.purchaseAmount && (
|
||||
<View className="flex-row items-center gap-1">
|
||||
<Wallet2CuteFiIcon height={16} width={16} color={accentColor} />
|
||||
<Balance className="text-secondary-label text-sm">
|
||||
{BigInt(listData.purchaseAmount)}
|
||||
</Balance>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
</ItemPressable>
|
||||
</SwipeableItem>
|
||||
)
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
title: {
|
||||
fontSize: 20,
|
||||
fontWeight: "semibold",
|
||||
},
|
||||
})
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
import type { RouteProp } from "@react-navigation/native"
|
||||
import { useMutation } from "@tanstack/react-query"
|
||||
import { router } from "expo-router"
|
||||
import type { MutableRefObject } from "react"
|
||||
import { createContext, useContext, useEffect, useMemo, useRef, useState } from "react"
|
||||
import { Text, View } from "react-native"
|
||||
|
||||
import { ModalHeaderSubmitButton } from "@/src/components/common/ModalSharedComponents"
|
||||
import {
|
||||
NavigationBlurEffectHeader,
|
||||
SafeNavigationScrollView,
|
||||
} from "@/src/components/common/SafeNavigationScrollView"
|
||||
import {
|
||||
GroupedInsetListBaseCell,
|
||||
GroupedInsetListCard,
|
||||
GroupedInsetListSectionHeader,
|
||||
} from "@/src/components/ui/grouped/GroupedList"
|
||||
import { FeedIcon } from "@/src/components/ui/icon/feed-icon"
|
||||
import { ItemPressable } from "@/src/components/ui/pressable/item-pressable"
|
||||
import { CheckLineIcon } from "@/src/icons/check_line"
|
||||
import { getBizFetchErrorMessage } from "@/src/lib/api-fetch"
|
||||
import { toast } from "@/src/lib/toast"
|
||||
import { useFeed } from "@/src/store/feed/hooks"
|
||||
import { useList, usePrefetchOwnedLists } from "@/src/store/list/hooks"
|
||||
import { listSyncServices } from "@/src/store/list/store"
|
||||
import {
|
||||
useFeedSubscriptionByView,
|
||||
usePrefetchSubscription,
|
||||
useSortedFeedSubscriptionByAlphabet,
|
||||
} from "@/src/store/subscription/hooks"
|
||||
import { accentColor } from "@/src/theme/colors"
|
||||
|
||||
import type { SettingsStackParamList } from "../types"
|
||||
|
||||
const ManageListContext = createContext<{
|
||||
nextSelectedFeedIdRef: MutableRefObject<Set<string>>
|
||||
}>(null!)
|
||||
export const ManageListScreen = ({
|
||||
route,
|
||||
}: {
|
||||
route: RouteProp<SettingsStackParamList, "ManageList">
|
||||
}) => {
|
||||
const { id } = route.params
|
||||
|
||||
usePrefetchOwnedLists()
|
||||
const list = useList(id)
|
||||
|
||||
return (
|
||||
<SafeNavigationScrollView className="bg-system-grouped-background mt-6">
|
||||
<NavigationBlurEffectHeader title={`Manage List - ${list?.title}`} />
|
||||
|
||||
{!!list && <ListImpl id={list.id} />}
|
||||
</SafeNavigationScrollView>
|
||||
)
|
||||
}
|
||||
|
||||
const ListImpl: React.FC<{ id: string }> = ({ id }) => {
|
||||
const list = useList(id)!
|
||||
usePrefetchSubscription(list.view)
|
||||
|
||||
const subscriptionIds = useFeedSubscriptionByView(list.view)
|
||||
|
||||
const sortedSubscriptionIds = useSortedFeedSubscriptionByAlphabet(subscriptionIds)
|
||||
|
||||
const nextSelectedFeedIdRef = useRef(new Set<string>())
|
||||
const ctxValue = useMemo(() => ({ nextSelectedFeedIdRef }), [nextSelectedFeedIdRef])
|
||||
|
||||
const initOnceRef = useRef(false)
|
||||
|
||||
useEffect(() => {
|
||||
if (initOnceRef.current) return
|
||||
initOnceRef.current = true
|
||||
|
||||
nextSelectedFeedIdRef.current = new Set(list.feedIds)
|
||||
}, [list.feedIds])
|
||||
|
||||
const addFeedsToFeedListMutation = useMutation({
|
||||
mutationFn: () =>
|
||||
listSyncServices.addFeedsToFeedList({
|
||||
listId: id,
|
||||
feedIds: Array.from(nextSelectedFeedIdRef.current),
|
||||
}),
|
||||
})
|
||||
return (
|
||||
<ManageListContext.Provider value={ctxValue}>
|
||||
<NavigationBlurEffectHeader
|
||||
headerRight={() => (
|
||||
<ModalHeaderSubmitButton
|
||||
isLoading={addFeedsToFeedListMutation.isPending}
|
||||
isValid
|
||||
onPress={() => {
|
||||
addFeedsToFeedListMutation
|
||||
.mutateAsync()
|
||||
.then(() => {
|
||||
router.back()
|
||||
})
|
||||
.catch((error) => {
|
||||
toast.error(getBizFetchErrorMessage(error))
|
||||
console.error(error)
|
||||
})
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
<GroupedInsetListSectionHeader label="Select feeds to add to the current list" />
|
||||
<GroupedInsetListCard>
|
||||
{sortedSubscriptionIds.map((id) => (
|
||||
<FeedCell key={id} feedId={id} isSelected={list.feedIds.includes(id)} />
|
||||
))}
|
||||
</GroupedInsetListCard>
|
||||
</ManageListContext.Provider>
|
||||
)
|
||||
}
|
||||
|
||||
const FeedCell = (props: { feedId: string; isSelected: boolean }) => {
|
||||
const feed = useFeed(props.feedId)
|
||||
|
||||
const { nextSelectedFeedIdRef } = useContext(ManageListContext)
|
||||
|
||||
const [currentSelected, setCurrentSelected] = useState(props.isSelected)
|
||||
if (!feed) return null
|
||||
return (
|
||||
<ItemPressable
|
||||
onPress={() => {
|
||||
const has = nextSelectedFeedIdRef.current.has(feed.id)
|
||||
if (has) {
|
||||
nextSelectedFeedIdRef.current.delete(feed.id)
|
||||
} else {
|
||||
nextSelectedFeedIdRef.current.add(feed.id)
|
||||
}
|
||||
|
||||
setCurrentSelected(!has)
|
||||
}}
|
||||
>
|
||||
<GroupedInsetListBaseCell>
|
||||
<View className="flex-1 flex-row items-center gap-4">
|
||||
<View className="size-4 items-center justify-center">
|
||||
<View className="overflow-hidden rounded-lg">
|
||||
<FeedIcon feed={feed} size={24} />
|
||||
</View>
|
||||
</View>
|
||||
<Text className="flex-1" ellipsizeMode="middle" numberOfLines={1}>
|
||||
{feed?.title || "Untitled Feed"}
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
<View className="ml-2 flex size-4 shrink-0 items-center justify-center">
|
||||
{currentSelected && <CheckLineIcon color={accentColor} height={18} width={18} />}
|
||||
</View>
|
||||
</GroupedInsetListBaseCell>
|
||||
</ItemPressable>
|
||||
)
|
||||
}
|
||||
@@ -1,9 +1,26 @@
|
||||
import { Text, View } from "react-native"
|
||||
import { router } from "expo-router"
|
||||
|
||||
import {
|
||||
NavigationBlurEffectHeader,
|
||||
SafeNavigationScrollView,
|
||||
} from "@/src/components/common/SafeNavigationScrollView"
|
||||
import {
|
||||
GroupedInsetListCard,
|
||||
GroupedInsetListNavigationLink,
|
||||
} from "@/src/components/ui/grouped/GroupedList"
|
||||
|
||||
export const PrivacyScreen = () => {
|
||||
return (
|
||||
<View className="flex-1 items-center justify-center">
|
||||
<Text>Privacy Settings</Text>
|
||||
</View>
|
||||
<SafeNavigationScrollView className="bg-system-grouped-background">
|
||||
<NavigationBlurEffectHeader title="Privacy" />
|
||||
<GroupedInsetListCard className="mt-4">
|
||||
<GroupedInsetListNavigationLink
|
||||
label="Terms"
|
||||
onPress={() => {
|
||||
router.push("/terms")
|
||||
}}
|
||||
/>
|
||||
</GroupedInsetListCard>
|
||||
</SafeNavigationScrollView>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -2,12 +2,12 @@ import type { FeedViewType } from "@follow/constants"
|
||||
import { cn } from "@follow/utils"
|
||||
import { Stack } from "expo-router"
|
||||
import { Fragment, useCallback, useEffect, useMemo } from "react"
|
||||
import { FlatList, Image, Linking, Pressable, StyleSheet, Text, View } from "react-native"
|
||||
import { FlatList, Image, Share, StyleSheet, Text, TouchableOpacity, View } from "react-native"
|
||||
import Animated, { useAnimatedScrollHandler, useSharedValue } from "react-native-reanimated"
|
||||
import { useSafeAreaInsets } from "react-native-safe-area-context"
|
||||
|
||||
import { ReAnimatedScrollView } from "@/src/components/common/AnimatedComponents"
|
||||
import { BlurEffect } from "@/src/components/common/HeaderBlur"
|
||||
import { BlurEffect } from "@/src/components/common/BlurEffect"
|
||||
import { FallbackIcon } from "@/src/components/ui/icon/fallback-icon"
|
||||
import type { FeedIconRequiredFeed } from "@/src/components/ui/icon/feed-icon"
|
||||
import { FeedIcon } from "@/src/components/ui/icon/feed-icon"
|
||||
@@ -51,8 +51,12 @@ export const ProfileScreen = () => {
|
||||
const textLabelColor = useColor("label")
|
||||
const openShareUrl = useCallback(() => {
|
||||
if (!whoami?.id) return
|
||||
Linking.openURL(`https://app.follow.is/share/users/${whoami.id}`)
|
||||
}, [whoami?.id])
|
||||
Share.share({
|
||||
url: `https://app.follow.is/share/users/${whoami.id}`,
|
||||
title: `Follow | ${whoami.name}'s Profile`,
|
||||
})
|
||||
}, [whoami?.id, whoami?.name])
|
||||
|
||||
return (
|
||||
<View className="bg-system-grouped-background flex-1">
|
||||
<ReAnimatedScrollView
|
||||
@@ -68,17 +72,21 @@ export const ProfileScreen = () => {
|
||||
{!isLoading && subscriptions && <SubscriptionList subscriptions={subscriptions.data} />}
|
||||
</ReAnimatedScrollView>
|
||||
{/* Top transparent header buttons */}
|
||||
<Pressable
|
||||
<TouchableOpacity
|
||||
onPress={() => settingNavigation.goBack()}
|
||||
className="absolute left-4"
|
||||
style={{ top: insets.top }}
|
||||
>
|
||||
<MingcuteLeftLineIcon color="#fff" />
|
||||
</Pressable>
|
||||
</TouchableOpacity>
|
||||
|
||||
<Pressable onPress={openShareUrl} className="absolute right-4" style={{ top: insets.top }}>
|
||||
<TouchableOpacity
|
||||
onPress={openShareUrl}
|
||||
className="absolute right-4"
|
||||
style={{ top: insets.top }}
|
||||
>
|
||||
<Share3CuteReIcon color="#fff" />
|
||||
</Pressable>
|
||||
</TouchableOpacity>
|
||||
{/* Header */}
|
||||
<Animated.View
|
||||
pointerEvents="none"
|
||||
@@ -86,17 +94,17 @@ export const ProfileScreen = () => {
|
||||
style={{ opacity: headerOpacity }}
|
||||
>
|
||||
<BlurEffect />
|
||||
<Pressable pointerEvents="auto" onPress={() => settingNavigation.goBack()}>
|
||||
<TouchableOpacity onPress={() => settingNavigation.goBack()}>
|
||||
<MingcuteLeftLineIcon color={textLabelColor} />
|
||||
</Pressable>
|
||||
</TouchableOpacity>
|
||||
|
||||
<Text className="text-label flex-1 text-center text-lg font-medium">
|
||||
{whoami?.name}'s Profile
|
||||
</Text>
|
||||
|
||||
<Pressable onPress={openShareUrl}>
|
||||
<TouchableOpacity onPress={openShareUrl}>
|
||||
<Share3CuteReIcon color={textLabelColor} />
|
||||
</Pressable>
|
||||
</TouchableOpacity>
|
||||
</Animated.View>
|
||||
</View>
|
||||
)
|
||||
|
||||
@@ -8,6 +8,7 @@ import { DataScreen } from "./Data"
|
||||
import { FeedsScreen } from "./Feeds"
|
||||
import { GeneralScreen } from "./General"
|
||||
import { ListsScreen } from "./Lists"
|
||||
import { ManageListScreen } from "./ManageList"
|
||||
import { NotificationsScreen } from "./Notifications"
|
||||
import { PrivacyScreen } from "./Privacy"
|
||||
import { ProfileScreen } from "./Profile"
|
||||
@@ -25,5 +26,6 @@ export const SettingRoutes = (Stack: ReturnType<typeof createNativeStackNavigato
|
||||
<Stack.Screen key="Feeds" name="Feeds" component={FeedsScreen} />,
|
||||
<Stack.Screen key="Privacy" name="Privacy" component={PrivacyScreen} />,
|
||||
<Stack.Screen key="About" name="About" component={AboutScreen} />,
|
||||
<Stack.Screen key="ManageList" name="ManageList" component={ManageListScreen} />,
|
||||
]
|
||||
}
|
||||
|
||||
@@ -10,4 +10,7 @@ export type SettingsStackParamList = {
|
||||
Feeds: undefined
|
||||
Privacy: undefined
|
||||
About: undefined
|
||||
ManageList: {
|
||||
id: string
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import { useUnreadCounts } from "@/src/store/unread/hooks"
|
||||
import { useColor } from "@/src/theme/colors"
|
||||
|
||||
import { SubscriptionFeedCategoryContextMenu } from "../context-menu/feeds"
|
||||
import { closeDrawer, selectFeed } from "../feed-drawer/atoms"
|
||||
import { GroupedContext, useViewPageCurrentView } from "./ctx"
|
||||
import { ItemSeparator } from "./ItemSeparator"
|
||||
import { UnGroupedList } from "./UnGroupedList"
|
||||
@@ -21,6 +22,7 @@ import { UnGroupedList } from "./UnGroupedList"
|
||||
// })
|
||||
// }
|
||||
export const CategoryGrouped = memo(
|
||||
// eslint-disable-next-line @eslint-react/no-unstable-context-value
|
||||
({ category, subscriptionIds }: { category: string; subscriptionIds: string[] }) => {
|
||||
const unreadCounts = useUnreadCounts(subscriptionIds)
|
||||
const [expanded, setExpanded] = useState(false)
|
||||
@@ -42,7 +44,11 @@ export const CategoryGrouped = memo(
|
||||
>
|
||||
<ItemPressable
|
||||
onPress={() => {
|
||||
// TODO navigate to category
|
||||
selectFeed({
|
||||
type: "category",
|
||||
categoryName: category,
|
||||
})
|
||||
closeDrawer()
|
||||
}}
|
||||
className="h-12 flex-row items-center px-3"
|
||||
>
|
||||
|
||||
@@ -11,6 +11,7 @@ import { useEventCallback } from "usehooks-ts"
|
||||
|
||||
import { ItemPressable } from "@/src/components/ui/pressable/item-pressable"
|
||||
import { StarCuteFiIcon } from "@/src/icons/star_cute_fi"
|
||||
import { FEED_COLLECTION_LIST } from "@/src/store/entry/utils"
|
||||
import {
|
||||
useGroupedSubscription,
|
||||
useInboxSubscription,
|
||||
@@ -22,6 +23,7 @@ import {
|
||||
} from "@/src/store/subscription/hooks"
|
||||
import { subscriptionSyncService } from "@/src/store/subscription/store"
|
||||
|
||||
import { closeDrawer, selectFeed } from "../feed-drawer/atoms"
|
||||
import { useFeedListSortMethod, useFeedListSortOrder, viewAtom } from "./atoms"
|
||||
import { CategoryGrouped } from "./CategoryGrouped"
|
||||
import { ViewTabHeight } from "./constants"
|
||||
@@ -200,7 +202,8 @@ const StarItem = () => {
|
||||
return (
|
||||
<ItemPressable
|
||||
onPress={() => {
|
||||
// TODO
|
||||
selectFeed({ type: "feed", feedId: FEED_COLLECTION_LIST })
|
||||
closeDrawer()
|
||||
}}
|
||||
className="mt-4 h-12 w-full flex-row items-center px-3"
|
||||
>
|
||||
|
||||
@@ -38,11 +38,11 @@ export const ViewTab = () => {
|
||||
indicatorPosition.value = withSpring(tabPositions[currentView] || 0, springConfig)
|
||||
|
||||
if (tabRef.current) {
|
||||
const x = currentView > 0 ? tabPositions[currentView - 1] + tabWidths[currentView - 1] : 0
|
||||
const x = currentView > 0 ? tabPositions[currentView - 1]! + tabWidths[currentView - 1]! : 0
|
||||
|
||||
const isCurrentTabVisible =
|
||||
scrollOffsetX.current < tabPositions[currentView] &&
|
||||
scrollOffsetX.current + tabWidths[currentView] > tabPositions[currentView]
|
||||
scrollOffsetX.current < tabPositions[currentView]! &&
|
||||
scrollOffsetX.current + tabWidths[currentView]! > tabPositions[currentView]!
|
||||
|
||||
if (!isCurrentTabVisible) {
|
||||
tabRef.current.scrollTo({ x, y: 0, animated: true })
|
||||
@@ -58,7 +58,7 @@ export const ViewTab = () => {
|
||||
translateX: indicatorPosition.value + 10 + Math.abs(offset),
|
||||
},
|
||||
],
|
||||
backgroundColor: views[currentView].activeColor,
|
||||
backgroundColor: views[currentView]!.activeColor,
|
||||
width: (tabWidths[currentView] || 20) - 40 + Math.abs(offset),
|
||||
}
|
||||
})
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user