mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-07-03 07:12:10 +08:00
修改歌单导入流程,添加对歌单导入错误的捕获
This commit is contained in:
parent
6dbb13bef2
commit
280bb79e5f
@ -7,7 +7,7 @@ buildscript {
|
||||
compileSdkVersion = 29
|
||||
targetSdkVersion = 29
|
||||
ndkVersion = "20.1.5948944"
|
||||
kotlinVersion = "1.4.21" // Or any version above 1.3.x
|
||||
kotlinVersion = "1.4.32" // Or any version above 1.3.x
|
||||
RNNKotlinVersion = kotlinVersion
|
||||
}
|
||||
repositories {
|
||||
|
@ -32,6 +32,7 @@ FLIPPER_VERSION=0.75.1
|
||||
# org.gradle.configureondemand=true
|
||||
org.gradle.jvmargs=-Xmx4g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||
|
||||
AsyncStorage_dedicatedExecutor = true
|
||||
|
||||
AsyncStorage_useNextStorage = true
|
||||
# AsyncStorage_dedicatedExecutor = true
|
||||
AsyncStorage_useNextStorage=true
|
||||
AsyncStorage_kotlinVersion=1.4.32
|
||||
|
@ -1,7 +1,3 @@
|
||||
### 优化
|
||||
|
||||
- 改进软件错误处理,添加对软件崩溃的错误日志记录,可在设置-其他查看错误日志历史。注:清理缓存时日志也将会被清理
|
||||
|
||||
### 修复
|
||||
|
||||
- 修复显示版本更新弹窗会导致应用崩溃的问题
|
||||
- 修改歌单导入流程,添加对歌单导入错误的捕获
|
||||
|
@ -1,6 +1,7 @@
|
||||
import React, { memo, useCallback, useState, useRef } from 'react'
|
||||
import { StyleSheet, View, Text, InteractionManager } from 'react-native'
|
||||
import { readFile, writeFile, temporaryDirectoryPath, unlink } from '@/utils/fs'
|
||||
import { log } from '@/utils/log'
|
||||
|
||||
import { useGetter, useDispatch } from '@/store'
|
||||
// import { gzip, ungzip } from 'pako'
|
||||
@ -58,6 +59,28 @@ const importList = async path => {
|
||||
return listData
|
||||
}
|
||||
|
||||
const handleSetList = (setList, lists) => {
|
||||
if (!lists.length) return Promise.resolve()
|
||||
const list = lists.shift()
|
||||
for (const item of list.list) {
|
||||
if (item.otherSource) item.otherSource = null
|
||||
if (item.typeUrl['128k']) delete item.typeUrl['128k']
|
||||
if (item.typeUrl['320k']) delete item.typeUrl['320k']
|
||||
if (item.typeUrl.flac) delete item.typeUrl.flac
|
||||
if (item.typeUrl.wav) delete item.typeUrl.wav
|
||||
|
||||
// PC v1.8.2以前的Lyric
|
||||
if (item.lxlrc) delete item.lxlrc
|
||||
if (item.lrc) delete item.lrc
|
||||
if (item.tlrc) delete item.tlrc
|
||||
}
|
||||
return setList(list).then(() => handleSetList(setList, lists)).catch(err => {
|
||||
toast(err.message)
|
||||
log.error(err.message)
|
||||
return handleSetList(setList, lists)
|
||||
})
|
||||
}
|
||||
|
||||
export default memo(() => {
|
||||
const { t } = useTranslation()
|
||||
const [isShowChoosePath, setShowChoosePath] = useState(false)
|
||||
@ -95,23 +118,33 @@ export default memo(() => {
|
||||
importList(path).then(listData => {
|
||||
// 兼容0.6.2及以前版本的列表数据
|
||||
if (listData.type === 'defautlList') {
|
||||
setList({ id: 'default', list: listData.data.list, name: '试听列表' })
|
||||
toast(t('setting_backup_part_import_list_tip_success'))
|
||||
handleSetList(setList, [
|
||||
{ id: 'default', list: listData.data.list, name: '试听列表' },
|
||||
]).then(() => {
|
||||
toast(t('setting_backup_part_import_list_tip_success'))
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
switch (listData.type) {
|
||||
case 'playList':
|
||||
toast(t('setting_backup_part_import_list_tip_runing'))
|
||||
for (const list of listData.data) setList(list)
|
||||
toast(t('setting_backup_part_import_list_tip_success'))
|
||||
handleSetList(setList, listData.data).then(() => {
|
||||
toast(t('setting_backup_part_import_list_tip_success'))
|
||||
})
|
||||
break
|
||||
case 'allData':
|
||||
toast(t('setting_backup_part_import_list_tip_runing'))
|
||||
if (listData.defaultList) { // 兼容pc端 0.6.2及以前版本的列表数据
|
||||
setList({ id: 'default', list: listData.defaultList.list, name: '试听列表' })
|
||||
handleSetList(setList, [
|
||||
{ id: 'default', list: listData.defaultList.list, name: '试听列表' },
|
||||
]).then(() => {
|
||||
toast(t('setting_backup_part_import_list_tip_success'))
|
||||
})
|
||||
} else {
|
||||
for (const list of listData.playList) setList(list)
|
||||
handleSetList(setList, listData.playList).then(() => {
|
||||
toast(t('setting_backup_part_import_list_tip_success'))
|
||||
})
|
||||
}
|
||||
toast(t('setting_backup_part_import_list_tip_success'))
|
||||
break
|
||||
|
Loading…
x
Reference in New Issue
Block a user