Skip to content

Commit

Permalink
chore: clean up and add documentation (#1026)
Browse files Browse the repository at this point in the history
* chore: clean up and add documentation
  • Loading branch information
Feichtmeier authored Nov 17, 2024
1 parent 5a6a38c commit 717b43f
Show file tree
Hide file tree
Showing 12 changed files with 284 additions and 263 deletions.
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"
13 changes: 7 additions & 6 deletions lib/app/app_model.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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,
Expand All @@ -19,7 +20,7 @@ class AppModel extends SafeChangeNotifier {
_gitHub = gitHub,
_allowManualUpdates = allowManualUpdates,
_settingsService = settingsService,
_version = appVersion,
_packageInfo = packageInfo,
_exposeService = exposeService;

final ExposeService _exposeService;
Expand Down Expand Up @@ -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<void> disposePatchNotes() async =>
_settingsService.disposePatchNotes(_version);
_settingsService.disposePatchNotes(version);

bool recentPatchNotesDisposed() =>
_settingsService.recentPatchNotesDisposed(_version);
_settingsService.recentPatchNotesDisposed(version);
bool? _updateAvailable;
bool? get updateAvailable => _updateAvailable;
String? _onlineVersion;
Expand Down
4 changes: 3 additions & 1 deletion lib/app/view/master_detail_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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),
);
Expand Down
5 changes: 5 additions & 0 deletions lib/app_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
5 changes: 4 additions & 1 deletion lib/library/library_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand Down
19 changes: 6 additions & 13 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -24,24 +20,21 @@ Future<void> main(List<String> 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(),
);
Expand Down
2 changes: 1 addition & 1 deletion lib/player/player_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> dispose() async {
Expand Down
Loading

0 comments on commit 717b43f

Please sign in to comment.