0.5.10 - Download fixes, translations, search history fix, bigger buffer

This commit is contained in:
exttex 2020-10-17 21:20:26 +02:00
parent 5adc854e46
commit bcf709e56d
9 changed files with 60 additions and 21 deletions

View file

@ -49,7 +49,7 @@ class Cache {
@JsonKey(ignore: true)
StreamSubscription sleepTimer;
@JsonKey(defaultValue: const [])
@JsonKey(defaultValue: [])
List<String> searchHistory;
//If download threads warning was shown

File diff suppressed because one or more lines are too long

View file

@ -21,6 +21,7 @@ const supportedLocales = [
const Locale('id', 'ID'),
const Locale('fa', 'IR'),
const Locale('pl', 'PL'),
const Locale('uk', 'UA'),
const Locale('fil', 'PH')
];

View file

@ -771,6 +771,21 @@ class QueueScreen extends StatefulWidget {
class _QueueScreenState extends State<QueueScreen> {
StreamSubscription _queueSub;
@override
void initState() {
_queueSub = AudioService.queueStream.listen((event) {setState((){});});
super.initState();
}
@override
void dispose() {
if (_queueSub != null)
_queueSub.cancel();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(

View file

@ -66,7 +66,10 @@ class _SearchScreenState extends State<SearchScreen> {
//Add to search history
try {cache.searchHistory.remove(_query);} catch (_) {}
cache.searchHistory.add(_query);
if (cache.searchHistory == null)
cache.searchHistory = [];
cache.searchHistory.insert(0, _query);
cache.save();
Navigator.of(context).push(
MaterialPageRoute(builder: (context) => SearchResultsScreen(_query, offline: _offline,))
@ -75,6 +78,7 @@ class _SearchScreenState extends State<SearchScreen> {
@override
void initState() {
print(cache.searchHistory);
//Check for connectivity and enable offline mode
Connectivity().checkConnectivity().then((res) {
if (res == ConnectivityResult.none) setState(() {
@ -165,9 +169,9 @@ class _SearchScreenState extends State<SearchScreen> {
Divider(),
//History
if (cache.searchHistory.length > 0 && (_query??'').length == 0)
if (cache.searchHistory != null && cache.searchHistory.length > 0 && (_query??'').length == 0)
...List.generate(cache.searchHistory.length > 10 ? 10 : cache.searchHistory.length, (int i) => ListTile(
title: Text(cache.searchHistory[i]),
title: Text(cache.searchHistory[i]??''),
leading: Icon(Icons.history),
onTap: () {
setState(() => _query = cache.searchHistory[i]);