Skip to content
Open
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
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
npm run lint-staged

2 changes: 1 addition & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
arrowParens: 'avoid',
bracketSameLine: true,
bracketSpacing: false,
bracketSpacing: true,
singleQuote: true,
trailingComma: 'all',
tabWidth: 4,
Expand Down
27 changes: 16 additions & 11 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ react {
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
// hermesFlags = ["-O", "-output-source-map"]

// 关键修改1:明确指定 Hermes 编译优化参数,提升字节码效率
hermesFlags = ["-O", "-output-source-map"]

/* Autolinking */
autolinkLibrariesWithApp()

Expand All @@ -72,7 +75,7 @@ react {
/**
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
*/
def enableProguardInReleaseBuilds = false
def enableProguardInReleaseBuilds = true

/**
* The preferred build flavor of JavaScriptCore (JSC)
Expand All @@ -89,7 +92,7 @@ def jscFlavor = 'org.webkit:android-jsc:+'

// !! Add lines
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('keystore.properties')
def keystorePropertiesFile = file('keystore.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
Expand Down Expand Up @@ -125,7 +128,7 @@ android {
namespace "fun.upup.musicfree"

defaultConfig {
applicationId "fun.upup.musicfree"
applicationId "fun.upup.musicfree.kx"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode appVersionCode
Expand All @@ -139,20 +142,20 @@ android {
keyPassword 'android'
}
// !! Add lines
release {
release {
storeFile file(keystoreProperties['RELEASE_STORE_FILE'])
storePassword keystoreProperties['RELEASE_STORE_PASSWORD']
keyAlias keystoreProperties['RELEASE_KEY_ALIAS']
keyPassword keystoreProperties['RELEASE_KEY_PASSWORD']
}
}
splits {
abi {
reset()
enable true
universalApk true
include "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
}
abi {
reset()
enable true
universalApk false
include "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
}
}


Expand All @@ -166,7 +169,9 @@ android {
// see https://reactnative.dev/docs/signed-apk-android.
signingConfig signingConfigs.release
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
// 开启资源压缩,移除无用图片/XML等资源
shrinkResources true
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="musicfree" android:host="app"/>
<data android:scheme="musicfree" android:host="install"/>
</intent-filter>
</intent-filter>
<!-- 处理音频文件 -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
Expand Down Expand Up @@ -119,7 +119,7 @@
<data android:mimeType="*/*" />
<data android:pathPattern=".*\\.m4a" />
<data android:pathPattern=".*\\.M4A" />
</intent-filter>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ class LyricUtilModule(private val reactContext: ReactApplicationContext): ReactC
try {
UiThreadUtil.runOnUiThread {
lyricView?.hideLyricWindow()
lyricView = null;
}
promise.resolve(true)
} catch (e: Exception) {
Expand Down Expand Up @@ -179,4 +180,8 @@ class LyricUtilModule(private val reactContext: ReactApplicationContext): ReactC
}
}

@ReactMethod
fun isShowStatusBar(promise: Promise) {
promise.resolve(lyricView != null);
}
}
18 changes: 9 additions & 9 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") }
plugins { id("com.facebook.react.settings") }
pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") }
plugins { id("com.facebook.react.settings") }
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex ->
def command = [
'node',
Expand All @@ -12,10 +12,10 @@ extensions.configure(com.facebook.react.ReactSettingsExtension){ ex ->
'android'
].toList()
ex.autolinkLibrariesFromCommand(command)
}
rootProject.name = 'MusicFree'
include ':app'
includeBuild('../node_modules/@react-native/gradle-plugin')
apply from: new File(["node", "--print", "require.resolve('expo/package.json')"].execute(null, rootDir).text.trim(), "../scripts/autolinking.gradle")
useExpoModules()
}
rootProject.name = 'MusicFree'
include ':app'
includeBuild('../node_modules/@react-native/gradle-plugin')

apply from: new File(["node", "--print", "require.resolve('expo/package.json')"].execute(null, rootDir).text.trim(), "../scripts/autolinking.gradle")
useExpoModules()
4 changes: 2 additions & 2 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
"ios": "react-native run-ios",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx src --fix",
"start": "react-native start",
"clean": "cd ./android && ./gradlew clean",
"clean": "cd .\\android && .\\gradlew clean",
"test": "jest",
"commit-lint": "commitlint --edit",
"commit-lint": "commitlint --edit",
"lint-staged": "lint-staged",
"connect-mumu": "adb kill-server & adb connect localhost:7555",
"build-android": "cd .\\android\\ && .\\gradlew assembleRelease",
Expand Down
4 changes: 4 additions & 0 deletions src/assets/icons/play-rate.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 11 additions & 4 deletions src/components/base/fastImage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect, useState } from "react";
import { ImageRequireSource } from "react-native";
import FastImage, { FastImageProps } from "react-native-fast-image";
import React, {useEffect, useState} from "react";
import {ImageRequireSource} from "react-native";
import FastImage, {FastImageProps} from "react-native-fast-image";

interface IFastImageProps {
style: FastImageProps["style"];
Expand All @@ -15,7 +15,14 @@ export default function (props: IFastImageProps) {

let realSource: FastImageProps["source"];
if (typeof source === "string") {
realSource = { uri: source };
let url = new URL(source);
realSource = {
uri: source,
headers: {
'Host': url.host,
'Referer': url.origin
}
};
if (source.length === 0) {
realSource = placeholderSource;
}
Expand Down
7 changes: 5 additions & 2 deletions src/components/base/icon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This file is generated by generate-assets.mjs. DO NOT MODIFY.
import { SvgProps } from "react-native-svg";
import {SvgProps} from "react-native-svg";

import AlarmOutlineIcon from "@/assets/icons/alarm-outline.svg";
import AlbumOutlineIcon from "@/assets/icons/album-outline.svg";
Expand Down Expand Up @@ -74,6 +74,7 @@ import TrashOutlineIcon from "@/assets/icons/trash-outline.svg";
import TrophyIcon from "@/assets/icons/trophy.svg";
import UserIcon from "@/assets/icons/user.svg";
import XMarkIcon from "@/assets/icons/x-mark.svg";
import PlayRateIcon from "@/assets/icons/play-rate.svg";

export type IIconName =
| "alarm-outline"
Expand Down Expand Up @@ -148,6 +149,7 @@ export type IIconName =
| "trash-outline"
| "trophy"
| "user"
| "play-rate"
| "x-mark";

interface IProps extends SvgProps {
Expand All @@ -157,7 +159,7 @@ interface IProps extends SvgProps {
size?: number;
}

const iconMap = {
export const iconMap = {
"alarm-outline": AlarmOutlineIcon,
"album-outline": AlbumOutlineIcon,
"archive-box-x-mark": ArchiveBoxXMarkIcon,
Expand Down Expand Up @@ -231,6 +233,7 @@ const iconMap = {
trophy: TrophyIcon,
user: UserIcon,
"x-mark": XMarkIcon,
"play-rate": PlayRateIcon
} as const;

export default function Icon(props: IProps) {
Expand Down
15 changes: 6 additions & 9 deletions src/components/base/listItem.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ReactNode } from "react";
import React, {ReactNode} from "react";
import {
StyleProp,
StyleSheet,
Expand All @@ -10,16 +10,12 @@ import {
ViewStyle,
} from "react-native";
import rpx from "@/utils/rpx";
import useColors, { CustomizedColors } from "@/hooks/useColors";
import useColors, {CustomizedColors} from "@/hooks/useColors";
import ThemeText from "./themeText";
import {
fontSizeConst,
fontWeightConst,
iconSizeConst,
} from "@/constants/uiConst";
import {fontSizeConst, fontWeightConst, iconSizeConst,} from "@/constants/uiConst";
import FastImage from "./fastImage";
import { ImageStyle } from "react-native-fast-image";
import Icon, { IIconName } from "@/components/base/icon.tsx";
import {ImageStyle} from "react-native-fast-image";
import Icon, {IIconName} from "@/components/base/icon.tsx";

interface IListItemProps {
// 是否有左右边距
Expand Down Expand Up @@ -347,5 +343,6 @@ ListItem.ListItemIcon = ListItemIcon;
ListItem.ListItemImage = ListItemImage;
ListItem.ListItemText = ListItemText;
ListItem.Content = Content;
ListItem.styles = styles;

export default ListItem;
Loading