Player wakelock

This commit is contained in:
LittleSheep 2024-09-02 20:25:19 +08:00
parent da2a3508d1
commit a5f39321eb
10 changed files with 110 additions and 130 deletions

View File

@ -9,7 +9,6 @@ import 'package:rhythm_box/services/color.dart';
import 'package:rhythm_box/services/database/database.dart';
import 'package:rhythm_box/services/sourced_track/enums.dart';
import 'package:spotify/spotify.dart';
import 'package:window_manager/window_manager.dart';
import 'package:flutter/material.dart';
import 'package:path/path.dart';
import 'package:path_provider/path_provider.dart';
@ -49,14 +48,6 @@ class UserPreferencesProvider extends GetxController {
.listen((event) async {
state.value = event;
if (PlatformInfo.isDesktop) {
await windowManager.setTitleBarStyle(
state.value.systemTitleBar
? TitleBarStyle.normal
: TitleBarStyle.hidden,
);
}
await audioPlayer.setAudioNormalization(state.value.normalizeAudio);
});
}
@ -171,10 +162,6 @@ class UserPreferencesProvider extends GetxController {
setData(PreferencesTableCompanion(discordPresence: Value(discordPresence)));
}
void setAmoledDarkTheme(bool isAmoled) {
setData(PreferencesTableCompanion(amoledDarkTheme: Value(isAmoled)));
}
void setNormalizeAudio(bool normalize) {
setData(PreferencesTableCompanion(normalizeAudio: Value(normalize)));
audioPlayer.setAudioNormalization(normalize);
@ -184,7 +171,7 @@ class UserPreferencesProvider extends GetxController {
setData(PreferencesTableCompanion(endlessPlayback: Value(endless)));
}
void setEnableConnect(bool enable) {
setData(PreferencesTableCompanion(enableConnect: Value(enable)));
void setPlayerWakelock(bool wakelock) {
setData(PreferencesTableCompanion(playerWakelock: Value(wakelock)));
}
}

View File

@ -10,6 +10,7 @@ import 'package:google_fonts/google_fonts.dart';
import 'package:media_kit/media_kit.dart';
import 'package:rhythm_box/providers/audio_player.dart';
import 'package:rhythm_box/providers/auth.dart';
import 'package:rhythm_box/providers/user_preferences.dart';
import 'package:rhythm_box/screens/player/queue.dart';
import 'package:rhythm_box/screens/player/siblings.dart';
import 'package:rhythm_box/services/artist.dart';
@ -20,6 +21,7 @@ import 'package:rhythm_box/services/audio_services/image.dart';
import 'package:rhythm_box/widgets/lyrics/synced_lyrics.dart';
import 'package:rhythm_box/widgets/tracks/heart_button.dart';
import 'package:rhythm_box/widgets/tracks/querying_track_info.dart';
import 'package:wakelock_plus/wakelock_plus.dart';
class PlayerScreen extends StatefulWidget {
const PlayerScreen({super.key});
@ -33,6 +35,8 @@ class _PlayerScreenState extends State<PlayerScreen> {
late final QueryingTrackInfoProvider _query = Get.find();
late final AuthenticationProvider _auth = Get.find();
late final UserPreferencesProvider _preferences = Get.find();
String? get _albumArt =>
(_playback.state.value.activeTrack?.album?.images).asUrlString(
index:
@ -56,6 +60,20 @@ class _PlayerScreenState extends State<PlayerScreen> {
static const double maxAlbumSize = 360;
@override
void activate() {
super.activate();
if (_preferences.state.value.playerWakelock) {
WakelockPlus.enable();
}
}
@override
void deactivate() {
super.deactivate();
WakelockPlus.disable();
}
@override
Widget build(BuildContext context) {
final size = MediaQuery.of(context).size;

View File

@ -123,6 +123,17 @@ class _SettingsScreenState extends State<SettingsScreen> {
onChanged: _preferences.setNormalizeAudio,
),
),
Obx(
() => SwitchListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 24),
secondary: const Icon(Icons.screen_lock_portrait),
title: const Text('Player Wakelock'),
subtitle: const Text(
'Keep your screen doesn\'t lock in player screen'),
value: _preferences.state.value.playerWakelock,
onChanged: _preferences.setPlayerWakelock,
),
),
const Divider(thickness: 0.3, height: 1),
ListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 24),

View File

@ -317,16 +317,6 @@ class $PreferencesTableTable extends PreferencesTable
defaultConstraints: GeneratedColumn.constraintIsAlways(
'CHECK ("album_color_sync" IN (0, 1))'),
defaultValue: const Constant(true));
static const VerificationMeta _amoledDarkThemeMeta =
const VerificationMeta('amoledDarkTheme');
@override
late final GeneratedColumn<bool> amoledDarkTheme = GeneratedColumn<bool>(
'amoled_dark_theme', aliasedName, false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'CHECK ("amoled_dark_theme" IN (0, 1))'),
defaultValue: const Constant(false));
static const VerificationMeta _checkUpdateMeta =
const VerificationMeta('checkUpdate');
@override
@ -524,22 +514,21 @@ class $PreferencesTableTable extends PreferencesTable
defaultConstraints: GeneratedColumn.constraintIsAlways(
'CHECK ("endless_playback" IN (0, 1))'),
defaultValue: const Constant(true));
static const VerificationMeta _enableConnectMeta =
const VerificationMeta('enableConnect');
static const VerificationMeta _playerWakelockMeta =
const VerificationMeta('playerWakelock');
@override
late final GeneratedColumn<bool> enableConnect = GeneratedColumn<bool>(
'enable_connect', aliasedName, false,
late final GeneratedColumn<bool> playerWakelock = GeneratedColumn<bool>(
'player_wakelock', aliasedName, false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'CHECK ("enable_connect" IN (0, 1))'),
defaultValue: const Constant(false));
'CHECK ("player_wakelock" IN (0, 1))'),
defaultValue: const Constant(true));
@override
List<GeneratedColumn> get $columns => [
id,
audioQuality,
albumColorSync,
amoledDarkTheme,
checkUpdate,
normalizeAudio,
showSystemTrayIcon,
@ -560,7 +549,7 @@ class $PreferencesTableTable extends PreferencesTable
downloadMusicCodec,
discordPresence,
endlessPlayback,
enableConnect
playerWakelock
];
@override
String get aliasedName => _alias ?? actualTableName;
@ -583,12 +572,6 @@ class $PreferencesTableTable extends PreferencesTable
albumColorSync.isAcceptableOrUnknown(
data['album_color_sync']!, _albumColorSyncMeta));
}
if (data.containsKey('amoled_dark_theme')) {
context.handle(
_amoledDarkThemeMeta,
amoledDarkTheme.isAcceptableOrUnknown(
data['amoled_dark_theme']!, _amoledDarkThemeMeta));
}
if (data.containsKey('check_update')) {
context.handle(
_checkUpdateMeta,
@ -655,11 +638,11 @@ class $PreferencesTableTable extends PreferencesTable
endlessPlayback.isAcceptableOrUnknown(
data['endless_playback']!, _endlessPlaybackMeta));
}
if (data.containsKey('enable_connect')) {
if (data.containsKey('player_wakelock')) {
context.handle(
_enableConnectMeta,
enableConnect.isAcceptableOrUnknown(
data['enable_connect']!, _enableConnectMeta));
_playerWakelockMeta,
playerWakelock.isAcceptableOrUnknown(
data['player_wakelock']!, _playerWakelockMeta));
}
return context;
}
@ -677,8 +660,6 @@ class $PreferencesTableTable extends PreferencesTable
DriftSqlType.string, data['${effectivePrefix}audio_quality'])!),
albumColorSync: attachedDatabase.typeMapping
.read(DriftSqlType.bool, data['${effectivePrefix}album_color_sync'])!,
amoledDarkTheme: attachedDatabase.typeMapping.read(
DriftSqlType.bool, data['${effectivePrefix}amoled_dark_theme'])!,
checkUpdate: attachedDatabase.typeMapping
.read(DriftSqlType.bool, data['${effectivePrefix}check_update'])!,
normalizeAudio: attachedDatabase.typeMapping
@ -731,8 +712,8 @@ class $PreferencesTableTable extends PreferencesTable
.read(DriftSqlType.bool, data['${effectivePrefix}discord_presence'])!,
endlessPlayback: attachedDatabase.typeMapping
.read(DriftSqlType.bool, data['${effectivePrefix}endless_playback'])!,
enableConnect: attachedDatabase.typeMapping
.read(DriftSqlType.bool, data['${effectivePrefix}enable_connect'])!,
playerWakelock: attachedDatabase.typeMapping
.read(DriftSqlType.bool, data['${effectivePrefix}player_wakelock'])!,
);
}
@ -776,7 +757,6 @@ class PreferencesTableData extends DataClass
final int id;
final SourceQualities audioQuality;
final bool albumColorSync;
final bool amoledDarkTheme;
final bool checkUpdate;
final bool normalizeAudio;
final bool showSystemTrayIcon;
@ -797,12 +777,11 @@ class PreferencesTableData extends DataClass
final SourceCodecs downloadMusicCodec;
final bool discordPresence;
final bool endlessPlayback;
final bool enableConnect;
final bool playerWakelock;
const PreferencesTableData(
{required this.id,
required this.audioQuality,
required this.albumColorSync,
required this.amoledDarkTheme,
required this.checkUpdate,
required this.normalizeAudio,
required this.showSystemTrayIcon,
@ -823,7 +802,7 @@ class PreferencesTableData extends DataClass
required this.downloadMusicCodec,
required this.discordPresence,
required this.endlessPlayback,
required this.enableConnect});
required this.playerWakelock});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
@ -833,7 +812,6 @@ class PreferencesTableData extends DataClass
$PreferencesTableTable.$converteraudioQuality.toSql(audioQuality));
}
map['album_color_sync'] = Variable<bool>(albumColorSync);
map['amoled_dark_theme'] = Variable<bool>(amoledDarkTheme);
map['check_update'] = Variable<bool>(checkUpdate);
map['normalize_audio'] = Variable<bool>(normalizeAudio);
map['show_system_tray_icon'] = Variable<bool>(showSystemTrayIcon);
@ -891,7 +869,7 @@ class PreferencesTableData extends DataClass
}
map['discord_presence'] = Variable<bool>(discordPresence);
map['endless_playback'] = Variable<bool>(endlessPlayback);
map['enable_connect'] = Variable<bool>(enableConnect);
map['player_wakelock'] = Variable<bool>(playerWakelock);
return map;
}
@ -900,7 +878,6 @@ class PreferencesTableData extends DataClass
id: Value(id),
audioQuality: Value(audioQuality),
albumColorSync: Value(albumColorSync),
amoledDarkTheme: Value(amoledDarkTheme),
checkUpdate: Value(checkUpdate),
normalizeAudio: Value(normalizeAudio),
showSystemTrayIcon: Value(showSystemTrayIcon),
@ -921,7 +898,7 @@ class PreferencesTableData extends DataClass
downloadMusicCodec: Value(downloadMusicCodec),
discordPresence: Value(discordPresence),
endlessPlayback: Value(endlessPlayback),
enableConnect: Value(enableConnect),
playerWakelock: Value(playerWakelock),
);
}
@ -933,7 +910,6 @@ class PreferencesTableData extends DataClass
audioQuality: $PreferencesTableTable.$converteraudioQuality
.fromJson(serializer.fromJson<String>(json['audioQuality'])),
albumColorSync: serializer.fromJson<bool>(json['albumColorSync']),
amoledDarkTheme: serializer.fromJson<bool>(json['amoledDarkTheme']),
checkUpdate: serializer.fromJson<bool>(json['checkUpdate']),
normalizeAudio: serializer.fromJson<bool>(json['normalizeAudio']),
showSystemTrayIcon: serializer.fromJson<bool>(json['showSystemTrayIcon']),
@ -964,7 +940,7 @@ class PreferencesTableData extends DataClass
.fromJson(serializer.fromJson<String>(json['downloadMusicCodec'])),
discordPresence: serializer.fromJson<bool>(json['discordPresence']),
endlessPlayback: serializer.fromJson<bool>(json['endlessPlayback']),
enableConnect: serializer.fromJson<bool>(json['enableConnect']),
playerWakelock: serializer.fromJson<bool>(json['playerWakelock']),
);
}
@override
@ -975,7 +951,6 @@ class PreferencesTableData extends DataClass
'audioQuality': serializer.toJson<String>(
$PreferencesTableTable.$converteraudioQuality.toJson(audioQuality)),
'albumColorSync': serializer.toJson<bool>(albumColorSync),
'amoledDarkTheme': serializer.toJson<bool>(amoledDarkTheme),
'checkUpdate': serializer.toJson<bool>(checkUpdate),
'normalizeAudio': serializer.toJson<bool>(normalizeAudio),
'showSystemTrayIcon': serializer.toJson<bool>(showSystemTrayIcon),
@ -1007,7 +982,7 @@ class PreferencesTableData extends DataClass
.toJson(downloadMusicCodec)),
'discordPresence': serializer.toJson<bool>(discordPresence),
'endlessPlayback': serializer.toJson<bool>(endlessPlayback),
'enableConnect': serializer.toJson<bool>(enableConnect),
'playerWakelock': serializer.toJson<bool>(playerWakelock),
};
}
@ -1015,7 +990,6 @@ class PreferencesTableData extends DataClass
{int? id,
SourceQualities? audioQuality,
bool? albumColorSync,
bool? amoledDarkTheme,
bool? checkUpdate,
bool? normalizeAudio,
bool? showSystemTrayIcon,
@ -1036,12 +1010,11 @@ class PreferencesTableData extends DataClass
SourceCodecs? downloadMusicCodec,
bool? discordPresence,
bool? endlessPlayback,
bool? enableConnect}) =>
bool? playerWakelock}) =>
PreferencesTableData(
id: id ?? this.id,
audioQuality: audioQuality ?? this.audioQuality,
albumColorSync: albumColorSync ?? this.albumColorSync,
amoledDarkTheme: amoledDarkTheme ?? this.amoledDarkTheme,
checkUpdate: checkUpdate ?? this.checkUpdate,
normalizeAudio: normalizeAudio ?? this.normalizeAudio,
showSystemTrayIcon: showSystemTrayIcon ?? this.showSystemTrayIcon,
@ -1062,7 +1035,7 @@ class PreferencesTableData extends DataClass
downloadMusicCodec: downloadMusicCodec ?? this.downloadMusicCodec,
discordPresence: discordPresence ?? this.discordPresence,
endlessPlayback: endlessPlayback ?? this.endlessPlayback,
enableConnect: enableConnect ?? this.enableConnect,
playerWakelock: playerWakelock ?? this.playerWakelock,
);
PreferencesTableData copyWithCompanion(PreferencesTableCompanion data) {
return PreferencesTableData(
@ -1073,9 +1046,6 @@ class PreferencesTableData extends DataClass
albumColorSync: data.albumColorSync.present
? data.albumColorSync.value
: this.albumColorSync,
amoledDarkTheme: data.amoledDarkTheme.present
? data.amoledDarkTheme.value
: this.amoledDarkTheme,
checkUpdate:
data.checkUpdate.present ? data.checkUpdate.value : this.checkUpdate,
normalizeAudio: data.normalizeAudio.present
@ -1126,9 +1096,9 @@ class PreferencesTableData extends DataClass
endlessPlayback: data.endlessPlayback.present
? data.endlessPlayback.value
: this.endlessPlayback,
enableConnect: data.enableConnect.present
? data.enableConnect.value
: this.enableConnect,
playerWakelock: data.playerWakelock.present
? data.playerWakelock.value
: this.playerWakelock,
);
}
@ -1138,7 +1108,6 @@ class PreferencesTableData extends DataClass
..write('id: $id, ')
..write('audioQuality: $audioQuality, ')
..write('albumColorSync: $albumColorSync, ')
..write('amoledDarkTheme: $amoledDarkTheme, ')
..write('checkUpdate: $checkUpdate, ')
..write('normalizeAudio: $normalizeAudio, ')
..write('showSystemTrayIcon: $showSystemTrayIcon, ')
@ -1159,7 +1128,7 @@ class PreferencesTableData extends DataClass
..write('downloadMusicCodec: $downloadMusicCodec, ')
..write('discordPresence: $discordPresence, ')
..write('endlessPlayback: $endlessPlayback, ')
..write('enableConnect: $enableConnect')
..write('playerWakelock: $playerWakelock')
..write(')'))
.toString();
}
@ -1169,7 +1138,6 @@ class PreferencesTableData extends DataClass
id,
audioQuality,
albumColorSync,
amoledDarkTheme,
checkUpdate,
normalizeAudio,
showSystemTrayIcon,
@ -1190,7 +1158,7 @@ class PreferencesTableData extends DataClass
downloadMusicCodec,
discordPresence,
endlessPlayback,
enableConnect
playerWakelock
]);
@override
bool operator ==(Object other) =>
@ -1199,7 +1167,6 @@ class PreferencesTableData extends DataClass
other.id == this.id &&
other.audioQuality == this.audioQuality &&
other.albumColorSync == this.albumColorSync &&
other.amoledDarkTheme == this.amoledDarkTheme &&
other.checkUpdate == this.checkUpdate &&
other.normalizeAudio == this.normalizeAudio &&
other.showSystemTrayIcon == this.showSystemTrayIcon &&
@ -1220,14 +1187,13 @@ class PreferencesTableData extends DataClass
other.downloadMusicCodec == this.downloadMusicCodec &&
other.discordPresence == this.discordPresence &&
other.endlessPlayback == this.endlessPlayback &&
other.enableConnect == this.enableConnect);
other.playerWakelock == this.playerWakelock);
}
class PreferencesTableCompanion extends UpdateCompanion<PreferencesTableData> {
final Value<int> id;
final Value<SourceQualities> audioQuality;
final Value<bool> albumColorSync;
final Value<bool> amoledDarkTheme;
final Value<bool> checkUpdate;
final Value<bool> normalizeAudio;
final Value<bool> showSystemTrayIcon;
@ -1248,12 +1214,11 @@ class PreferencesTableCompanion extends UpdateCompanion<PreferencesTableData> {
final Value<SourceCodecs> downloadMusicCodec;
final Value<bool> discordPresence;
final Value<bool> endlessPlayback;
final Value<bool> enableConnect;
final Value<bool> playerWakelock;
const PreferencesTableCompanion({
this.id = const Value.absent(),
this.audioQuality = const Value.absent(),
this.albumColorSync = const Value.absent(),
this.amoledDarkTheme = const Value.absent(),
this.checkUpdate = const Value.absent(),
this.normalizeAudio = const Value.absent(),
this.showSystemTrayIcon = const Value.absent(),
@ -1274,13 +1239,12 @@ class PreferencesTableCompanion extends UpdateCompanion<PreferencesTableData> {
this.downloadMusicCodec = const Value.absent(),
this.discordPresence = const Value.absent(),
this.endlessPlayback = const Value.absent(),
this.enableConnect = const Value.absent(),
this.playerWakelock = const Value.absent(),
});
PreferencesTableCompanion.insert({
this.id = const Value.absent(),
this.audioQuality = const Value.absent(),
this.albumColorSync = const Value.absent(),
this.amoledDarkTheme = const Value.absent(),
this.checkUpdate = const Value.absent(),
this.normalizeAudio = const Value.absent(),
this.showSystemTrayIcon = const Value.absent(),
@ -1301,13 +1265,12 @@ class PreferencesTableCompanion extends UpdateCompanion<PreferencesTableData> {
this.downloadMusicCodec = const Value.absent(),
this.discordPresence = const Value.absent(),
this.endlessPlayback = const Value.absent(),
this.enableConnect = const Value.absent(),
this.playerWakelock = const Value.absent(),
});
static Insertable<PreferencesTableData> custom({
Expression<int>? id,
Expression<String>? audioQuality,
Expression<bool>? albumColorSync,
Expression<bool>? amoledDarkTheme,
Expression<bool>? checkUpdate,
Expression<bool>? normalizeAudio,
Expression<bool>? showSystemTrayIcon,
@ -1328,13 +1291,12 @@ class PreferencesTableCompanion extends UpdateCompanion<PreferencesTableData> {
Expression<String>? downloadMusicCodec,
Expression<bool>? discordPresence,
Expression<bool>? endlessPlayback,
Expression<bool>? enableConnect,
Expression<bool>? playerWakelock,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (audioQuality != null) 'audio_quality': audioQuality,
if (albumColorSync != null) 'album_color_sync': albumColorSync,
if (amoledDarkTheme != null) 'amoled_dark_theme': amoledDarkTheme,
if (checkUpdate != null) 'check_update': checkUpdate,
if (normalizeAudio != null) 'normalize_audio': normalizeAudio,
if (showSystemTrayIcon != null)
@ -1358,7 +1320,7 @@ class PreferencesTableCompanion extends UpdateCompanion<PreferencesTableData> {
'download_music_codec': downloadMusicCodec,
if (discordPresence != null) 'discord_presence': discordPresence,
if (endlessPlayback != null) 'endless_playback': endlessPlayback,
if (enableConnect != null) 'enable_connect': enableConnect,
if (playerWakelock != null) 'player_wakelock': playerWakelock,
});
}
@ -1366,7 +1328,6 @@ class PreferencesTableCompanion extends UpdateCompanion<PreferencesTableData> {
{Value<int>? id,
Value<SourceQualities>? audioQuality,
Value<bool>? albumColorSync,
Value<bool>? amoledDarkTheme,
Value<bool>? checkUpdate,
Value<bool>? normalizeAudio,
Value<bool>? showSystemTrayIcon,
@ -1387,12 +1348,11 @@ class PreferencesTableCompanion extends UpdateCompanion<PreferencesTableData> {
Value<SourceCodecs>? downloadMusicCodec,
Value<bool>? discordPresence,
Value<bool>? endlessPlayback,
Value<bool>? enableConnect}) {
Value<bool>? playerWakelock}) {
return PreferencesTableCompanion(
id: id ?? this.id,
audioQuality: audioQuality ?? this.audioQuality,
albumColorSync: albumColorSync ?? this.albumColorSync,
amoledDarkTheme: amoledDarkTheme ?? this.amoledDarkTheme,
checkUpdate: checkUpdate ?? this.checkUpdate,
normalizeAudio: normalizeAudio ?? this.normalizeAudio,
showSystemTrayIcon: showSystemTrayIcon ?? this.showSystemTrayIcon,
@ -1413,7 +1373,7 @@ class PreferencesTableCompanion extends UpdateCompanion<PreferencesTableData> {
downloadMusicCodec: downloadMusicCodec ?? this.downloadMusicCodec,
discordPresence: discordPresence ?? this.discordPresence,
endlessPlayback: endlessPlayback ?? this.endlessPlayback,
enableConnect: enableConnect ?? this.enableConnect,
playerWakelock: playerWakelock ?? this.playerWakelock,
);
}
@ -1431,9 +1391,6 @@ class PreferencesTableCompanion extends UpdateCompanion<PreferencesTableData> {
if (albumColorSync.present) {
map['album_color_sync'] = Variable<bool>(albumColorSync.value);
}
if (amoledDarkTheme.present) {
map['amoled_dark_theme'] = Variable<bool>(amoledDarkTheme.value);
}
if (checkUpdate.present) {
map['check_update'] = Variable<bool>(checkUpdate.value);
}
@ -1511,8 +1468,8 @@ class PreferencesTableCompanion extends UpdateCompanion<PreferencesTableData> {
if (endlessPlayback.present) {
map['endless_playback'] = Variable<bool>(endlessPlayback.value);
}
if (enableConnect.present) {
map['enable_connect'] = Variable<bool>(enableConnect.value);
if (playerWakelock.present) {
map['player_wakelock'] = Variable<bool>(playerWakelock.value);
}
return map;
}
@ -1523,7 +1480,6 @@ class PreferencesTableCompanion extends UpdateCompanion<PreferencesTableData> {
..write('id: $id, ')
..write('audioQuality: $audioQuality, ')
..write('albumColorSync: $albumColorSync, ')
..write('amoledDarkTheme: $amoledDarkTheme, ')
..write('checkUpdate: $checkUpdate, ')
..write('normalizeAudio: $normalizeAudio, ')
..write('showSystemTrayIcon: $showSystemTrayIcon, ')
@ -1544,7 +1500,7 @@ class PreferencesTableCompanion extends UpdateCompanion<PreferencesTableData> {
..write('downloadMusicCodec: $downloadMusicCodec, ')
..write('discordPresence: $discordPresence, ')
..write('endlessPlayback: $endlessPlayback, ')
..write('enableConnect: $enableConnect')
..write('playerWakelock: $playerWakelock')
..write(')'))
.toString();
}
@ -3980,7 +3936,6 @@ typedef $$PreferencesTableTableCreateCompanionBuilder
Value<int> id,
Value<SourceQualities> audioQuality,
Value<bool> albumColorSync,
Value<bool> amoledDarkTheme,
Value<bool> checkUpdate,
Value<bool> normalizeAudio,
Value<bool> showSystemTrayIcon,
@ -4001,14 +3956,13 @@ typedef $$PreferencesTableTableCreateCompanionBuilder
Value<SourceCodecs> downloadMusicCodec,
Value<bool> discordPresence,
Value<bool> endlessPlayback,
Value<bool> enableConnect,
Value<bool> playerWakelock,
});
typedef $$PreferencesTableTableUpdateCompanionBuilder
= PreferencesTableCompanion Function({
Value<int> id,
Value<SourceQualities> audioQuality,
Value<bool> albumColorSync,
Value<bool> amoledDarkTheme,
Value<bool> checkUpdate,
Value<bool> normalizeAudio,
Value<bool> showSystemTrayIcon,
@ -4029,7 +3983,7 @@ typedef $$PreferencesTableTableUpdateCompanionBuilder
Value<SourceCodecs> downloadMusicCodec,
Value<bool> discordPresence,
Value<bool> endlessPlayback,
Value<bool> enableConnect,
Value<bool> playerWakelock,
});
class $$PreferencesTableTableTableManager extends RootTableManager<
@ -4053,7 +4007,6 @@ class $$PreferencesTableTableTableManager extends RootTableManager<
Value<int> id = const Value.absent(),
Value<SourceQualities> audioQuality = const Value.absent(),
Value<bool> albumColorSync = const Value.absent(),
Value<bool> amoledDarkTheme = const Value.absent(),
Value<bool> checkUpdate = const Value.absent(),
Value<bool> normalizeAudio = const Value.absent(),
Value<bool> showSystemTrayIcon = const Value.absent(),
@ -4074,13 +4027,12 @@ class $$PreferencesTableTableTableManager extends RootTableManager<
Value<SourceCodecs> downloadMusicCodec = const Value.absent(),
Value<bool> discordPresence = const Value.absent(),
Value<bool> endlessPlayback = const Value.absent(),
Value<bool> enableConnect = const Value.absent(),
Value<bool> playerWakelock = const Value.absent(),
}) =>
PreferencesTableCompanion(
id: id,
audioQuality: audioQuality,
albumColorSync: albumColorSync,
amoledDarkTheme: amoledDarkTheme,
checkUpdate: checkUpdate,
normalizeAudio: normalizeAudio,
showSystemTrayIcon: showSystemTrayIcon,
@ -4101,13 +4053,12 @@ class $$PreferencesTableTableTableManager extends RootTableManager<
downloadMusicCodec: downloadMusicCodec,
discordPresence: discordPresence,
endlessPlayback: endlessPlayback,
enableConnect: enableConnect,
playerWakelock: playerWakelock,
),
createCompanionCallback: ({
Value<int> id = const Value.absent(),
Value<SourceQualities> audioQuality = const Value.absent(),
Value<bool> albumColorSync = const Value.absent(),
Value<bool> amoledDarkTheme = const Value.absent(),
Value<bool> checkUpdate = const Value.absent(),
Value<bool> normalizeAudio = const Value.absent(),
Value<bool> showSystemTrayIcon = const Value.absent(),
@ -4128,13 +4079,12 @@ class $$PreferencesTableTableTableManager extends RootTableManager<
Value<SourceCodecs> downloadMusicCodec = const Value.absent(),
Value<bool> discordPresence = const Value.absent(),
Value<bool> endlessPlayback = const Value.absent(),
Value<bool> enableConnect = const Value.absent(),
Value<bool> playerWakelock = const Value.absent(),
}) =>
PreferencesTableCompanion.insert(
id: id,
audioQuality: audioQuality,
albumColorSync: albumColorSync,
amoledDarkTheme: amoledDarkTheme,
checkUpdate: checkUpdate,
normalizeAudio: normalizeAudio,
showSystemTrayIcon: showSystemTrayIcon,
@ -4155,7 +4105,7 @@ class $$PreferencesTableTableTableManager extends RootTableManager<
downloadMusicCodec: downloadMusicCodec,
discordPresence: discordPresence,
endlessPlayback: endlessPlayback,
enableConnect: enableConnect,
playerWakelock: playerWakelock,
),
));
}
@ -4180,11 +4130,6 @@ class $$PreferencesTableTableFilterComposer
builder: (column, joinBuilders) =>
ColumnFilters(column, joinBuilders: joinBuilders));
ColumnFilters<bool> get amoledDarkTheme => $state.composableBuilder(
column: $state.table.amoledDarkTheme,
builder: (column, joinBuilders) =>
ColumnFilters(column, joinBuilders: joinBuilders));
ColumnFilters<bool> get checkUpdate => $state.composableBuilder(
column: $state.table.checkUpdate,
builder: (column, joinBuilders) =>
@ -4307,8 +4252,8 @@ class $$PreferencesTableTableFilterComposer
builder: (column, joinBuilders) =>
ColumnFilters(column, joinBuilders: joinBuilders));
ColumnFilters<bool> get enableConnect => $state.composableBuilder(
column: $state.table.enableConnect,
ColumnFilters<bool> get playerWakelock => $state.composableBuilder(
column: $state.table.playerWakelock,
builder: (column, joinBuilders) =>
ColumnFilters(column, joinBuilders: joinBuilders));
}
@ -4331,11 +4276,6 @@ class $$PreferencesTableTableOrderingComposer
builder: (column, joinBuilders) =>
ColumnOrderings(column, joinBuilders: joinBuilders));
ColumnOrderings<bool> get amoledDarkTheme => $state.composableBuilder(
column: $state.table.amoledDarkTheme,
builder: (column, joinBuilders) =>
ColumnOrderings(column, joinBuilders: joinBuilders));
ColumnOrderings<bool> get checkUpdate => $state.composableBuilder(
column: $state.table.checkUpdate,
builder: (column, joinBuilders) =>
@ -4436,8 +4376,8 @@ class $$PreferencesTableTableOrderingComposer
builder: (column, joinBuilders) =>
ColumnOrderings(column, joinBuilders: joinBuilders));
ColumnOrderings<bool> get enableConnect => $state.composableBuilder(
column: $state.table.enableConnect,
ColumnOrderings<bool> get playerWakelock => $state.composableBuilder(
column: $state.table.playerWakelock,
builder: (column, joinBuilders) =>
ColumnOrderings(column, joinBuilders: joinBuilders));
}

View File

@ -45,8 +45,6 @@ class PreferencesTable extends Table {
.withDefault(Constant(SourceQualities.high.name))();
BoolColumn get albumColorSync =>
boolean().withDefault(const Constant(true))();
BoolColumn get amoledDarkTheme =>
boolean().withDefault(const Constant(false))();
BoolColumn get checkUpdate => boolean().withDefault(const Constant(true))();
BoolColumn get normalizeAudio =>
boolean().withDefault(const Constant(false))();
@ -88,8 +86,8 @@ class PreferencesTable extends Table {
boolean().withDefault(const Constant(true))();
BoolColumn get endlessPlayback =>
boolean().withDefault(const Constant(true))();
BoolColumn get enableConnect =>
boolean().withDefault(const Constant(false))();
BoolColumn get playerWakelock =>
boolean().withDefault(const Constant(true))();
// Default values as PreferencesTableData
static PreferencesTableData defaults() {
@ -97,7 +95,6 @@ class PreferencesTable extends Table {
id: 0,
audioQuality: SourceQualities.high,
albumColorSync: true,
amoledDarkTheme: false,
checkUpdate: true,
normalizeAudio: false,
showSystemTrayIcon: false,
@ -118,7 +115,7 @@ class PreferencesTable extends Table {
downloadMusicCodec: SourceCodecs.m4a,
discordPresence: true,
endlessPlayback: true,
enableConnect: false,
playerWakelock: true,
);
}
}

View File

@ -19,6 +19,7 @@ import shared_preferences_foundation
import sqflite
import sqlite3_flutter_libs
import url_launcher_macos
import wakelock_plus
import window_manager
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
@ -36,5 +37,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
Sqlite3FlutterLibsPlugin.register(with: registry.registrar(forPlugin: "Sqlite3FlutterLibsPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
WakelockPlusMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockPlusMacosPlugin"))
WindowManagerPlugin.register(with: registry.registrar(forPlugin: "WindowManagerPlugin"))
}

View File

@ -259,7 +259,7 @@
attributes = {
BuildIndependentTargetsInParallel = YES;
LastSwiftUpdateCheck = 0920;
LastUpgradeCheck = 1540;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
331C80D4294CF70F00263BE5 = {

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1540"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"

View File

@ -310,6 +310,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.3.6"
dbus:
dependency: transitive
description:
name: dbus
sha256: "365c771ac3b0e58845f39ec6deebc76e3276aa9922b0cc60840712094d9047ac"
url: "https://pub.dev"
source: hosted
version: "0.7.10"
desktop_webview_window:
dependency: "direct main"
description:
@ -1526,6 +1534,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "14.2.5"
wakelock_plus:
dependency: "direct main"
description:
name: wakelock_plus
sha256: bf4ee6f17a2fa373ed3753ad0e602b7603f8c75af006d5b9bdade263928c0484
url: "https://pub.dev"
source: hosted
version: "1.2.8"
wakelock_plus_platform_interface:
dependency: transitive
description:
name: wakelock_plus_platform_interface
sha256: "422d1cdbb448079a8a62a5a770b69baa489f8f7ca21aef47800c726d404f9d16"
url: "https://pub.dev"
source: hosted
version: "1.2.1"
watcher:
dependency: transitive
description:

View File

@ -100,6 +100,7 @@ dependencies:
flutter_inappwebview: ^6.0.0
timezone: ^0.9.4
url_launcher: ^6.3.0
wakelock_plus: ^1.2.8
dev_dependencies:
flutter_test: