diff --git a/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
new file mode 100644
index 0000000..18d9810
--- /dev/null
+++ b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
@@ -0,0 +1,8 @@
+
+
+
+
+ IDEDidComputeMac32BitWarning
+
+
+
diff --git a/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
new file mode 100644
index 0000000..f9b0d7c
--- /dev/null
+++ b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
@@ -0,0 +1,8 @@
+
+
+
+
+ PreviewsEnabled
+
+
+
diff --git a/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
new file mode 100644
index 0000000..f9b0d7c
--- /dev/null
+++ b/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
@@ -0,0 +1,8 @@
+
+
+
+
+ PreviewsEnabled
+
+
+
diff --git a/lib/home/about.dart b/lib/home/about.dart
index ac4e88e..47d43b7 100644
--- a/lib/home/about.dart
+++ b/lib/home/about.dart
@@ -191,15 +191,6 @@ class AboutApp extends StatelessWidget {
'https://github.com/stonega'),
_listItem(context, 'Medium', LineIcons.medium,
'https://medium.com/@stonegate'),
- Padding(
- padding: EdgeInsets.fromLTRB(20, 10, 20, 10),
- child: Text(
- 'I need to pay for podcast search API and '
- 'always get headache without caffeine.',
- textAlign: TextAlign.center,
- style: TextStyle(color: Colors.grey[500]),
- ),
- ),
Center(
child: SizedBox(
width: 200,
@@ -221,7 +212,6 @@ class AboutApp extends StatelessWidget {
children: [
Text('Buy me a coffee',
style: TextStyle(
- color: context.accentColor,
fontWeight: FontWeight.bold)),
SizedBox(width: 10),
Image(
@@ -236,6 +226,15 @@ class AboutApp extends StatelessWidget {
),
),
),
+ Padding(
+ padding: EdgeInsets.fromLTRB(20, 10, 20, 10),
+ child: Text(
+ 'I need to pay for podcast search API and '
+ 'always get headache without caffeine.',
+ textAlign: TextAlign.center,
+ style: TextStyle(color: Colors.grey[500]),
+ ),
+ ),
],
),
),
diff --git a/lib/home/pocast_discovery.dart b/lib/home/pocast_discovery.dart
index db28edd..805c710 100644
--- a/lib/home/pocast_discovery.dart
+++ b/lib/home/pocast_discovery.dart
@@ -390,7 +390,6 @@ class __TopPodcastListState extends State<_TopPodcastList> {
() {
_loading = true;
_page++;
- print(_page);
_searchFuture = _getTopPodcasts(
genre: widget.genre, page: _page);
},
diff --git a/lib/service/gpodder_api.dart b/lib/service/gpodder_api.dart
index 3177ed1..3f19f0c 100644
--- a/lib/service/gpodder_api.dart
+++ b/lib/service/gpodder_api.dart
@@ -194,7 +194,6 @@ class Gpodder {
final timeStamp = changes['timestamp'];
final addList = changes['add'].cast();
final removeList = changes['remove'].cast();
- print(removeList);
await _storage.saveStringList([username, deviceId, timeStamp.toString()]);
await _remoteAddStorage.addList(addList);
await _remoteRemoveStorage.addList(removeList);
diff --git a/lib/settings/data_backup.dart b/lib/settings/data_backup.dart
index 8d92d72..a9ff7ab 100644
--- a/lib/settings/data_backup.dart
+++ b/lib/settings/data_backup.dart
@@ -12,8 +12,6 @@ import 'package:line_icons/line_icons.dart';
import 'package:path/path.dart' as path;
import 'package:path_provider/path_provider.dart';
import 'package:provider/provider.dart';
-import 'package:tsacdop/util/custom_widget.dart';
-import 'package:tuple/tuple.dart';
import 'package:wc_flutter_share/wc_flutter_share.dart';
import '../local_storage/key_value_storage.dart';
@@ -23,6 +21,7 @@ import '../service/opml_build.dart';
import '../state/podcast_group.dart';
import '../state/setting_state.dart';
import '../type/settings_backup.dart';
+import '../util/custom_widget.dart';
import '../util/extension_helper.dart';
class DataBackup extends StatefulWidget {
@@ -151,9 +150,11 @@ class _DataBackupState extends State {
}
Future _syncNow() async {
- setState(() {
- _syncing = true;
- });
+ if (mounted) {
+ setState(() {
+ _syncing = true;
+ });
+ }
final gpodder = Gpodder();
final status = await gpodder.getChanges();
@@ -169,10 +170,12 @@ class _DataBackupState extends State {
}
}
- Future> _getSyncStatus() async {
- final syncDateTime = await KeyValueStorage(gpodderSyncDateTimeKey).getInt();
- final statusIndex = await KeyValueStorage(gpodderSyncStatusKey).getInt();
- return Tuple2(syncDateTime, statusIndex);
+ Future> _getSyncStatus() async {
+ var dateTimeStorage = KeyValueStorage(gpodderSyncDateTimeKey);
+ var statusStorage = KeyValueStorage(gpodderSyncStatusKey);
+ final syncDateTime = await dateTimeStorage.getInt();
+ final statusIndex = await statusStorage.getInt();
+ return [syncDateTime, statusIndex];
}
@override
@@ -186,228 +189,167 @@ class _DataBackupState extends State {
Theme.of(context).accentColorBrightness,
),
child: Scaffold(
- appBar: AppBar(
- elevation: 0,
- title: Text(s.settingsBackup),
- backgroundColor: context.primaryColor,
- ),
- body: Column(
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Padding(
- padding: EdgeInsets.all(10.0),
- ),
- FutureBuilder>(
- future: _getLoginInfo(),
- initialData: [],
- builder: (context, snapshot) {
- final loginInfo = snapshot.data;
- return Container(
- height: 160,
- width: double.infinity,
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- Stack(
- children: [
- Hero(
- tag: 'gpodder.net',
- child: CircleAvatar(
- minRadius: 40,
- backgroundColor: context.primaryColor,
- child: SizedBox(
- height: 60,
- width: 60,
- child: Image.asset('assets/gpodder.png')),
- ),
+ appBar: AppBar(
+ elevation: 0,
+ title: Text(s.settingsBackup),
+ backgroundColor: context.primaryColor,
+ ),
+ body: Column(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Padding(
+ padding: EdgeInsets.all(10.0),
+ ),
+ FutureBuilder>(
+ future: _getLoginInfo(),
+ initialData: [],
+ builder: (context, snapshot) {
+ final loginInfo = snapshot.data;
+ return Container(
+ height: 160,
+ width: double.infinity,
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ Stack(
+ children: [
+ Hero(
+ tag: 'gpodder.net',
+ child: CircleAvatar(
+ minRadius: 40,
+ backgroundColor: context.primaryColor,
+ child: SizedBox(
+ height: 60,
+ width: 60,
+ child: Image.asset('assets/gpodder.png')),
),
- if (_syncing)
- Positioned(
- left: context.width / 2 - 40,
- child: SizedBox(
- height: 80,
- width: 80,
- child: CircularProgressIndicator(
- strokeWidth: 1,
- ),
- ),
- ),
- if (_syncing)
- Positioned(
- bottom: 39,
- left: context.width / 2 - 12,
- child: _OpenEye()),
- if (_syncing)
- Positioned(
- bottom: 39,
- left: context.width / 2 + 3,
- child: _OpenEye()),
- ],
- ),
- Text(
- loginInfo.isEmpty
- ? s.intergateWith('gpodder.net')
- : s.loggedInAs(loginInfo.first),
- style: TextStyle(color: Colors.purple[700])),
- ButtonTheme(
- height: 32,
- child: OutlineButton(
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(100.0),
- side: BorderSide(color: Colors.purple[700])),
- highlightedBorderColor: Colors.purple[700],
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- Icon(
- LineIcons.user,
- color: Colors.purple[700],
- size: context.textTheme.headline6.fontSize,
- ),
- SizedBox(width: 10),
- Text(loginInfo.isEmpty ? s.login : s.logout,
- style:
- TextStyle(color: Colors.purple[700])),
- ],
- ),
- onPressed: () {
- if (loginInfo.isEmpty) {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (context) => _LoginGpodder(),
- fullscreenDialog: true));
- } else {
- _logout();
- }
- },
),
- ),
- ],
- ),
- );
- }),
- FutureBuilder>(
- future: _getLoginInfo(),
- initialData: [],
- builder: (context, snapshot) {
- final loginInfo = snapshot.data;
- if (loginInfo.isNotEmpty) {
- return ListTile(
- contentPadding:
- const EdgeInsets.only(left: 70.0, right: 20),
- onTap: _syncNow,
- title: Text(s.syncNow),
- subtitle: FutureBuilder>(
- future: _getSyncStatus(),
- initialData: Tuple2(0, 0),
- builder: (context, snapshot) {
- final dateTime = snapshot.data.item1;
- final status = snapshot.data.item2;
- return Wrap(
- children: [
- Text(
- '${s.lastUpdate}: ${dateTime.toDate(context)}'),
- SizedBox(width: 8),
- Text('${s.status}: '),
- _syncStauts(status),
- ],
- );
- }),
- );
- }
- return Center();
- }),
- Divider(height: 1),
- Container(
- height: 30.0,
- padding: EdgeInsets.fromLTRB(70, 0, 70, 0),
- alignment: Alignment.centerLeft,
- child: Text(s.subscribe,
- style: context.textTheme.bodyText1
- .copyWith(color: context.accentColor)),
- ),
- Padding(
- padding:
- EdgeInsets.only(left: 70.0, right: 20, top: 10, bottom: 10),
- child: Text(s.subscribeExportDes),
- ),
- Padding(
- padding: EdgeInsets.only(left: 70.0, right: 20),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.start,
- children: [
- ButtonTheme(
- height: 32,
- child: OutlineButton(
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(100.0),
- side: BorderSide(color: Colors.green[700])),
- highlightedBorderColor: Colors.green[700],
- child: Row(
- children: [
- Icon(
- LineIcons.save,
- color: Colors.green[700],
- size: context.textTheme.headline6.fontSize,
+ if (_syncing)
+ Positioned(
+ left: context.width / 2 - 40,
+ child: SizedBox(
+ height: 80,
+ width: 80,
+ child: CircularProgressIndicator(
+ strokeWidth: 1,
+ ),
+ ),
),
- SizedBox(width: 10),
- Text(s.save,
- style: TextStyle(color: Colors.green[700])),
- ],
+ if (_syncing)
+ Positioned(
+ bottom: 39,
+ left: context.width / 2 - 12,
+ child: _OpenEye()),
+ if (_syncing)
+ Positioned(
+ bottom: 39,
+ left: context.width / 2 + 3,
+ child: _OpenEye()),
+ ],
+ ),
+ Text(
+ loginInfo.isEmpty
+ ? s.intergateWith('gpodder.net')
+ : s.loggedInAs(loginInfo.first),
+ style: TextStyle(color: Colors.purple[700])),
+ ButtonTheme(
+ height: 32,
+ child: OutlineButton(
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(100.0),
+ side: BorderSide(color: Colors.purple[700])),
+ highlightedBorderColor: Colors.purple[700],
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Icon(
+ LineIcons.user,
+ color: Colors.purple[700],
+ size: context.textTheme.headline6.fontSize,
+ ),
+ SizedBox(width: 10),
+ Text(loginInfo.isEmpty ? s.login : s.logout,
+ style:
+ TextStyle(color: Colors.purple[700])),
+ ],
+ ),
+ onPressed: () {
+ if (loginInfo.isEmpty) {
+ Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (context) => _LoginGpodder(),
+ fullscreenDialog: true));
+ } else {
+ _logout();
+ }
+ },
),
- onPressed: () async {
- var file = await _exportOmpl(context);
- await _saveFile(file);
- }),
+ ),
+ ],
),
- SizedBox(width: 10),
- ButtonTheme(
- height: 32,
- child: OutlineButton(
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(100.0),
- side: BorderSide(color: Colors.blue[700])),
- highlightedBorderColor: Colors.blue[700],
- child: Row(
- children: [
- Icon(
- Icons.share,
- size: context.textTheme.headline6.fontSize,
- color: Colors.blue[700],
- ),
- SizedBox(width: 10),
- Text(s.share,
- style: TextStyle(color: Colors.blue[700])),
- ],
- ),
- onPressed: () async {
- var file = await _exportOmpl(context);
- await _shareFile(file);
+ );
+ }),
+ FutureBuilder>(
+ future: _getLoginInfo(),
+ initialData: [],
+ builder: (context, snapshot) {
+ final loginInfo = snapshot.data;
+ if (loginInfo.isNotEmpty) {
+ return ListTile(
+ contentPadding:
+ const EdgeInsets.only(left: 70.0, right: 20),
+ onTap: _syncNow,
+ title: Text(s.syncNow),
+ subtitle: FutureBuilder>(
+ future: _getSyncStatus(),
+ initialData: [0, 0],
+ builder: (context, snapshot) {
+ final dateTime = snapshot.data[0];
+ final status = snapshot.data[1];
+ return Wrap(
+ children: [
+ Text(
+ '${s.lastUpdate}: ${dateTime.toDate(context)}'),
+ SizedBox(width: 8),
+ Text('${s.status}: '),
+ _syncStauts(status),
+ ],
+ );
}),
- )
- ],
- ),
- ),
- Divider(),
- Container(
- height: 30.0,
- padding: EdgeInsets.symmetric(horizontal: 70),
- alignment: Alignment.centerLeft,
- child: Text(s.settings,
- style: context.textTheme.bodyText1
- .copyWith(color: Theme.of(context).accentColor)),
- ),
- Padding(
- padding:
- EdgeInsets.only(left: 70.0, right: 20, top: 10, bottom: 10),
- child: Text(s.settingsExportDes),
- ),
- Padding(
- padding: EdgeInsets.only(left: 70.0, right: 10),
- child: Wrap(children: [
+ );
+ }
+ return Center();
+ }),
+ // ListTile(
+ // onTap: () async {
+ // final subscribeWorker = context.read();
+ // await subscribeWorker.cancelWork();
+ // subscribeWorker.setWorkManager();
+ // },
+ // title: Text('reset'),
+ // ),
+ Divider(height: 1),
+ Container(
+ height: 30.0,
+ padding: EdgeInsets.fromLTRB(70, 0, 70, 0),
+ alignment: Alignment.centerLeft,
+ child: Text(s.subscribe,
+ style: context.textTheme.bodyText1
+ .copyWith(color: context.accentColor)),
+ ),
+ Padding(
+ padding:
+ EdgeInsets.only(left: 70.0, right: 20, top: 10, bottom: 10),
+ child: Text(s.subscribeExportDes),
+ ),
+ Padding(
+ padding: EdgeInsets.only(left: 70.0, right: 20),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ children: [
ButtonTheme(
height: 32,
child: OutlineButton(
@@ -416,7 +358,6 @@ class _DataBackupState extends State {
side: BorderSide(color: Colors.green[700])),
highlightedBorderColor: Colors.green[700],
child: Row(
- mainAxisSize: MainAxisSize.min,
children: [
Icon(
LineIcons.save,
@@ -429,7 +370,7 @@ class _DataBackupState extends State {
],
),
onPressed: () async {
- var file = await _exportSetting(context);
+ var file = await _exportOmpl(context);
await _saveFile(file);
}),
),
@@ -442,7 +383,6 @@ class _DataBackupState extends State {
side: BorderSide(color: Colors.blue[700])),
highlightedBorderColor: Colors.blue[700],
child: Row(
- mainAxisSize: MainAxisSize.min,
children: [
Icon(
Icons.share,
@@ -455,41 +395,113 @@ class _DataBackupState extends State {
],
),
onPressed: () async {
- var file = await _exportSetting(context);
+ var file = await _exportOmpl(context);
await _shareFile(file);
}),
- ),
- SizedBox(width: 10),
- ButtonTheme(
- height: 32,
- child: OutlineButton(
- highlightedBorderColor: Colors.red[700],
+ )
+ ],
+ ),
+ ),
+ Divider(),
+ Container(
+ height: 30.0,
+ padding: EdgeInsets.symmetric(horizontal: 70),
+ alignment: Alignment.centerLeft,
+ child: Text(s.settings,
+ style: context.textTheme.bodyText1
+ .copyWith(color: Theme.of(context).accentColor)),
+ ),
+ Padding(
+ padding:
+ EdgeInsets.only(left: 70.0, right: 20, top: 10, bottom: 10),
+ child: Text(s.settingsExportDes),
+ ),
+ Padding(
+ padding: EdgeInsets.only(left: 70.0, right: 10),
+ child: Wrap(children: [
+ ButtonTheme(
+ height: 32,
+ child: OutlineButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(100.0),
- side: BorderSide(color: Colors.red[700])),
+ side: BorderSide(color: Colors.green[700])),
+ highlightedBorderColor: Colors.green[700],
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
- LineIcons.paperclip_solid,
+ LineIcons.save,
+ color: Colors.green[700],
size: context.textTheme.headline6.fontSize,
- color: Colors.red[700],
),
SizedBox(width: 10),
- Text(s.import,
- style: TextStyle(color: Colors.red[700])),
+ Text(s.save,
+ style: TextStyle(color: Colors.green[700])),
],
),
- onPressed: () {
- _getFilePath(context);
- },
+ onPressed: () async {
+ var file = await _exportSetting(context);
+ await _saveFile(file);
+ }),
+ ),
+ SizedBox(width: 10),
+ ButtonTheme(
+ height: 32,
+ child: OutlineButton(
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(100.0),
+ side: BorderSide(color: Colors.blue[700])),
+ highlightedBorderColor: Colors.blue[700],
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Icon(
+ Icons.share,
+ size: context.textTheme.headline6.fontSize,
+ color: Colors.blue[700],
+ ),
+ SizedBox(width: 10),
+ Text(s.share,
+ style: TextStyle(color: Colors.blue[700])),
+ ],
+ ),
+ onPressed: () async {
+ var file = await _exportSetting(context);
+ await _shareFile(file);
+ }),
+ ),
+ SizedBox(width: 10),
+ ButtonTheme(
+ height: 32,
+ child: OutlineButton(
+ highlightedBorderColor: Colors.red[700],
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(100.0),
+ side: BorderSide(color: Colors.red[700])),
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Icon(
+ LineIcons.paperclip_solid,
+ size: context.textTheme.headline6.fontSize,
+ color: Colors.red[700],
+ ),
+ SizedBox(width: 10),
+ Text(s.import,
+ style: TextStyle(color: Colors.red[700])),
+ ],
),
+ onPressed: () {
+ _getFilePath(context);
+ },
),
- ]),
- ),
- Divider(height: 1)
- ],
- )),
+ ),
+ ]),
+ ),
+ Divider(height: 1)
+ ],
+ ),
+ ),
);
}
}
@@ -634,7 +646,7 @@ class __LoginGpodderState extends State<_LoginGpodder> {
}
}
await subscribeWorker.cancelWork();
- subscribeWorker.setWorkManager(4);
+ subscribeWorker.setWorkManager();
}
String _validateName(String value) {
@@ -750,6 +762,8 @@ class __LoginGpodderState extends State<_LoginGpodder> {
child: Text(
s.gpodderLoginDes,
textAlign: TextAlign.center,
+ style:
+ context.textTheme.subtitle1.copyWith(height: 2),
),
),
Center(
diff --git a/lib/settings/languages.dart b/lib/settings/languages.dart
index dd550d6..272d18f 100644
--- a/lib/settings/languages.dart
+++ b/lib/settings/languages.dart
@@ -107,7 +107,7 @@ class _LanguagesSettingState extends State {
),
Divider(height: 1),
ListTile(
- title: Text('português'),
+ title: Text('Português'),
onTap: () => _setLocale(Locale('pt')),
contentPadding: const EdgeInsets.only(left: 20, right: 20),
trailing: Radio(
diff --git a/lib/state/podcast_group.dart b/lib/state/podcast_group.dart
index 39de481..6cfaa7a 100644
--- a/lib/state/podcast_group.dart
+++ b/lib/state/podcast_group.dart
@@ -30,6 +30,7 @@ void callbackDispatcher() {
final status = await gpodder.getChanges();
if (status == 200) {
await gpodder.updateChange();
+ developer.log('Gpodder sync successfully');
}
return Future.value(true);
});
@@ -310,14 +311,14 @@ class GroupList extends ChangeNotifier {
}
}
- void setWorkManager(int hour) {
+ void setWorkManager() {
Workmanager.initialize(
callbackDispatcher,
isInDebugMode: false,
);
Workmanager.registerPeriodicTask("2", "gpodder_sync",
- frequency: Duration(hours: hour),
- initialDelay: Duration(seconds: 10),
+ frequency: Duration(hours: 4),
+ initialDelay: Duration(seconds: 1),
constraints: Constraints(
networkType: NetworkType.connected,
));