Skip to content

Commit

Permalink
精简设置说明,将详细说明放到选项后面帮助按钮中
Browse files Browse the repository at this point in the history
  • Loading branch information
lyswhut committed Sep 8, 2023
1 parent 0f4859e commit e56c40d
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 11 deletions.
Binary file modified android/app/src/main/assets/fonts/icomoon.ttf
Binary file not shown.
2 changes: 1 addition & 1 deletion publish/changeLog.md
Expand Up @@ -18,7 +18,7 @@
- 新增“不喜欢歌曲”功能,可以在我的列表或者在线列表内歌曲的右击菜单使用,还可以去“设置-其他”手动编辑不喜欢规则,注:“上一曲”、“下一曲”功能将跳过符合“不喜欢歌曲”规则的歌曲,但你仍可以手动播放这些歌曲
- 新增同步功能对“不喜欢歌曲”列表的同步
- 新增设置-播放设置-是否启用音频卸载,该设置之前默认是启用的,现在添加开关允许将其关闭,若出现播放器问题可尝试将其关闭
- 新增设置-播放设置-点击相同列表内的歌曲切歌时是否清空已播放列表(随机模式下列表内所有歌曲会重新参与随机)选项,默认关闭
- 新增设置-播放设置-自动清空已播放列表选项,默认关闭

### 优化

Expand Down
36 changes: 33 additions & 3 deletions src/components/common/CheckBox/index.tsx
@@ -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
Expand All @@ -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 = {
Expand Down Expand Up @@ -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) }
Expand All @@ -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>
)
: (
Expand All @@ -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>
)
)
Expand Down Expand Up @@ -94,5 +119,10 @@ const styles = createStyle({
name: {
marginTop: 2,
},
helpBtn: {
// backgroundColor: 'rgba(0, 0, 0, 0.2)',
paddingHorizontal: 8,
paddingVertical: 3,
},
})

6 changes: 4 additions & 2 deletions src/lang/en_us.json
Expand Up @@ -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",
Expand Down
6 changes: 4 additions & 2 deletions src/lang/zh_cn.json
Expand Up @@ -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": "缓存设置完毕,重启应用后生效",
Expand Down
Binary file modified src/resources/fonts/icomoon.ttf
Binary file not shown.
2 changes: 1 addition & 1 deletion src/resources/fonts/selection.json

Large diffs are not rendered by default.

Expand Up @@ -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>
)
})
Expand Down
Expand Up @@ -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>
)
})
Expand Down

0 comments on commit e56c40d

Please sign in to comment.