Added automatic refresh (every 60s) of chatList.dart and periodic timestamp updates (every 30s)
This commit is contained in:
parent
97551738b0
commit
cee122602f
@ -1,5 +1,4 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:marianum_mobile/api/marianumcloud/talk/chat/getChat.dart';
|
||||
import 'package:marianum_mobile/api/marianumcloud/talk/chat/getChatParams.dart';
|
||||
@ -15,7 +14,6 @@ class GetChatCache extends RequestCache<GetChatResponse> {
|
||||
|
||||
@override
|
||||
Future<GetChatResponse> onLoad() {
|
||||
log("LOAD");
|
||||
return GetChat(
|
||||
chatToken,
|
||||
GetChatParams(
|
||||
|
@ -1,4 +1,5 @@
|
||||
|
||||
import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:jiffy/jiffy.dart';
|
||||
import 'package:marianum_mobile/api/marianumcloud/talk/room/getRoomResponse.dart';
|
||||
@ -22,6 +23,13 @@ class _ChatListState extends State<ChatList> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
Timer.periodic(const Duration(seconds: 30), (Timer t) => {
|
||||
setState((){}),
|
||||
});
|
||||
Timer.periodic(const Duration(minutes: 1), (timer) {
|
||||
Provider.of<ChatListProps>(context, listen: false).run();
|
||||
});
|
||||
|
||||
SharedPreferences.getInstance().then((value) => {
|
||||
username = value.getString("username")!
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user