diff --git a/lib/home/audioplayer.dart b/lib/home/audioplayer.dart index ba5f92f..69399a0 100644 --- a/lib/home/audioplayer.dart +++ b/lib/home/audioplayer.dart @@ -320,7 +320,6 @@ class LastPosition extends StatelessWidget { FutureBuilder( future: getPosition(episode), builder: (context, snapshot) { - if (snapshot.hasError) print(snapshot.error); return snapshot.hasData ? snapshot.data.seekValue > 0.90 ? Container( diff --git a/lib/home/home.dart b/lib/home/home.dart index 5bfa152..3186779 100644 --- a/lib/home/home.dart +++ b/lib/home/home.dart @@ -765,7 +765,6 @@ class _RecentUpdateState extends State<_RecentUpdate> return FutureBuilder>( future: _getRssItem(_top, _group), builder: (context, snapshot) { - if (snapshot.hasError) print(snapshot.error); return (snapshot.hasData) ? snapshot.data.length == 0 ? Padding( @@ -1059,7 +1058,6 @@ class _MyFavoriteState extends State<_MyFavorite> return FutureBuilder>( future: _getLikedRssItem(_top, _sortBy), builder: (context, snapshot) { - if (snapshot.hasError) print(snapshot.error); return (snapshot.hasData) ? snapshot.data.length == 0 ? Padding( diff --git a/lib/home/home_groups.dart b/lib/home/home_groups.dart index 9ae3689..7adad2d 100644 --- a/lib/home/home_groups.dart +++ b/lib/home/home_groups.dart @@ -430,10 +430,6 @@ class PodcastPreview extends StatelessWidget { return FutureBuilder>( future: _getRssItemTop(podcastLocal), builder: (context, snapshot) { - if (snapshot.hasError) { - print(snapshot.error); - Center(); - } return (snapshot.hasData) ? ShowEpisode( episodes: snapshot.data, diff --git a/lib/home/home_menu.dart b/lib/home/home_menu.dart index c355cee..4407a9f 100644 --- a/lib/home/home_menu.dart +++ b/lib/home/home_menu.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:developer' as developer; import 'dart:io'; import 'package:file_picker/file_picker.dart'; @@ -71,7 +72,7 @@ class _PopupMenuState extends State { } } } catch (e) { - print(e); + developer.log(e, name: 'OMPL parse error'); Fluttertoast.showToast( msg: s.toastFileError, gravity: ToastGravity.TOP, @@ -86,15 +87,13 @@ class _PopupMenuState extends State { if (filePath == '') { return; } - print('File Path$filePath'); - //importOmpl.importState = ImportState.start; Fluttertoast.showToast( msg: s.toastReadFile, gravity: ToastGravity.TOP, ); _saveOmpl(filePath); } on PlatformException catch (e) { - print(e.toString()); + developer.log(e.toString(), name: 'Get OMPL file'); } } diff --git a/lib/local_storage/key_value_storage.dart b/lib/local_storage/key_value_storage.dart index 2b28fd6..c294015 100644 --- a/lib/local_storage/key_value_storage.dart +++ b/lib/local_storage/key_value_storage.dart @@ -53,7 +53,6 @@ class KeyValueStorage { 'groups': [home.toEntity().toJson()] })); } - print(prefs.getString(key)); return json .decode(prefs.getString(key))['groups'] .cast>() diff --git a/lib/local_storage/sqflite_localpodcast.dart b/lib/local_storage/sqflite_localpodcast.dart index e00322f..148aad3 100644 --- a/lib/local_storage/sqflite_localpodcast.dart +++ b/lib/local_storage/sqflite_localpodcast.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:developer' as developer; import 'package:dio/dio.dart'; import 'package:flutter_downloader/flutter_downloader.dart'; @@ -427,7 +428,7 @@ class DBHelper { } } date.add(Duration(hours: timezoneInt)).add(DateTime.now().timeZoneOffset); - print(date.toString()); + developer.log(date.toString()); return date; } @@ -467,7 +468,7 @@ class DBHelper { var dbClient = await database; String description, url; for (var i = 0; i < result; i++) { - print(feed.items[i].title); + developer.log(feed.items[i].title); description = _getDescription(feed.items[i]?.content?.value ?? '', feed.items[i].description ?? '', feed.items[i].itunes.summary ?? ''); if (feed.items[i].enclosure != null) { @@ -536,7 +537,7 @@ class DBHelper { [podcastLocal.id]); } for (var item in feed.items) { - print(item.title); + developer.log(item.title); description = _getDescription(item.content.value ?? '', item.description ?? '', item.itunes.summary ?? ''); @@ -550,7 +551,6 @@ class DBHelper { final length = item?.enclosure?.length ?? 0; final pubDate = item.pubDate; final date = _parsePubDate(pubDate); - print(date.toString()); final milliseconds = date.millisecondsSinceEpoch; final duration = item.itunes.duration?.inSeconds ?? 0; final explicit = _getExplicit(item.itunes.explicit); @@ -586,7 +586,7 @@ class DBHelper { } return 0; } catch (e) { - print(e); + developer.log(e, name: 'Update podcast error'); return -1; } } @@ -1009,7 +1009,7 @@ class DBHelper { await txn.rawUpdate( "UPDATE Episodes SET is_new = 0 WHERE enclosure_url = ?", [url]); }); - print('remove new episode $url'); + developer.log('remove new episode $url'); } Future> getLikedRssItem(int i, int sortBy) async { @@ -1126,7 +1126,7 @@ class DBHelper { "UPDATE Episodes SET downloaded = 'ND', media_id = ? WHERE enclosure_url = ?", [url, url]); }); - print('Deleted $url'); + developer.log('Deleted $url'); return count; } diff --git a/lib/podcasts/podcast_detail.dart b/lib/podcasts/podcast_detail.dart index b16ee11..75a24d9 100644 --- a/lib/podcasts/podcast_detail.dart +++ b/lib/podcasts/podcast_detail.dart @@ -187,10 +187,7 @@ class _PodcastDetailState extends State { widget.podcastLocal.title, maxLines: 2, overflow: TextOverflow.ellipsis, - style: Theme.of(context) - .textTheme - .headline5 - .copyWith(color: Colors.white), + style: context.textTheme.headline5.copyWith(color: Colors.white), ), ), ); @@ -821,7 +818,6 @@ class _PodcastDetailState extends State { filter: _filter, query: _query), builder: (context, snapshot) { - if (snapshot.hasError) print(snapshot.error); return (snapshot.hasData) ? EpisodeGrid( episodes: snapshot.data, diff --git a/lib/podcasts/podcast_group.dart b/lib/podcasts/podcast_group.dart index 5937861..cfe3e9d 100644 --- a/lib/podcasts/podcast_group.dart +++ b/lib/podcasts/podcast_group.dart @@ -289,7 +289,6 @@ class _PodcastCardState extends State setState(() { if (!value) { _selectedGroups.remove(group); - print(group.name); } else { _selectedGroups.add(group); } @@ -313,7 +312,6 @@ class _PodcastCardState extends State ), IconButton( onPressed: () async { - print(_selectedGroups); if (_selectedGroups.length > 0) { setState(() { _addGroup = false; diff --git a/lib/service/ompl_build.dart b/lib/service/ompl_build.dart index 5f91de9..f13e22c 100644 --- a/lib/service/ompl_build.dart +++ b/lib/service/ompl_build.dart @@ -1,3 +1,4 @@ +import 'dart:developer' as developer; import 'dart:io'; import 'package:xml/xml.dart' as xml; @@ -60,7 +61,7 @@ class PodcastsBackup { var content = xml.XmlDocument.parse(opml); var title = content.findAllElements('head').first.findElements('title').first.text; - print(title); + developer.log(title, name: 'Import OMPL'); var groups = content.findAllElements('body').first.findElements('outline'); if (title != 'Tsacdop Feed Groups') { var total = content @@ -68,7 +69,6 @@ class PodcastsBackup { .map((ele) => OmplOutline.parse(ele)) .toList(); data['Home'] = total; - print(data.toString()); return data; } @@ -80,7 +80,6 @@ class PodcastsBackup { .toList(); data[title] = total; } - print(data.toString()); return data; } } diff --git a/lib/settings/data_backup.dart b/lib/settings/data_backup.dart index a3c935e..15fc2ba 100644 --- a/lib/settings/data_backup.dart +++ b/lib/settings/data_backup.dart @@ -1,4 +1,5 @@ import 'dart:convert'; +import 'dart:developer' as developer; import 'dart:io'; import 'package:file_picker/file_picker.dart'; @@ -80,7 +81,7 @@ class _DataBackupState extends State { gravity: ToastGravity.BOTTOM, ); } catch (e) { - print(e); + developer.log(e, name: 'Import settings'); Fluttertoast.showToast( msg: s.toastFileError, gravity: ToastGravity.BOTTOM, @@ -95,14 +96,13 @@ class _DataBackupState extends State { if (filePath == '') { return; } - print('File Path$filePath'); Fluttertoast.showToast( msg: s.toastReadFile, gravity: ToastGravity.BOTTOM, ); _importSetting(filePath, context); } on PlatformException catch (e) { - print(e.toString()); + developer.log(e.toString(), name: 'Get file path'); } } diff --git a/lib/settings/downloads_manage.dart b/lib/settings/downloads_manage.dart index 832bb08..e844898 100644 --- a/lib/settings/downloads_manage.dart +++ b/lib/settings/downloads_manage.dart @@ -44,7 +44,6 @@ class _DownloadsManageState extends State { _size = 0; _fileNum = 0; var dir = await getExternalStorageDirectory(); - print(dir.path); dir.list().forEach((d) { var fileDir = Directory(d.path); fileDir.list().forEach((file) async { diff --git a/lib/settings/history.dart b/lib/settings/history.dart index 9c8b3b1..4f2dca3 100644 --- a/lib/settings/history.dart +++ b/lib/settings/history.dart @@ -1,3 +1,5 @@ +import 'dart:developer' as developer; + import 'package:dio/dio.dart'; import 'package:fl_chart/fl_chart.dart'; import 'package:flutter/material.dart'; @@ -84,8 +86,8 @@ class _PlayedHistoryState extends State var item = SubscribeItem(podcast.rss, podcast.title, imgUrl: podcast.image, group: 'Home'); subscribeWorker.setSubscribeItem(item); - } on DioError catch (e) { - print(e); + } catch (e) { + developer.log(e.toString(), name: 'Recover podcast error'); Fluttertoast.showToast( msg: context.s.toastRecoverFailed, gravity: ToastGravity.BOTTOM, diff --git a/lib/state/audio_state.dart b/lib/state/audio_state.dart index cb3bafa..08bc5f1 100644 --- a/lib/state/audio_state.dart +++ b/lib/state/audio_state.dart @@ -282,7 +282,6 @@ class AudioPlayerNotifier extends ChangeNotifier { Future episodeLoad(EpisodeBrief episode, {int startPosition = 0}) async { - print(episode.enclosureUrl); final episodeNew = await dbHelper.getRssItemWithUrl(episode.enclosureUrl); //TODO load episode from last position when player running if (playerRunning) { @@ -434,7 +433,6 @@ class AudioPlayerNotifier extends ChangeNotifier { AudioService.customEventStream.distinct().listen((event) async { if (event is String && _episode.title == event) { - print(event); _queue.delFromPlaylist(_episode); _lastPostion = 0; notifyListeners(); diff --git a/lib/state/download_state.dart b/lib/state/download_state.dart index fcf29f5..aaf40c8 100644 --- a/lib/state/download_state.dart +++ b/lib/state/download_state.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:developer' as developer; import 'dart:io'; import 'dart:isolate'; import 'dart:ui'; @@ -27,13 +28,14 @@ class EpisodeTask { } void downloadCallback(String id, DownloadTaskStatus status, int progress) { - print('Homepage callback task in $id status ($status) $progress'); + developer.log('Homepage callback task in $id status ($status) $progress'); final send = IsolateNameServer.lookupPortByName('downloader_send_port'); send.send([id, status, progress]); } void autoDownloadCallback(String id, DownloadTaskStatus status, int progress) { - print('Autodownload callback task in $id status ($status) $progress'); + developer + .log('Autodownload callback task in $id status ($status) $progress'); final send = IsolateNameServer.lookupPortByName('auto_downloader_send_port'); send.send([id, status, progress]); } @@ -56,7 +58,6 @@ class AutoDownloader { bindBackgroundIsolate(); return; } - print('start listen'); _port.listen((dynamic data) { String id = data[0]; DownloadTaskStatus status = data[1]; @@ -206,7 +207,6 @@ class DownloadState extends ChangeNotifier { query: "SELECT * FROM task WHERE task_id = '${episodeTask.taskId}'"); var filePath = 'file://${path.join(completeTask.first.savedDir, Uri.encodeComponent(completeTask.first.filename))}'; - print(filePath); var fileStat = await File( path.join(completeTask.first.savedDir, completeTask.first.filename)) .stat(); @@ -325,7 +325,7 @@ class DownloadState extends ChangeNotifier { } _autoDelete() async { - print('Start auto delete outdated episodes'); + developer.log('Start auto delete outdated episodes'); var autoDeleteStorage = KeyValueStorage(autoDeleteKey); var autoDelete = await autoDeleteStorage.getInt(); if (autoDelete == 0) { diff --git a/lib/state/podcast_group.dart b/lib/state/podcast_group.dart index 8d67b94..08a3f8c 100644 --- a/lib/state/podcast_group.dart +++ b/lib/state/podcast_group.dart @@ -1,4 +1,5 @@ import 'dart:core'; +import 'dart:developer' as developer; import 'dart:io'; import 'dart:isolate'; import 'dart:math' as math; @@ -445,7 +446,6 @@ Future subIsolateEntryPoint(SendPort sendPort) async { connectTimeout: 20000, receiveTimeout: 20000, ); - print(rss); try { var response = await Dio(options).get(rss); @@ -495,7 +495,7 @@ Future subIsolateEntryPoint(SendPort sendPort) async { var image = img.decodeImage(imageResponse.data); thumbnail = img.copyResize(image, width: 300); } catch (e) { - print(e); + developer.log(e.toString(), name: 'Download image error'); try { var index = math.Random().nextInt(3); var imageResponse = await Dio().get>( @@ -506,7 +506,7 @@ Future subIsolateEntryPoint(SendPort sendPort) async { "${listColor[index]}&color=fff&name=${item.title}&length=2&bold=true"; thumbnail = img.decodeImage(imageResponse.data); } catch (e) { - print(e); + developer.log(e.toString(), name: 'Donwload image error'); sendPort.send([item.title, item.url, 6]); await Future.delayed(Duration(seconds: 2)); sendPort.send([item.title, item.url, 4]); @@ -539,7 +539,7 @@ Future subIsolateEntryPoint(SendPort sendPort) async { try { await data.fatchData(); } catch (e) { - print(e); + developer.log(e.toString(), name: 'Fatch fireside data error'); } } await dbHelper.savePodcastRss(p, uuid); @@ -567,7 +567,7 @@ Future subIsolateEntryPoint(SendPort sendPort) async { } } } catch (e) { - print('$e confirm'); + developer.log('$e confirm'); sendPort.send([item.title, item.url, 6]); await Future.delayed(Duration(seconds: 2)); sendPort.send([item.title, item.url, 4]); diff --git a/lib/state/refresh_podcast.dart b/lib/state/refresh_podcast.dart index e8b5a4e..4fa002b 100644 --- a/lib/state/refresh_podcast.dart +++ b/lib/state/refresh_podcast.dart @@ -1,3 +1,4 @@ +import 'dart:developer' as developer; import 'dart:isolate'; import 'package:flutter/material.dart'; @@ -74,7 +75,7 @@ Future refreshIsolateEntryPoint(SendPort sendPort) async { for (var podcastLocal in podcastList) { sendPort.send([podcastLocal.title, 1]); var updateCount = await dbHelper.updatePodcastRss(podcastLocal); - print('Refresh ${podcastLocal.title}$updateCount'); + developer.log('Refresh ${podcastLocal.title}$updateCount'); } sendPort.send("done"); } diff --git a/lib/state/setting_state.dart b/lib/state/setting_state.dart index a52aa43..adb706d 100644 --- a/lib/state/setting_state.dart +++ b/lib/state/setting_state.dart @@ -1,3 +1,4 @@ +import 'dart:developer' as developer; import 'dart:io'; import 'dart:ui'; @@ -25,7 +26,7 @@ void callbackDispatcher() { var lastWork = await lastWorkStorage.getInt(); for (var podcastLocal in podcastList) { await dbHelper.updatePodcastRss(podcastLocal, removeMark: lastWork); - print('Refresh ${podcastLocal.title}'); + developer.log('Refresh ${podcastLocal.title}'); } await FlutterDownloader.initialize(); var downloader = AutoDownloader(); @@ -140,12 +141,12 @@ class SettingState extends ChangeNotifier { constraints: Constraints( networkType: NetworkType.connected, )); - print('work manager init done + '); + developer.log('work manager init done + '); } Future cancelWork() async { await Workmanager.cancelAll(); - print('work job cancelled'); + developer.log('work job cancelled'); } Color _accentSetColor; @@ -348,7 +349,6 @@ class SettingState extends ChangeNotifier { _locale = Locale(localeString.first, localeString[1]); } await S.load(_locale); - print(_locale.toString()); } Future _saveAccentSetColor() async { diff --git a/lib/type/fireside_data.dart b/lib/type/fireside_data.dart index 26a8da1..da60196 100644 --- a/lib/type/fireside_data.dart +++ b/lib/type/fireside_data.dart @@ -41,8 +41,6 @@ class FiresideData { PodcastHost host; var name = element.text.trim(); var image = element.children.first.children.first.attributes.toString(); - print(reg.stringMatch(image)); - host = PodcastHost( name, reg.stringMatch(image) ?? diff --git a/lib/type/playlist.dart b/lib/type/playlist.dart index 9c1b865..fda4f28 100644 --- a/lib/type/playlist.dart +++ b/lib/type/playlist.dart @@ -55,7 +55,6 @@ class Playlist { var index = _playlist.indexOf(episodeBrief); _playlist.removeWhere( (episode) => episode.enclosureUrl == episodeBrief.enclosureUrl); - print('delete${episodeBrief.title}'); await savePlaylist(); return index; } diff --git a/lib/util/extension_helper.dart b/lib/util/extension_helper.dart index 1f2b747..9d16459 100644 --- a/lib/util/extension_helper.dart +++ b/lib/util/extension_helper.dart @@ -1,4 +1,5 @@ import 'dart:convert'; +import 'dart:developer' as developer; import 'package:flutter/material.dart'; import 'package:fluttertoast/fluttertoast.dart'; @@ -63,7 +64,7 @@ extension StringExtension on String { if (await canLaunch(this)) { await launch(this); } else { - print('Could not launch $this'); + developer.log('Could not launch $this'); Fluttertoast.showToast( msg: '$this Invalid Link', gravity: ToastGravity.TOP,