do not add subscriptions that have no url (i.e. antennapod local folder subscriptions)
This commit is contained in:
parent
a9e29e269c
commit
e119d41c86
@ -1,4 +1,9 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## upcoming
|
||||||
|
### Changed
|
||||||
|
- Ignore subscriptions that have no url
|
||||||
|
|
||||||
## 3.1.0 - 2021-10-18
|
## 3.1.0 - 2021-10-18
|
||||||
### Changed
|
### Changed
|
||||||
- Add timestamp to subscription change response @JonOfUs
|
- Add timestamp to subscription change response @JonOfUs
|
||||||
|
@ -13,6 +13,7 @@ class SubscriptionChangesReader {
|
|||||||
*/
|
*/
|
||||||
public static function mapToSubscriptionsChanges(array $urls, bool $subscribed): array {
|
public static function mapToSubscriptionsChanges(array $urls, bool $subscribed): array {
|
||||||
$subscriptionChanges = [];
|
$subscriptionChanges = [];
|
||||||
|
$urls = array_filter($urls, function(string $url) {return filter_var($url, FILTER_VALIDATE_URL) !== false; });
|
||||||
foreach ($urls as $url) {
|
foreach ($urls as $url) {
|
||||||
$subscriptionChanges[] = new SubscriptionChange($url, $subscribed);
|
$subscriptionChanges[] = new SubscriptionChange($url, $subscribed);
|
||||||
}
|
}
|
||||||
|
@ -14,4 +14,14 @@ class SubscriptionChangeReaderTest extends TestCase {
|
|||||||
$this->assertSame("https://feeds.megaphone.fm/another", $subscriptionChange[1]->getUrl());
|
$this->assertSame("https://feeds.megaphone.fm/another", $subscriptionChange[1]->getUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function testNonUrisAreOmmited(): void {
|
||||||
|
$subscriptionChange = SubscriptionChangesReader::mapToSubscriptionsChanges([
|
||||||
|
"https://feeds.megaphone.fm/HSW8286374095",
|
||||||
|
"antennapod_local:content://com.android.externalstorage.documents/tree/home:podcast"
|
||||||
|
], true);
|
||||||
|
$this->assertCount(1, $subscriptionChange);
|
||||||
|
$this->assertSame("https://feeds.megaphone.fm/HSW8286374095", $subscriptionChange[0]->getUrl());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user