Skip to content

Commit

Permalink
启动后打开播放详情界面 (lyswhut#502)
Browse files Browse the repository at this point in the history
* 启动后打开歌曲详细界面

* update

---------

Co-authored-by: lyswhut <lyswhut@qq.com>
  • Loading branch information
mingcc7 and lyswhut committed May 12, 2024
1 parent e692ad9 commit 585e22b
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 2 deletions.
4 changes: 4 additions & 0 deletions publish/changeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 新增

- 新增 设置-基本设置-启动后打开播放详情界面 设置,默认关闭(#502 @mingcc7

### 变更

- 设置-播放设置-优先播放320k音质选项改为“优先播放的音质”,允许选择更高优先播放的音质,如果歌曲及音源支持的话(#487
Expand Down
1 change: 1 addition & 0 deletions src/config/defaultSetting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/lang/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "使用动态背景",
Expand Down
4 changes: 2 additions & 2 deletions src/navigation/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export async function pushHomeScreen() {
},
})
}
export function pushPlayDetailScreen(componentId: string) {
export function pushPlayDetailScreen(componentId: string, skipAnimation = false) {
/*
Navigation.setDefaultOptions({
topBar: {
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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 (
<View style={styles.content}>
<CheckBoxItem check={startupPushPlayDetailScreen} label={t('setting_basic_startup_push_play_detail_screen')} onChange={setStartupPushPlayDetailScreen} />
</View>
)
})


const styles = createStyle({
content: {
marginTop: 5,
// marginBottom: 15,
},
})
2 changes: 2 additions & 0 deletions src/screens/Home/Views/Setting/settings/Basic/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -24,6 +25,7 @@ export default memo(() => {
return (
<Section title={t('setting_basic')}>
<IsStartupAutoPlay />
<IsStartupPushPlayDetailScreen />
<IsShowBackBtn />
<IsShowExitBtn />
<IsAutoHidePlayBar />
Expand Down
7 changes: 7 additions & 0 deletions src/screens/Home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 (
Expand Down
5 changes: 5 additions & 0 deletions src/types/app_setting.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ declare global {
*/
'player.startupAutoPlay': boolean

/**
* 启动后打开歌曲详细界面
*/
'player.startupPushPlayDetailScreen': boolean

/**
* 切歌模式
*/
Expand Down

0 comments on commit 585e22b

Please sign in to comment.