diff --git a/publish/changeLog.md b/publish/changeLog.md index 43fb95ee4..42c791771 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -1,3 +1,7 @@ +### 新增 + +- 新增 设置-基本设置-启动后打开播放详情界面 设置,默认关闭(#502 @mingcc7) + ### 变更 - 设置-播放设置-优先播放320k音质选项改为“优先播放的音质”,允许选择更高优先播放的音质,如果歌曲及音源支持的话(#487) diff --git a/src/config/defaultSetting.ts b/src/config/defaultSetting.ts index fe19bd401..4fbdce95a 100644 --- a/src/config/defaultSetting.ts +++ b/src/config/defaultSetting.ts @@ -15,6 +15,7 @@ const defaultSetting: LX.AppSetting = { 'common.alwaysKeepStatusbarHeight': false, 'player.startupAutoPlay': false, + 'player.startupPushPlayDetailScreen': false, 'player.togglePlayMethod': 'listLoop', 'player.playQuality': '128k', 'player.isSavePlayTime': false, diff --git a/src/lang/en_us.json b/src/lang/en_us.json index 713c08499..b3b1f1402 100644 --- a/src/lang/en_us.json +++ b/src/lang/en_us.json @@ -277,6 +277,7 @@ "setting_basic_sourcename_real": "Original", "setting_basic_sourcename_title": "Select the name of music source", "setting_basic_startup_auto_play": "Play music automatically after startup", + "setting_basic_startup_push_play_detail_screen": "Open the playback details interface after startup", "setting_basic_theme": "Theme", "setting_basic_theme_auto_theme": "Follow the system light and dark mode to switch themes", "setting_basic_theme_dynamic_bg": "Use dynamic backgrounds", diff --git a/src/lang/zh_cn.json b/src/lang/zh_cn.json index ca5f7c74b..d74340b9a 100644 --- a/src/lang/zh_cn.json +++ b/src/lang/zh_cn.json @@ -277,6 +277,7 @@ "setting_basic_sourcename_real": "原名", "setting_basic_sourcename_title": "选择音源名字类型", "setting_basic_startup_auto_play": "启动后自动播放音乐", + "setting_basic_startup_push_play_detail_screen": "启动后打开播放详情界面", "setting_basic_theme": "主题颜色", "setting_basic_theme_auto_theme": "跟随系统亮、暗模式切换主题", "setting_basic_theme_dynamic_bg": "使用动态背景", diff --git a/src/navigation/navigation.ts b/src/navigation/navigation.ts index ea1d9c6f9..5c4026f6d 100644 --- a/src/navigation/navigation.ts +++ b/src/navigation/navigation.ts @@ -85,7 +85,7 @@ export async function pushHomeScreen() { }, }) } -export function pushPlayDetailScreen(componentId: string) { +export function pushPlayDetailScreen(componentId: string, skipAnimation = false) { /* Navigation.setDefaultOptions({ topBar: { @@ -144,7 +144,7 @@ export function pushPlayDetailScreen(componentId: string) { componentBackgroundColor: theme['c-content-background'], }, animations: { - push: { + push: skipAnimation ? {} : { sharedElementTransitions: [ { fromId: NAV_SHEAR_NATIVE_IDS.playDetail_pic, diff --git a/src/screens/Home/Views/Setting/settings/Basic/IsStartupPushPlayDetailScreen.tsx b/src/screens/Home/Views/Setting/settings/Basic/IsStartupPushPlayDetailScreen.tsx new file mode 100644 index 000000000..65a89ee7f --- /dev/null +++ b/src/screens/Home/Views/Setting/settings/Basic/IsStartupPushPlayDetailScreen.tsx @@ -0,0 +1,31 @@ +import { updateSetting } from '@/core/common' +import { useI18n } from '@/lang' +import { createStyle } from '@/utils/tools' +import { memo } from 'react' +import { View } from 'react-native' +import { useSettingValue } from '@/store/setting/hook' + + +import CheckBoxItem from '../../components/CheckBoxItem' + +export default memo(() => { + const t = useI18n() + const startupPushPlayDetailScreen = useSettingValue('player.startupPushPlayDetailScreen') + const setStartupPushPlayDetailScreen = (startupPushPlayDetailScreen: boolean) => { + updateSetting({ 'player.startupPushPlayDetailScreen': startupPushPlayDetailScreen }) + } + + return ( + + + + ) +}) + + +const styles = createStyle({ + content: { + marginTop: 5, + // marginBottom: 15, + }, +}) diff --git a/src/screens/Home/Views/Setting/settings/Basic/index.tsx b/src/screens/Home/Views/Setting/settings/Basic/index.tsx index 10a05fa56..d8bd9cb0d 100644 --- a/src/screens/Home/Views/Setting/settings/Basic/index.tsx +++ b/src/screens/Home/Views/Setting/settings/Basic/index.tsx @@ -8,6 +8,7 @@ import Language from './Language' import FontSize from './FontSize' import ShareType from './ShareType' import IsStartupAutoPlay from './IsStartupAutoPlay' +import IsStartupPushPlayDetailScreen from './IsStartupPushPlayDetailScreen' import IsAutoHidePlayBar from './IsAutoHidePlayBar' import IsHomePageScroll from './IsHomePageScroll' import IsUseSystemFileSelector from './IsUseSystemFileSelector' @@ -24,6 +25,7 @@ export default memo(() => { return (
+ diff --git a/src/screens/Home/index.tsx b/src/screens/Home/index.tsx index ea2c95820..0180bbd21 100644 --- a/src/screens/Home/index.tsx +++ b/src/screens/Home/index.tsx @@ -5,6 +5,9 @@ import { setComponentId } from '@/core/common' import { COMPONENT_IDS } from '@/config/constant' import Vertical from './Vertical' import Horizontal from './Horizontal' +import { navigations } from '@/navigation' +import settingState from '@/store/setting/state' + interface Props { componentId: string @@ -16,6 +19,10 @@ export default ({ componentId }: Props) => { useEffect(() => { setComponentId(COMPONENT_IDS.home, componentId) // eslint-disable-next-line react-hooks/exhaustive-deps + + if (settingState.setting['player.startupPushPlayDetailScreen']) { + navigations.pushPlayDetailScreen(componentId, true) + } }, []) return ( diff --git a/src/types/app_setting.d.ts b/src/types/app_setting.d.ts index f497e342c..5a7980fe5 100644 --- a/src/types/app_setting.d.ts +++ b/src/types/app_setting.d.ts @@ -106,6 +106,11 @@ declare global { */ 'player.startupAutoPlay': boolean + /** + * 启动后打开歌曲详细界面 + */ + 'player.startupPushPlayDetailScreen': boolean + /** * 切歌模式 */