@@ -549,18 +549,18 @@ class LibraryService {
549549 }
550550 addSubscribedPodcastName (feedUrl: feedUrl, name: name);
551551 addSubscribedPodcastArtist (feedUrl: feedUrl, artist: artist);
552- await _addPodcastLastUpdatedWithTimestamp (feedUrl);
552+ await _checkAndAddPodcastLastUpdated (feedUrl);
553553 }
554554
555- Future <void > _addPodcastLastUpdatedWithTimestamp (String feedUrl) async {
555+ Future <void > _checkAndAddPodcastLastUpdated (String feedUrl) async {
556556 DateTime ? lastUpdated;
557557 try {
558558 lastUpdated = await Feed .feedLastUpdated (url: feedUrl);
559559 } on Exception catch (e) {
560560 printMessageInDebugMode (e);
561561 }
562562 if (lastUpdated != null ) {
563- _addPodcastLastUpdated (
563+ addPodcastLastUpdated (
564564 feedUrl: feedUrl,
565565 timestamp: lastUpdated.podcastTimeStamp,
566566 );
@@ -581,7 +581,7 @@ class LibraryService {
581581 }
582582 addSubscribedPodcastName (feedUrl: p.feedUrl, name: p.name);
583583 addSubscribedPodcastArtist (feedUrl: p.feedUrl, artist: p.artist);
584- await _addPodcastLastUpdatedWithTimestamp (p.feedUrl);
584+ await _checkAndAddPodcastLastUpdated (p.feedUrl);
585585 }
586586 }
587587 _sharedPreferences
@@ -617,14 +617,12 @@ class LibraryService {
617617 Set <String >? _podcastUpdates;
618618 int ? get podcastUpdatesLength => _podcastUpdates? .length;
619619
620- void _addPodcastLastUpdated ({
620+ Future < void > addPodcastLastUpdated ({
621621 required String feedUrl,
622622 required String timestamp,
623- }) {
624- _sharedPreferences
625- .setString (feedUrl + SPKeys .podcastLastUpdatedSuffix, timestamp)
626- .then (notify);
627- }
623+ }) async => _sharedPreferences
624+ .setString (feedUrl + SPKeys .podcastLastUpdatedSuffix, timestamp)
625+ .then (notify);
628626
629627 void _removePodcastLastUpdated (String feedUrl) => _sharedPreferences
630628 .remove (feedUrl + SPKeys .podcastLastUpdatedSuffix)
@@ -636,19 +634,16 @@ class LibraryService {
636634 bool podcastUpdateAvailable (String feedUrl) =>
637635 _podcastUpdates? .contains (feedUrl) == true ;
638636
639- void addPodcastUpdate (String feedUrl, DateTime ? lastUpdated) {
640- if (_podcastUpdates? .contains (feedUrl) == true || lastUpdated == null )
641- return ;
637+ Future <void > addPodcastUpdate (String feedUrl, DateTime lastUpdated) async {
638+ if (_podcastUpdates? .contains (feedUrl) == true ) return ;
642639
643- _addPodcastLastUpdated (
644- feedUrl: feedUrl,
645- timestamp: lastUpdated.podcastTimeStamp,
646- );
647- _podcastUpdates? .add (feedUrl);
648- writeStringIterable (
640+ await writeStringIterable (
649641 iterable: _podcastUpdates! ,
650642 filename: FileNames .podcastUpdates,
651- ).then ((_) => _propertiesChangedController.add (true ));
643+ ).then ((_) {
644+ _podcastUpdates? .add (feedUrl);
645+ _propertiesChangedController.add (true );
646+ });
652647 }
653648
654649 Future <void > removePodcastUpdate (String feedUrl) async {
0 commit comments