Remove listennotes request under fdroid.
This commit is contained in:
parent
939699c892
commit
54fc876676
|
@ -197,6 +197,7 @@ class DiscoveryPageState extends State<DiscoveryPage> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<OnlinePodcast>> _getTopPodcasts({int page}) async {
|
Future<List<OnlinePodcast>> _getTopPodcasts({int page}) async {
|
||||||
|
if(environment['apiKey'] == '') return [];
|
||||||
final searchEngine = ListenNotesSearch();
|
final searchEngine = ListenNotesSearch();
|
||||||
var searchResult = await searchEngine.fetchBestPodcast(
|
var searchResult = await searchEngine.fetchBestPodcast(
|
||||||
genre: '',
|
genre: '',
|
||||||
|
|
|
@ -24,9 +24,11 @@ class ListenNotesSearch {
|
||||||
final _dio = Dio(BaseOptions(connectTimeout: 30000, receiveTimeout: 90000));
|
final _dio = Dio(BaseOptions(connectTimeout: 30000, receiveTimeout: 90000));
|
||||||
final _baseUrl = "https://listen-api.listennotes.com/api/v2/";
|
final _baseUrl = "https://listen-api.listennotes.com/api/v2/";
|
||||||
final _apiKey = environment['apiKey'];
|
final _apiKey = environment['apiKey'];
|
||||||
|
bool get _validApi => _apiKey != '';
|
||||||
|
|
||||||
Future<SearchPodcast<dynamic>> searchPodcasts(
|
Future<SearchPodcast<dynamic>> searchPodcasts(
|
||||||
{String searchText, int nextOffset}) async {
|
{String searchText, int nextOffset}) async {
|
||||||
|
if(!_validApi) return null;
|
||||||
var url = "${_baseUrl}search?q="
|
var url = "${_baseUrl}search?q="
|
||||||
"${Uri.encodeComponent(searchText)}${"&sort_by_date=0&type=podcast&offset=$nextOffset"}";
|
"${Uri.encodeComponent(searchText)}${"&sort_by_date=0&type=podcast&offset=$nextOffset"}";
|
||||||
var response = await _dio.get(url,
|
var response = await _dio.get(url,
|
||||||
|
@ -41,6 +43,7 @@ class ListenNotesSearch {
|
||||||
|
|
||||||
Future<SearchEpisodes<dynamic>> fetchEpisode(
|
Future<SearchEpisodes<dynamic>> fetchEpisode(
|
||||||
{String id, int nextEpisodeDate}) async {
|
{String id, int nextEpisodeDate}) async {
|
||||||
|
if(!_validApi) return null;
|
||||||
var url =
|
var url =
|
||||||
"${_baseUrl}podcasts/$id?next_episode_pub_date=$nextEpisodeDate";
|
"${_baseUrl}podcasts/$id?next_episode_pub_date=$nextEpisodeDate";
|
||||||
var response = await _dio.get(url,
|
var response = await _dio.get(url,
|
||||||
|
@ -55,6 +58,7 @@ class ListenNotesSearch {
|
||||||
|
|
||||||
Future<SearchTopPodcast<dynamic>> fetchBestPodcast(
|
Future<SearchTopPodcast<dynamic>> fetchBestPodcast(
|
||||||
{String genre, int page, String region = 'us'}) async {
|
{String genre, int page, String region = 'us'}) async {
|
||||||
|
if(!_validApi) return null;
|
||||||
var url =
|
var url =
|
||||||
"${_baseUrl}best_podcasts?genre_id=$genre&page=$page®ion=$region";
|
"${_baseUrl}best_podcasts?genre_id=$genre&page=$page®ion=$region";
|
||||||
var response = await Dio().get(url,
|
var response = await Dio().get(url,
|
||||||
|
|
Loading…
Reference in New Issue