Skip to content

Commit

Permalink
更新依赖&版本号(1.2.0-beta.9)
Browse files Browse the repository at this point in the history
  • Loading branch information
lyswhut committed Dec 10, 2023
1 parent f7793cf commit 6a830ff
Show file tree
Hide file tree
Showing 53 changed files with 123 additions and 94 deletions.
32 changes: 16 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lx-music-mobile",
"version": "1.2.0-beta.8",
"version": "1.2.0-beta.9",
"versionCode": 62,
"private": true,
"scripts": {
Expand Down Expand Up @@ -74,14 +74,14 @@
"@react-native/metro-config": "^0.73.2",
"@react-native/typescript-config": "^0.74.0",
"@tsconfig/react-native": "^3.0.2",
"@types/react": "^18.2.42",
"@types/react": "^18.2.43",
"@types/react-native": "^0.70.19",
"@types/react-native-background-timer": "^2.0.2",
"@types/react-native-vector-icons": "^6.4.18",
"babel-plugin-module-resolver": "^5.0.0",
"changelog-parser": "^3.0.1",
"eslint-config-standard": "^17.1.0",
"eslint-config-standard-with-typescript": "^40.0.0",
"eslint-config-standard-with-typescript": "^42.0.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"typescript": "^5.3.3"
Expand Down
4 changes: 2 additions & 2 deletions src/components/MusicAddModal/MusicAddModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default forwardRef<MusicAddModalType, MusicAddModalProps>(({ onAdded }, r
dialogRef.current?.setVisible(false)
if (selectInfo.isMove) {
void moveListMusics(selectInfo.listId, listInfo.id,
[selectInfo.musicInfo as LX.Music.MusicInfo],
[selectInfo.musicInfo!],
settingState.setting['list.addMusicLocationType'],
).then(() => {
onAdded?.()
Expand All @@ -62,7 +62,7 @@ export default forwardRef<MusicAddModalType, MusicAddModalProps>(({ onAdded }, r
})
} else {
void addListMusics(listInfo.id,
[selectInfo.musicInfo as LX.Music.MusicInfo],
[selectInfo.musicInfo!],
settingState.setting['list.addMusicLocationType'],
).then(() => {
onAdded?.()
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/ChoosePath/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const caches = new Map<string, PathItem[]>()

const handleReadDir = async(path: string, dirOnly: boolean, filter?: RegExp, isRefresh = false) => {
const cacheKey = `${path}_${dirOnly ? 'true' : 'false'}_${filter ? filter.toString() : 'null'}`
if (!isRefresh && caches.has(cacheKey)) return caches.get(cacheKey) as PathItem[]
if (!isRefresh && caches.has(cacheKey)) return caches.get(cacheKey)!
return readDir(path).then(paths => {
// console.log('read')
// prevPath = path
Expand Down
2 changes: 1 addition & 1 deletion src/components/player/PlayerBar/components/Pic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default ({ isHome }: { isHome: boolean }) => {
// console.log('')
// console.log(playMusicInfo)
if (!musicInfo.id) return
navigations.pushPlayDetailScreen(commonState.componentIds.home as string)
navigations.pushPlayDetailScreen(commonState.componentIds.home!)

// toast(global.i18n.t('play_detail_todo_tip'), 'long')
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/player/PlayerBar/components/Title.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default ({ isHome }: { isHome: boolean }) => {
// console.log('')
// console.log(playMusicInfo)
if (!musicInfo.id) return
navigations.pushPlayDetailScreen(commonState.componentIds.home as string)
navigations.pushPlayDetailScreen(commonState.componentIds.home!)
// toast(global.i18n.t('play_detail_todo_tip'), 'long')
}

Expand Down
4 changes: 2 additions & 2 deletions src/config/migrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ const timeStr2Intv = (timeStr: string) => {
let intv = 0
let unit = 1
while (intvArr.length) {
intv += parseInt(intvArr.pop() as string) * unit
intv += parseInt(intvArr.pop()!) * unit
unit *= 60
}
return intv
Expand All @@ -160,7 +160,7 @@ const migratePlayInfo = async() => {
const playInfo = await getData<any>(storageDataPrefixOld.playInfo)
if (playInfo == null) return
if (playInfo.list !== undefined) delete playInfo.list
if (playInfo.maxTime) playInfo.maxTime = timeStr2Intv(playInfo.maxTime)
if (playInfo.maxTime) playInfo.maxTime = timeStr2Intv(playInfo.maxTime as string)
await saveData(storageDataPrefix.playInfo, playInfo)
}
/**
Expand Down
2 changes: 1 addition & 1 deletion src/config/migrateSetting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default (setting: any): Partial<LX.AppSetting> => {
setting = { ...setting }

// 迁移 v1 之前的配置
if (compareVer(setting.version, '2.0') < 0) {
if (compareVer(setting.version as string, '2.0') < 0) {
setting['player.startupAutoPlay'] = setting.startupAutoPlay
setting['player.togglePlayMethod'] = setting.player?.togglePlayMethod
setting['player.isPlayHighQuality'] = setting.player?.highQuality
Expand Down
5 changes: 3 additions & 2 deletions src/core/hotSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const getList = async(source: Source): Promise<string[]> => {
if (source == 'all') continue
task.push(
hotSearchState.sourceList[source]?.length
? Promise.resolve({ source, list: hotSearchState.sourceList[source] as Lists[number]['list'] })
? Promise.resolve({ source, list: hotSearchState.sourceList[source]! })
: ((musicSdk[source]?.hotSearch.getList() as Promise<Lists[number]>) ?? Promise.reject(new Error('source not found: ' + source))).catch((err: any) => {
console.log(err)
return { source, list: [] }
Expand All @@ -20,14 +20,15 @@ export const getList = async(source: Source): Promise<string[]> => {
return hotSearchActions.setList(source, results)
})
} else {
if (hotSearchState.sourceList[source]?.length) return hotSearchState.sourceList[source] as string[]
if (hotSearchState.sourceList[source]?.length) return hotSearchState.sourceList[source]!
if (!musicSdk[source]?.hotSearch) {
hotSearchActions.setList(source, [])
return []
}
return musicSdk[source]?.hotSearch.getList().catch((err: any) => {
console.log(err)
return { source, list: [] }
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
}).then(data => hotSearchActions.setList(source, data.list))
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/init/player/playProgress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const delaySavePlayInfo = throttleBackgroundTimer(() => {
void savePlayInfo({
time: playerState.progress.nowPlayTime,
maxTime: playerState.progress.maxPlayTime,
listId: playerState.playMusicInfo.listId as string,
listId: playerState.playMusicInfo.listId!,
index: playerState.playInfo.playIndex,
})
}, 2000)
Expand Down Expand Up @@ -121,7 +121,7 @@ export default () => {
void savePlayInfo({
time: playerState.progress.nowPlayTime,
maxTime: playerState.progress.maxPlayTime,
listId: playerState.playMusicInfo.listId as string,
listId: playerState.playMusicInfo.listId!,
index: playerState.playInfo.playIndex,
})
}
Expand Down
2 changes: 2 additions & 0 deletions src/core/init/syncSetting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ const handleUpdateSourceNmaes = () => {
kg: 'kg',
mg: 'mg',
wy: 'wy',
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
all: global.i18n.t(prefix + 'all' as any),
}
for (const { id } of musicSdk.sources) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
sourceNames[id as LX.OnlineSource] = global.i18n.t(prefix + id as any)
}
commonActions.setSourceNames(sourceNames)
Expand Down
2 changes: 1 addition & 1 deletion src/core/init/userApi/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default async(setting: LX.AppSetting) => {
// eslint-disable-next-line @typescript-eslint/promise-function-async
}).then(res => {
// console.log(res)
if (!/^https?:/.test(res.data.url)) return Promise.reject(new Error('Get url failed'))
if (!/^https?:/.test(res.data.url as string)) return Promise.reject(new Error('Get url failed'))
return { type, url: res.data.url }
}).catch(async err => {
console.log(err.message)
Expand Down
10 changes: 5 additions & 5 deletions src/core/leaderboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ const getListLimit = async(source: LX.OnlineSource, bangId: string, page: number
const prevPageKey = `${source}__${bangId}__${page - 1}`
const tempListKey = `${source}__${bangId}__temp`

let listCache = cache.get(listKey) as CacheValue
if (!listCache) cache.set(listKey, listCache = new Map())
let listCache = cache.get(listKey)!
if (!listCache) cache.set(listKey, listCache = new Map<string, PageCache | LX.Music.MusicInfoOnline[]>())
let sourcePage = 0
{
const prevPageData = listCache.get(prevPageKey) as PageCache
Expand Down Expand Up @@ -113,7 +113,7 @@ export const getListDetail = async(id: string, page: number, isRefresh = false):

let listCache = cache.get(listKey)
if (!listCache || isRefresh) {
cache.set(listKey, listCache = new Map())
cache.set(listKey, listCache = new Map<string, PageCache | LX.Music.MusicInfoOnline[]>())
}

let pageCache = listCache.get(pageKey) as PageCache
Expand All @@ -132,9 +132,9 @@ export const getListDetailAll = async(id: string, isRefresh = false): Promise<LX
const [source, bangId] = id.split('__') as [LX.OnlineSource, string]
// console.log(tabId)
const listKey = `${source}__${bangId}`
let listCache = cache.get(listKey) as CacheValue
let listCache = cache.get(listKey)!
if (!listCache || isRefresh) {
cache.set(listKey, listCache = new Map())
cache.set(listKey, listCache = new Map<string, PageCache | LX.Music.MusicInfoOnline[]>())
}

const loadData = async(page: number): Promise<ListDetailInfo> => {
Expand Down
6 changes: 3 additions & 3 deletions src/core/music/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export const getOnlineOtherSourceMusicUrl = async({ musicInfos, quality, onToggl
let musicInfo: LX.Music.MusicInfoOnline | null = null
let itemQuality: LX.Quality | null = null
// eslint-disable-next-line no-cond-assign
while (musicInfo = (musicInfos.shift() as LX.Music.MusicInfoOnline)) {
while (musicInfo = (musicInfos.shift()!)) {
if (retryedSource.includes(musicInfo.source)) continue
retryedSource.push(musicInfo.source)
if (!assertApiSupport(musicInfo.source)) continue
Expand Down Expand Up @@ -261,7 +261,7 @@ export const getOnlineOtherSourcePicUrl = async({ musicInfos, onToggleSource, is
}> => {
let musicInfo: LX.Music.MusicInfoOnline | null = null
// eslint-disable-next-line no-cond-assign
while (musicInfo = (musicInfos.shift() as LX.Music.MusicInfoOnline)) {
while (musicInfo = (musicInfos.shift()!)) {
if (retryedSource.includes(musicInfo.source)) continue
retryedSource.push(musicInfo.source)
// if (!assertApiSupport(musicInfo.source)) continue
Expand Down Expand Up @@ -344,7 +344,7 @@ export const getOnlineOtherSourceLyricInfo = async({ musicInfos, onToggleSource,
}> => {
let musicInfo: LX.Music.MusicInfoOnline | null = null
// eslint-disable-next-line no-cond-assign
while (musicInfo = (musicInfos.shift() as LX.Music.MusicInfoOnline)) {
while (musicInfo = (musicInfos.shift()!)) {
if (retryedSource.includes(musicInfo.source)) continue
retryedSource.push(musicInfo.source)
// if (!assertApiSupport(musicInfo.source)) continue
Expand Down
2 changes: 1 addition & 1 deletion src/core/player/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export const setMusicUrl = (musicInfo: LX.Music.MusicInfo | LX.Download.ListItem
setResource(musicInfo, url, playerState.progress.nowPlayTime)
}).catch((err: any) => {
console.log(err)
setStatusText(err.message)
setStatusText(err.message as string)
global.app_event.error()
addDelayNextTimeout()
}).finally(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/player/timeoutExit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const timeoutTools = {
clearTimeout() {
if (!this.bgTimeout) return
BackgroundTimer.clearTimeout(this.bgTimeout)
clearInterval(this.timeout as NodeJS.Timer)
clearInterval(this.timeout!)
this.bgTimeout = null
this.timeout = null
this.time = -1
Expand Down
4 changes: 2 additions & 2 deletions src/core/search/music.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import searchMusicState, { type ListInfo, type Source } from '@/store/search/music/state'
import searchMusicState, { type Source } from '@/store/search/music/state'
import searchMusicActions, { type SearchResult } from '@/store/search/music/action'
import musicSdk from '@/utils/musicSdk'

Expand All @@ -18,7 +18,7 @@ export const clearListInfo: typeof searchMusicActions.clearListInfo = (source) =


export const search = async(text: string, page: number, sourceId: Source): Promise<LX.Music.MusicInfoOnline[]> => {
const listInfo = searchMusicState.listInfos[sourceId] as ListInfo
const listInfo = searchMusicState.listInfos[sourceId]!
if (!text) return []
const key = `${page}__${text}`
if (sourceId == 'all') {
Expand Down
6 changes: 3 additions & 3 deletions src/core/search/songlist.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import searchSonglistState, { type SearchListInfo, type Source, type ListInfoItem } from '@/store/search/songlist/state'
import searchSonglistState, { type Source, type ListInfoItem } from '@/store/search/songlist/state'
import searchSonglistActions, { type SearchResult } from '@/store/search/songlist/action'
import musicSdk from '@/utils/musicSdk'

Expand All @@ -18,15 +18,15 @@ export const clearListInfo: typeof searchSonglistActions.clearListInfo = (source


export const search = async(text: string, page: number, sourceId: Source): Promise<ListInfoItem[]> => {
const listInfo = searchSonglistState.listInfos[sourceId] as SearchListInfo
const listInfo = searchSonglistState.listInfos[sourceId]!
// if (!text) return []
const key = `${page}__${sourceId}__${text}`
if (listInfo.key == key && listInfo.list.length) return listInfo.list
if (sourceId == 'all') {
listInfo.key = key
let task = []
for (const source of searchSonglistState.sources) {
if (source == 'all' || (page > 1 && page > (searchSonglistState.maxPages[source] as number))) continue
if (source == 'all' || (page > 1 && page > (searchSonglistState.maxPages[source]!))) continue
task.push(((musicSdk[source]?.songList.search(text, page, searchSonglistState.listInfos.all.limit) as Promise<SearchResult>) ?? Promise.reject(new Error('source not found: ' + source))).catch((error: any) => {
console.log(error)
return {
Expand Down
4 changes: 2 additions & 2 deletions src/core/songlist.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import songlistState, { type TagInfo, type ListDetailInfo, type ListInfo, type SortInfo, type ListInfoItem } from '@/store/songlist/state'
import songlistState, { type TagInfo, type ListDetailInfo, type ListInfo, type ListInfoItem } from '@/store/songlist/state'
import songlistActions from '@/store/songlist/action'
import { deduplicationList, toNewMusicInfo } from '@/utils'
import musicSdk from '@/utils/musicSdk'
Expand Down Expand Up @@ -28,7 +28,7 @@ export const setSelectListInfo = (info: ListInfoItem) => {
* @returns
*/
export const getSortList = (source: LX.OnlineSource) => {
return songlistState.sortList[source] as SortInfo[]
return songlistState.sortList[source]!
}

/**
Expand Down
Loading

0 comments on commit 6a830ff

Please sign in to comment.