mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-07-03 15:12:10 +08:00
新增是否在左侧导航栏显示返回桌面按钮设置
This commit is contained in:
parent
a0d9f78ada
commit
35b891879c
Binary file not shown.
@ -16,6 +16,7 @@
|
||||
- 新增播放器音量大小设置,可以去播放详情页-播放器设置-音量大小更改
|
||||
- 新增播放器播放速率设置,可以去播放详情页-播放器设置-播放速率更改
|
||||
- 新增播放详情页歌词对齐方式设置,可以去播放详情页-播放器设置-歌词对齐方式更改
|
||||
- 新增是否在左侧导航栏显示返回桌面按钮设置,默认关闭,可以去设置-基本设置-是否显示返回桌面按钮开启
|
||||
- 支持wy源flac hires歌曲类型的显示
|
||||
- 添加kg源评论图片展示(@helloplhm-qwq)
|
||||
- 支持kg源搜索列表、排行榜flac hires歌曲类型的显示(@helloplhm-qwq, @Folltoshe)
|
||||
|
@ -8,6 +8,7 @@ const defaultSetting: LX.AppSetting = {
|
||||
'common.isAgreePact': false,
|
||||
'common.autoHidePlayBar': true,
|
||||
'common.drawerLayoutPosition': 'left',
|
||||
'common.showBackBtn': false,
|
||||
|
||||
'player.startupAutoPlay': false,
|
||||
'player.togglePlayMethod': 'listLoop',
|
||||
|
@ -3,6 +3,7 @@
|
||||
"agree": "Agree",
|
||||
"agree_go": "To turn on",
|
||||
"back": "Back",
|
||||
"back_home": "Back",
|
||||
"cancel": "Cancel",
|
||||
"change_position": "Change Position",
|
||||
"change_position_list_title": "Change the position of the list",
|
||||
@ -35,6 +36,7 @@
|
||||
"disagree": "Disagree",
|
||||
"disagree_tip": "Cancelled...",
|
||||
"duplicate_list_tip": "You have previously favorited the list [{name}], do you want to update the songs?",
|
||||
"exit_app_tip": "Are you sure you want to quit the app?",
|
||||
"input_error": "Don't input indiscriminately 😡",
|
||||
"list_add_btn_title": "Add the song(s) to {name}",
|
||||
"list_add_tip_exists": "This song already exists in the list, don't click me again~😡",
|
||||
@ -187,6 +189,7 @@
|
||||
"setting_basic_share_type_clipboard": "copy to clipboard",
|
||||
"setting_basic_share_type_system": "Share using the system",
|
||||
"setting_basic_show_animation": "Show switching animation",
|
||||
"setting_basic_show_back_btn": "Show back to desktop button",
|
||||
"setting_basic_source": "Music source",
|
||||
"setting_basic_source_direct": "Direct API",
|
||||
"setting_basic_source_temp": "Temporary API (some features not available; workaround if Test API unavailable)",
|
||||
|
@ -3,6 +3,7 @@
|
||||
"agree": "行行行",
|
||||
"agree_go": "去开启",
|
||||
"back": "返回",
|
||||
"back_home": "返回桌面",
|
||||
"cancel": "取消",
|
||||
"change_position": "调整位置",
|
||||
"change_position_list_title": "调整列表位置",
|
||||
@ -35,6 +36,7 @@
|
||||
"disagree": "我就不",
|
||||
"disagree_tip": "那算了... 🙄",
|
||||
"duplicate_list_tip": "你之前已收藏过该列表 [{name}],是否需要更新里面的歌曲?",
|
||||
"exit_app_tip": "确定要退出应用吗?",
|
||||
"input_error": "不要乱输好吧😡",
|
||||
"list_add_btn_title": "把该歌曲添加到 {name}",
|
||||
"list_add_tip_exists": "列表已经存在这首歌啦,不要再点我啦~😡",
|
||||
@ -187,6 +189,7 @@
|
||||
"setting_basic_share_type_clipboard": "复制到剪贴板",
|
||||
"setting_basic_share_type_system": "使用系统分享",
|
||||
"setting_basic_show_animation": "显示切换动画",
|
||||
"setting_basic_show_back_btn": "显示返回桌面按钮",
|
||||
"setting_basic_source": "音乐来源",
|
||||
"setting_basic_source_direct": "试听接口(这是最后的选择...)",
|
||||
"setting_basic_source_temp": "临时接口(软件的某些功能不可用,建议测试接口不可用再使用本接口)",
|
||||
|
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -3,12 +3,13 @@ import { ScrollView, StatusBar, TouchableOpacity, View } from 'react-native'
|
||||
import { useNavActiveId } from '@/store/common/hook'
|
||||
import { useTheme } from '@/store/theme/hook'
|
||||
import { Icon } from '@/components/common/Icon'
|
||||
import { createStyle } from '@/utils/tools'
|
||||
import { confirmDialog, createStyle, exitApp as backHome } from '@/utils/tools'
|
||||
import { NAV_MENUS } from '@/config/constant'
|
||||
import type { InitState } from '@/store/common/state'
|
||||
// import commonState from '@/store/common/state'
|
||||
import { exitApp, setNavActiveId } from '@/core/common'
|
||||
import { BorderWidths } from '@/theme'
|
||||
import { useSettingValue } from '@/store/setting/hook'
|
||||
|
||||
const NAV_WIDTH = 68
|
||||
|
||||
@ -74,7 +75,7 @@ const Header = () => {
|
||||
)
|
||||
}
|
||||
|
||||
type IdType = InitState['navActiveId'] | 'nav_exit'
|
||||
type IdType = InitState['navActiveId'] | 'nav_exit' | 'back_home'
|
||||
|
||||
const MenuItem = ({ id, icon, onPress }: {
|
||||
id: IdType
|
||||
@ -103,10 +104,21 @@ const MenuItem = ({ id, icon, onPress }: {
|
||||
export default memo(() => {
|
||||
const theme = useTheme()
|
||||
// console.log('render drawer nav')
|
||||
const showBackBtn = useSettingValue('common.showBackBtn')
|
||||
|
||||
const handlePress = (id: IdType) => {
|
||||
if (id == 'nav_exit') {
|
||||
switch (id) {
|
||||
case 'nav_exit':
|
||||
void confirmDialog({
|
||||
message: global.i18n.t('exit_app_tip'),
|
||||
confirmButtonText: global.i18n.t('list_remove_tip_button'),
|
||||
}).then(isExit => {
|
||||
if (!isExit) return
|
||||
exitApp()
|
||||
})
|
||||
return
|
||||
case 'back_home':
|
||||
backHome()
|
||||
return
|
||||
}
|
||||
|
||||
@ -122,6 +134,9 @@ export default memo(() => {
|
||||
{NAV_MENUS.map(menu => <MenuItem key={menu.id} id={menu.id} icon={menu.icon} onPress={handlePress} />)}
|
||||
</View>
|
||||
</ScrollView>
|
||||
{
|
||||
showBackBtn ? <MenuItem id="back_home" icon="back-2" onPress={handlePress} /> : null
|
||||
}
|
||||
<MenuItem id="nav_exit" icon="exit2" onPress={handlePress} />
|
||||
</View>
|
||||
)
|
||||
|
@ -4,13 +4,14 @@ import { useI18n } from '@/lang'
|
||||
import { useNavActiveId } from '@/store/common/hook'
|
||||
import { useTheme } from '@/store/theme/hook'
|
||||
import { Icon } from '@/components/common/Icon'
|
||||
import { createStyle } from '@/utils/tools'
|
||||
import { confirmDialog, createStyle, exitApp as backHome } from '@/utils/tools'
|
||||
import { NAV_MENUS } from '@/config/constant'
|
||||
import type { InitState } from '@/store/common/state'
|
||||
// import { navigations } from '@/navigation'
|
||||
// import commonState from '@/store/common/state'
|
||||
import { exitApp, setNavActiveId } from '@/core/common'
|
||||
import Text from '@/components/common/Text'
|
||||
import { useSettingValue } from '@/store/setting/hook'
|
||||
|
||||
const styles = createStyle({
|
||||
container: {
|
||||
@ -68,7 +69,7 @@ const Header = () => {
|
||||
)
|
||||
}
|
||||
|
||||
type IdType = InitState['navActiveId'] | 'nav_exit'
|
||||
type IdType = InitState['navActiveId'] | 'nav_exit' | 'back_home'
|
||||
|
||||
const MenuItem = ({ id, icon, onPress }: {
|
||||
id: IdType
|
||||
@ -97,31 +98,29 @@ const MenuItem = ({ id, icon, onPress }: {
|
||||
export default memo(() => {
|
||||
const theme = useTheme()
|
||||
// console.log('render drawer nav')
|
||||
const showBackBtn = useSettingValue('common.showBackBtn')
|
||||
|
||||
const handlePress = (id: IdType) => {
|
||||
if (id == 'nav_exit') {
|
||||
switch (id) {
|
||||
case 'nav_exit':
|
||||
void confirmDialog({
|
||||
message: global.i18n.t('exit_app_tip'),
|
||||
confirmButtonText: global.i18n.t('list_remove_tip_button'),
|
||||
}).then(isExit => {
|
||||
if (!isExit) return
|
||||
exitApp()
|
||||
})
|
||||
return
|
||||
case 'back_home':
|
||||
backHome()
|
||||
return
|
||||
}
|
||||
// switch (id) {
|
||||
// case 'nav_search':
|
||||
// break
|
||||
// case 'nav_songlist':
|
||||
// break
|
||||
// case 'nav_top':
|
||||
// break
|
||||
// case 'nav_love':
|
||||
// break
|
||||
// case 'nav_setting':
|
||||
// // void InteractionManager.runAfterInteractions(() => {
|
||||
// // navigations.pushSettingScreen(commonState.componentIds.home)
|
||||
// // })
|
||||
// return
|
||||
// }
|
||||
|
||||
global.app_event.changeMenuVisible(false)
|
||||
setNavActiveId(id)
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<View style={{ ...styles.container, backgroundColor: theme['c-content-background'] }}>
|
||||
<Header />
|
||||
@ -130,6 +129,10 @@ export default memo(() => {
|
||||
{NAV_MENUS.map(menu => <MenuItem key={menu.id} id={menu.id} icon={menu.icon} onPress={handlePress} />)}
|
||||
</View>
|
||||
</ScrollView>
|
||||
|
||||
{
|
||||
showBackBtn ? <MenuItem id="back_home" icon="back-2" onPress={handlePress} /> : null
|
||||
}
|
||||
<MenuItem id="nav_exit" icon="exit2" onPress={handlePress} />
|
||||
</View>
|
||||
)
|
||||
|
@ -0,0 +1,30 @@
|
||||
import { updateSetting } from '@/core/common'
|
||||
import { useI18n } from '@/lang'
|
||||
import { createStyle } from '@/utils/tools'
|
||||
import React, { 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 showBackBtn = useSettingValue('common.showBackBtn')
|
||||
const setShowBaclBtn = (showBackBtn: boolean) => {
|
||||
updateSetting({ 'common.showBackBtn': showBackBtn })
|
||||
}
|
||||
|
||||
return (
|
||||
<View style={styles.content}>
|
||||
<CheckBoxItem check={showBackBtn} label={t('setting_basic_show_back_btn')} onChange={setShowBaclBtn} />
|
||||
</View>
|
||||
)
|
||||
})
|
||||
|
||||
|
||||
const styles = createStyle({
|
||||
content: {
|
||||
marginTop: 5,
|
||||
},
|
||||
})
|
@ -10,6 +10,7 @@ import ShareType from './ShareType'
|
||||
import IsAutoTheme from './IsAutoTheme'
|
||||
import IsStartupAutoPlay from './IsStartupAutoPlay'
|
||||
import IsAutoHidePlayBar from './IsAutoHidePlayBar'
|
||||
import IsShowBackBtn from './IsShowBackBtn'
|
||||
import DrawerLayoutPosition from './DrawerLayoutPosition'
|
||||
import { useI18n } from '@/lang/i18n'
|
||||
|
||||
@ -22,6 +23,7 @@ export default memo(() => {
|
||||
<Theme />
|
||||
<IsAutoTheme />
|
||||
<IsStartupAutoPlay />
|
||||
<IsShowBackBtn />
|
||||
<IsAutoHidePlayBar />
|
||||
<Source />
|
||||
<SourceName />
|
||||
|
5
src/types/app_setting.d.ts
vendored
5
src/types/app_setting.d.ts
vendored
@ -46,6 +46,11 @@ declare global {
|
||||
*/
|
||||
'common.drawerLayoutPosition': 'left' | 'right'
|
||||
|
||||
/**
|
||||
* 是否显示返回按钮
|
||||
*/
|
||||
'common.showBackBtn': boolean
|
||||
|
||||
/**
|
||||
* 主题id
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user