0.6.11 - noone cares or reads this anyway, the repo is for issues, and the code so bad, it's practically obfuscated
This commit is contained in:
parent
9f850a6f30
commit
aa7f82b399
|
@ -634,14 +634,19 @@ class HomePageSection {
|
||||||
);
|
);
|
||||||
|
|
||||||
String layout = json['layout'];
|
String layout = json['layout'];
|
||||||
//No ads there
|
switch (layout) {
|
||||||
if (layout == 'ads') return null;
|
case 'ads':
|
||||||
if (layout == 'horizontal-grid' || layout == 'grid') {
|
return null;
|
||||||
hps.layout = HomePageSectionLayout.ROW;
|
case 'horizontal-grid':
|
||||||
} else {
|
hps.layout = HomePageSectionLayout.ROW;
|
||||||
//Currently only row layout
|
break;
|
||||||
return null;
|
case 'grid':
|
||||||
|
hps.layout = HomePageSectionLayout.GRID;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Parse items
|
//Parse items
|
||||||
for (var i in (json['items']??[])) {
|
for (var i in (json['items']??[])) {
|
||||||
HomePageItem hpi = HomePageItem.fromPrivateJson(i);
|
HomePageItem hpi = HomePageItem.fromPrivateJson(i);
|
||||||
|
@ -747,7 +752,8 @@ enum HomePageItemType {
|
||||||
}
|
}
|
||||||
|
|
||||||
enum HomePageSectionLayout {
|
enum HomePageSectionLayout {
|
||||||
ROW
|
ROW,
|
||||||
|
GRID
|
||||||
}
|
}
|
||||||
|
|
||||||
enum RepeatType {
|
enum RepeatType {
|
||||||
|
|
|
@ -368,6 +368,7 @@ Map<String, dynamic> _$HomePageSectionToJson(HomePageSection instance) =>
|
||||||
|
|
||||||
const _$HomePageSectionLayoutEnumMap = {
|
const _$HomePageSectionLayoutEnumMap = {
|
||||||
HomePageSectionLayout.ROW: 'ROW',
|
HomePageSectionLayout.ROW: 'ROW',
|
||||||
|
HomePageSectionLayout.GRID: 'GRID',
|
||||||
};
|
};
|
||||||
|
|
||||||
DeezerChannel _$DeezerChannelFromJson(Map<String, dynamic> json) {
|
DeezerChannel _$DeezerChannelFromJson(Map<String, dynamic> json) {
|
||||||
|
|
|
@ -392,21 +392,24 @@ class DownloadManager {
|
||||||
for (Track t in tracks) {
|
for (Track t in tracks) {
|
||||||
//Check if library
|
//Check if library
|
||||||
List rawTrack = await db.query('Tracks', where: 'id == ?', whereArgs: [t.id], columns: ['favorite']);
|
List rawTrack = await db.query('Tracks', where: 'id == ?', whereArgs: [t.id], columns: ['favorite']);
|
||||||
if (rawTrack.length > 0 && rawTrack[0]['favorite'] == 0) {
|
if (rawTrack.length > 0) {
|
||||||
//Count occurrences in playlists and albums
|
//Count occurrences in playlists and albums
|
||||||
List albums = await db.rawQuery('SELECT (id) FROM Albums WHERE tracks LIKE "%${t.id}%"');
|
List albums = await db.rawQuery('SELECT (id) FROM Albums WHERE tracks LIKE "%${t.id}%"');
|
||||||
List playlists = await db.rawQuery('SELECT (id) FROM Playlists WHERE tracks LIKE "%${t.id}%"');
|
List playlists = await db.rawQuery('SELECT (id) FROM Playlists WHERE tracks LIKE "%${t.id}%"');
|
||||||
if (albums.length + playlists.length == 0) {
|
if (albums.length + playlists.length == 0 && rawTrack[0]['favorite'] == 0) {
|
||||||
//Safe to remove
|
//Safe to remove
|
||||||
await db.delete('Tracks', where: 'id == ?', whereArgs: [t.id]);
|
await db.delete('Tracks', where: 'id == ?', whereArgs: [t.id]);
|
||||||
//Remove file
|
} else {
|
||||||
try {
|
await db.update('Tracks', {'offline': 0}, where: 'id == ?', whereArgs: [t.id]);
|
||||||
File(p.join(offlinePath, t.id)).delete();
|
|
||||||
} catch (e) {
|
|
||||||
print(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Remove file
|
||||||
|
try {
|
||||||
|
File(p.join(offlinePath, t.id)).delete();
|
||||||
|
} catch (e) {
|
||||||
|
print(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -619,6 +619,8 @@ class AudioPlayerTask extends BackgroundAudioTask {
|
||||||
@override
|
@override
|
||||||
Future onUpdateQueue(List<MediaItem> q) async {
|
Future onUpdateQueue(List<MediaItem> q) async {
|
||||||
//just_audio
|
//just_audio
|
||||||
|
_shuffle = false;
|
||||||
|
_originalQueue = null;
|
||||||
_player.stop();
|
_player.stop();
|
||||||
if (_audioSource != null) _audioSource.clear();
|
if (_audioSource != null) _audioSource.clear();
|
||||||
//Filter duplicate IDs
|
//Filter duplicate IDs
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -373,6 +373,11 @@ const language_en_us = {
|
||||||
"Options": "Options",
|
"Options": "Options",
|
||||||
"Invalid/Unsupported URL": "Invalid/Unsupported URL",
|
"Invalid/Unsupported URL": "Invalid/Unsupported URL",
|
||||||
"Please wait...": "Please wait...",
|
"Please wait...": "Please wait...",
|
||||||
"Login using email": "Login using email"
|
"Login using email": "Login using email",
|
||||||
|
|
||||||
|
//0.6.11, offline text OCD lol
|
||||||
|
"Track removed from offline!": "Track removed from offline!",
|
||||||
|
"Removed album from offline!": "Removed album from offline!",
|
||||||
|
"Playlist removed from offline!": "Playlist removed from offline!"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -286,6 +286,7 @@ class _MakeAlbumOfflineState extends State<MakeAlbumOffline> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
downloadManager.removeOfflineAlbum(widget.album.id);
|
downloadManager.removeOfflineAlbum(widget.album.id);
|
||||||
|
Fluttertoast.showToast(msg: "Removed album from offline!".i18n, gravity: ToastGravity.BOTTOM, toastLength: Toast.LENGTH_SHORT);
|
||||||
setState(() {
|
setState(() {
|
||||||
_offline = false;
|
_offline = false;
|
||||||
});
|
});
|
||||||
|
@ -1098,6 +1099,7 @@ class _MakePlaylistOfflineState extends State<MakePlaylistOffline> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
downloadManager.removeOfflinePlaylist(widget.playlist.id);
|
downloadManager.removeOfflinePlaylist(widget.playlist.id);
|
||||||
|
Fluttertoast.showToast(msg: "Playlist removed from offline!".i18n, gravity: ToastGravity.BOTTOM, toastLength: Toast.LENGTH_SHORT);
|
||||||
setState(() {
|
setState(() {
|
||||||
_offline = false;
|
_offline = false;
|
||||||
});
|
});
|
||||||
|
|
|
@ -145,16 +145,23 @@ class _HomePageScreenState extends State<HomePageScreen> {
|
||||||
return ErrorScreen();
|
return ErrorScreen();
|
||||||
return Column(
|
return Column(
|
||||||
children: List.generate(_homePage.sections.length, (i) {
|
children: List.generate(_homePage.sections.length, (i) {
|
||||||
return HomepageSectionWidget(_homePage.sections[i]);
|
switch (_homePage.sections[i].layout) {
|
||||||
|
case HomePageSectionLayout.ROW:
|
||||||
|
return HomepageRowSection(_homePage.sections[i]);
|
||||||
|
case HomePageSectionLayout.GRID:
|
||||||
|
return HomePageGridSection(_homePage.sections[i]);
|
||||||
|
default:
|
||||||
|
return HomepageRowSection(_homePage.sections[i]);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class HomepageSectionWidget extends StatelessWidget {
|
class HomepageRowSection extends StatelessWidget {
|
||||||
|
|
||||||
final HomePageSection section;
|
final HomePageSection section;
|
||||||
HomepageSectionWidget(this.section);
|
HomepageRowSection(this.section);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -192,9 +199,9 @@ class HomepageSectionWidget extends StatelessWidget {
|
||||||
builder: (context) => Scaffold(
|
builder: (context) => Scaffold(
|
||||||
appBar: FreezerAppBar(section.title),
|
appBar: FreezerAppBar(section.title),
|
||||||
body: SingleChildScrollView(
|
body: SingleChildScrollView(
|
||||||
child: HomePageScreen(
|
child: HomePageScreen(
|
||||||
channel: DeezerChannel(target: section.pagePath)
|
channel: DeezerChannel(target: section.pagePath)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
|
@ -213,6 +220,41 @@ class HomepageSectionWidget extends StatelessWidget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class HomePageGridSection extends StatelessWidget {
|
||||||
|
|
||||||
|
final HomePageSection section;
|
||||||
|
HomePageGridSection(this.section);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return ListTile(
|
||||||
|
contentPadding: EdgeInsets.symmetric(horizontal: 4.0, vertical: 2.0),
|
||||||
|
title: Padding(
|
||||||
|
padding: EdgeInsets.symmetric(vertical: 4.0, horizontal: 6.0),
|
||||||
|
child: Text(
|
||||||
|
section.title??'',
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
maxLines: 2,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20.0,
|
||||||
|
fontWeight: FontWeight.w900
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
subtitle: Wrap(
|
||||||
|
alignment: WrapAlignment.spaceAround,
|
||||||
|
children: List.generate(section.items.length, (i) {
|
||||||
|
|
||||||
|
//Item
|
||||||
|
return HomePageItemWidget(section.items[i]);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class HomePageItemWidget extends StatelessWidget {
|
class HomePageItemWidget extends StatelessWidget {
|
||||||
|
|
|
@ -323,6 +323,7 @@ class MenuSheet {
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
if (isOffline) {
|
if (isOffline) {
|
||||||
await downloadManager.removeOfflineTracks([track]);
|
await downloadManager.removeOfflineTracks([track]);
|
||||||
|
Fluttertoast.showToast(msg: "Track removed from offline!".i18n, gravity: ToastGravity.BOTTOM, toastLength: Toast.LENGTH_SHORT);
|
||||||
} else {
|
} else {
|
||||||
await downloadManager.addOfflineTrack(track, private: true, context: context);
|
await downloadManager.addOfflineTrack(track, private: true, context: context);
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,13 +77,18 @@ class PlayerBar extends StatelessWidget {
|
||||||
overflow: TextOverflow.clip,
|
overflow: TextOverflow.clip,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
),
|
),
|
||||||
trailing: Row(
|
trailing: IconTheme(
|
||||||
mainAxisSize: MainAxisSize.min,
|
data: IconThemeData(
|
||||||
children: <Widget>[
|
color: settings.isDark ? Colors.white : Colors.grey[600]
|
||||||
PrevNextButton(iconSize, prev: true, hidePrev: true,),
|
),
|
||||||
PlayPauseButton(iconSize),
|
child: Row(
|
||||||
PrevNextButton(iconSize)
|
mainAxisSize: MainAxisSize.min,
|
||||||
],
|
children: <Widget>[
|
||||||
|
PrevNextButton(iconSize, prev: true, hidePrev: true,),
|
||||||
|
PlayPauseButton(iconSize),
|
||||||
|
PrevNextButton(iconSize)
|
||||||
|
],
|
||||||
|
),
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:audio_service/audio_service.dart';
|
import 'package:audio_service/audio_service.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_screenutil/screenutil.dart';
|
import 'package:flutter_screenutil/screenutil.dart';
|
||||||
|
import 'package:fluttertoast/fluttertoast.dart';
|
||||||
import 'package:freezer/api/cache.dart';
|
import 'package:freezer/api/cache.dart';
|
||||||
import 'package:freezer/api/deezer.dart';
|
import 'package:freezer/api/deezer.dart';
|
||||||
import 'package:freezer/api/download.dart';
|
import 'package:freezer/api/download.dart';
|
||||||
|
@ -379,6 +380,18 @@ class _PlayerScreenVerticalState extends State<PlayerScreenVertical> {
|
||||||
updateColor();
|
updateColor();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(Icons.file_download),
|
||||||
|
onPressed: () async {
|
||||||
|
Track t = Track.fromMediaItem(AudioService.currentMediaItem);
|
||||||
|
if (await downloadManager.addOfflineTrack(t, private: false, context: context, isSingleton: true) != false)
|
||||||
|
Fluttertoast.showToast(
|
||||||
|
msg: 'Downloads added!'.i18n,
|
||||||
|
gravity: ToastGravity.BOTTOM,
|
||||||
|
toastLength: Toast.LENGTH_SHORT
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
QualityInfoWidget(),
|
QualityInfoWidget(),
|
||||||
RepeatButton(ScreenUtil().setWidth(46)),
|
RepeatButton(ScreenUtil().setWidth(46)),
|
||||||
PlayerMenuButton()
|
PlayerMenuButton()
|
||||||
|
|
Loading…
Reference in New Issue