Files
Musify/lib/services/settings_manager.dart
2026-01-02 00:17:56 +04:00

107 lines
3.3 KiB
Dart

/*
* Copyright (C) 2026 Valeri Gokadze
*
* Musify is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Musify is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*
* For more information about Musify, including how to contribute,
* please visit: https://github.com/gokadzev/Musify
*/
import 'package:audio_service/audio_service.dart';
import 'package:flutter/material.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'package:musify/screens/playlist_page.dart';
import 'package:musify/screens/user_songs_page.dart';
import 'package:musify/utilities/utils.dart';
// Preferences
final shouldWeCheckUpdates = ValueNotifier<bool?>(
Hive.box('settings').get('shouldWeCheckUpdates', defaultValue: null),
);
final playNextSongAutomatically = ValueNotifier<bool>(
Hive.box('settings').get('playNextSongAutomatically', defaultValue: false),
);
final useSystemColor = ValueNotifier<bool>(
Hive.box('settings').get('useSystemColor', defaultValue: true),
);
final usePureBlackColor = ValueNotifier<bool>(
Hive.box('settings').get('usePureBlackColor', defaultValue: false),
);
final offlineMode = ValueNotifier<bool>(
Hive.box('settings').get('offlineMode', defaultValue: false),
);
final predictiveBack = ValueNotifier<bool>(
Hive.box('settings').get('predictiveBack', defaultValue: false),
);
final sponsorBlockSupport = ValueNotifier<bool>(
Hive.box('settings').get('sponsorBlockSupport', defaultValue: false),
);
final externalRecommendations = ValueNotifier<bool>(
Hive.box('settings').get('externalRecommendations', defaultValue: false),
);
final useProxy = ValueNotifier<bool>(
Hive.box('settings').get('useProxy', defaultValue: false),
);
final audioQualitySetting = ValueNotifier<String>(
Hive.box('settings').get('audioQuality', defaultValue: 'high'),
);
Locale languageSetting = getLocaleFromLanguageCode(
Hive.box('settings').get('language', defaultValue: 'English') as String,
);
final themeModeSetting =
Hive.box('settings').get('themeIndex', defaultValue: 0) as int;
String playlistSortSetting = Hive.box(
'settings',
).get('playlistSortType', defaultValue: PlaylistSortType.default_.name);
String offlineSortSetting = Hive.box(
'settings',
).get('offlineSortType', defaultValue: OfflineSortType.default_.name);
Color primaryColorSetting = Color(
Hive.box('settings').get('accentColor', defaultValue: 0xff91cef4),
);
final shuffleNotifier = ValueNotifier<bool>(
Hive.box('settings').get('shuffleEnabled', defaultValue: false),
);
final repeatNotifier = ValueNotifier<AudioServiceRepeatMode>(
AudioServiceRepeatMode.values[Hive.box(
'settings',
).get('repeatMode', defaultValue: 0)],
);
// Non-storage notifiers
var sleepTimerNotifier = ValueNotifier<Duration?>(null);
// Server-Notifiers
final announcementURL = ValueNotifier<String?>(null);