Skip to content
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
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK"/>
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
Expand Down
11 changes: 7 additions & 4 deletions lib/core/services/audio_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ class BusicAudioHandler extends BaseAudioHandler with SeekHandler {
Future<void> Function()? onSkipToPrevious;
Future<void> Function(Duration position)? onSeek;
Future<void> Function()? onStop;

BusicAudioHandler();

@override
Future<void> play() async {
await onPlay?.call();
Expand Down Expand Up @@ -83,7 +80,13 @@ class BusicAudioHandler extends BaseAudioHandler with SeekHandler {
PlaybackState(
controls: [
MediaControl.skipToPrevious,
playing ? MediaControl.pause : MediaControl.play,
MediaControl(
androidIcon: playing
? 'drawable/audio_service_pause'
: 'drawable/audio_service_play_arrow',
label: 'PlayPause',
action: MediaAction.playPause,
),
MediaControl.skipToNext,
],
systemActions: const {
Expand Down
9 changes: 8 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:audio_service/audio_service.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:media_kit/media_kit.dart';
import 'package:permission_handler/permission_handler.dart';

import 'app.dart';
import 'core/api/bili_dio.dart';
Expand Down Expand Up @@ -54,7 +55,13 @@ Future<void> main() async {
androidStopForegroundOnPause: true,
),
);

// Android: Get Permission
if (PlatformUtils.isAndroid) {
var notificationStatus = await Permission.notification.status;
if (!notificationStatus.isGranted) {
notificationStatus = await Permission.notification.request();
}
}
// Desktop-specific: initialize window manager and system tray
if (PlatformUtils.isDesktop) {
await WindowService.initialize();
Expand Down
1 change: 1 addition & 0 deletions linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ function(APPLY_STANDARD_SETTINGS TARGET)
target_compile_features(${TARGET} PUBLIC cxx_std_14)
target_compile_options(${TARGET} PRIVATE -Wall -Werror)
target_compile_options(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O3>")
target_compile_options(${TARGET} PRIVATE -Wno-error=deprecated-declarations)
target_compile_definitions(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:NDEBUG>")
endfunction()

Expand Down
62 changes: 55 additions & 7 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,13 @@ packages:
source: hosted
version: "3.1.8"
dbus:
dependency: transitive
dependency: "direct main"
description:
name: dbus
sha256: d0c98dcd4f5169878b6cf8f6e0a52403a9dff371a3e2f019697accbf6f44a270
sha256: "0ce9b0a839e6dee59a37a623d2fc26a35bbbe6404213e419b0d6411023d62645"
url: "https://pub.dev"
source: hosted
version: "0.7.12"
version: "0.7.14"
dio:
dependency: "direct main"
description:
Expand Down Expand Up @@ -853,14 +853,62 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.3.0"
permission_handler:
dependency: "direct main"
description:
name: permission_handler
sha256: fe54465bcc62a4564c6e4db337bbaded6c0c0fa6e10487414436d163114784f6
url: "https://pub.dev"
source: hosted
version: "12.0.3"
permission_handler_android:
dependency: transitive
description:
name: permission_handler_android
sha256: "1e3bc410ca1bf84662104b100eb126e066cb55791b7451307f9708d4007350e6"
url: "https://pub.dev"
source: hosted
version: "13.0.1"
permission_handler_apple:
dependency: transitive
description:
name: permission_handler_apple
sha256: "79dfa1df734798aa3cfdad166d3a3698c206d8813de13516ea1071b5d7e2f420"
url: "https://pub.dev"
source: hosted
version: "9.4.10"
permission_handler_html:
dependency: transitive
description:
name: permission_handler_html
sha256: "38f000e83355abb3392140f6bc3030660cfaef189e1f87824facb76300b4ff24"
url: "https://pub.dev"
source: hosted
version: "0.1.3+5"
permission_handler_platform_interface:
dependency: transitive
description:
name: permission_handler_platform_interface
sha256: eb99b295153abce5d683cac8c02e22faab63e50679b937fa1bf67d58bb282878
url: "https://pub.dev"
source: hosted
version: "4.3.0"
permission_handler_windows:
dependency: transitive
description:
name: permission_handler_windows
sha256: "1a790728016f79a41216d88672dbc5df30e686e811ad4e698bfc51f76ad91f1e"
url: "https://pub.dev"
source: hosted
version: "0.2.1"
petitparser:
dependency: transitive
description:
name: petitparser
sha256: "07c8f0b1913bcde1ff0d26e57ace2f3012ccbf2b204e070290dad3bb22797646"
sha256: "91bd59303e9f769f108f8df05e371341b15d59e995e6806aefab827b58336675"
url: "https://pub.dev"
source: hosted
version: "6.1.0"
version: "7.0.2"
platform:
dependency: transitive
description:
Expand Down Expand Up @@ -1478,10 +1526,10 @@ packages:
dependency: transitive
description:
name: xml
sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226
sha256: "971043b3a0d3da28727e40ed3e0b5d18b742fa5a68665cca88e74b7876d5e025"
url: "https://pub.dev"
source: hosted
version: "6.5.0"
version: "6.6.1"
yaml:
dependency: "direct main"
description:
Expand Down
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ publish_to: "none"
version: 0.4.3+18

environment:
sdk: '>=3.12.2 <4.0.0'
flutter: '>=3.44.6'
sdk: ">=3.12.2 <4.0.0"
flutter: ">=3.44.6"

dependencies:
flutter:
Expand Down Expand Up @@ -68,7 +68,7 @@ dependencies:
file_picker: ^10.3.10
audio_service: ^0.18.18
tray_manager: ^0.5.2

permission_handler: ^12.0.3
# App Update
yaml: ^3.1.2
archive: ^4.0.2
Expand Down
Loading