mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-26 06:49:22 +00:00
Fix refresh issue when conversation has been closed
This commit is contained in:
parent
32c15ae915
commit
910b8188ae
@ -64,8 +64,7 @@ class _ConversationScreenState extends State<ConversationScreen> {
|
|||||||
void deactivate() {
|
void deactivate() {
|
||||||
super.deactivate();
|
super.deactivate();
|
||||||
|
|
||||||
if(_refreshTime != null)
|
if (_refreshTime != null) _refreshTime.cancel();
|
||||||
_refreshTime.cancel();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _setError(ErrorLevel err) => setState(() => _error = err);
|
void _setError(ErrorLevel err) => setState(() => _error = err);
|
||||||
@ -94,6 +93,8 @@ class _ConversationScreenState extends State<ConversationScreen> {
|
|||||||
|
|
||||||
/// Load a list of messages
|
/// Load a list of messages
|
||||||
Future<void> _loadMessages(bool online) async {
|
Future<void> _loadMessages(bool online) async {
|
||||||
|
if (!mounted) return;
|
||||||
|
|
||||||
//First, get the messages
|
//First, get the messages
|
||||||
final messages = await _conversationsHelper.getNewMessages(
|
final messages = await _conversationsHelper.getNewMessages(
|
||||||
conversationID: widget.conversationID,
|
conversationID: widget.conversationID,
|
||||||
@ -417,27 +418,27 @@ class _ConversationScreenState extends State<ConversationScreen> {
|
|||||||
final choice = await showDialog<bool>(
|
final choice = await showDialog<bool>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (c) => AlertDialog(
|
builder: (c) => AlertDialog(
|
||||||
title: Text(tr("Confirm deletion")),
|
title: Text(tr("Confirm deletion")),
|
||||||
content: Text(
|
content: Text(
|
||||||
tr("Do you really want to delete this message ? The operation can not be cancelled !"),
|
tr("Do you really want to delete this message ? The operation can not be cancelled !"),
|
||||||
textAlign: TextAlign.justify,
|
textAlign: TextAlign.justify,
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
FlatButton(
|
||||||
|
child: Text(
|
||||||
|
tr("Cancel").toUpperCase(),
|
||||||
),
|
),
|
||||||
actions: <Widget>[
|
onPressed: () => Navigator.pop(c, false),
|
||||||
FlatButton(
|
|
||||||
child: Text(
|
|
||||||
tr("Cancel").toUpperCase(),
|
|
||||||
),
|
|
||||||
onPressed: () => Navigator.pop(c, false),
|
|
||||||
),
|
|
||||||
FlatButton(
|
|
||||||
child: Text(
|
|
||||||
tr("Confirm").toUpperCase(),
|
|
||||||
style: TextStyle(color: Colors.red),
|
|
||||||
),
|
|
||||||
onPressed: () => Navigator.pop(c, true),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
|
FlatButton(
|
||||||
|
child: Text(
|
||||||
|
tr("Confirm").toUpperCase(),
|
||||||
|
style: TextStyle(color: Colors.red),
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.pop(c, true),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (choice == null || !choice) return;
|
if (choice == null || !choice) return;
|
||||||
|
Loading…
Reference in New Issue
Block a user