From a9dd7ab939c371c1d211eb0880cf23ee9799d2df Mon Sep 17 00:00:00 2001 From: lyswhut Date: Thu, 16 Jun 2022 14:43:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E7=A6=BB=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lang/en_us.json | 2 +- src/lang/zh_cn.json | 2 +- src/screens/Home/Setting/Basic/IsAutoTheme.js | 27 +++++++++++++++++++ .../Home/Setting/Basic/IsStartupAutoPlay.js | 2 +- src/screens/Home/Setting/Basic/Theme.js | 17 ------------ src/screens/Home/Setting/Basic/index.js | 2 ++ 6 files changed, 32 insertions(+), 20 deletions(-) create mode 100644 src/screens/Home/Setting/Basic/IsAutoTheme.js diff --git a/src/lang/en_us.json b/src/lang/en_us.json index 2e085f8..5c15e01 100644 --- a/src/lang/en_us.json +++ b/src/lang/en_us.json @@ -123,7 +123,7 @@ "setting_backup_part_import_setting": "Import settings", "setting_backup_part_import_setting_desc": "Select the Settings file", "setting_basic": "General", - "setting_basic__startup_auto_play": "Play music automatically after startup", + "setting_basic_startup_auto_play": "Play music automatically after startup", "setting_basic_animation": "Random pop-up animation", "setting_basic_lang": "Language", "setting_basic_share_type": "Share", diff --git a/src/lang/zh_cn.json b/src/lang/zh_cn.json index c7afca5..5fe03a8 100644 --- a/src/lang/zh_cn.json +++ b/src/lang/zh_cn.json @@ -124,7 +124,7 @@ "setting_backup_part_import_setting": "导入设置", "setting_backup_part_import_setting_desc": "选择配置文件", "setting_basic": "基本设置", - "setting_basic__startup_auto_play": "启动后自动播放音乐", + "setting_basic_startup_auto_play": "启动后自动播放音乐", "setting_basic_animation": "弹出层随机动画", "setting_basic_lang": "语言", "setting_basic_share_type": "分享方式", diff --git a/src/screens/Home/Setting/Basic/IsAutoTheme.js b/src/screens/Home/Setting/Basic/IsAutoTheme.js new file mode 100644 index 0000000..62875ac --- /dev/null +++ b/src/screens/Home/Setting/Basic/IsAutoTheme.js @@ -0,0 +1,27 @@ +import React, { memo } from 'react' +import { View } from 'react-native' + +import { useGetter, useDispatch } from '@/store' + +import CheckBoxItem from '../components/CheckBoxItem' +import { useTranslation } from '@/plugins/i18n' +import { getIsSupportedAutoTheme } from '@/utils/tools' + +const isSupportedAutoTheme = getIsSupportedAutoTheme() + +export default memo(() => { + const { t } = useTranslation() + const isAutoTheme = useGetter('common', 'isAutoTheme') + const setIsAutoTheme = useDispatch('common', 'setIsAutoTheme') + + + return ( + isSupportedAutoTheme + ? ( + + + + ) + : null + ) +}) diff --git a/src/screens/Home/Setting/Basic/IsStartupAutoPlay.js b/src/screens/Home/Setting/Basic/IsStartupAutoPlay.js index b3a8b55..caa79ae 100644 --- a/src/screens/Home/Setting/Basic/IsStartupAutoPlay.js +++ b/src/screens/Home/Setting/Basic/IsStartupAutoPlay.js @@ -14,7 +14,7 @@ export default memo(() => { return ( - + ) }) diff --git a/src/screens/Home/Setting/Basic/Theme.js b/src/screens/Home/Setting/Basic/Theme.js index 9fe1ccb..d1b765d 100644 --- a/src/screens/Home/Setting/Basic/Theme.js +++ b/src/screens/Home/Setting/Basic/Theme.js @@ -4,10 +4,7 @@ import { StyleSheet, View, Text, ImageBackground, TouchableOpacity, InteractionM import { useGetter, useDispatch } from '@/store' import SubTitle from '../components/SubTitle' -import CheckBoxItem from '../components/CheckBoxItem' import { useTranslation } from '@/plugins/i18n' -import { getIsSupportedAutoTheme } from '@/utils/tools' -const isSupportedAutoTheme = getIsSupportedAutoTheme() const useActive = id => { const activeThemeId = useGetter('common', 'activeThemeId') @@ -44,9 +41,6 @@ export default memo(() => { }) }, [setTheme]) - const isAutoTheme = useGetter('common', 'isAutoTheme') - const setIsAutoTheme = useDispatch('common', 'setIsAutoTheme') - return ( @@ -54,17 +48,6 @@ export default memo(() => { themes.map(({ id, color, image }) => ) } - - { - isSupportedAutoTheme - ? ( - - - - ) - : null - } - ) }) diff --git a/src/screens/Home/Setting/Basic/index.js b/src/screens/Home/Setting/Basic/index.js index 7367829..5936e5d 100644 --- a/src/screens/Home/Setting/Basic/index.js +++ b/src/screens/Home/Setting/Basic/index.js @@ -6,6 +6,7 @@ import Source from './Source' import SourceName from './SourceName' import Language from './Language' import ShareType from './ShareType' +import IsAutoTheme from './IsAutoTheme' import IsStartupAutoPlay from './IsStartupAutoPlay' import { useTranslation } from '@/plugins/i18n' @@ -16,6 +17,7 @@ export default memo(() => { return (
+