From ece524864fe4fbae049c9ec47b8db94bcf87a114 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8C=AB=E5=A4=B4=E7=8C=AB?= Date: Tue, 3 Sep 2024 09:44:41 +0800 Subject: [PATCH 1/9] =?UTF-8?q?fix:=20=E6=A1=8C=E9=9D=A2=E6=AD=8C=E8=AF=8D?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/fun/upup/musicfree/lyricUtil/LyricUtilModule.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/android/app/src/main/java/fun/upup/musicfree/lyricUtil/LyricUtilModule.kt b/android/app/src/main/java/fun/upup/musicfree/lyricUtil/LyricUtilModule.kt index 83636291..26fb5caf 100644 --- a/android/app/src/main/java/fun/upup/musicfree/lyricUtil/LyricUtilModule.kt +++ b/android/app/src/main/java/fun/upup/musicfree/lyricUtil/LyricUtilModule.kt @@ -37,7 +37,7 @@ class LyricUtilModule(private val reactContext: ReactApplicationContext): ReactC } @ReactMethod - fun showStatusBarLyric(initLyric: String, options: ReadableMap, promise: Promise) { + fun showStatusBarLyric(initLyric: String?, options: ReadableMap?, promise: Promise) { try { UiThreadUtil.runOnUiThread { if (lyricView == null) { @@ -45,6 +45,9 @@ class LyricUtilModule(private val reactContext: ReactApplicationContext): ReactC } val mapOptions = mutableMapOf().apply { + if (options == null) { + return@apply + } if (options.hasKey("topPercent")) { put("topPercent", options.getDouble("topPercent")) } From fe4a38198982f78ed0ab998adbf731ec51346ef2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8C=AB=E5=A4=B4=E7=8C=AB?= Date: Tue, 3 Sep 2024 22:03:48 +0800 Subject: [PATCH 2/9] =?UTF-8?q?fix:=20=E6=A1=8C=E9=9D=A2=E6=AD=8C=E8=AF=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/fun/upup/musicfree/lyricUtil/LyricUtilModule.kt | 6 +++--- android/app/src/main/res/values/strings.xml | 4 ++++ src/native/lyricUtil/index.ts | 2 ++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/android/app/src/main/java/fun/upup/musicfree/lyricUtil/LyricUtilModule.kt b/android/app/src/main/java/fun/upup/musicfree/lyricUtil/LyricUtilModule.kt index 26fb5caf..0c5cae65 100644 --- a/android/app/src/main/java/fun/upup/musicfree/lyricUtil/LyricUtilModule.kt +++ b/android/app/src/main/java/fun/upup/musicfree/lyricUtil/LyricUtilModule.kt @@ -61,13 +61,13 @@ class LyricUtilModule(private val reactContext: ReactApplicationContext): ReactC options.getString("color")?.let { put("color", it) } } if (options.hasKey("backgroundColor")) { - options.getString("backgroundColor")?.let { put("color", it) } + options.getString("backgroundColor")?.let { put("backgroundColor", it) } } if (options.hasKey("widthPercent")) { - put("color", options.getDouble("widthPercent")) + put("widthPercent", options.getDouble("widthPercent")) } if (options.hasKey("fontSize")) { - put("color", options.getDouble("fontSize")) + put("fontSize", options.getDouble("fontSize")) } } diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml index 8403b999..dbd0daab 100644 --- a/android/app/src/main/res/values/strings.xml +++ b/android/app/src/main/res/values/strings.xml @@ -1,5 +1,9 @@ MusicFree true + + musicfree_temporary_channel + + musicfree_temporary_channel MusicFree diff --git a/src/native/lyricUtil/index.ts b/src/native/lyricUtil/index.ts index 08fbd109..9e659836 100644 --- a/src/native/lyricUtil/index.ts +++ b/src/native/lyricUtil/index.ts @@ -1,6 +1,7 @@ import Config from '@/core/config'; import Toast from '@/utils/toast'; import {NativeModule, NativeModules} from 'react-native'; +import {errorLog} from '@/utils/log.ts'; export enum NativeTextAlignment { // 左对齐 @@ -54,6 +55,7 @@ const showStatusBarLyric: ILyricUtil['showStatusBarLyric'] = async ( try { await originalShowStatusBarLyric(initLyric, config); } catch (e) { + errorLog('状态栏歌词开启失败', e); Toast.warn('状态栏歌词开启失败,请到手机系统设置打开悬浮窗权限'); Config.set('setting.lyric.showStatusBarLyric', false); } From e9e7efbbcc1b77c07f9f3218ffd573e376b9de47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8C=AB=E5=A4=B4=E7=8C=AB?= Date: Sat, 7 Sep 2024 22:29:03 +0800 Subject: [PATCH 3/9] =?UTF-8?q?fix:=20=E5=9B=BA=E5=AE=9A=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- android/app/build.gradle | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 57b487b3..e69908c1 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -91,21 +91,21 @@ static def getVersion() { return packageJson["version"] } -static def versionStringToCode(String version) { - def parts = version.split('\\.') - def versionCode = 0 - def multiplier = 1000000 - - parts.each { part -> - versionCode += part.toInteger() * multiplier - multiplier /= 1000 - } - - return versionCode.intValue() -} +// static def versionStringToCode(String version) { +// def parts = version.split('\\.') +// def versionCode = 0 +// def multiplier = 1000000 +// +// parts.each { part -> +// versionCode += part.toInteger() * multiplier +// multiplier /= 1000 +// } +// +// return versionCode.intValue() +// } def appVersion = getVersion() -def appVersionCode = versionStringToCode(appVersion) +def appVersionCode = 400011 android { @@ -146,19 +146,7 @@ android { } } - applicationVariants.all { variant -> - variant.outputs.each { output -> - def versionCodes = ["armeabi-v7a": 1, "arm64-v8a": 2, "x86": 3, "x86_64": 4] - - def abi = output.getFilter(OutputFile.ABI) - if (abi != null) { - output.versionCodeOverride = defaultConfig.versionCode * 100 + versionCodes.get(abi); - } else { - output.versionCodeOverride = defaultConfig.versionCode * 100 - } - } - } buildTypes { debug { From e593fd4a6f831a1746f5c1616ab738bd2b30698a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8C=AB=E5=A4=B4=E7=8C=AB?= Date: Sat, 7 Sep 2024 23:11:09 +0800 Subject: [PATCH 4/9] =?UTF-8?q?fix:=20=E6=9C=AC=E5=9C=B0=E9=9F=B3=E4=B9=90?= =?UTF-8?q?=E4=B9=B1=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/localMusicSheet.ts | 38 +++++++++++++++---------------------- src/utils/fileUtils.ts | 10 +++++++--- 2 files changed, 22 insertions(+), 26 deletions(-) diff --git a/src/core/localMusicSheet.ts b/src/core/localMusicSheet.ts index aae3d4e9..65ab1acb 100644 --- a/src/core/localMusicSheet.ts +++ b/src/core/localMusicSheet.ts @@ -13,9 +13,9 @@ import StateMapper from '@/utils/stateMapper'; import {getStorage, setStorage} from '@/utils/storage'; import {nanoid} from 'nanoid'; import {useEffect, useState} from 'react'; -import {unlink} from 'react-native-fs'; -import {getInfoAsync, readDirectoryAsync} from 'expo-file-system'; +import {exists, readDir, ReadDirItem, unlink} from 'react-native-fs'; import {addFileScheme, getFileName} from '@/utils/fileUtils.ts'; +import CryptoJs from 'crypto-js'; let localSheet: IMusic.IMusicItem[] = []; const localSheetStateMapper = new StateMapper(() => localSheet); @@ -29,7 +29,7 @@ export async function setup() { musicItem, InternalDataType.LOCALPATH, ); - if (localPath && (await getInfoAsync(localPath)).exists) { + if (localPath && (await exists(localPath))) { validSheet.push(musicItem); } } @@ -126,36 +126,32 @@ function localMediaFilter(filename: string) { let importToken: string | null = null; // 获取本地的文件列表 async function getMusicStats(folderPaths: string[]) { + console.log('GGGG', folderPaths); const _importToken = nanoid(); importToken = _importToken; const musicList: string[] = []; let peek: string | undefined; - let dirFiles: string[] = []; + let dirFiles: ReadDirItem[] = []; while (folderPaths.length !== 0) { if (importToken !== _importToken) { throw new Error('Import Broken'); } peek = folderPaths.shift() as string; try { - dirFiles = await readDirectoryAsync(peek); + dirFiles = await readDir(peek); } catch { dirFiles = []; } - await Promise.all( - dirFiles.map(async fileName => { - const stat = await getInfoAsync(peek + '/' + fileName); - if (!stat.exists) { - return; - } - if (stat.isDirectory && !folderPaths.includes(stat.uri)) { - folderPaths.push(stat.uri); - } else if (localMediaFilter(stat.uri)) { - musicList.push(stat.uri); - } - }), - ); + dirFiles.forEach(item => { + if (item.isDirectory() && !folderPaths.includes(item.path)) { + folderPaths.push(item.path); + } else if (localMediaFilter(item.path)) { + musicList.push(item.path); + } + }); } + return {musicList, token: _importToken}; } @@ -168,7 +164,6 @@ const groupNum = 25; async function importLocal(_folderPaths: string[]) { const folderPaths = [..._folderPaths.map(it => addFileScheme(it))]; const {musicList, token} = await getMusicStats(folderPaths); - console.log('HI!!!', musicList, folderPaths, _folderPaths); if (token !== importToken) { throw new Error('Import Broken'); } @@ -192,10 +187,7 @@ async function importLocal(_folderPaths: string[]) { const meta = metas[index]; if (!platform || !id) { platform = '本地'; - const fileInfo = await getInfoAsync(musicPath, { - md5: true, - }); - id = fileInfo.exists ? fileInfo.md5 : nanoid(); + id = CryptoJs.MD5(musicPath).toString(CryptoJs.enc.Hex); } return { id, diff --git a/src/utils/fileUtils.ts b/src/utils/fileUtils.ts index 2ae73ce3..5618a10c 100644 --- a/src/utils/fileUtils.ts +++ b/src/utils/fileUtils.ts @@ -149,11 +149,15 @@ export function getFileName(filePath: string, withoutExt?: boolean) { if (lastSlash === -1) { return filePath; } - const fileName = filePath.slice(lastSlash + 1); + let fileName = filePath.slice(lastSlash + 1); if (withoutExt) { const lastDot = fileName.lastIndexOf('.'); - return lastDot === -1 ? fileName : fileName.slice(0, lastDot); - } else { + fileName = lastDot === -1 ? fileName : fileName.slice(0, lastDot); + } + + try { + return decodeURIComponent(fileName); + } catch { return fileName; } } From d8bc08a85be3b7152d4e861ca6db9d972ad65665 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8C=AB=E5=A4=B4=E7=8C=AB?= Date: Sun, 8 Sep 2024 10:07:11 +0800 Subject: [PATCH 5/9] =?UTF-8?q?feat:=20=E5=A4=87=E7=94=A8=E9=93=BE?= =?UTF-8?q?=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/dialogs/components/downloadDialog.tsx | 1 + src/hooks/useCheckUpdate.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/src/components/dialogs/components/downloadDialog.tsx b/src/components/dialogs/components/downloadDialog.tsx index d894f95c..314a388a 100644 --- a/src/components/dialogs/components/downloadDialog.tsx +++ b/src/components/dialogs/components/downloadDialog.tsx @@ -73,6 +73,7 @@ export default function DownloadDialog(props: IDownloadDialogProps) {