Remove listennotes request under fdroid.

This commit is contained in:
stonega 2021-02-11 12:45:26 +08:00
parent 939699c892
commit 54fc876676
2 changed files with 5 additions and 0 deletions

View File

@ -197,6 +197,7 @@ class DiscoveryPageState extends State<DiscoveryPage> {
}
Future<List<OnlinePodcast>> _getTopPodcasts({int page}) async {
if(environment['apiKey'] == '') return [];
final searchEngine = ListenNotesSearch();
var searchResult = await searchEngine.fetchBestPodcast(
genre: '',

View File

@ -24,9 +24,11 @@ class ListenNotesSearch {
final _dio = Dio(BaseOptions(connectTimeout: 30000, receiveTimeout: 90000));
final _baseUrl = "https://listen-api.listennotes.com/api/v2/";
final _apiKey = environment['apiKey'];
bool get _validApi => _apiKey != '';
Future<SearchPodcast<dynamic>> searchPodcasts(
{String searchText, int nextOffset}) async {
if(!_validApi) return null;
var url = "${_baseUrl}search?q="
"${Uri.encodeComponent(searchText)}${"&sort_by_date=0&type=podcast&offset=$nextOffset"}";
var response = await _dio.get(url,
@ -41,6 +43,7 @@ class ListenNotesSearch {
Future<SearchEpisodes<dynamic>> fetchEpisode(
{String id, int nextEpisodeDate}) async {
if(!_validApi) return null;
var url =
"${_baseUrl}podcasts/$id?next_episode_pub_date=$nextEpisodeDate";
var response = await _dio.get(url,
@ -55,6 +58,7 @@ class ListenNotesSearch {
Future<SearchTopPodcast<dynamic>> fetchBestPodcast(
{String genre, int page, String region = 'us'}) async {
if(!_validApi) return null;
var url =
"${_baseUrl}best_podcasts?genre_id=$genre&page=$page&region=$region";
var response = await Dio().get(url,