Made Settings persistent with autosave

This commit is contained in:
2023-06-03 23:26:18 +02:00
parent e26a1e9598
commit 3f05f68ac1
9 changed files with 253 additions and 156 deletions

View File

@ -21,6 +21,7 @@ class App extends StatefulWidget {
class _AppState extends State<App> {
int currentPage = 0;
late Timer refetchChats;
@override
void initState() {
@ -29,7 +30,8 @@ class _AppState extends State<App> {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
Provider.of<ChatListProps>(context, listen: false).run();
});
Timer.periodic(const Duration(minutes: 1), (timer) {
refetchChats = Timer.periodic(const Duration(minutes: 1), (timer) {
if(!context.mounted) return;
Provider.of<ChatListProps>(context, listen: false).run();
});
@ -101,4 +103,10 @@ class _AppState extends State<App> {
);
}
@override
void dispose() {
refetchChats.cancel();
super.dispose();
}
}