mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-05-23 22:37:41 +08:00
添加创建同名列表时的二次确认
This commit is contained in:
parent
4393e5333d
commit
855c983fc4
@ -26,6 +26,7 @@
|
|||||||
- 歌曲评论内容过长时自动折叠,需手动展开
|
- 歌曲评论内容过长时自动折叠,需手动展开
|
||||||
- 改进本地音乐在线信息的匹配机制
|
- 改进本地音乐在线信息的匹配机制
|
||||||
- 移除播放服务唤醒锁,解决APP在空闲时仍然处于唤醒状态的问题
|
- 移除播放服务唤醒锁,解决APP在空闲时仍然处于唤醒状态的问题
|
||||||
|
- 添加创建同名列表时的二次确认
|
||||||
|
|
||||||
### 修复
|
### 修复
|
||||||
|
|
||||||
@ -44,4 +45,4 @@
|
|||||||
- 移除所有内置源,由于收到腾讯投诉要求停止提供软件内置的连接到他们平台的在线播放及下载服务,所以从即日(2023年10月18日)起LX本身不再提供上述服务
|
- 移除所有内置源,由于收到腾讯投诉要求停止提供软件内置的连接到他们平台的在线播放及下载服务,所以从即日(2023年10月18日)起LX本身不再提供上述服务
|
||||||
- 更新许可协议的排版,使其看起来更加清晰明了,更新数据来源原理说明
|
- 更新许可协议的排版,使其看起来更加清晰明了,更新数据来源原理说明
|
||||||
- 更新 React native 到 v0.73.2
|
- 更新 React native 到 v0.73.2
|
||||||
- 核心播放器从 ExoPlayer 迁移到 media3 v1.2.0
|
- 核心播放器从 ExoPlayer 迁移到 media3 v1.2.1
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { useState, useRef, useEffect } from 'react'
|
import { useState, useRef, useEffect } from 'react'
|
||||||
import { View } from 'react-native'
|
import { View } from 'react-native'
|
||||||
import Input, { type InputType } from '@/components/common/Input'
|
import Input, { type InputType } from '@/components/common/Input'
|
||||||
import { createStyle } from '@/utils/tools'
|
import { confirmDialog, createStyle } from '@/utils/tools'
|
||||||
import { useI18n } from '@/lang'
|
import { useI18n } from '@/lang'
|
||||||
import { createUserList } from '@/core/list'
|
import { createUserList } from '@/core/list'
|
||||||
import listState from '@/store/list/state'
|
import listState from '@/store/list/state'
|
||||||
@ -23,10 +23,12 @@ export default ({ isEdit, onHide }: {
|
|||||||
}
|
}
|
||||||
}, [isEdit])
|
}, [isEdit])
|
||||||
|
|
||||||
const handleSubmitEditing = () => {
|
const handleSubmitEditing = async() => {
|
||||||
onHide()
|
onHide()
|
||||||
const name = text.trim()
|
const name = text.trim()
|
||||||
if (!name.length) return
|
if (!name.length || (listState.userList.some(l => l.name == name) && !(await confirmDialog({
|
||||||
|
message: global.i18n.t('list_duplicate_tip'),
|
||||||
|
})))) return
|
||||||
void createUserList(listState.userList.length, [{ id: `userlist_${Date.now()}`, name, locationUpdateTime: null }])
|
void createUserList(listState.userList.length, [{ id: `userlist_${Date.now()}`, name, locationUpdateTime: null }])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +55,7 @@
|
|||||||
"list_add_title_last": "to...",
|
"list_add_title_last": "to...",
|
||||||
"list_create": "Create a new list",
|
"list_create": "Create a new list",
|
||||||
"list_create_input_placeholder": "What name do you think of...",
|
"list_create_input_placeholder": "What name do you think of...",
|
||||||
|
"list_duplicate_tip": "A list with the same name already exists. Do you want to continue creating it?",
|
||||||
"list_edit_action_tip_add_failed": "add failed",
|
"list_edit_action_tip_add_failed": "add failed",
|
||||||
"list_edit_action_tip_add_success": "Added successfully",
|
"list_edit_action_tip_add_success": "Added successfully",
|
||||||
"list_edit_action_tip_exist": "This song already exists in this list",
|
"list_edit_action_tip_exist": "This song already exists in this list",
|
||||||
|
@ -55,6 +55,7 @@
|
|||||||
"list_add_title_last": "到...",
|
"list_add_title_last": "到...",
|
||||||
"list_create": "新建列表",
|
"list_create": "新建列表",
|
||||||
"list_create_input_placeholder": "你想起啥名...",
|
"list_create_input_placeholder": "你想起啥名...",
|
||||||
|
"list_duplicate_tip": "已存在同名列表,是否继续创建?",
|
||||||
"list_edit_action_tip_add_failed": "添加失败",
|
"list_edit_action_tip_add_failed": "添加失败",
|
||||||
"list_edit_action_tip_add_success": "添加成功",
|
"list_edit_action_tip_add_success": "添加成功",
|
||||||
"list_edit_action_tip_exist": "该列表已经有这首歌啦",
|
"list_edit_action_tip_exist": "该列表已经有这首歌啦",
|
||||||
|
@ -4,8 +4,9 @@ import Text from '@/components/common/Text'
|
|||||||
import { View } from 'react-native'
|
import { View } from 'react-native'
|
||||||
import Input, { type InputType } from '@/components/common/Input'
|
import Input, { type InputType } from '@/components/common/Input'
|
||||||
import { createUserList, updateUserList } from '@/core/list'
|
import { createUserList, updateUserList } from '@/core/list'
|
||||||
import { createStyle } from '@/utils/tools'
|
import { confirmDialog, createStyle } from '@/utils/tools'
|
||||||
import { useTheme } from '@/store/theme/hook'
|
import { useTheme } from '@/store/theme/hook'
|
||||||
|
import listState from '@/store/list/state'
|
||||||
|
|
||||||
interface NameInputType {
|
interface NameInputType {
|
||||||
setName: (text: string) => void
|
setName: (text: string) => void
|
||||||
@ -98,8 +99,13 @@ export default forwardRef<ListNameEditType, {}>((props, ref) => {
|
|||||||
if (position == -1) {
|
if (position == -1) {
|
||||||
void updateUserList([{ ...selectedListInfo.current, name }])
|
void updateUserList([{ ...selectedListInfo.current, name }])
|
||||||
} else {
|
} else {
|
||||||
const now = Date.now()
|
void (listState.userList.some(l => l.name == name) ? confirmDialog({
|
||||||
void createUserList(position, [{ id: `userlist_${now}`, name, locationUpdateTime: now }])
|
message: global.i18n.t('list_duplicate_tip'),
|
||||||
|
}) : Promise.resolve(true)).then(confirmed => {
|
||||||
|
if (!confirmed) return
|
||||||
|
const now = Date.now()
|
||||||
|
void createUserList(position, [{ id: `userlist_${now}`, name, locationUpdateTime: now }])
|
||||||
|
})
|
||||||
}
|
}
|
||||||
alertRef.current?.setVisible(false)
|
alertRef.current?.setVisible(false)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user