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
## v0.3.4
Release date 2020/6/16
### 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 costomize episode popup menu, you can add options you most want, **Like** | **Mark Listened** | **Download** newly added.
- 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 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.
### Minor UI change
- Removed the listened indicator, increased the color difference for listened episodes.
@ -12,3 +14,5 @@
### Bugs fixed
- Auto play when receive notification.
- 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/services.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:tsacdop/util/custompaint.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:line_icons/line_icons.dart';
import '../util/context_extension.dart';
const String version = '0.3.4';
const String version = '0.3.5';
class AboutApp extends StatelessWidget {
_launchUrl(String url) async {
@ -85,7 +86,7 @@ class AboutApp extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(
height: 200.0,
height: 100.0,
alignment: Alignment.center,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
@ -100,7 +101,7 @@ class AboutApp extends StatelessWidget {
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 50),
padding: const EdgeInsets.all(20),
child: Text(
'Tsacdop is a podcast player developed in flutter, a clean, simply beautiful and friendly app.',
textAlign: TextAlign.center,
@ -117,6 +118,7 @@ class AboutApp extends StatelessWidget {
style: TextStyle(color: context.accentColor)),
),
Container(
margin: const EdgeInsets.symmetric(horizontal: 5),
height: 4,
width: 4,
decoration: BoxDecoration(
@ -126,7 +128,7 @@ class AboutApp extends StatelessWidget {
FlatButton(
onPressed: () => _launchUrl(
'https://tsacdop.stonegate.me/#/changelog'),
child: Text('Changelogs',
child: Text('Changelog',
style: TextStyle(color: context.accentColor)),
),
],
@ -145,13 +147,45 @@ class AboutApp extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(
Padding(
padding: EdgeInsets.symmetric(horizontal: 20.0),
alignment: Alignment.centerLeft,
child: Text(
'Developer',
style: TextStyle(
color: Theme.of(context).accentColor),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'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,

View File

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

View File

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

View File

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

View File

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