Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish 0.4.1 #289

Merged
merged 9 commits into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 13 additions & 25 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,17 @@ 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) {
lyricView = LyricView(reactContext)
}

val mapOptions = mutableMapOf<String, Any>().apply {
if (options == null) {
return@apply
}
if (options.hasKey("topPercent")) {
put("topPercent", options.getDouble("topPercent"))
}
Expand All @@ -58,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"))
}
}

Expand Down
4 changes: 4 additions & 0 deletions android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<resources>
<string name="app_name">MusicFree</string>
<string name="expo_splash_screen_status_bar_translucent">true</string>
<!-- rtnp channel id -->
<string name="rntp_temporary_channel_id">musicfree_temporary_channel</string>
<!-- rtnp channel name -->
<string name="rntp_temporary_channel_name">musicfree_temporary_channel</string>
<string name="playback_channel_name">MusicFree</string>
</resources>
7 changes: 7 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
`2024.9.8 v0.4.1`
安装包上传到了飞书云文档,浏览器打开链接后有个下载说明,可以根据这个指引安装apk
1. 【修复】修复桌面歌词无法开启的问题
2. 【修复】修复了修改桌面歌词颜色会导致闪退的问题
3. 【修复】回滚了本地音乐部分读取文件的逻辑
4. 【修复】修复了点击【编辑歌单信息】按钮无效的问题

`2024.9.1 v0.4.0`
本次更新修改了歌单的存储机制,建议谨慎更新
安装包上传到了飞书云文档,浏览器打开链接后有个下载说明,可以根据这个指引安装apk
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "MusicFree",
"version": "0.4.0",
"version": "0.4.1",
"private": true,
"license": "GPL",
"license": "AGPL",
"author": {
"name": "猫头猫",
"email": "[email protected]"
Expand Down
2 changes: 1 addition & 1 deletion release/version.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"0.4.0","changeLog":["本次更新修改了歌单的存储机制,建议谨慎更新","安装包上传到了飞书云文档,浏览器打开链接后有个下载说明,可以根据这个指引安装apk","1. 【升级】ReactNative升级到0.74.4","2. 【功能】换了个logo和开屏页","3. 【功能】播放列表的歌曲限制从1500首调整到10000首","4. 【功能】重写了歌曲排序机制","5. 【功能】插件新增评论区功能(需要插件实现getMusicComments方法)","6. 【优化】调整部分样式,优化删除歌曲时的性能","7. 【修复】修复歌词翻译错位的问题","8. 【修复】修复部分情况下无法复制作者/专辑的问题","9. 【修复】修复在歌单详情页删除歌单会导致白屏的问题","10. 【修复】修复搜索框在部分情况下自动触发搜索的问题","11. 【修复】修复右上角菜单位置跳变的问题","12. 【修复】修复在预览专辑封面时触发返回不会关闭预览弹窗的问题","13. 【修复】下载文件时转移文件中的保留字符(感谢@GuGuMur)","14. 【其他】分架构打包,更新开源协议为 AGPL 3.0", "15. 【其他】支持上传本地歌词"],"download":["https://r0rvr854dd1.feishu.cn/drive/folder/KLqKfWOA3lx8MKdo8xNcYpR8n7t"]}
{"version":"0.4.1","changeLog":["安装包上传到了飞书云文档,浏览器打开链接后有个下载说明,可以根据这个指引安装apk","1. 【修复】修复桌面歌词无法开启的问题","2. 【修复】修复了修改桌面歌词颜色会导致闪退的问题","3. 【修复】回滚了本地音乐部分读取文件的逻辑","4. 【修复】修复了点击【编辑歌单信息】按钮无效的问题"],"download":["https://r0rvr854dd1.feishu.cn/drive/folder/KLqKfWOA3lx8MKdo8xNcYpR8n7t"]}
2 changes: 1 addition & 1 deletion src/components/base/toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export function ToastBaseComponent() {
color={typeConfig[activeToast.type].color}
/>
<Text
numberOfLines={1}
numberOfLines={2}
style={[styles.text, {color: colors.text}]}>
{activeToast.message}
</Text>
Expand Down
1 change: 1 addition & 0 deletions src/components/dialogs/components/downloadDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export default function DownloadDialog(props: IDownloadDialogProps) {
<Button
style={style.button}
onPress={async () => {
Config.set('status.app.skipVersion', undefined);
openUrl(backUrl);
Clipboard.setString(backUrl);
}}>
Expand Down
9 changes: 2 additions & 7 deletions src/components/panels/base/panelBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,6 @@ export default function (props: IPanelBaseProps) {
let keyboardDidShowListener: EmitterSubscription;
let keyboardDidHideListener: EmitterSubscription;
if (awareKeyboard) {
Keyboard.addListener('keyboardDidChangeFrame', event => {
console.log(event, 'KKss');
});
Keyboard.addListener('keyboardWillShow', event => {
console.log(event, 'KKsss');
});
keyboardDidShowListener = Keyboard.addListener(
'keyboardDidShow',
event => {
Expand Down Expand Up @@ -185,7 +179,8 @@ export default function (props: IPanelBaseProps) {
height:
orientation === 'horizonal'
? vh(100) - safeAreaInsets.top
: height - keyboardHeight,
: height -
(isFinite(keyboardHeight) ? keyboardHeight : 0),
},
panelAnimated,
]}>
Expand Down
38 changes: 15 additions & 23 deletions src/core/localMusicSheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
}
}
Expand Down Expand Up @@ -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};
}

Expand All @@ -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');
}
Expand All @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/hooks/useCheckUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const checkUpdateAndShowResult = (
version: data.version,
content: data.changeLog,
fromUrl: data.download[0],
backUrl: data.download[1],
});
} else {
if (showToast) {
Expand Down
2 changes: 2 additions & 0 deletions src/native/lyricUtil/index.ts
Original file line number Diff line number Diff line change
@@ -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 {
// 左对齐
Expand Down Expand Up @@ -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);
}
Expand Down
10 changes: 7 additions & 3 deletions src/utils/fileUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down