Skip to content

Commit

Permalink
Releases/v1.5.0 (#32)
Browse files Browse the repository at this point in the history
feat: new feature

1. 多线程下载支持仅对单个账号设置
2. 错误信息和日志调整
3. 支持导入本地和网盘里的m3u播放列表
4. flutter upgrade to 3.27.4
  • Loading branch information
GhostenEditor authored Feb 18, 2025
1 parent 4b8cafc commit 51d10cf
Show file tree
Hide file tree
Showing 121 changed files with 1,734 additions and 1,620 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/media3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
- run: git clone https://github.com/androidx/media.git

- working-directory: media
run: git checkout tags/1.4.1
run: git checkout tags/1.5.1

- working-directory: media/libraries/decoder_av1/src/main/jni
run: git clone https://github.com/google/cpu_features
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ jobs:

- uses: subosito/flutter-action@v1
with:
flutter-version: '3.22.2'
flutter-version: '3.27.4'

- run: flutter pub get

- run: |
sed -i '882a\rect = rect.inflate(96);' ${{ env.FLUTTER_ROOT }}/packages/flutter/lib/src/rendering/viewport.dart
sed -i '890a\rect = rect.inflate(96);' ${{ env.FLUTTER_ROOT }}/packages/flutter/lib/src/rendering/viewport.dart
- name: Decode Keystore
run: |
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
*.swp
.DS_Store
.atom/
.build/
.buildlog/
.history
.svn/
.swiftpm/
migrate_working_dir/

# IntelliJ related
Expand Down
2 changes: 1 addition & 1 deletion android/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ gradle-wrapper.jar
GeneratedPluginRegistrant.java

# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
# See https://flutter.dev/to/reference-keystore
key.properties
**/*.keystore
**/*.jks
20 changes: 7 additions & 13 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,6 @@ if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
if (flutterVersionCode == null) {
flutterVersionCode = "1"
}

def flutterVersionName = localProperties.getProperty("flutter.versionName")
if (flutterVersionName == null) {
flutterVersionName = "1.0"
}

android {
namespace = "com.ghosten.player"
compileSdk = flutter.compileSdkVersion
Expand All @@ -38,14 +28,18 @@ android {
targetCompatibility = JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}

defaultConfig {
applicationId = "com.ghosten.player"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
// For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutterVersionCode.toInteger()
versionName = flutterVersionName
versionCode = flutter.versionCode
versionName = flutter.versionName
}

signingConfigs {
Expand Down
4 changes: 4 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:taskAffinity=""
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
Expand Down Expand Up @@ -56,6 +57,9 @@
<data android:host="player"/>
</intent-filter>
</activity>
<meta-data
android:name="io.flutter.embedding.android.EnableImpeller"
android:value="false"/>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
Expand Down
13 changes: 13 additions & 0 deletions android/app/src/main/kotlin/com/ghosten/player/MainFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.content.res.Configuration
import android.provider.Settings
import android.window.BackEvent
import androidx.annotation.RequiresApi
import io.flutter.Build.API_LEVELS
Expand Down Expand Up @@ -64,6 +65,18 @@ class MainFragment : FlutterFragment() {
})
}

override fun onFlutterUiDisplayed() {
if (Settings.Global.getFloat(
context.contentResolver,
Settings.Global.TRANSITION_ANIMATION_SCALE,
1.0f
) == 0.0f
) {
flutterEngine?.accessibilityChannel?.setAccessibilityFeatures(0)
}
super.onFlutterUiDisplayed()
}

override fun onResume() {
super.onResume()
val mScreenStatusFilter = IntentFilter()
Expand Down
16 changes: 16 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@ allprojects {
}
}

// FIX flutter plugin install_plugin for Flutter 3.24
subprojects {
afterEvaluate { project ->
if (project.group == "com.example.installplugin" || project.group == "io.flutter.plugins.webview_cookie_manager") {
project.android {
compileSdkVersion = 35
namespace = project.group
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}
}
}
}

rootProject.buildDir = "../build"
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
Expand Down
2 changes: 1 addition & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
org.gradle.jvmargs=-Xmx4G -XX:+HeapDumpOnOutOfMemoryError
org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
4 changes: 2 additions & 2 deletions android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ pluginManagement {

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
id "com.android.application" version "8.1.0" apply false
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
}

include ":app"
2 changes: 1 addition & 1 deletion lib/components/blurred_background.dart
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class _BlurredBackgroundState extends State<BlurredBackground> with SingleTicker
} while (isDirty && retryCounter >= 0);
try {
buildOwner.finalizeTree();
} catch (e) {}
} catch (_) {}

return image;
}
Expand Down
74 changes: 22 additions & 52 deletions lib/components/error_message.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import 'package:api/api.dart';
import 'package:bluetooth/bluetooth.dart';
import 'package:dio/dio.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

import 'gap.dart';
Expand Down Expand Up @@ -35,9 +33,11 @@ class ErrorMessage<T> extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(exception.message, style: Theme.of(context).textTheme.titleMedium),
if (kDebugMode && exception.detail?.isNotEmpty == true) ...[Gap.vLG, Text(exception.detail!)],
if (kDebugMode && exception.error?.toString().isNotEmpty == true) ...[Gap.vLG, if (exception.error != null) Text(exception.error.toString())],
Text(exception.code, style: Theme.of(context).textTheme.titleMedium),
if (kDebugMode && exception.details?.toString().isNotEmpty == true) ...[
Gap.vLG,
if (exception.details != null) Text(exception.details.toString())
],
],
),
),
Expand All @@ -63,57 +63,27 @@ class ErrorMessage<T> extends StatelessWidget {

CommonException _toCommonException(BuildContext context, Object error) {
return switch (snapshot.error) {
_ when error is DioException => switch (error.type) {
DioExceptionType.connectionTimeout || DioExceptionType.sendTimeout || DioExceptionType.receiveTimeout => CommonException(
message: 'HTTP Request Timeout',
detail: 'URL: ${error.requestOptions.path}',
),
DioExceptionType.badCertificate => CommonException(
message: 'HTTP Bad Certificate',
detail: 'URL: ${error.requestOptions.path}',
),
DioExceptionType.cancel => CommonException(
message: 'HTTP Has Been Canceled',
detail: 'URL: ${error.requestOptions.path}',
),
DioExceptionType.connectionError => CommonException(
message: 'HTTP Connection Error',
detail: 'URL: ${error.requestOptions.path}',
),
DioExceptionType.badResponse || DioExceptionType.unknown => CommonException(
message: 'HTTP ${error.response?.statusCode}',
detail: 'URL: ${error.requestOptions.path}',
error: error.response?.data,
),
},
_ when error is ApiException => CommonException(
message: error.message ?? '',
detail: error.details,
),
_ when error is BluetoothException => switch (error.type) {
BluetoothExceptionType.connectTimeout => CommonException(
message: AppLocalizations.of(context)!.errorTextConnectTimeout,
detail: AppLocalizations.of(context)!.errorTextConnectTimeoutHelper,
),
BluetoothExceptionType.nonAdaptor => CommonException(
message: AppLocalizations.of(context)!.errorTextNoBluetoothAdaptor,
),
},
_ when error is RollbackDataException => CommonException(
message: AppLocalizations.of(context)!.errorTextNoDataToRollback,
),
_ when error is StoragePermissionException => CommonException(
message: AppLocalizations.of(context)!.errorTextNoStoragePermission,
_ when error is PlatformException => CommonException(
code: AppLocalizations.of(context)!.errorCode(error.code, error.message as Object? ?? ''),
message: error.message,
details: AppLocalizations.of(context)!.errorDetails(error.code, error.message as Object? ?? ''),
stackTrace: error.stacktrace == null ? null : StackTrace.fromString(error.stacktrace!),
),
_ => CommonException(message: error.toString(), error: snapshot.stackTrace.toString())
_ => CommonException(code: '0', message: error.toString())
};
}
}

class CommonException implements Exception {
final String message;
final String? detail;
final dynamic error;
final String code;
final String? message;
final dynamic details;
final StackTrace? stackTrace;

const CommonException({required this.message, this.detail, this.error});
const CommonException({
required this.code,
this.message,
this.details,
this.stackTrace,
});
}
15 changes: 5 additions & 10 deletions lib/components/form_group.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import 'package:collection/collection.dart';
import 'package:flutter/material.dart';

class FormItem {
late final TextEditingController controller;

final focusNode = FocusNode();
final String? labelText;
final String? helperText;
final String? hintText;
final String name;
final IconData? prefixIcon;
final Widget? suffixIcon;
final FormFieldValidator<String?>? validator;
final bool obscureText;

Expand All @@ -20,19 +19,17 @@ class FormItem {
this.helperText,
this.hintText,
this.prefixIcon,
this.suffixIcon,
this.validator,
this.obscureText = false,
}) {
controller = TextEditingController(text: value);
}
TextEditingController? controller,
}) : controller = controller ?? TextEditingController(text: value);

String? get value => controller.text.isEmpty ? null : controller.text;

bool get focused => focusNode.hasFocus;

void dispose() {
controller.dispose();
focusNode.dispose();
}
}

Expand All @@ -53,8 +50,6 @@ class FormGroupController {
bool validate() {
return formKey.currentState!.validate();
}

FormItem? get focusedItem => items.firstWhereOrNull((item) => item.focused);
}

class FormGroup extends StatefulWidget {
Expand All @@ -77,13 +72,13 @@ class _FormGroupState extends State<FormGroup> {
final item = widget.controller.items[index];
return TextFormField(
controller: item.controller,
focusNode: item.focusNode,
decoration: InputDecoration(
isDense: true,
labelText: item.labelText,
helperText: item.helperText,
hintText: item.hintText,
prefixIcon: Icon(item.prefixIcon),
suffixIcon: item.suffixIcon,
),
obscureText: item.obscureText,
validator: item.validator,
Expand Down
26 changes: 0 additions & 26 deletions lib/components/pop_to_top.dart

This file was deleted.

Loading

0 comments on commit 51d10cf

Please sign in to comment.