Fixed bug remove episodes in FlutterDownloader after remove a podcast.

Add buy me a coffee in about page.
This commit is contained in:
stonegate 2020-06-20 12:52:29 +08:00
parent 73fd9f6c37
commit eebb49f386
7 changed files with 64 additions and 18 deletions

View File

@ -1,9 +1,11 @@
# Tsacdop Changelog # Tsacdop Changelog
## v0.3.4 ## v0.3.4
Release date 2020/6/16
### New feature ### New feature
- Support auto donwload new episodes, you can choose which podcast you want to auto download, you can also set if download using cellular data. - Support auto download new episodes, you can choose which podcast you want to auto download, you can also set if download using cellular data.
- Support costomize episode popup menu, you can add options you most want, **Like** | **Mark Listened** | **Download** newly added. - Support auto delete downloaded episode, you can set days before delete.
- Support customize episode popup menu, you can add options you most want, **Like** | **Mark Listened** | **Download** newly added.
- Improved downloaded file manager, you can now sort downloads by date or size, you can also only view listened downloads. - Improved downloaded file manager, you can now sort downloads by date or size, you can also only view listened downloads.
### Minor UI change ### Minor UI change
- Removed the listened indicator, increased the color difference for listened episodes. - Removed the listened indicator, increased the color difference for listened episodes.
@ -12,3 +14,5 @@
### Bugs fixed ### Bugs fixed
- Auto play when receive notification. - Auto play when receive notification.
- Lose podcast when import OMPL file. - Lose podcast when import OMPL file.
### Other
- Add privacy policy.

BIN
assets/buymeacoffee.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -1,12 +1,13 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:tsacdop/util/custompaint.dart'; import 'package:tsacdop/util/custompaint.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import 'package:line_icons/line_icons.dart'; import 'package:line_icons/line_icons.dart';
import '../util/context_extension.dart'; import '../util/context_extension.dart';
const String version = '0.3.4'; const String version = '0.3.5';
class AboutApp extends StatelessWidget { class AboutApp extends StatelessWidget {
_launchUrl(String url) async { _launchUrl(String url) async {
@ -85,7 +86,7 @@ class AboutApp extends StatelessWidget {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
Container( Container(
height: 200.0, height: 100.0,
alignment: Alignment.center, alignment: Alignment.center,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@ -100,7 +101,7 @@ class AboutApp extends StatelessWidget {
), ),
), ),
Padding( Padding(
padding: EdgeInsets.symmetric(horizontal: 50), padding: const EdgeInsets.all(20),
child: Text( child: Text(
'Tsacdop is a podcast player developed in flutter, a clean, simply beautiful and friendly app.', 'Tsacdop is a podcast player developed in flutter, a clean, simply beautiful and friendly app.',
textAlign: TextAlign.center, textAlign: TextAlign.center,
@ -117,6 +118,7 @@ class AboutApp extends StatelessWidget {
style: TextStyle(color: context.accentColor)), style: TextStyle(color: context.accentColor)),
), ),
Container( Container(
margin: const EdgeInsets.symmetric(horizontal: 5),
height: 4, height: 4,
width: 4, width: 4,
decoration: BoxDecoration( decoration: BoxDecoration(
@ -126,7 +128,7 @@ class AboutApp extends StatelessWidget {
FlatButton( FlatButton(
onPressed: () => _launchUrl( onPressed: () => _launchUrl(
'https://tsacdop.stonegate.me/#/changelog'), 'https://tsacdop.stonegate.me/#/changelog'),
child: Text('Changelogs', child: Text('Changelog',
style: TextStyle(color: context.accentColor)), style: TextStyle(color: context.accentColor)),
), ),
], ],
@ -145,13 +147,45 @@ class AboutApp extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
Container( Padding(
padding: EdgeInsets.symmetric(horizontal: 20.0), padding: EdgeInsets.symmetric(horizontal: 20.0),
alignment: Alignment.centerLeft, child: Row(
child: Text( mainAxisAlignment: MainAxisAlignment.center,
'Developer', children: [
style: TextStyle( Text(
color: Theme.of(context).accentColor), 'Developer',
style: TextStyle(
color: Theme.of(context).accentColor, fontWeight: FontWeight.bold),
),
Spacer(),
InkWell(
onTap: () => _launchUrl(
'https://www.buymeacoffee.com/stonegate'),
child: Container(
height: 30.0,
padding:
EdgeInsets.symmetric(horizontal: 10.0),
alignment: Alignment.centerLeft,
child: Row(
mainAxisAlignment:
MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text('Buy a coffee',
style: TextStyle(
color: context.accentColor)),
SizedBox(width: 10),
Image(
image: AssetImage(
'assets/buymeacoffee.png'),
height: 20,
fit: BoxFit.fitHeight,
),
],
),
),
)
],
), ),
), ),
_listItem(context, 'Twitter', LineIcons.twitter, _listItem(context, 'Twitter', LineIcons.twitter,

View File

@ -1,4 +1,5 @@
import 'dart:io'; import 'dart:io';
import 'package:flutter_downloader/flutter_downloader.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -28,7 +29,7 @@ Widget _downloadButton(EpisodeTask task, BuildContext context) {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
IconButton( IconButton(
icon: Icon(Icons.refresh), icon: Icon(Icons.refresh, color: Colors.red),
onPressed: () => downloader.retryTask(task.episode), onPressed: () => downloader.retryTask(task.episode),
), ),
IconButton( IconButton(
@ -87,7 +88,9 @@ class _DownloadListState extends State<DownloadList> {
), ),
Expanded( Expanded(
flex: 1, flex: 1,
child: tasks[index].progress >= 0 child: tasks[index].progress >= 0 &&
tasks[index].status !=
DownloadTaskStatus.failed
? Container( ? Container(
width: 40.0, width: 40.0,
padding: padding:

View File

@ -218,7 +218,7 @@ class DBHelper {
[id]); [id]);
for (int i = 0; i < list.length; i++) { for (int i = 0; i < list.length; i++) {
if (list[i] != null) if (list[i] != null)
FlutterDownloader.remove( await FlutterDownloader.remove(
taskId: list[i]['downloaded'], shouldDeleteContent: true); taskId: list[i]['downloaded'], shouldDeleteContent: true);
print('Removed all download tasks'); print('Removed all download tasks');
} }

View File

@ -161,8 +161,12 @@ class DownloadState extends ChangeNotifier {
if (tasks.length != 0) if (tasks.length != 0)
await Future.forEach(tasks, (DownloadTask task) async { await Future.forEach(tasks, (DownloadTask task) async {
EpisodeBrief episode = await dbHelper.getRssItemWithUrl(task.url); EpisodeBrief episode = await dbHelper.getRssItemWithUrl(task.url);
_episodeTasks.add(EpisodeTask(episode, task.taskId, if (episode == null)
progress: task.progress, status: task.status)); await FlutterDownloader.remove(
taskId: task.taskId, shouldDeleteContent: true);
else
_episodeTasks.add(EpisodeTask(episode, task.taskId,
progress: task.progress, status: task.status));
}); });
notifyListeners(); notifyListeners();
} }
@ -221,6 +225,7 @@ class DownloadState extends ChangeNotifier {
} }
EpisodeTask episodeToTask(EpisodeBrief episode) { EpisodeTask episodeToTask(EpisodeBrief episode) {
print(_episodeTasks.first.episode.description);
return _episodeTasks return _episodeTasks
.firstWhere((task) => task.episode.enclosureUrl == episode.enclosureUrl, .firstWhere((task) => task.episode.enclosureUrl == episode.enclosureUrl,
orElse: () { orElse: () {

View File

@ -1,7 +1,7 @@
name: tsacdop name: tsacdop
description: An easy-use podacasts player. description: An easy-use podacasts player.
version: 0.3.4+17 version: 0.3.5+18
environment: environment:
sdk: ">=2.6.0 <3.0.0" sdk: ">=2.6.0 <3.0.0"