精简设置说明,将详细说明放到选项后面帮助按钮中

This commit is contained in:
lyswhut 2023-09-08 15:58:41 +08:00
parent 0f4859e901
commit e56c40dab9
9 changed files with 55 additions and 11 deletions

View File

@ -18,7 +18,7 @@
- 新增“不喜欢歌曲”功能,可以在我的列表或者在线列表内歌曲的右击菜单使用,还可以去“设置-其他”手动编辑不喜欢规则,注:“上一曲”、“下一曲”功能将跳过符合“不喜欢歌曲”规则的歌曲,但你仍可以手动播放这些歌曲
- 新增同步功能对“不喜欢歌曲”列表的同步
- 新增设置-播放设置-是否启用音频卸载,该设置之前默认是启用的,现在添加开关允许将其关闭,若出现播放器问题可尝试将其关闭
- 新增设置-播放设置-点击相同列表内的歌曲切歌时是否清空已播放列表(随机模式下列表内所有歌曲会重新参与随机)选项,默认关闭
- 新增设置-播放设置-自动清空已播放列表选项,默认关闭
### 优化

View File

@ -1,11 +1,12 @@
import { useCallback, useEffect, useState } from 'react'
import { View, TouchableOpacity } from 'react-native'
import { useCallback, useEffect, useMemo, useState } from 'react'
import { View, TouchableOpacity, Alert } from 'react-native'
import CheckBox from './Checkbox'
import { createStyle } from '@/utils/tools'
import { scaleSizeH, scaleSizeW } from '@/utils/pixelRatio'
import { useTheme } from '@/store/theme/hook'
import Text from '../Text'
import { Icon } from '../Icon'
export interface CheckBoxProps {
check: boolean
@ -16,9 +17,12 @@ export interface CheckBoxProps {
need?: boolean
marginRight?: number
marginBottom?: number
helpTitle?: string
helpDesc?: string
}
export default ({ check, label, children, onChange, disabled = false, need = false, marginRight = 0, marginBottom = 0 }: CheckBoxProps) => {
export default ({ check, label, children, onChange, helpTitle, helpDesc, disabled = false, need = false, marginRight = 0, marginBottom = 0 }: CheckBoxProps) => {
const theme = useTheme()
const [isDisabled, setDisabled] = useState(false)
const tintColors = {
@ -47,6 +51,25 @@ export default ({ check, label, children, onChange, disabled = false, need = fal
onChange?.(!check)
}, [isDisabled, onChange, check])
const helpComponent = useMemo(() => {
const handleShowHelp = () => {
Alert.alert(helpTitle ?? '', helpDesc,
// [{
// text: '我知道了 (Close)',
// // onPress: () => {
// // void saveData(storageDataPrefix.cheatTip, true)
// // resolve()
// // },
// }],
)
}
return (helpTitle ?? helpDesc) ? (
<TouchableOpacity style={styles.helpBtn} onPress={handleShowHelp}>
<Icon name="help" />
</TouchableOpacity>
) : null
}, [helpTitle, helpDesc])
const contentStyle = { ...styles.content, marginBottom: scaleSizeH(marginBottom) }
const labelStyle = { ...styles.label, marginRight: scaleSizeW(marginRight) }
@ -57,6 +80,7 @@ export default ({ check, label, children, onChange, disabled = false, need = fal
<View style={contentStyle}>
<CheckBox status={check ? 'checked' : 'unchecked'} disabled={true} tintColors={disabledTintColors} />
<View style={labelStyle}>{label ? <Text style={styles.name} color={theme['c-500']}>{label}</Text> : children}</View>
{helpComponent}
</View>
)
: (
@ -65,6 +89,7 @@ export default ({ check, label, children, onChange, disabled = false, need = fal
<TouchableOpacity style={labelStyle} activeOpacity={0.3} onPress={handleLabelPress}>
{label ? <Text style={styles.name}>{label}</Text> : children}
</TouchableOpacity>
{helpComponent}
</View>
)
)
@ -94,5 +119,10 @@ const styles = createStyle({
name: {
marginTop: 2,
},
helpBtn: {
// backgroundColor: 'rgba(0, 0, 0, 0.2)',
paddingHorizontal: 8,
paddingVertical: 3,
},
})

View File

@ -254,8 +254,10 @@
"setting_other_log_sync_log": "Record synchronization log",
"setting_other_log_tip_clean_success": "Log cleaning completed",
"setting_other_log_tip_null": "The log is empty~",
"setting_play_audio_offload": "Enable audio offloading (to save power, if available)",
"setting_play_auto_clean_played_list": "Whether to clear the existing playlist when clicking the same list as the playlist to switch songs (all songs in the list in random mode will participate in the random again)",
"setting_play_audio_offload": "Enable audio offload",
"setting_play_audio_offload_tip": "Enabling audio offloading can save power consumption, but on some devices, all songs may prompt \"Audio loading error\" or \"The whole song cannot be played completely\". This is caused by a bug in the current system.\nFor People who encounter this problem can turn off this option and restart the application completely to try again.",
"setting_play_auto_clean_played_list": "Automatically clear the played list",
"setting_play_auto_clean_played_list_tip": "In random play mode, when switching songs by clicking the same list as the playlist, if automatic clearing of the already played list is enabled, the played songs will re-participate in random play.",
"setting_play_cache_size": "Maximum cache size (MB)",
"setting_play_cache_size_no_cache": "Disabled cache",
"setting_play_cache_size_save_tip": "The cache setting is completed, it will take effect after restarting the application",

View File

@ -254,8 +254,10 @@
"setting_other_log_sync_log": "记录同步日志",
"setting_other_log_tip_clean_success": "日志清理完成",
"setting_other_log_tip_null": "日志是空的哦~",
"setting_play_audio_offload": "启用音频卸载(可节省耗电量,如果可用)",
"setting_play_auto_clean_played_list": "点击与播放列表相同的列表切歌时是否清空已播放列表(随机模式下列表内所有歌曲会重新参与随机)",
"setting_play_audio_offload": "启用音频卸载",
"setting_play_audio_offload_tip": "启用音频卸载可以节省耗电量,但在某些设备上可能会出现所有歌曲都提示 「音频加载出错」 或者 「无法完整播放整首歌」 的问题这是由于当前系统的bug导致的。\n对于遇到这个问题的人可以关闭此选项后完全重启应用再试。",
"setting_play_auto_clean_played_list": "自动清空已播放列表",
"setting_play_auto_clean_played_list_tip": "随机播放模式下,通过 「点击」 与 「播放列表相同的列表内的歌曲」 切歌时,若启用 「自动清空已播放列表」,则已播放的歌曲将重新参与随机播放。",
"setting_play_cache_size": "最大缓存大小MB",
"setting_play_cache_size_no_cache": "禁用缓存",
"setting_play_cache_size_save_tip": "缓存设置完毕,重启应用后生效",

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -17,7 +17,12 @@ export default memo(() => {
return (
<View style={styles.content}>
<CheckBoxItem check={isAutoCleanPlayedList} onChange={setAutoCleanPlayedList} label={t('setting_play_auto_clean_played_list')} />
<CheckBoxItem
check={isAutoCleanPlayedList}
onChange={setAutoCleanPlayedList}
helpDesc={t('setting_play_auto_clean_played_list_tip')}
label={t('setting_play_auto_clean_played_list')}
/>
</View>
)
})

View File

@ -18,7 +18,12 @@ export default memo(() => {
return (
<View style={styles.content}>
<CheckBoxItem check={isEnableAudioOffload} onChange={setHandleAudioFocus} label={t('setting_play_audio_offload')} />
<CheckBoxItem
check={isEnableAudioOffload}
onChange={setHandleAudioFocus}
helpDesc={t('setting_play_audio_offload_tip')}
label={t('setting_play_audio_offload')}
/>
</View>
)
})