优化字体阴影,修复潜在动态背景显示问题

This commit is contained in:
lyswhut 2023-12-24 12:02:09 +08:00
parent 125310bfdd
commit 9261a0b9d3
10 changed files with 26 additions and 19 deletions

View File

@ -6,6 +6,11 @@ const path = require('node:path')
const rootPath = path.join(__dirname, './')
const patchs = [
[
path.join(rootPath, './node_modules/@react-native-community/cli-tools/build/findDevServerPort.js'),
'let startPackager = true;',
'let startPackager = false;',
],
[
path.join(rootPath, './node_modules/react-native-navigation/lib/android/app/build.gradle'),
`

View File

@ -4,8 +4,8 @@
- 新增长按收藏列表名自动跳转列表顶部的功能
- 新增实验性的添加本地歌曲到我的收藏支持与PC端类似在我的收藏的列表菜单中选择歌曲目录将添加所选目录下的所有歌曲目前支持mp3/flac/ogg/wav等格式
- 新增歌曲标签编辑功能,允许编辑本地源且文件歌曲存在的歌曲标签信息
- 新增动态背景,默认关闭,启用后将使用当前歌曲封面做APP背景
- 新增APP全局字体阴影默认开启,可到设置-主题设置关闭
- 新增动态背景启用后将使用当前歌曲封面做APP背景,默认关闭,可到设置-主题设置启用
- 新增APP全局字体阴影默认关闭,可到设置-主题设置启用
- 新增启用竖屏首页横向滚动设置,默认开启(原来的行为),如果你不想要竖屏的首页左右滑动则可以关闭此设置(#397
### 优化

View File

@ -37,8 +37,8 @@ export const Icon = memo(({ size = 15, rawSize, color, style, ...props }: IconPr
const theme = useTheme()
const textShadow = useTextShadow()
const newStyle = textShadow ? StyleSheet.compose({
textShadowColor: theme['c-primary-alpha-700'],
textShadowOffset: { width: 0, height: 0.2 },
textShadowColor: theme['c-primary-dark-300-alpha-800'],
textShadowOffset: { width: 0.2, height: 0.2 },
textShadowRadius: 2,
}, style) : style
return (

View File

@ -1,4 +1,4 @@
import { type ComponentProps } from 'react'
import { memo, type ComponentProps } from 'react'
import { Text, type TextProps as _TextProps, StyleSheet, Animated, type ColorValue, type TextStyle } from 'react-native'
import { useTextShadow, useTheme } from '@/store/theme/hook'
import { setSpText } from '@/utils/pixelRatio'
@ -29,13 +29,13 @@ export interface TextProps extends _TextProps {
// }
// }
export default ({ style, size = 15, color, children, ...props }: TextProps) => {
export default memo(({ style, size = 15, color, children, ...props }: TextProps) => {
const theme = useTheme()
const textShadow = useTextShadow()
style = StyleSheet.compose(textShadow ? {
fontFamily: 'System',
textShadowColor: theme['c-primary-alpha-700'],
textShadowOffset: { width: 0, height: 0.2 },
textShadowColor: theme['c-primary-dark-300-alpha-800'],
textShadowOffset: { width: 0.2, height: 0.2 },
textShadowRadius: 2,
fontSize: setSpText(size),
color: color ?? theme['c-font'],
@ -51,7 +51,7 @@ export default ({ style, size = 15, color, children, ...props }: TextProps) => {
{...props}
>{children}</Text>
)
}
})
export interface AnimatedTextProps extends _AnimatedTextProps {
/**
@ -68,8 +68,8 @@ export const AnimatedText = ({ style, size = 15, color, children, ...props }: An
const textShadow = useTextShadow()
style = StyleSheet.compose(textShadow ? {
fontFamily: 'System',
textShadowColor: theme['c-primary-alpha-700'],
textShadowOffset: { width: 0, height: 0.2 },
textShadowColor: theme['c-primary-dark-300-alpha-800'],
textShadowOffset: { width: 0.2, height: 0.2 },
textShadowRadius: 2,
fontSize: setSpText(size),
color: color ?? theme['c-font'],
@ -107,8 +107,8 @@ export const AnimatedColorText = ({ style, size = 15, opacity: _opacity, color:
style = StyleSheet.compose(textShadow ? {
fontFamily: 'System',
textShadowColor: theme['c-primary-alpha-700'],
textShadowOffset: { width: 0, height: 0.2 },
textShadowColor: theme['c-primary-dark-300-alpha-800'],
textShadowOffset: { width: 0.2, height: 0.2 },
textShadowRadius: 2,
fontSize: setSpText(size),
color: color as unknown as ColorValue,

View File

@ -72,7 +72,7 @@ const defaultSetting: LX.AppSetting = {
'theme.darkId': 'black',
'theme.hideBgDark': false,
'theme.dynamicBg': false,
'theme.fontShadow': true,
'theme.fontShadow': false,
}

View File

@ -37,7 +37,7 @@ export default async(setting: LX.AppSetting) => {
if (!pic) return
const picUrl = formatUri(pic)
void prefetch(picUrl).then(() => {
if (pic != playerState.musicInfo.pic) return
if (pic != playerState.musicInfo.pic || !isDynamicBg) return
setBgPic(picUrl)
})
}

View File

@ -436,11 +436,12 @@
"toggle_source_try": "Try switching to another source...",
"understand": "Already understood 👌",
"user_api__init_failed_alert": "Custom source [{name}] failed to initialize:",
"user_api_add_failed_tip": "Invalid custom source file",
"user_api_allow_show_update_alert": "Allow update popups to be displayed",
"user_api_btn_import": "Import",
"user_api_empty": "Its actually empty here 😲",
"user_api_import_desc": "Select custom source file",
"user_api_import_failed_tip": "Import failed",
"user_api_import_failed_tip": "Import failed:",
"user_api_import_success_tip": "Import successful 🎉",
"user_api_max_tip": "A maximum of 20 sources can exist at the same time🤪\n\nIf you want to continue importing, please remove some old sources to make room.",
"user_api_note": "Tip: Although we have isolated the running environment of the script as much as possible, importing scripts containing malicious behaviors may still affect your system, so please import with caution.",

View File

@ -436,11 +436,12 @@
"toggle_source_try": "尝试切换到其他源...",
"understand": "已了解 👌",
"user_api__init_failed_alert": "自定义源 [{name}] 初始化失败:",
"user_api_add_failed_tip": "无效的自定义源文件",
"user_api_allow_show_update_alert": "允许显示更新弹窗",
"user_api_btn_import": "导入",
"user_api_empty": "这里竟然是空的 😲",
"user_api_import_desc": "选择自定义源文件",
"user_api_import_failed_tip": "导入失败",
"user_api_import_failed_tip": "导入失败",
"user_api_import_success_tip": "导入成功 🎉",
"user_api_max_tip": "最多只能同时存在20个源哦🤪\n想要继续导入的话请先移除一些旧的源腾出位置吧",
"user_api_note": "提示:虽然我们已经尽可能地隔离了脚本的运行环境,但导入包含恶意行为的脚本仍可能会影响你的系统,请谨慎导入。",

View File

@ -12,7 +12,7 @@ export const handleImport = (path: string) => {
toast(global.i18n.t('user_api_import_success_tip'))
}).catch((error: any) => {
log.error(error.stack)
toast(global.i18n.t('user_api_import_failed_tip'))
toast(global.i18n.t('user_api_import_failed_tip') + '\n' + error.message)
})
}

View File

@ -534,7 +534,7 @@ const matchInfo = (scriptInfo: string) => {
}
export const addUserApi = async(script: string): Promise<LX.UserApi.UserApiInfo> => {
const result = /^\/\*[\S|\s]+?\*\//.exec(script)
if (!result) throw new Error('无效的自定义源文件')
if (!result) throw new Error(global.i18n.t('user_api_add_failed_tip'))
let scriptInfo = matchInfo(result[0])