mirror of
https://github.com/stonega/tsacdop
synced 2025-02-09 08:08:46 +01:00
Minor change.
This commit is contained in:
parent
e17ed8a81f
commit
5c01a9c83c
@ -6,6 +6,8 @@ import 'package:shared_preferences/shared_preferences.dart';
|
|||||||
|
|
||||||
import '../state/podcast_group.dart';
|
import '../state/podcast_group.dart';
|
||||||
|
|
||||||
|
const String groupsKey = 'groups';
|
||||||
|
const String playlistKey = 'playlist';
|
||||||
const String autoPlayKey = 'autoPlay';
|
const String autoPlayKey = 'autoPlay';
|
||||||
const String audioPositionKey = 'audioposition';
|
const String audioPositionKey = 'audioposition';
|
||||||
const String lastWorkKey = 'lastWork';
|
const String lastWorkKey = 'lastWork';
|
||||||
|
@ -41,7 +41,7 @@ class _PodcastGroupListState extends State<PodcastGroupList> {
|
|||||||
final podcast = widget.group.podcasts.removeAt(oldIndex);
|
final podcast = widget.group.podcasts.removeAt(oldIndex);
|
||||||
widget.group.podcasts.insert(newIndex, podcast);
|
widget.group.podcasts.insert(newIndex, podcast);
|
||||||
});
|
});
|
||||||
widget.group.setOrderedPodcasts = widget.group.podcasts;
|
widget.group.orderedPodcasts = widget.group.podcasts;
|
||||||
groupList.addToOrderChanged(widget.group);
|
groupList.addToOrderChanged(widget.group);
|
||||||
},
|
},
|
||||||
children: widget.group.podcasts.map<Widget>((podcastLocal) {
|
children: widget.group.podcasts.map<Widget>((podcastLocal) {
|
||||||
@ -49,7 +49,7 @@ class _PodcastGroupListState extends State<PodcastGroupList> {
|
|||||||
decoration:
|
decoration:
|
||||||
BoxDecoration(color: Theme.of(context).primaryColor),
|
BoxDecoration(color: Theme.of(context).primaryColor),
|
||||||
key: ObjectKey(podcastLocal.title),
|
key: ObjectKey(podcastLocal.title),
|
||||||
child: PodcastCard(
|
child: _PodcastCard(
|
||||||
podcastLocal: podcastLocal,
|
podcastLocal: podcastLocal,
|
||||||
group: widget.group,
|
group: widget.group,
|
||||||
),
|
),
|
||||||
@ -60,15 +60,15 @@ class _PodcastGroupListState extends State<PodcastGroupList> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class PodcastCard extends StatefulWidget {
|
class _PodcastCard extends StatefulWidget {
|
||||||
final PodcastLocal podcastLocal;
|
final PodcastLocal podcastLocal;
|
||||||
final PodcastGroup group;
|
final PodcastGroup group;
|
||||||
PodcastCard({this.podcastLocal, this.group, Key key}) : super(key: key);
|
_PodcastCard({this.podcastLocal, this.group, Key key}) : super(key: key);
|
||||||
@override
|
@override
|
||||||
_PodcastCardState createState() => _PodcastCardState();
|
__PodcastCardState createState() => __PodcastCardState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _PodcastCardState extends State<PodcastCard>
|
class __PodcastCardState extends State<_PodcastCard>
|
||||||
with SingleTickerProviderStateMixin {
|
with SingleTickerProviderStateMixin {
|
||||||
bool _loadMenu;
|
bool _loadMenu;
|
||||||
bool _addGroup;
|
bool _addGroup;
|
||||||
@ -161,11 +161,11 @@ class _PodcastCardState extends State<PodcastCard>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var _c = (Theme.of(context).brightness == Brightness.light)
|
final c = (Theme.of(context).brightness == Brightness.light)
|
||||||
? widget.podcastLocal.primaryColor.colorizedark()
|
? widget.podcastLocal.primaryColor.colorizedark()
|
||||||
: widget.podcastLocal.primaryColor.colorizeLight();
|
: widget.podcastLocal.primaryColor.colorizeLight();
|
||||||
final s = context.s;
|
final s = context.s;
|
||||||
var _width = MediaQuery.of(context).size.width;
|
var width = context.width;
|
||||||
var groupList = context.watch<GroupList>();
|
var groupList = context.watch<GroupList>();
|
||||||
_belongGroups = groupList.getPodcastGroup(widget.podcastLocal.id);
|
_belongGroups = groupList.getPodcastGroup(widget.podcastLocal.id);
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ class _PodcastCardState extends State<PodcastCard>
|
|||||||
Container(
|
Container(
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.unfold_more,
|
Icons.unfold_more,
|
||||||
color: _c,
|
color: c,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
@ -214,7 +214,7 @@ class _PodcastCardState extends State<PodcastCard>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
width: _width / 2,
|
width: width / 2,
|
||||||
padding: EdgeInsets.symmetric(horizontal: 10),
|
padding: EdgeInsets.symmetric(horizontal: 10),
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: Column(
|
child: Column(
|
||||||
|
@ -551,6 +551,10 @@ class AudioPlayerNotifier extends ChangeNotifier {
|
|||||||
await AudioService.removeQueueItem(episodeNew.toMediaItem());
|
await AudioService.removeQueueItem(episodeNew.toMediaItem());
|
||||||
}
|
}
|
||||||
var index = await _queue.delFromPlaylist(episodeNew);
|
var index = await _queue.delFromPlaylist(episodeNew);
|
||||||
|
if (index == 0) {
|
||||||
|
_lastPostion = 0;
|
||||||
|
await positionStorage.saveInt(0);
|
||||||
|
}
|
||||||
_queueUpdate = !_queueUpdate;
|
_queueUpdate = !_queueUpdate;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
return index;
|
return index;
|
||||||
|
@ -13,6 +13,7 @@ import 'package:image/image.dart' as img;
|
|||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
import 'package:webfeed/webfeed.dart';
|
import 'package:webfeed/webfeed.dart';
|
||||||
import 'package:uuid/uuid.dart';
|
import 'package:uuid/uuid.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
|
||||||
import '../local_storage/key_value_storage.dart';
|
import '../local_storage/key_value_storage.dart';
|
||||||
import '../local_storage/sqflite_localpodcast.dart';
|
import '../local_storage/sqflite_localpodcast.dart';
|
||||||
@ -38,7 +39,7 @@ class GroupEntity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class PodcastGroup {
|
class PodcastGroup extends Equatable {
|
||||||
/// Group name.
|
/// Group name.
|
||||||
final String name;
|
final String name;
|
||||||
|
|
||||||
@ -48,22 +49,28 @@ class PodcastGroup {
|
|||||||
final String color;
|
final String color;
|
||||||
|
|
||||||
/// Id lists of podcasts in group.
|
/// Id lists of podcasts in group.
|
||||||
List<String> podcastList;
|
List<String> _podcastList;
|
||||||
|
|
||||||
|
List<String> get podcastList => _podcastList;
|
||||||
|
|
||||||
|
set podcastList(list) {
|
||||||
|
_podcastList = list;
|
||||||
|
}
|
||||||
|
|
||||||
PodcastGroup(this.name,
|
PodcastGroup(this.name,
|
||||||
{this.color = '#000000', String id, List<String> podcastList})
|
{this.color = '#000000', String id, List<String> podcastList})
|
||||||
: id = id ?? Uuid().v4(),
|
: id = id ?? Uuid().v4(),
|
||||||
podcastList = podcastList ?? [];
|
_podcastList = podcastList ?? [];
|
||||||
|
|
||||||
Future getPodcasts() async {
|
Future<void> getPodcasts() async {
|
||||||
var dbHelper = DBHelper();
|
var dbHelper = DBHelper();
|
||||||
if (podcastList != []) {
|
if (_podcastList != []) {
|
||||||
try {
|
try {
|
||||||
_podcasts = await dbHelper.getPodcastLocal(podcastList);
|
_podcasts = await dbHelper.getPodcastLocal(_podcastList);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await Future.delayed(Duration(milliseconds: 200));
|
await Future.delayed(Duration(milliseconds: 200));
|
||||||
try {
|
try {
|
||||||
_podcasts = await dbHelper.getPodcastLocal(podcastList);
|
_podcasts = await dbHelper.getPodcastLocal(_podcastList);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
developer.log(e.toString());
|
developer.log(e.toString());
|
||||||
}
|
}
|
||||||
@ -86,9 +93,9 @@ class PodcastGroup {
|
|||||||
|
|
||||||
///Ordered podcast list.
|
///Ordered podcast list.
|
||||||
List<PodcastLocal> _orderedPodcasts;
|
List<PodcastLocal> _orderedPodcasts;
|
||||||
List<PodcastLocal> get ordereddPodcasts => _orderedPodcasts;
|
List<PodcastLocal> get orderedPodcasts => _orderedPodcasts;
|
||||||
|
|
||||||
set setOrderedPodcasts(List<PodcastLocal> list) => _orderedPodcasts = list;
|
set orderedPodcasts(list) => _orderedPodcasts = list;
|
||||||
|
|
||||||
GroupEntity toEntity() {
|
GroupEntity toEntity() {
|
||||||
return GroupEntity(name, id, color, podcastList);
|
return GroupEntity(name, id, color, podcastList);
|
||||||
@ -102,6 +109,9 @@ class PodcastGroup {
|
|||||||
podcastList: entity.podcastList,
|
podcastList: entity.podcastList,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [id, name];
|
||||||
}
|
}
|
||||||
|
|
||||||
enum SubscribeState { none, start, subscribe, fetch, stop, exist, error }
|
enum SubscribeState { none, start, subscribe, fetch, stop, exist, error }
|
||||||
@ -136,10 +146,10 @@ class GroupList extends ChangeNotifier {
|
|||||||
final List<PodcastGroup> _groups = [];
|
final List<PodcastGroup> _groups = [];
|
||||||
List<PodcastGroup> get groups => _groups;
|
List<PodcastGroup> get groups => _groups;
|
||||||
|
|
||||||
DBHelper dbHelper = DBHelper();
|
final DBHelper _dbHelper = DBHelper();
|
||||||
|
|
||||||
/// Groups save in shared_prefrences.
|
/// Groups save in shared_prefrences.
|
||||||
KeyValueStorage storage = KeyValueStorage('groups');
|
final KeyValueStorage _groupStorage = KeyValueStorage(groupsKey);
|
||||||
|
|
||||||
//GroupList({List<PodcastGroup> groups}) : _groups = groups ?? [];
|
//GroupList({List<PodcastGroup> groups}) : _groups = groups ?? [];
|
||||||
|
|
||||||
@ -238,7 +248,7 @@ class GroupList extends ChangeNotifier {
|
|||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
clearOrderChanged() async {
|
Future<void> clearOrderChanged() async {
|
||||||
if (_orderChanged.length > 0) {
|
if (_orderChanged.length > 0) {
|
||||||
for (var group in _orderChanged) {
|
for (var group in _orderChanged) {
|
||||||
await group.getPodcasts();
|
await group.getPodcasts();
|
||||||
@ -264,7 +274,7 @@ class GroupList extends ChangeNotifier {
|
|||||||
Future loadGroups() async {
|
Future loadGroups() async {
|
||||||
_isLoading = true;
|
_isLoading = true;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
storage.getGroups().then((loadgroups) async {
|
_groupStorage.getGroups().then((loadgroups) async {
|
||||||
_groups.addAll(loadgroups.map(PodcastGroup.fromEntity));
|
_groups.addAll(loadgroups.map(PodcastGroup.fromEntity));
|
||||||
for (var group in _groups) {
|
for (var group in _groups) {
|
||||||
await group.getPodcasts();
|
await group.getPodcasts();
|
||||||
@ -306,7 +316,7 @@ class GroupList extends ChangeNotifier {
|
|||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
updateGroup(PodcastGroup podcastGroup) async {
|
Future<void> updateGroup(PodcastGroup podcastGroup) async {
|
||||||
var oldGroup = _groups.firstWhere((it) => it.id == podcastGroup.id);
|
var oldGroup = _groups.firstWhere((it) => it.id == podcastGroup.id);
|
||||||
var index = _groups.indexOf(oldGroup);
|
var index = _groups.indexOf(oldGroup);
|
||||||
_groups.replaceRange(index, index + 1, [podcastGroup]);
|
_groups.replaceRange(index, index + 1, [podcastGroup]);
|
||||||
@ -315,21 +325,21 @@ class GroupList extends ChangeNotifier {
|
|||||||
_saveGroup();
|
_saveGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
_saveGroup() async {
|
Future<void> _saveGroup() async {
|
||||||
await storage.saveGroup(_groups.map((it) => it.toEntity()).toList());
|
await _groupStorage.saveGroup(_groups.map((it) => it.toEntity()).toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Subscribe podcast from search result.
|
/// Subscribe podcast from search result.
|
||||||
Future subscribe(PodcastLocal podcastLocal) async {
|
Future subscribe(PodcastLocal podcastLocal) async {
|
||||||
_groups[0].podcastList.insert(0, podcastLocal.id);
|
_groups[0].podcastList.insert(0, podcastLocal.id);
|
||||||
await _saveGroup();
|
await _saveGroup();
|
||||||
await dbHelper.savePodcastLocal(podcastLocal);
|
await _dbHelper.savePodcastLocal(podcastLocal);
|
||||||
await _groups[0].getPodcasts();
|
await _groups[0].getPodcasts();
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future updatePodcast(String id) async {
|
Future updatePodcast(String id) async {
|
||||||
var counts = await dbHelper.getPodcastCounts(id);
|
var counts = await _dbHelper.getPodcastCounts(id);
|
||||||
for (var group in _groups) {
|
for (var group in _groups) {
|
||||||
if (group.podcastList.contains(id)) {
|
if (group.podcastList.contains(id)) {
|
||||||
group.podcasts.firstWhere((podcast) => podcast.id == id)
|
group.podcasts.firstWhere((podcast) => podcast.id == id)
|
||||||
@ -381,7 +391,7 @@ class GroupList extends ChangeNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Change podcast groups
|
//Change podcast groups
|
||||||
changeGroup(String id, List<PodcastGroup> list) async {
|
Future<void> changeGroup(String id, List<PodcastGroup> list) async {
|
||||||
_isLoading = true;
|
_isLoading = true;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
|
||||||
@ -404,14 +414,14 @@ class GroupList extends ChangeNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Unsubscribe podcast
|
/// Unsubscribe podcast
|
||||||
removePodcast(String id) async {
|
Future<void> removePodcast(String id) async {
|
||||||
_isLoading = true;
|
_isLoading = true;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
for (var group in _groups) {
|
for (var group in _groups) {
|
||||||
group.podcastList.remove(id);
|
group.podcastList.remove(id);
|
||||||
}
|
}
|
||||||
await _saveGroup();
|
await _saveGroup();
|
||||||
await dbHelper.delPodcastLocal(id);
|
await _dbHelper.delPodcastLocal(id);
|
||||||
for (var group in _groups) {
|
for (var group in _groups) {
|
||||||
await group.getPodcasts();
|
await group.getPodcasts();
|
||||||
}
|
}
|
||||||
@ -420,7 +430,7 @@ class GroupList extends ChangeNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
saveOrder(PodcastGroup group) async {
|
saveOrder(PodcastGroup group) async {
|
||||||
group.podcastList = group.ordereddPodcasts.map((e) => e.id).toList();
|
group.podcastList = group.orderedPodcasts.map((e) => e.id).toList();
|
||||||
await _saveGroup();
|
await _saveGroup();
|
||||||
await group.getPodcasts();
|
await group.getPodcasts();
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import 'dart:ui';
|
import 'package:equatable/equatable.dart';
|
||||||
|
|
||||||
import 'package:audio_service/audio_service.dart';
|
import 'package:audio_service/audio_service.dart';
|
||||||
|
|
||||||
class EpisodeBrief {
|
class EpisodeBrief extends Equatable {
|
||||||
final String title;
|
final String title;
|
||||||
final String description;
|
final String description;
|
||||||
final int pubDate;
|
final int pubDate;
|
||||||
@ -50,11 +50,5 @@ class EpisodeBrief {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object episode) =>
|
List<Object> get props => [enclosureUrl, title];
|
||||||
episode is EpisodeBrief &&
|
|
||||||
episode.title == title &&
|
|
||||||
episode.enclosureUrl == enclosureUrl;
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => hashValues(enclosureUrl, title);
|
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ class FiresideData {
|
|||||||
List<PodcastHost> get hosts => _hosts;
|
List<PodcastHost> get hosts => _hosts;
|
||||||
FiresideData(this.id, this.link);
|
FiresideData(this.id, this.link);
|
||||||
|
|
||||||
DBHelper dbHelper = DBHelper();
|
final DBHelper _dbHelper = DBHelper();
|
||||||
|
|
||||||
String parseLink(String link) {
|
String parseLink(String link) {
|
||||||
if (link == "http://www.shengfm.cn/") {
|
if (link == "http://www.shengfm.cn/") {
|
||||||
@ -26,7 +26,12 @@ class FiresideData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future fatchData() async {
|
Future fatchData() async {
|
||||||
var response = await Dio().get(parseLink(link));
|
var options = BaseOptions(
|
||||||
|
connectTimeout: 20000,
|
||||||
|
receiveTimeout: 20000,
|
||||||
|
);
|
||||||
|
|
||||||
|
var response = await Dio(options).get(parseLink(link));
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
var doc = parse(response.data);
|
var doc = parse(response.data);
|
||||||
var reg = RegExp(r'https(.+)jpg');
|
var reg = RegExp(r'https(.+)jpg');
|
||||||
@ -54,12 +59,12 @@ class FiresideData {
|
|||||||
backgroundImage,
|
backgroundImage,
|
||||||
json.encode({'hosts': hosts.map((host) => host.toJson()).toList()})
|
json.encode({'hosts': hosts.map((host) => host.toJson()).toList()})
|
||||||
];
|
];
|
||||||
await dbHelper.saveFiresideData(data);
|
await _dbHelper.saveFiresideData(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future getData() async {
|
Future getData() async {
|
||||||
var data = await dbHelper.getFiresideData(id);
|
var data = await _dbHelper.getFiresideData(id);
|
||||||
_background = data[0];
|
_background = data[0];
|
||||||
if (data[1] != '') {
|
if (data[1] != '') {
|
||||||
_hosts = json
|
_hosts = json
|
||||||
|
@ -2,7 +2,7 @@ import '../local_storage/sqflite_localpodcast.dart';
|
|||||||
import 'episodebrief.dart';
|
import 'episodebrief.dart';
|
||||||
|
|
||||||
class PlayHistory {
|
class PlayHistory {
|
||||||
DBHelper dbHelper = DBHelper();
|
final DBHelper _dbHelper = DBHelper();
|
||||||
|
|
||||||
/// Episdoe title.
|
/// Episdoe title.
|
||||||
String title;
|
String title;
|
||||||
@ -26,6 +26,6 @@ class PlayHistory {
|
|||||||
EpisodeBrief get episode => _episode;
|
EpisodeBrief get episode => _episode;
|
||||||
|
|
||||||
getEpisode() async {
|
getEpisode() async {
|
||||||
_episode = await dbHelper.getRssItemWithUrl(url);
|
_episode = await _dbHelper.getRssItemWithUrl(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,28 +4,28 @@ import 'episodebrief.dart';
|
|||||||
|
|
||||||
class Playlist {
|
class Playlist {
|
||||||
String name;
|
String name;
|
||||||
DBHelper dbHelper = DBHelper();
|
final DBHelper _dbHelper = DBHelper();
|
||||||
List<EpisodeBrief> _playlist;
|
List<EpisodeBrief> _playlist;
|
||||||
List<EpisodeBrief> get playlist => _playlist;
|
List<EpisodeBrief> get playlist => _playlist;
|
||||||
KeyValueStorage storage = KeyValueStorage('playlist');
|
final KeyValueStorage _playlistStorage = KeyValueStorage(playlistKey);
|
||||||
|
|
||||||
getPlaylist() async {
|
Future<void> getPlaylist() async {
|
||||||
var urls = await storage.getStringList();
|
var urls = await _playlistStorage.getStringList();
|
||||||
if (urls.length == 0) {
|
if (urls.length == 0) {
|
||||||
_playlist = [];
|
_playlist = [];
|
||||||
} else {
|
} else {
|
||||||
_playlist = [];
|
_playlist = [];
|
||||||
for (var url in urls) {
|
for (var url in urls) {
|
||||||
var episode = await dbHelper.getRssItemWithUrl(url);
|
var episode = await _dbHelper.getRssItemWithUrl(url);
|
||||||
if (episode != null) _playlist.add(episode);
|
if (episode != null) _playlist.add(episode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
savePlaylist() async {
|
Future<void> savePlaylist() async {
|
||||||
var urls = <String>[];
|
var urls = <String>[];
|
||||||
urls.addAll(_playlist.map((e) => e.enclosureUrl));
|
urls.addAll(_playlist.map((e) => e.enclosureUrl));
|
||||||
await storage.saveStringList(urls.toSet().toList());
|
await _playlistStorage.saveStringList(urls.toSet().toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> addToPlayList(EpisodeBrief episodeBrief) async {
|
Future<void> addToPlayList(EpisodeBrief episodeBrief) async {
|
||||||
@ -33,7 +33,7 @@ class Playlist {
|
|||||||
_playlist.add(episodeBrief);
|
_playlist.add(episodeBrief);
|
||||||
await savePlaylist();
|
await savePlaylist();
|
||||||
if (episodeBrief.isNew == 1) {
|
if (episodeBrief.isNew == 1) {
|
||||||
await dbHelper.removeEpisodeNewMark(episodeBrief.enclosureUrl);
|
await _dbHelper.removeEpisodeNewMark(episodeBrief.enclosureUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -44,7 +44,7 @@ class Playlist {
|
|||||||
_playlist.removeWhere(
|
_playlist.removeWhere(
|
||||||
(episode) => episode.enclosureUrl == episodeBrief.enclosureUrl);
|
(episode) => episode.enclosureUrl == episodeBrief.enclosureUrl);
|
||||||
if (episodeBrief.isNew == 1) {
|
if (episodeBrief.isNew == 1) {
|
||||||
await dbHelper.removeEpisodeNewMark(episodeBrief.enclosureUrl);
|
await _dbHelper.removeEpisodeNewMark(episodeBrief.enclosureUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_playlist.insert(index, episodeBrief);
|
_playlist.insert(index, episodeBrief);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import 'dart:ui';
|
import 'package:equatable/equatable.dart';
|
||||||
|
|
||||||
class PodcastLocal {
|
class PodcastLocal extends Equatable {
|
||||||
final String title;
|
final String title;
|
||||||
final String imageUrl;
|
final String imageUrl;
|
||||||
final String rssUrl;
|
final String rssUrl;
|
||||||
@ -13,18 +13,22 @@ class PodcastLocal {
|
|||||||
final String link;
|
final String link;
|
||||||
|
|
||||||
final String description;
|
final String description;
|
||||||
int upateCount;
|
|
||||||
int episodeCount;
|
int _upateCount;
|
||||||
|
int get updateCount => _upateCount;
|
||||||
|
set updateCount(i) => _upateCount = i;
|
||||||
|
|
||||||
|
int _episodeCount;
|
||||||
|
int get episodeCount => _episodeCount;
|
||||||
|
set episodeCount(i) => _episodeCount = i;
|
||||||
|
|
||||||
PodcastLocal(this.title, this.imageUrl, this.rssUrl, this.primaryColor,
|
PodcastLocal(this.title, this.imageUrl, this.rssUrl, this.primaryColor,
|
||||||
this.author, this.id, this.imagePath, this.provider, this.link,
|
this.author, this.id, this.imagePath, this.provider, this.link,
|
||||||
{this.description = '', this.upateCount = 0, this.episodeCount = 0})
|
{this.description = '', int upateCount, int episodeCount})
|
||||||
: assert(rssUrl != null);
|
: assert(rssUrl != null),
|
||||||
@override
|
_episodeCount = episodeCount ?? 0,
|
||||||
bool operator ==(Object podcastLocal) =>
|
_upateCount = upateCount ?? 0;
|
||||||
podcastLocal is PodcastLocal &&
|
|
||||||
podcastLocal.rssUrl == rssUrl &&
|
|
||||||
podcastLocal.id == id;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode => hashValues(id, rssUrl);
|
List<Object> get props => [id, rssUrl];
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name: tsacdop
|
name: tsacdop
|
||||||
description: An easy-use podacasts player.
|
description: An open source podacasts player.
|
||||||
|
|
||||||
version: 0.4.11+28
|
version: 0.4.11+28
|
||||||
|
|
||||||
@ -20,6 +20,7 @@ dependencies:
|
|||||||
dio: ^3.0.9
|
dio: ^3.0.9
|
||||||
extended_nested_scroll_view: ^1.0.1
|
extended_nested_scroll_view: ^1.0.1
|
||||||
effective_dart: ^1.2.4
|
effective_dart: ^1.2.4
|
||||||
|
equatable: ^1.2.3
|
||||||
feature_discovery: ^0.10.0
|
feature_discovery: ^0.10.0
|
||||||
file_picker: ^1.12.0
|
file_picker: ^1.12.0
|
||||||
flutter_html: ^0.11.1
|
flutter_html: ^0.11.1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user