diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index e1ca574ef..7bb2df6ba 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -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 diff --git a/android/settings.gradle b/android/settings.gradle index 536165d35..b9e43bd37 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -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" diff --git a/lib/app/app_model.dart b/lib/app/app_model.dart index 9f8856b1b..58988c9a5 100644 --- a/lib/app/app_model.dart +++ b/lib/app/app_model.dart @@ -1,5 +1,6 @@ import 'package:flutter/widgets.dart'; import 'package:github/github.dart'; +import 'package:package_info_plus/package_info_plus.dart'; import 'package:safe_change_notifier/safe_change_notifier.dart'; import '../constants.dart'; @@ -8,7 +9,7 @@ import '../settings/settings_service.dart'; class AppModel extends SafeChangeNotifier { AppModel({ - required String appVersion, + required PackageInfo packageInfo, required SettingsService settingsService, required GitHub gitHub, required bool allowManualUpdates, @@ -19,7 +20,7 @@ class AppModel extends SafeChangeNotifier { _gitHub = gitHub, _allowManualUpdates = allowManualUpdates, _settingsService = settingsService, - _version = appVersion, + _packageInfo = packageInfo, _exposeService = exposeService; final ExposeService _exposeService; @@ -64,14 +65,14 @@ class AppModel extends SafeChangeNotifier { notifyListeners(); } - final String _version; - String? get version => _version; + final PackageInfo _packageInfo; + String get version => _packageInfo.version; Future disposePatchNotes() async => - _settingsService.disposePatchNotes(_version); + _settingsService.disposePatchNotes(version); bool recentPatchNotesDisposed() => - _settingsService.recentPatchNotesDisposed(_version); + _settingsService.recentPatchNotesDisposed(version); bool? _updateAvailable; bool? get updateAvailable => _updateAvailable; String? _onlineVersion; diff --git a/lib/app/view/master_detail_page.dart b/lib/app/view/master_detail_page.dart index 2eb912e69..2a44be3ed 100644 --- a/lib/app/view/master_detail_page.dart +++ b/lib/app/view/master_detail_page.dart @@ -5,6 +5,7 @@ import 'package:flutter/material.dart'; import 'package:watch_it/watch_it.dart'; import 'package:yaru/yaru.dart'; +import '../../app_config.dart'; import '../../common/data/audio.dart'; import '../../common/view/back_gesture.dart'; import '../../common/view/global_keys.dart'; @@ -91,7 +92,8 @@ class MasterDetailPage extends StatelessWidget with WatchItMixin { return PageRouteBuilder( settings: settings, - pageBuilder: (_, __, ___) => BackGesture(child: page), + pageBuilder: (_, __, ___) => + useCustomBackGestures ? page : BackGesture(child: page), transitionsBuilder: (_, a, __, c) => FadeTransition(opacity: a, child: c), ); diff --git a/lib/app_config.dart b/lib/app_config.dart index 685185b4c..02c3a98f7 100644 --- a/lib/app_config.dart +++ b/lib/app_config.dart @@ -15,3 +15,8 @@ bool get appleStyled => Platform.isMacOS || Platform.isIOS; // TODO(#1022): fix linux video fullscreen bool get allowVideoFullScreen => !Platform.isLinux; + +bool get isGtkApp => Platform.isLinux; + +bool get useCustomBackGestures => + Platform.isAndroid || Platform.isIOS || Platform.isFuchsia; diff --git a/lib/library/library_model.dart b/lib/library/library_model.dart index 3729ddd67..1e52b7b2f 100644 --- a/lib/library/library_model.dart +++ b/lib/library/library_model.dart @@ -3,6 +3,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:safe_change_notifier/safe_change_notifier.dart'; +import '../app_config.dart'; import '../common/data/audio.dart'; import '../common/logging.dart'; import '../common/view/back_gesture.dart'; @@ -203,7 +204,9 @@ class LibraryModel extends SafeChangeNotifier implements NavigatorObserver { await _masterNavigatorKey.currentState?.pushNamed(pageId); } else if (builder != null) { final materialPageRoute = MaterialPageRoute( - builder: (context) => BackGesture(child: builder(context)), + builder: (context) => useCustomBackGestures + ? builder(context) + : BackGesture(child: builder(context)), maintainState: maintainState, settings: RouteSettings( name: pageId, diff --git a/lib/main.dart b/lib/main.dart index b1e0f02ac..a92d5930a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,10 +1,6 @@ -import 'dart:io'; - import 'package:flutter/material.dart'; import 'package:gtk/gtk.dart'; import 'package:media_kit/media_kit.dart'; -import 'package:package_info_plus/package_info_plus.dart'; -import 'package:shared_preferences/shared_preferences.dart'; import 'package:system_theme/system_theme.dart'; import 'package:window_manager/window_manager.dart'; import 'package:yaru/yaru.dart'; @@ -24,24 +20,21 @@ Future main(List args) async { WindowManager.instance ..setMinimumSize(const Size(500, 700)) ..setSize(const Size(950, 820)); - if (!Platform.isLinux) { - SystemTheme.fallbackColor = kMusicPodFallBackColor; - await SystemTheme.accentColor.load(); - } + } + if (!yaruStyled) { + SystemTheme.fallbackColor = kMusicPodFallBackColor; + await SystemTheme.accentColor.load(); } MediaKit.ensureInitialized(); - await registerServicesAndViewModels( + await registerDependencies( args: args, - sharedPreferences: await SharedPreferences.getInstance(), - version: (await PackageInfo.fromPlatform()).version, - allowDiscordRPC: allowDiscordRPC, downloadsDefaultDir: await getDownloadsDefaultDir(), ); runApp( - Platform.isLinux + isGtkApp ? const GtkApplication(child: YaruMusicPodApp()) : const MaterialMusicPodApp(), ); diff --git a/lib/player/player_model.dart b/lib/player/player_model.dart index eb0894870..37561d2f5 100644 --- a/lib/player/player_model.dart +++ b/lib/player/player_model.dart @@ -150,7 +150,7 @@ class PlayerModel extends SafeChangeNotifier { .replaceAll(')', ''); } - void setTimer(Duration duration) => _playerService.setTimer(duration); + void setTimer(Duration duration) => _playerService.setPauseTimer(duration); @override Future dispose() async { diff --git a/lib/player/player_service.dart b/lib/player/player_service.dart index 2a39fb626..4540ae747 100644 --- a/lib/player/player_service.dart +++ b/lib/player/player_service.dart @@ -20,6 +20,7 @@ import '../extensions/string_x.dart'; import '../local_audio/local_cover_service.dart'; import '../persistence_utils.dart'; import '../radio/online_art_service.dart'; +import 'player_service_audio_handler.dart'; typedef Queue = ({String name, List