From e118a29219dfa06d9d854f77060ce7c4b6715c33 Mon Sep 17 00:00:00 2001 From: xmflsct Date: Thu, 10 Feb 2022 03:19:22 +0100 Subject: [PATCH 01/33] New translations parse.json (Vietnamese) --- src/i18n/vi/components/parse.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/i18n/vi/components/parse.json b/src/i18n/vi/components/parse.json index 3240627b..16f07954 100644 --- a/src/i18n/vi/components/parse.json +++ b/src/i18n/vi/components/parse.json @@ -1,8 +1,8 @@ { "HTML": { "expanded": { - "true": "Thu gọn {{hint}}", - "false": "Mở rộng {{hint}}" + "true": "Thu gọn", + "false": "Mở rộng" }, "defaultHint": "Tút" } From 425799cabea03df310ec159a6210fbf7901b8806 Mon Sep 17 00:00:00 2001 From: xmflsct Date: Thu, 10 Feb 2022 03:19:23 +0100 Subject: [PATCH 02/33] New translations relativeTime.json (Vietnamese) --- src/i18n/vi/components/relativeTime.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/i18n/vi/components/relativeTime.json b/src/i18n/vi/components/relativeTime.json index 501807fe..c5fffdb1 100644 --- a/src/i18n/vi/components/relativeTime.json +++ b/src/i18n/vi/components/relativeTime.json @@ -2,7 +2,7 @@ "strings": { "prefixAgo": "", "prefixFromNow": "", - "suffixAgo": "trước", + "suffixAgo": " trước", "suffixFromNow": "", "seconds": "%d giây", "minute": "một phút", From a986ea8c23cc6cba6b4ac14f177dced443cbdfca Mon Sep 17 00:00:00 2001 From: xmflsct Date: Thu, 10 Feb 2022 03:19:24 +0100 Subject: [PATCH 03/33] New translations timeline.json (Vietnamese) --- src/i18n/vi/components/timeline.json | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/i18n/vi/components/timeline.json b/src/i18n/vi/components/timeline.json index 2e4d305c..bf5abb88 100644 --- a/src/i18n/vi/components/timeline.json +++ b/src/i18n/vi/components/timeline.json @@ -62,7 +62,7 @@ }, "attachment": { "sensitive": { - "button": "Hiện nội dung nhạy cảm" + "button": "NSFW" }, "unsupported": { "text": "Không hỗ trợ định dạng", @@ -74,14 +74,16 @@ "accessibilityHint": "Đến trang cá nhân {{name}}" }, "content": { - "expandHint": "nội dung bị ẩn" + "expandHint": "nội dung ẩn" }, "filtered": "Đã lọc", "fullConversation": "Xem thêm", "translate": { "default": "Dịch", "succeed": "Dịch bằng {{provider}} từ {{source}}", - "failed": "Không thể dịch!" + "failed": "Không thể dịch!", + "source_not_supported": "không hỗ trợ ngôn ngữ tút", + "target_not_supported": "Ngôn ngữ đích không hỗ trợ" }, "header": { "shared": { From 92e8dc6ef7dca1e0621f41c61588a1d512858e95 Mon Sep 17 00:00:00 2001 From: xmflsct Date: Thu, 10 Feb 2022 03:19:25 +0100 Subject: [PATCH 04/33] New translations tabs.json (Vietnamese) --- src/i18n/vi/screens/tabs.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/i18n/vi/screens/tabs.json b/src/i18n/vi/screens/tabs.json index 60ac665b..cb98b84f 100644 --- a/src/i18n/vi/screens/tabs.json +++ b/src/i18n/vi/screens/tabs.json @@ -283,11 +283,11 @@ }, "search": { "header": { - "prefix": "Đang tìm...", + "prefix": "Tìm kiếm", "placeholder": "về..." }, "empty": { - "general": "Nhập từ khóa $t(screenTabs:shared.search.sections.accounts)$t(screenTabs:shared.search.sections.hashtags) hoặc$t(screenTabs:shared.search.sections.statuses)", + "general": "Tìm $t(screenTabs:shared.search.sections.accounts), $t(screenTabs:shared.search.sections.hashtags) hoặc$t(screenTabs:shared.search.sections.statuses)", "advanced": { "header": "Tìm kiếm nâng cao", "example": { @@ -310,7 +310,7 @@ }, "users": { "accounts": { - "following": "Đang theo dõi {{count}}", + "following": "{{count}} Theo dõi", "followers": "{{count}} người theo dõi" }, "statuses": { From be23f827f58683314468a9f785c86fa2290252d1 Mon Sep 17 00:00:00 2001 From: xmflsct Date: Thu, 10 Feb 2022 04:16:02 +0100 Subject: [PATCH 05/33] New translations parse.json (Vietnamese) --- src/i18n/vi/components/parse.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/i18n/vi/components/parse.json b/src/i18n/vi/components/parse.json index 16f07954..ccfb69d0 100644 --- a/src/i18n/vi/components/parse.json +++ b/src/i18n/vi/components/parse.json @@ -1,8 +1,8 @@ { "HTML": { "expanded": { - "true": "Thu gọn", - "false": "Mở rộng" + "true": "Cuộn {{hint}}", + "false": "Mở {{hint}}" }, "defaultHint": "Tút" } From c3eb1039d4684ffd239626707365877e0e6e9cda Mon Sep 17 00:00:00 2001 From: xmflsct Date: Thu, 10 Feb 2022 04:16:03 +0100 Subject: [PATCH 06/33] New translations timeline.json (Vietnamese) --- src/i18n/vi/components/timeline.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/i18n/vi/components/timeline.json b/src/i18n/vi/components/timeline.json index bf5abb88..9ef851fc 100644 --- a/src/i18n/vi/components/timeline.json +++ b/src/i18n/vi/components/timeline.json @@ -27,7 +27,7 @@ "follow_request": "{{name}} yêu cầu theo dõi bạn", "poll": "Cuộc bình chọn đã kết thúc", "reblog": { - "default": "{{name}} đã chia sẻ", + "default": "{{name}} chia sẻ", "notification": "{{name}} chia sẻ tút của bạn" } }, @@ -95,7 +95,7 @@ "accessibilityHint": "Tài khoản" } }, - "application": "Đăng bằng {{application}}", + "application": "via {{application}}", "muted": { "accessibilityLabel": "Đã ẩn tút" }, @@ -109,7 +109,7 @@ } }, "conversation": { - "withAccounts": "Với", + "withAccounts": "Với ", "delete": { "function": "Xóa nhắn riêng" } @@ -152,7 +152,7 @@ "button": "Chia sẻ URL tút" }, "account": { - "heading": "Chia sẻ người dùng", + "heading": "Chia sẻ", "button": "Chia sẻ URL người dùng này" } }, From c3be690a7d6405802cc6057dfa3f201a2f54c3fa Mon Sep 17 00:00:00 2001 From: xmflsct Date: Thu, 10 Feb 2022 04:16:04 +0100 Subject: [PATCH 07/33] New translations actions.json (Vietnamese) --- src/i18n/vi/screens/actions.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/i18n/vi/screens/actions.json b/src/i18n/vi/screens/actions.json index ff9993c3..e248b0aa 100644 --- a/src/i18n/vi/screens/actions.json +++ b/src/i18n/vi/screens/actions.json @@ -5,7 +5,7 @@ "cancel": "$t(common:buttons.cancel)" }, "notificationsFilter": { - "heading": "Hiện những dạng thông báo", + "heading": "Chỉ hiện thông báo", "content": { "follow": "$t(screenTabs:me.push.follow.heading)", "favourite": "$t(screenTabs:me.push.favourite.heading)", From 0c5fd9efba8016623c91403a037effe2e01897de Mon Sep 17 00:00:00 2001 From: xmflsct Date: Thu, 10 Feb 2022 04:16:05 +0100 Subject: [PATCH 08/33] New translations compose.json (Vietnamese) --- src/i18n/vi/screens/compose.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/i18n/vi/screens/compose.json b/src/i18n/vi/screens/compose.json index ebc28f52..2854afa6 100644 --- a/src/i18n/vi/screens/compose.json +++ b/src/i18n/vi/screens/compose.json @@ -63,7 +63,7 @@ "option": { "placeholder": { "accessibilityLabel": "Tùy chọn bình chọn {{index}}", - "single": "Chỉ được chọn một", + "single": "Lựa chọn", "multiple": "Nhiều lựa chọn" } }, @@ -117,7 +117,7 @@ }, "visibility": { "accessibilityLabel": "Tút thuộc dạng {{visibility}}", - "title": "Dạng tút", + "title": "Kiểu tút", "options": { "public": "Công khai", "unlisted": "Hạn chế", From 70fbf076f9316c6dfcb2be26ba7665ec5b49a14c Mon Sep 17 00:00:00 2001 From: xmflsct Date: Thu, 10 Feb 2022 04:16:06 +0100 Subject: [PATCH 09/33] New translations tabs.json (Vietnamese) --- src/i18n/vi/screens/tabs.json | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/i18n/vi/screens/tabs.json b/src/i18n/vi/screens/tabs.json index cb98b84f..949d30ef 100644 --- a/src/i18n/vi/screens/tabs.json +++ b/src/i18n/vi/screens/tabs.json @@ -53,7 +53,7 @@ "name": "Thông báo đẩy" }, "profile": { - "name": "Trang cá nhân" + "name": "Cài đặt cá nhân" }, "profileName": { "name": "Tên hiển thị mới" @@ -65,7 +65,7 @@ "name": "Metadata" }, "settings": { - "name": "Cài đặt App" + "name": "Thiết lập" }, "switch": { "name": "Chuyển đổi tài khoản" @@ -102,22 +102,22 @@ }, "avatar": { "title": "Ảnh đại diện", - "description": "Sẽ tự động chuyển còn 400x400px" + "description": "Tự động nén xuống 400x400px" }, "header": { "title": "Ảnh bìa", - "description": "Sẽ tự động chuyển còn 1500x1500px" + "description": "Tự động nén xuống 1500x500px" }, "note": { "title": "Mô tả" }, "fields": { "title": "Metadata", - "total": "{{count}} trường", - "total_plural": "{{count}} trường" + "total": "{{count}} mục", + "total_plural": "{{count}} mục" }, "visibility": { - "title": "Dạng tút", + "title": "Kiểu tút mặc định", "options": { "public": "Công khai", "unlisted": "Hạn chế", @@ -126,19 +126,19 @@ } }, "sensitive": { - "title": "Đăng nội dung nhạy cảm" + "title": "Đây là tài khoản NSFW" }, "lock": { "title": "Đây là tài khoản riêng tư", "description": "Tự bạn sẽ phê duyệt người theo dõi" }, "bot": { - "title": "Tài khoản bot", + "title": "Đây là tài khoản Bot", "description": "Tài khoản này tự động thực hiện các hành động và không được quản lý bởi người thật" } }, "fields": { - "group": "Nhóm {{index}}", + "group": "Mục {{index}}", "label": "Nhãn", "content": "Nội dung" } @@ -250,13 +250,13 @@ "heading": "Liên hệ tooot" }, "analytics": { - "heading": "Đóng góp ý kiến", - "description": "Chỉ thu thập thông tin không liên quan người dùng" + "heading": "Thu thập dữ liệu", + "description": "Giúp cải thiện chất lượng app" }, "version": "Phiên bản {{version}}" }, "switch": { - "existing": "Chọn từ màn hình đăng nhập", + "existing": "Đã đăng nhập trước đó", "new": "Đăng nhập máy chủ" } }, @@ -287,7 +287,7 @@ "placeholder": "về..." }, "empty": { - "general": "Tìm $t(screenTabs:shared.search.sections.accounts), $t(screenTabs:shared.search.sections.hashtags) hoặc$t(screenTabs:shared.search.sections.statuses)", + "general": "Tìm $t(screenTabs:shared.search.sections.accounts), $t(screenTabs:shared.search.sections.hashtags) hoặc $t(screenTabs:shared.search.sections.statuses)", "advanced": { "header": "Tìm kiếm nâng cao", "example": { @@ -314,8 +314,8 @@ "followers": "{{count}} người theo dõi" }, "statuses": { - "reblogged_by": "{{count}} người chia sẻ", - "favourited_by": "{{count}} người thích" + "reblogged_by": "{{count}} chia sẻ", + "favourited_by": "{{count}} thích" } } } From be0f54d7c1256d9f33f4203efb3e406bd9149880 Mon Sep 17 00:00:00 2001 From: xmflsct Date: Thu, 10 Feb 2022 05:28:17 +0100 Subject: [PATCH 10/33] New translations compose.json (Vietnamese) --- src/i18n/vi/screens/compose.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/i18n/vi/screens/compose.json b/src/i18n/vi/screens/compose.json index 2854afa6..09a5ae8e 100644 --- a/src/i18n/vi/screens/compose.json +++ b/src/i18n/vi/screens/compose.json @@ -15,7 +15,7 @@ "button": { "default": "Tút", "conversation": "Tin nhắn", - "reply": "Lượt trả lời", + "reply": "Trả lời", "edit": "Tút" }, "alert": { From d11e8bd3563998c39213d002f2cec8f001707c8e Mon Sep 17 00:00:00 2001 From: xmflsct Date: Thu, 10 Feb 2022 07:57:01 +0100 Subject: [PATCH 11/33] New translations timeline.json (Vietnamese) --- src/i18n/vi/components/timeline.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/i18n/vi/components/timeline.json b/src/i18n/vi/components/timeline.json index 9ef851fc..4947b444 100644 --- a/src/i18n/vi/components/timeline.json +++ b/src/i18n/vi/components/timeline.json @@ -157,7 +157,7 @@ } }, "status": { - "heading": "Về tút", + "heading": "Đối với tút", "delete": { "function": "Xóa tút", "button": "Xóa tút này" From d5a551a2a533fe79feeda5338dc7935a45d4a725 Mon Sep 17 00:00:00 2001 From: xmflsct Date: Thu, 10 Feb 2022 08:55:39 +0100 Subject: [PATCH 12/33] New translations timeline.json (Vietnamese) --- src/i18n/vi/components/timeline.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/i18n/vi/components/timeline.json b/src/i18n/vi/components/timeline.json index 4947b444..2adc2b90 100644 --- a/src/i18n/vi/components/timeline.json +++ b/src/i18n/vi/components/timeline.json @@ -148,7 +148,7 @@ }, "share": { "status": { - "heading": "Tút", + "heading": "Chia sẻ", "button": "Chia sẻ URL tút" }, "account": { From 98186e1f2b91439c3b586149703f03892e8b4c8f Mon Sep 17 00:00:00 2001 From: Zhiyuan Zheng Date: Thu, 10 Feb 2022 22:01:57 +0100 Subject: [PATCH 13/33] Bump fastlane --- Gemfile.lock | 20 ++++++++++---------- package.json | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 2288987d..94755cfa 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -17,17 +17,17 @@ GEM artifactory (3.0.15) atomos (0.1.3) aws-eventstream (1.2.0) - aws-partitions (1.551.0) - aws-sdk-core (3.125.5) + aws-partitions (1.554.0) + aws-sdk-core (3.126.0) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.525.0) aws-sigv4 (~> 1.1) jmespath (~> 1.0) - aws-sdk-kms (1.53.0) - aws-sdk-core (~> 3, >= 3.125.0) + aws-sdk-kms (1.54.0) + aws-sdk-core (~> 3, >= 3.126.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.111.3) - aws-sdk-core (~> 3, >= 3.125.0) + aws-sdk-s3 (1.112.0) + aws-sdk-core (~> 3, >= 3.126.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.4) aws-sigv4 (1.4.0) @@ -86,7 +86,7 @@ GEM escape (0.0.4) ethon (0.15.0) ffi (>= 1.15.0) - excon (0.90.0) + excon (0.91.0) faraday (1.9.3) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) @@ -116,7 +116,7 @@ GEM faraday_middleware (1.2.0) faraday (~> 1.0) fastimage (2.2.6) - fastlane (2.203.0) + fastlane (2.204.2) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.8, < 3.0.0) artifactory (~> 3.0) @@ -155,8 +155,8 @@ GEM xcodeproj (>= 1.13.0, < 2.0.0) xcpretty (~> 0.3.0) xcpretty-travis-formatter (>= 0.0.3) - fastlane-plugin-json (1.0.0) - fastlane-plugin-sentry (1.11.0) + fastlane-plugin-json (1.1.0) + fastlane-plugin-sentry (1.11.1) fastlane-plugin-versioning_android (0.1.0) fastlane-plugin-yarn (1.2) ffi (1.15.4) diff --git a/package.json b/package.json index 5c0627f1..17bf8d9c 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "native": "220206", "major": 3, "minor": 4, - "patch": 1, + "patch": 2, "expo": "44.0.0" }, "description": "tooot app for Mastodon", From f96e9af7b9ad59b23612ab75d896e4e14239672f Mon Sep 17 00:00:00 2001 From: Zhiyuan Zheng Date: Thu, 10 Feb 2022 22:42:46 +0100 Subject: [PATCH 14/33] Add feature request link --- src/i18n/en/screens/tabs.json | 3 +++ src/screens/Tabs/Me/Settings/Tooot.tsx | 19 +++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/i18n/en/screens/tabs.json b/src/i18n/en/screens/tabs.json index 79d5b652..838c2802 100644 --- a/src/i18n/en/screens/tabs.json +++ b/src/i18n/en/screens/tabs.json @@ -240,6 +240,9 @@ "cancel": "$t(common:buttons.cancel)" } }, + "feedback": { + "heading": "Feature Requests" + }, "support": { "heading": "Support tooot" }, diff --git a/src/screens/Tabs/Me/Settings/Tooot.tsx b/src/screens/Tabs/Me/Settings/Tooot.tsx index 08456970..06a6cdb9 100644 --- a/src/screens/Tabs/Me/Settings/Tooot.tsx +++ b/src/screens/Tabs/Me/Settings/Tooot.tsx @@ -11,7 +11,7 @@ import React from 'react' import { useTranslation } from 'react-i18next' import { useSelector } from 'react-redux' import { getInstanceActive } from '@utils/slices/instancesSlice' -import { isCandidate, isDevelopment } from '@utils/checkEnvironment' +import { isDevelopment, isRelease } from '@utils/checkEnvironment' const SettingsTooot: React.FC = () => { const instanceActive = useSelector(getInstanceActive) @@ -21,6 +21,21 @@ const SettingsTooot: React.FC = () => { return ( + + } + iconBack='ChevronRight' + onPress={() => { + analytics('settings_feedback_press') + Linking.openURL('https://feedback.tooot.app/') + }} + /> { Linking.openURL('https://www.buymeacoffee.com/xmflsct') }} /> - {isDevelopment || isCandidate ? ( + {isDevelopment || isRelease ? ( Date: Thu, 10 Feb 2022 23:09:40 +0100 Subject: [PATCH 15/33] Fix whole word filter not working --- src/components/Timeline/Shared/Filtered.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Timeline/Shared/Filtered.tsx b/src/components/Timeline/Shared/Filtered.tsx index c1dc2afd..82c8f2e9 100644 --- a/src/components/Timeline/Shared/Filtered.tsx +++ b/src/components/Timeline/Shared/Filtered.tsx @@ -46,7 +46,7 @@ export const shouldFilter = ({ let shouldFilter = false if (!ownAccount) { const parser = new htmlparser2.Parser({ - ontext (text: string) { + ontext: (text: string) => { const checkFilter = (filter: Mastodon.Filter) => { const escapedPhrase = filter.phrase.replace( /[.*+?^${}()|[\]\\]/g, @@ -54,7 +54,7 @@ export const shouldFilter = ({ ) // $& means the whole matched string switch (filter.whole_word) { case true: - if (new RegExp('\\b' + escapedPhrase + '\\b').test(text)) { + if (new RegExp('\\B' + escapedPhrase + '\\B').test(text)) { shouldFilter = true } break From 4832501282be8beaccb726fb7449d4d2ecfdd71a Mon Sep 17 00:00:00 2001 From: xmflsct Date: Thu, 10 Feb 2022 23:15:17 +0100 Subject: [PATCH 16/33] New translations tabs.json (Chinese Simplified) --- src/i18n/zh-Hans/screens/tabs.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/i18n/zh-Hans/screens/tabs.json b/src/i18n/zh-Hans/screens/tabs.json index 3c9ea0f6..dee9282f 100644 --- a/src/i18n/zh-Hans/screens/tabs.json +++ b/src/i18n/zh-Hans/screens/tabs.json @@ -240,6 +240,9 @@ "cancel": "$t(common:buttons.cancel)" } }, + "feedback": { + "heading": "功能建议" + }, "support": { "heading": "赞助 tooot 开发" }, From b1565ee24087f491109f52b380710141814d90fd Mon Sep 17 00:00:00 2001 From: Zhiyuan Zheng Date: Thu, 10 Feb 2022 23:18:14 +0100 Subject: [PATCH 17/33] Fix feedback link --- src/screens/Tabs/Me/Settings/Tooot.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/screens/Tabs/Me/Settings/Tooot.tsx b/src/screens/Tabs/Me/Settings/Tooot.tsx index 06a6cdb9..0bc55272 100644 --- a/src/screens/Tabs/Me/Settings/Tooot.tsx +++ b/src/screens/Tabs/Me/Settings/Tooot.tsx @@ -33,7 +33,7 @@ const SettingsTooot: React.FC = () => { iconBack='ChevronRight' onPress={() => { analytics('settings_feedback_press') - Linking.openURL('https://feedback.tooot.app/') + Linking.openURL('https://feedback.tooot.app/feature-requests') }} /> Date: Fri, 11 Feb 2022 21:30:45 +0100 Subject: [PATCH 18/33] Try to fix toot id not found --- package.json | 2 +- src/screens/Tabs/Shared/Toot.tsx | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 17bf8d9c..86b48048 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "native": "220206", "major": 3, "minor": 4, - "patch": 2, + "patch": 3, "expo": "44.0.0" }, "description": "tooot app for Mastodon", diff --git a/src/screens/Tabs/Shared/Toot.tsx b/src/screens/Tabs/Shared/Toot.tsx index 990ddb96..c36aa9ac 100644 --- a/src/screens/Tabs/Shared/Toot.tsx +++ b/src/screens/Tabs/Shared/Toot.tsx @@ -35,29 +35,30 @@ const TabSharedToot: React.FC> = ({ ? // @ts-ignore result.data.pages.flatMap(d => [...d.body]) : [] - setItemsLength(flattenData.length) // Auto go back when toot page is empty if (flattenData.length === 0) { navigation.goBack() } + setItemsLength(flattenData.length) if (!scrolled.current) { scrolled.current = true const pointer = flattenData.findIndex(({ id }) => id === toot.id) + if (pointer === -1) return try { - pointer < flattenData.length && - setTimeout(() => { - flRef.current?.scrollToIndex({ - index: pointer, - viewOffset: 100 - }) - }, 500) + setTimeout(() => { + flRef.current?.scrollToIndex({ + index: pointer, + viewOffset: 100 + }) + }, 500) } catch (err) { if (Math.random() < 0.1) { Sentry.Native.setContext('Scroll to Index', { type: 'original', index: pointer, itemsLength: flattenData.length, - flattenData + id: toot.id, + flattenData: flattenData.map(({ id }) => id) }) Sentry.Native.captureException(err) } @@ -87,7 +88,8 @@ const TabSharedToot: React.FC> = ({ Sentry.Native.setContext('Scroll to Index', { type: 'onScrollToIndexFailed', index: error.index, - itemsLength + itemsLength, + id: toot.id }) Sentry.Native.captureException(err) } From 930b5e4b3468abf174c8ab55e90c07acfab33959 Mon Sep 17 00:00:00 2001 From: xmflsct Date: Sat, 12 Feb 2022 04:31:45 +0100 Subject: [PATCH 19/33] New translations actions.json (Vietnamese) --- src/i18n/vi/screens/actions.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/i18n/vi/screens/actions.json b/src/i18n/vi/screens/actions.json index e248b0aa..e561ddb4 100644 --- a/src/i18n/vi/screens/actions.json +++ b/src/i18n/vi/screens/actions.json @@ -5,7 +5,7 @@ "cancel": "$t(common:buttons.cancel)" }, "notificationsFilter": { - "heading": "Chỉ hiện thông báo", + "heading": "Những kiểu thông báo cho phép", "content": { "follow": "$t(screenTabs:me.push.follow.heading)", "favourite": "$t(screenTabs:me.push.favourite.heading)", From c8b73f47f13177e97486ac870534aa0f6a44bff8 Mon Sep 17 00:00:00 2001 From: xmflsct Date: Sat, 12 Feb 2022 04:31:46 +0100 Subject: [PATCH 20/33] New translations compose.json (Vietnamese) --- src/i18n/vi/screens/compose.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/i18n/vi/screens/compose.json b/src/i18n/vi/screens/compose.json index 09a5ae8e..c5473438 100644 --- a/src/i18n/vi/screens/compose.json +++ b/src/i18n/vi/screens/compose.json @@ -13,10 +13,10 @@ }, "right": { "button": { - "default": "Tút", + "default": "Đăng", "conversation": "Tin nhắn", "reply": "Trả lời", - "edit": "Tút" + "edit": "Sửa" }, "alert": { "default": { From bf42a715cd633fcbaa2d5fbed5933fc4fd5da0b9 Mon Sep 17 00:00:00 2001 From: xmflsct Date: Sat, 12 Feb 2022 04:31:47 +0100 Subject: [PATCH 21/33] New translations tabs.json (Vietnamese) --- src/i18n/vi/screens/tabs.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/i18n/vi/screens/tabs.json b/src/i18n/vi/screens/tabs.json index 949d30ef..81622b17 100644 --- a/src/i18n/vi/screens/tabs.json +++ b/src/i18n/vi/screens/tabs.json @@ -150,11 +150,11 @@ "settings": "Bật trong cài đặt" }, "global": { - "heading": "Bật khi {{acct}}", + "heading": "Bật cho {{acct}}", "description": "Thông báo được truyền qua máy chủ tooot" }, "decode": { - "heading": "Chi tiết thông báo", + "heading": "Hiện chi tiết thông báo", "description": "Theo mặc định, thông báo truyền qua máy chủ tooot sẽ được mã hóa, nhưng bạn cũng có thể chọn không mã hóa. Máy chủ của chúng tôi luôn công khai mã nguồn và không lưu lại bất cứ gì." }, "default": { @@ -240,6 +240,9 @@ "cancel": "$t(common:buttons.cancel)" } }, + "feedback": { + "heading": "Yêu cầu tính năng" + }, "support": { "heading": "Ủng hộ tooot" }, @@ -310,7 +313,7 @@ }, "users": { "accounts": { - "following": "{{count}} Theo dõi", + "following": "{{count}} theo dõi", "followers": "{{count}} người theo dõi" }, "statuses": { From 50141b29638074c32526de199a91b424b598d0ad Mon Sep 17 00:00:00 2001 From: Zhiyuan Zheng Date: Sat, 12 Feb 2022 11:12:05 +0100 Subject: [PATCH 22/33] Proper gate return preventing running further codes --- package.json | 2 +- src/screens/Tabs/Shared/Toot.tsx | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 86b48048..e511625b 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "native": "220206", "major": 3, "minor": 4, - "patch": 3, + "patch": 4, "expo": "44.0.0" }, "description": "tooot app for Mastodon", diff --git a/src/screens/Tabs/Shared/Toot.tsx b/src/screens/Tabs/Shared/Toot.tsx index c36aa9ac..0b72de23 100644 --- a/src/screens/Tabs/Shared/Toot.tsx +++ b/src/screens/Tabs/Shared/Toot.tsx @@ -38,6 +38,7 @@ const TabSharedToot: React.FC> = ({ // Auto go back when toot page is empty if (flattenData.length === 0) { navigation.goBack() + return } setItemsLength(flattenData.length) if (!scrolled.current) { From 6f0c318d06dbfc24ec630ebfefd11dd57a326a5f Mon Sep 17 00:00:00 2001 From: Zhiyuan Zheng Date: Sat, 12 Feb 2022 14:51:01 +0100 Subject: [PATCH 23/33] Implemented new dark theme --- src/Screens.tsx | 11 ++- src/components/Account.tsx | 9 +- src/components/Button.tsx | 26 +++--- src/components/Emojis/Button.tsx | 6 +- src/components/Emojis/List.tsx | 4 +- src/components/GracefullyImage.tsx | 8 +- src/components/Hashtag.tsx | 9 +- src/components/Header/Center.tsx | 4 +- src/components/Header/Left.tsx | 8 +- src/components/Header/Right.tsx | 10 +-- src/components/Input.tsx | 14 +-- src/components/Instance.tsx | 22 ++--- src/components/Instance/Info.tsx | 8 +- src/components/Menu/Header.tsx | 4 +- src/components/Menu/Row.tsx | 18 ++-- src/components/Message.tsx | 28 +++--- src/components/Parse/Emojis.tsx | 6 +- src/components/Parse/HTML.tsx | 28 +++--- src/components/Relationship/Incoming.tsx | 4 +- src/components/Relationship/Outgoing.tsx | 4 +- src/components/Separator.tsx | 6 +- src/components/Timeline.tsx | 6 +- src/components/Timeline/Conversation.tsx | 11 ++- src/components/Timeline/Default.tsx | 9 +- src/components/Timeline/Empty.tsx | 19 ++-- src/components/Timeline/Footer.tsx | 8 +- src/components/Timeline/Lookback.tsx | 8 +- src/components/Timeline/Notifications.tsx | 15 ++-- src/components/Timeline/Refresh.tsx | 13 +-- src/components/Timeline/Shared/Actioned.tsx | 9 +- src/components/Timeline/Shared/Actions.tsx | 16 ++-- .../Timeline/Shared/ActionsUsers.tsx | 11 ++- .../Timeline/Shared/Attachment/Audio.tsx | 12 +-- .../Shared/Attachment/Unsupported.tsx | 6 +- src/components/Timeline/Shared/Card.tsx | 13 +-- src/components/Timeline/Shared/Filtered.tsx | 6 +- .../Timeline/Shared/FullConversation.tsx | 4 +- .../Timeline/Shared/HeaderConversation.tsx | 12 ++- .../Timeline/Shared/HeaderDefault.tsx | 4 +- .../Timeline/Shared/HeaderNotification.tsx | 4 +- .../Timeline/Shared/HeaderShared/Account.tsx | 4 +- .../Shared/HeaderShared/Application.tsx | 4 +- .../Timeline/Shared/HeaderShared/Created.tsx | 4 +- .../Timeline/Shared/HeaderShared/Muted.tsx | 4 +- .../Shared/HeaderShared/Visibility.tsx | 6 +- src/components/Timeline/Shared/Poll.tsx | 36 ++++---- src/components/Timeline/Shared/Translate.tsx | 10 +-- src/i18n/en/screens/tabs.json | 8 ++ src/screens/Actions.tsx | 8 +- src/screens/Actions/Account.tsx | 6 +- src/screens/Actions/Domain.tsx | 4 +- src/screens/Actions/Status.tsx | 4 +- src/screens/Announcements.tsx | 38 ++++---- src/screens/Compose.tsx | 6 +- src/screens/Compose/DraftsList/Root.tsx | 18 ++-- src/screens/Compose/EditAttachment/Image.tsx | 15 ++-- src/screens/Compose/EditAttachment/Root.tsx | 12 +-- src/screens/Compose/Posting.tsx | 6 +- src/screens/Compose/Root.tsx | 4 +- src/screens/Compose/Root/Actions.tsx | 33 +++---- .../Compose/Root/Footer/Attachments.tsx | 16 ++-- src/screens/Compose/Root/Footer/Emojis.tsx | 4 +- src/screens/Compose/Root/Footer/Poll.tsx | 18 ++-- src/screens/Compose/Root/Footer/Reply.tsx | 4 +- src/screens/Compose/Root/Header/PostingAs.tsx | 4 +- .../Compose/Root/Header/SpoilerInput.tsx | 8 +- src/screens/Compose/Root/Header/TextInput.tsx | 8 +- src/screens/Compose/formatText.tsx | 4 +- src/screens/ImageViewer/save.ts | 23 ++--- src/screens/ImagesViewer.tsx | 11 +-- src/screens/Tabs.tsx | 8 +- src/screens/Tabs/Me/Profile/Fields.tsx | 16 ++-- src/screens/Tabs/Me/Profile/Name.tsx | 6 +- src/screens/Tabs/Me/Profile/Note.tsx | 14 +-- src/screens/Tabs/Me/Profile/Root.tsx | 27 +++--- .../Tabs/Me/Profile/Root/AvatarHeader.tsx | 4 +- src/screens/Tabs/Me/Push.tsx | 6 +- src/screens/Tabs/Me/Settings/Analytics.tsx | 4 +- src/screens/Tabs/Me/Settings/App.tsx | 50 +++++++++-- src/screens/Tabs/Me/Settings/Dev.tsx | 7 +- src/screens/Tabs/Me/Settings/Tooot.tsx | 8 +- src/screens/Tabs/Me/SettingsFontsize.tsx | 14 +-- src/screens/Tabs/Me/Switch.tsx | 8 +- src/screens/Tabs/Shared/Account.tsx | 10 +-- .../Tabs/Shared/Account/Attachments.tsx | 13 ++- src/screens/Tabs/Shared/Account/Header.tsx | 4 +- .../Tabs/Shared/Account/Information.tsx | 6 +- .../Shared/Account/Information/Account.tsx | 17 ++-- .../Shared/Account/Information/Created.tsx | 8 +- .../Shared/Account/Information/Fields.tsx | 10 +-- .../Tabs/Shared/Account/Information/Name.tsx | 4 +- .../Tabs/Shared/Account/Information/Stats.tsx | 19 ++-- src/screens/Tabs/Shared/Account/Nav.tsx | 4 +- src/screens/Tabs/Shared/Root.tsx | 10 +-- src/screens/Tabs/Shared/Search.tsx | 34 ++++---- src/store.ts | 8 +- src/utils/migrations/contexts/migration.ts | 15 ++-- src/utils/migrations/contexts/v2.ts | 13 +++ src/utils/migrations/instances/migration.ts | 41 +++++---- src/utils/migrations/instances/v7.ts | 77 +++++++++++++++++ src/utils/migrations/settings/migration.ts | 13 +++ src/utils/migrations/settings/v0.ts | 7 ++ src/utils/migrations/settings/v1.ts | 8 ++ src/utils/push/useConnect.ts | 4 +- src/utils/queryHooks/profile.ts | 7 +- src/utils/slices/settingsSlice.ts | 19 +++- src/utils/styles/ThemeManager.tsx | 72 ++++++++++++---- src/utils/styles/themes.ts | 86 +++++++++++++------ 108 files changed, 863 insertions(+), 571 deletions(-) create mode 100644 src/utils/migrations/contexts/v2.ts create mode 100644 src/utils/migrations/instances/v7.ts create mode 100644 src/utils/migrations/settings/migration.ts create mode 100644 src/utils/migrations/settings/v0.ts create mode 100644 src/utils/migrations/settings/v1.ts diff --git a/src/Screens.tsx b/src/Screens.tsx index 86d27c7f..632452a9 100644 --- a/src/Screens.tsx +++ b/src/Screens.tsx @@ -26,7 +26,6 @@ import { addScreenshotListener } from 'expo-screen-capture' import React, { useCallback, useEffect, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' import { Alert, Platform, StatusBar } from 'react-native' -import { useQueryClient } from 'react-query' import { useDispatch, useSelector } from 'react-redux' import * as Sentry from 'sentry-expo' @@ -40,7 +39,7 @@ const Screens: React.FC = ({ localCorrupt }) => { const { t } = useTranslation('screens') const dispatch = useDispatch() const instanceActive = useSelector(getInstanceActive) - const { mode, theme } = useTheme() + const { colors, mode, theme } = useTheme() enum barStyle { light = 'dark-content', dark = 'light-content' @@ -53,7 +52,6 @@ const Screens: React.FC = ({ localCorrupt }) => { getInstances, (prev, next) => prev.length === next.length ) - const queryClient = useQueryClient() pushUseConnect({ t, instances }) pushUseReceive({ instances }) pushUseRespond({ instances }) @@ -77,8 +75,9 @@ const Screens: React.FC = ({ localCorrupt }) => { message: t('localCorrupt.message'), description: localCorrupt.length ? localCorrupt : undefined, type: 'error', - mode + theme }) + // @ts-ignore navigationRef.navigate('Screen-Tabs', { screen: 'Tab-Me' }) @@ -164,11 +163,11 @@ const Screens: React.FC = ({ localCorrupt }) => { <> diff --git a/src/components/Account.tsx b/src/components/Account.tsx index ca9d2f17..6ef62e2e 100644 --- a/src/components/Account.tsx +++ b/src/components/Account.tsx @@ -20,10 +20,9 @@ const ComponentAccount: React.FC = ({ onPress: customOnPress, origin }) => { - const { theme } = useTheme() - const navigation = useNavigation< - StackNavigationProp - >() + const { colors } = useTheme() + const navigation = + useNavigation>() const onPress = useCallback(() => { analytics('search_account_press', { page: origin }) @@ -51,7 +50,7 @@ const ComponentAccount: React.FC = ({ @{account.acct} diff --git a/src/components/Button.tsx b/src/components/Button.tsx index d884b472..ffdb695f 100644 --- a/src/components/Button.tsx +++ b/src/components/Button.tsx @@ -54,7 +54,7 @@ const Button: React.FC = ({ overlay = false, onPress }) => { - const { mode, theme } = useTheme() + const { colors, theme } = useTheme() const mounted = useRef(false) useEffect(() => { @@ -68,35 +68,35 @@ const Button: React.FC = ({ const loadingSpinkit = useMemo( () => ( - + ), - [mode] + [theme] ) const mainColor = useMemo(() => { if (selected) { - return theme.blue + return colors.blue } else if (overlay) { - return theme.primaryOverlay + return colors.primaryOverlay } else if (disabled || loading) { - return theme.disabled + return colors.disabled } else { if (destructive) { - return theme.red + return colors.red } else { - return theme.primaryDefault + return colors.primaryDefault } } - }, [mode, disabled, loading, selected]) + }, [theme, disabled, loading, selected]) const colorBackground = useMemo(() => { if (overlay) { - return theme.backgroundOverlayInvert + return colors.backgroundOverlayInvert } else { - return theme.backgroundDefault + return colors.backgroundDefault } - }, [mode]) + }, [theme]) const children = useMemo(() => { switch (type) { @@ -130,7 +130,7 @@ const Button: React.FC = ({ ) } - }, [mode, content, loading, disabled]) + }, [theme, content, loading, disabled]) const [layoutHeight, setLayoutHeight] = useState() diff --git a/src/components/Emojis/Button.tsx b/src/components/Emojis/Button.tsx index e6d03283..92ce4620 100644 --- a/src/components/Emojis/Button.tsx +++ b/src/components/Emojis/Button.tsx @@ -7,7 +7,7 @@ import EmojisContext from './helpers/EmojisContext' const EmojisButton = React.memo( () => { - const { theme } = useTheme() + const { colors } = useTheme() const { emojisState, emojisDispatch } = useContext(EmojisContext) return emojisState.enabled ? ( @@ -30,8 +30,8 @@ const EmojisButton = React.memo( size={StyleConstants.Font.Size.L} color={ emojisState.emojis && emojisState.emojis.length - ? theme.primaryDefault - : theme.disabled + ? colors.primaryDefault + : colors.disabled } /> } diff --git a/src/components/Emojis/List.tsx b/src/components/Emojis/List.tsx index 5e5998d0..c143e3c8 100644 --- a/src/components/Emojis/List.tsx +++ b/src/components/Emojis/List.tsx @@ -23,11 +23,11 @@ const EmojisList = React.memo( const { t } = useTranslation() const { emojisState, emojisDispatch } = useContext(EmojisContext) - const { theme } = useTheme() + const { colors } = useTheme() const listHeader = useCallback( ({ section: { title } }) => ( - {title} + {title} ), [] ) diff --git a/src/components/GracefullyImage.tsx b/src/components/GracefullyImage.tsx index 2e1257d0..6ba1d475 100644 --- a/src/components/GracefullyImage.tsx +++ b/src/components/GracefullyImage.tsx @@ -51,7 +51,7 @@ const GracefullyImage = React.memo( imageStyle, setImageDimensions }: Props) => { - const { theme } = useTheme() + const { colors } = useTheme() const [originalFailed, setOriginalFailed] = useState(false) const [imageLoaded, setImageLoaded] = useState(false) @@ -85,7 +85,7 @@ const GracefullyImage = React.memo( source={{ uri: uri.preview }} style={[ styles.placeholder, - { backgroundColor: theme.shimmerDefault } + { backgroundColor: colors.shimmerDefault } ]} /> ) : null, @@ -118,7 +118,7 @@ const GracefullyImage = React.memo( ) @@ -135,7 +135,7 @@ const GracefullyImage = React.memo( : { accessibilityRole: 'image' })} accessibilityLabel={accessibilityLabel} accessibilityHint={accessibilityHint} - style={[style, dimension, { backgroundColor: theme.shimmerDefault }]} + style={[style, dimension, { backgroundColor: colors.shimmerDefault }]} {...(onPress ? hidden ? { disabled: true } diff --git a/src/components/Hashtag.tsx b/src/components/Hashtag.tsx index d23ea288..c32a9ef7 100644 --- a/src/components/Hashtag.tsx +++ b/src/components/Hashtag.tsx @@ -17,10 +17,9 @@ const ComponentHashtag: React.FC = ({ onPress: customOnPress, origin }) => { - const { theme } = useTheme() - const navigation = useNavigation< - StackNavigationProp - >() + const { colors } = useTheme() + const navigation = + useNavigation>() const onPress = useCallback(() => { analytics('search_account_press', { page: origin }) @@ -33,7 +32,7 @@ const ComponentHashtag: React.FC = ({ style={styles.itemDefault} onPress={customOnPress || onPress} > - + #{hashtag.name} diff --git a/src/components/Header/Center.tsx b/src/components/Header/Center.tsx index 74c93c25..eb6965ea 100644 --- a/src/components/Header/Center.tsx +++ b/src/components/Header/Center.tsx @@ -11,13 +11,13 @@ export interface Props { // Used for Android mostly const HeaderCenter = React.memo( ({ content, inverted = false }: Props) => { - const { theme } = useTheme() + const { colors } = useTheme() return ( diff --git a/src/components/Header/Left.tsx b/src/components/Header/Left.tsx index b89c8ead..6aabba0d 100644 --- a/src/components/Header/Left.tsx +++ b/src/components/Header/Left.tsx @@ -20,14 +20,14 @@ const HeaderLeft: React.FC = ({ background = false, onPress }) => { - const { theme } = useTheme() + const { colors, theme } = useTheme() const children = useMemo(() => { switch (type) { case 'icon': return ( @@ -35,7 +35,7 @@ const HeaderLeft: React.FC = ({ case 'text': return ( ) @@ -50,7 +50,7 @@ const HeaderLeft: React.FC = ({ styles.base, { backgroundColor: background - ? theme.backgroundOverlayDefault + ? colors.backgroundOverlayDefault : undefined, minHeight: 44, minWidth: 44, diff --git a/src/components/Header/Right.tsx b/src/components/Header/Right.tsx index dde2f58d..94ebf1d8 100644 --- a/src/components/Header/Right.tsx +++ b/src/components/Header/Right.tsx @@ -41,14 +41,14 @@ const HeaderRight: React.FC = ({ disabled, onPress }) => { - const { theme } = useTheme() + const { colors, theme } = useTheme() const loadingSpinkit = useMemo( () => ( ), @@ -64,7 +64,7 @@ const HeaderRight: React.FC = ({ name={content} style={{ opacity: loading ? 0 : 1 }} size={StyleConstants.Spacing.M * 1.25} - color={disabled ? theme.secondary : theme.primaryDefault} + color={disabled ? colors.secondary : colors.primaryDefault} /> {loading && loadingSpinkit} @@ -76,7 +76,7 @@ const HeaderRight: React.FC = ({ style={[ styles.text, { - color: disabled ? theme.secondary : theme.primaryDefault, + color: disabled ? colors.secondary : colors.primaryDefault, opacity: loading ? 0 : 1 } ]} @@ -101,7 +101,7 @@ const HeaderRight: React.FC = ({ styles.base, { backgroundColor: background - ? theme.backgroundOverlayDefault + ? colors.backgroundOverlayDefault : undefined, minHeight: 44, minWidth: 44, diff --git a/src/components/Input.tsx b/src/components/Input.tsx index dcdd0f20..123c8165 100644 --- a/src/components/Input.tsx +++ b/src/components/Input.tsx @@ -57,7 +57,7 @@ const Input: React.FC = ({ setValue, options }) => { - const { mode, theme } = useTheme() + const { colors, mode } = useTheme() const animateTitle = useAnimatedStyle(() => { if (value) { @@ -66,7 +66,7 @@ const Input: React.FC = ({ paddingHorizontal: withTiming(StyleConstants.Spacing.XS), left: withTiming(StyleConstants.Spacing.S), top: withTiming(-(StyleConstants.Font.Size.S / 2) - 2), - backgroundColor: withTiming(theme.backgroundDefault) + backgroundColor: withTiming(colors.backgroundDefault) } } else { return { @@ -74,7 +74,7 @@ const Input: React.FC = ({ paddingHorizontal: withTiming(0), left: withTiming(StyleConstants.Spacing.S), top: withTiming(StyleConstants.Spacing.S + 1), - backgroundColor: withTiming(theme.backgroundDefaultTransparent) + backgroundColor: withTiming(colors.backgroundDefaultTransparent) } } }, [mode, value]) @@ -109,7 +109,7 @@ const Input: React.FC = ({ style={[ styles.base, { - borderColor: theme.border, + borderColor: colors.border, flexDirection: multiline ? 'column' : 'row', alignItems: 'stretch' } @@ -127,7 +127,7 @@ const Input: React.FC = ({ style={[ styles.textInput, { - color: theme.primaryDefault, + color: colors.primaryDefault, minHeight: Platform.OS === 'ios' && multiline ? StyleConstants.Font.LineHeight.M * 5 @@ -149,14 +149,14 @@ const Input: React.FC = ({ {title ? ( {title} ) : null} {options?.maxLength && value?.length ? ( - + {value?.length} / {options.maxLength} ) : null} diff --git a/src/components/Instance.tsx b/src/components/Instance.tsx index 1b46c7d5..26c1f6fc 100644 --- a/src/components/Instance.tsx +++ b/src/components/Instance.tsx @@ -39,7 +39,7 @@ const ComponentInstance: React.FC = ({ goBack = false }) => { const { t } = useTranslation('componentInstance') - const { mode, theme } = useTheme() + const { colors, mode } = useTheme() const { screenReaderEnabled } = useAccessibility() const instances = useSelector(getInstances, () => true) @@ -149,10 +149,10 @@ const ComponentInstance: React.FC = ({ style={[ styles.prefix, { - color: theme.primaryDefault, + color: colors.primaryDefault, borderBottomColor: instanceQuery.isError - ? theme.red - : theme.border + ? colors.red + : colors.border } ]} editable={false} @@ -162,10 +162,10 @@ const ComponentInstance: React.FC = ({ style={[ styles.textInput, { - color: theme.primaryDefault, + color: colors.primaryDefault, borderBottomColor: instanceQuery.isError - ? theme.red - : theme.border + ? colors.red + : colors.border } ]} onChangeText={onChangeText} @@ -175,7 +175,7 @@ const ComponentInstance: React.FC = ({ textContentType='URL' onSubmitEditing={onSubmitEditing} placeholder={' ' + t('server.textInput.placeholder')} - placeholderTextColor={theme.secondary} + placeholderTextColor={colors.secondary} returnKeyType='go' keyboardAppearance={mode} {...(scrollViewRef && { @@ -234,11 +234,11 @@ const ComponentInstance: React.FC = ({ { if (screenReaderEnabled) { @@ -252,7 +252,7 @@ const ComponentInstance: React.FC = ({ {t('server.disclaimer.base')} { analytics('view_privacy') WebBrowser.openBrowserAsync( diff --git a/src/components/Instance/Info.tsx b/src/components/Instance/Info.tsx index 77f92ed4..7a2ca6b1 100644 --- a/src/components/Instance/Info.tsx +++ b/src/components/Instance/Info.tsx @@ -13,15 +13,15 @@ export interface Props { const InstanceInfo = React.memo( ({ style, header, content, potentialWidth }: Props) => { - const { theme } = useTheme() + const { colors } = useTheme() return ( - + {header} {content ? ( - + {content} ) : ( @@ -32,7 +32,7 @@ const InstanceInfo = React.memo( : undefined } height={StyleConstants.Font.LineHeight.M} - color={theme.shimmerDefault} + color={colors.shimmerDefault} noMargin style={{ borderRadius: 0 }} /> diff --git a/src/components/Menu/Header.tsx b/src/components/Menu/Header.tsx index fc455484..fca2e036 100644 --- a/src/components/Menu/Header.tsx +++ b/src/components/Menu/Header.tsx @@ -8,11 +8,11 @@ export interface Props { } const MenuHeader: React.FC = ({ heading }) => { - const { theme } = useTheme() + const { colors } = useTheme() return ( - {heading} + {heading} ) } diff --git a/src/components/Menu/Row.tsx b/src/components/Menu/Row.tsx index 04040091..b44e68d3 100644 --- a/src/components/Menu/Row.tsx +++ b/src/components/Menu/Row.tsx @@ -43,7 +43,7 @@ const MenuRow: React.FC = ({ loading = false, onPress }) => { - const { theme } = useTheme() + const { colors, theme } = useTheme() const { screenReaderEnabled } = useAccessibility() const loadingSpinkit = useMemo( @@ -51,7 +51,7 @@ const MenuRow: React.FC = ({ ), @@ -83,7 +83,7 @@ const MenuRow: React.FC = ({ )} @@ -92,7 +92,7 @@ const MenuRow: React.FC = ({ style={{ width: 8, height: 8, - backgroundColor: theme.red, + backgroundColor: colors.red, borderRadius: 8, marginRight: StyleConstants.Spacing.S }} @@ -100,7 +100,7 @@ const MenuRow: React.FC = ({ ) : null} {title} @@ -116,7 +116,7 @@ const MenuRow: React.FC = ({ style={[ styles.content, { - color: theme.secondary, + color: colors.secondary, opacity: !iconBack && loading ? 0 : 1 } ]} @@ -133,7 +133,7 @@ const MenuRow: React.FC = ({ value={switchValue} onValueChange={switchOnValueChange} disabled={switchDisabled} - trackColor={{ true: theme.blue, false: theme.disabled }} + trackColor={{ true: colors.blue, false: colors.disabled }} style={{ opacity: loading ? 0 : 1 }} /> ) : null} @@ -141,7 +141,7 @@ const MenuRow: React.FC = ({ ) : null} @@ -150,7 +150,7 @@ const MenuRow: React.FC = ({ ) : null} {description ? ( - + {description} ) : null} diff --git a/src/components/Message.tsx b/src/components/Message.tsx index db350f64..ab6c1468 100644 --- a/src/components/Message.tsx +++ b/src/components/Message.tsx @@ -1,7 +1,7 @@ import Icon from '@components/Icon' import { StyleConstants } from '@utils/styles/constants' import { useTheme } from '@utils/styles/ThemeManager' -import { getTheme } from '@utils/styles/themes' +import { getColors, Theme } from '@utils/styles/themes' import React, { RefObject } from 'react' import { AccessibilityInfo } from 'react-native' import FlashMessage, { @@ -17,7 +17,7 @@ const displayMessage = ({ message, description, onPress, - mode, + theme, type }: | { @@ -27,7 +27,7 @@ const displayMessage = ({ message: string description?: string onPress?: () => void - mode?: undefined + theme?: undefined type?: undefined } | { @@ -37,7 +37,7 @@ const displayMessage = ({ message: string description?: string onPress?: () => void - mode: 'light' | 'dark' + theme: Theme type: 'success' | 'error' | 'warning' }) => { AccessibilityInfo.announceForAccessibility(message + '.' + description) @@ -64,14 +64,14 @@ const displayMessage = ({ message, description, onPress, - ...(mode && + ...(theme && type && { renderFlashMessageIcon: () => { return ( ) @@ -85,14 +85,14 @@ const displayMessage = ({ message, description, onPress, - ...(mode && + ...(theme && type && { renderFlashMessageIcon: () => { return ( ) @@ -111,7 +111,7 @@ const removeMessage = () => { } const Message = React.forwardRef((_, ref) => { - const { mode, theme } = useTheme() + const { colors, theme } = useTheme() return ( ((_, ref) => { position='top' floating style={{ - backgroundColor: theme.backgroundDefault, - shadowColor: theme.primaryDefault, + backgroundColor: colors.backgroundDefault, + shadowColor: colors.primaryDefault, shadowOffset: { width: 0, height: 0 }, - shadowOpacity: mode === 'light' ? 0.16 : 0.24, + shadowOpacity: theme === 'light' ? 0.16 : 0.24, shadowRadius: 4 }} titleStyle={{ - color: theme.primaryDefault, + color: colors.primaryDefault, ...StyleConstants.FontStyle.M, fontWeight: StyleConstants.Font.Weight.Bold }} textStyle={{ - color: theme.primaryDefault, + color: colors.primaryDefault, ...StyleConstants.FontStyle.S }} // @ts-ignore diff --git a/src/components/Parse/Emojis.tsx b/src/components/Parse/Emojis.tsx index 79457eb5..0a06b02c 100644 --- a/src/components/Parse/Emojis.tsx +++ b/src/components/Parse/Emojis.tsx @@ -39,11 +39,11 @@ const ParseEmojis = React.memo( adaptiveSize ? adaptiveFontsize : 0 ) - const { mode, theme } = useTheme() + const { colors, theme } = useTheme() const styles = useMemo(() => { return StyleSheet.create({ text: { - color: theme.primaryDefault, + color: colors.primaryDefault, fontSize: adaptedFontsize, lineHeight: adaptedLineheight, ...(fontBold && { fontWeight: StyleConstants.Font.Weight.Bold }) @@ -54,7 +54,7 @@ const ParseEmojis = React.memo( transform: [{ translateY: -2 }] } }) - }, [mode, adaptiveFontsize]) + }, [theme, adaptiveFontsize]) return ( diff --git a/src/components/Parse/HTML.tsx b/src/components/Parse/HTML.tsx index 5c9f90e5..38d88536 100644 --- a/src/components/Parse/HTML.tsx +++ b/src/components/Parse/HTML.tsx @@ -18,7 +18,7 @@ import { useSelector } from 'react-redux' // Prevent going to the same hashtag multiple times const renderNode = ({ routeParams, - theme, + colors, node, index, adaptedFontsize, @@ -30,7 +30,7 @@ const renderNode = ({ disableDetails }: { routeParams?: any - theme: any + colors: any node: any index: number adaptedFontsize: number @@ -56,7 +56,7 @@ const renderNode = ({ accessible key={index} style={{ - color: theme.blue, + color: colors.blue, fontSize: adaptedFontsize, lineHeight: adaptedLineheight }} @@ -84,7 +84,8 @@ const renderNode = ({ - >() + const navigation = + useNavigation>() const route = useRoute() - const { mode, theme } = useTheme() + const { colors, theme } = useTheme() const { t, i18n } = useTranslation('componentParse') if (!expandHint) { expandHint = t('HTML.defaultHint') @@ -206,7 +206,7 @@ const ParseHTML = React.memo( (node, index) => renderNode({ routeParams: route.params, - theme, + colors, node, index, adaptedFontsize, @@ -271,14 +271,14 @@ const ParseHTML = React.memo( justifyContent: 'center', marginTop: expanded ? 0 : -adaptedLineheight, minHeight: 44, - backgroundColor: theme.backgroundDefault + backgroundColor: colors.backgroundDefault }} > ) }, - [mode, i18n.language] + [theme, i18n.language] ) return ( diff --git a/src/components/Relationship/Incoming.tsx b/src/components/Relationship/Incoming.tsx index d8d8f14f..feb97340 100644 --- a/src/components/Relationship/Incoming.tsx +++ b/src/components/Relationship/Incoming.tsx @@ -19,7 +19,7 @@ export interface Props { } const RelationshipIncoming: React.FC = ({ id }) => { - const { mode } = useTheme() + const { theme } = useTheme() const { t } = useTranslation() const queryKeyRelationship: QueryKeyRelationship = ['Relationship', { id }] @@ -40,7 +40,7 @@ const RelationshipIncoming: React.FC = ({ id }) => { haptics('Error') displayMessage({ type: 'error', - mode, + theme, message: t('common:message.error.message', { function: t(`relationship:${type}.function`) }), diff --git a/src/components/Relationship/Outgoing.tsx b/src/components/Relationship/Outgoing.tsx index 783e3951..13c9b229 100644 --- a/src/components/Relationship/Outgoing.tsx +++ b/src/components/Relationship/Outgoing.tsx @@ -19,7 +19,7 @@ export interface Props { const RelationshipOutgoing = React.memo( ({ id }: Props) => { - const { mode } = useTheme() + const { theme } = useTheme() const { t } = useTranslation('componentRelationship') const query = useRelationshipQuery({ id }) @@ -40,7 +40,7 @@ const RelationshipOutgoing = React.memo( }, onError: (err: any, { payload: { action } }) => { displayMessage({ - mode, + theme, type: 'error', message: t('common:message.error.message', { function: t(`${action}.function`) diff --git a/src/components/Separator.tsx b/src/components/Separator.tsx index 6cf64835..0241ce90 100644 --- a/src/components/Separator.tsx +++ b/src/components/Separator.tsx @@ -10,13 +10,13 @@ export interface Props { const ComponentSeparator = React.memo( ({ extraMarginLeft = 0, extraMarginRight = 0 }: Props) => { - const { theme } = useTheme() + const { colors } = useTheme() return ( = ({ lookback, customProps }) => { - const { theme } = useTheme() + const { colors } = useTheme() const { data, @@ -118,8 +118,8 @@ const Timeline: React.FC = ({ refreshControl: ( refetch()} /> diff --git a/src/components/Timeline/Conversation.tsx b/src/components/Timeline/Conversation.tsx index 01fc64d4..dea4c1c5 100644 --- a/src/components/Timeline/Conversation.tsx +++ b/src/components/Timeline/Conversation.tsx @@ -62,7 +62,7 @@ const TimelineConversation: React.FC = ({ getInstanceAccount, (prev, next) => prev?.id === next?.id ) - const { theme } = useTheme() + const { colors } = useTheme() const queryClient = useQueryClient() const fireMutation = useCallback(() => { @@ -77,9 +77,8 @@ const TimelineConversation: React.FC = ({ } }) - const navigation = useNavigation< - StackNavigationProp - >() + const navigation = + useNavigation>() const onPress = useCallback(() => { analytics('timeline_conversation_press') if (conversation.last_status) { @@ -95,10 +94,10 @@ const TimelineConversation: React.FC = ({ = ({ disableDetails = false, disableOnPress = false }) => { - const { theme } = useTheme() + const { colors } = useTheme() const instanceAccount = useSelector(getInstanceAccount, () => true) - const navigation = useNavigation< - StackNavigationProp - >() + const navigation = + useNavigation>() const actualStatus = item.reblog ? item.reblog : item @@ -78,7 +77,7 @@ const TimelineDefault: React.FC = ({ style={[ styles.statusView, { - backgroundColor: theme.backgroundDefault, + backgroundColor: colors.backgroundDefault, paddingBottom: disableDetails && disableOnPress ? StyleConstants.Spacing.Global.PagePadding diff --git a/src/components/Timeline/Empty.tsx b/src/components/Timeline/Empty.tsx index 18d9378a..8b7fdf4b 100644 --- a/src/components/Timeline/Empty.tsx +++ b/src/components/Timeline/Empty.tsx @@ -20,14 +20,17 @@ const TimelineEmpty = React.memo( options: { notifyOnChangeProps: ['status'] } }) - const { mode, theme } = useTheme() + const { colors, theme } = useTheme() const { t, i18n } = useTranslation('componentTimeline') const children = useMemo(() => { switch (status) { case 'loading': return ( - + ) case 'error': return ( @@ -35,9 +38,9 @@ const TimelineEmpty = React.memo( - + {t('empty.error.message')}