mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-05-25 10:32:13 +00:00
add missing mounted guards
This commit is contained in:
parent
fcb93830e1
commit
5722cb71bb
9 changed files with 14 additions and 1 deletions
|
|
@ -39,6 +39,7 @@ class _VerificationBadgeCompState extends State<VerificationBadgeComp> {
|
||||||
_streamAllVerified = twonlyDB.keyVerificationDao
|
_streamAllVerified = twonlyDB.keyVerificationDao
|
||||||
.watchAllGroupMembersVerified(widget.group!.groupId)
|
.watchAllGroupMembersVerified(widget.group!.groupId)
|
||||||
.listen((update) {
|
.listen((update) {
|
||||||
|
if (!mounted) return;
|
||||||
setState(() {
|
setState(() {
|
||||||
_isVerified = update;
|
_isVerified = update;
|
||||||
});
|
});
|
||||||
|
|
@ -47,6 +48,7 @@ class _VerificationBadgeCompState extends State<VerificationBadgeComp> {
|
||||||
_streamContactVerification = twonlyDB.keyVerificationDao
|
_streamContactVerification = twonlyDB.keyVerificationDao
|
||||||
.watchContactVerification(widget.contact!.userId)
|
.watchContactVerification(widget.contact!.userId)
|
||||||
.listen((update) {
|
.listen((update) {
|
||||||
|
if (!mounted) return;
|
||||||
setState(() {
|
setState(() {
|
||||||
_isVerified = update.isNotEmpty;
|
_isVerified = update.isNotEmpty;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,7 @@ class _UserListItem extends State<GroupListItemComp> {
|
||||||
_lastReactionStream = twonlyDB.reactionsDao
|
_lastReactionStream = twonlyDB.reactionsDao
|
||||||
.watchLastReactions(widget.group.groupId)
|
.watchLastReactions(widget.group.groupId)
|
||||||
.listen((update) {
|
.listen((update) {
|
||||||
|
if (!mounted) return;
|
||||||
setState(() {
|
setState(() {
|
||||||
_lastReaction = update;
|
_lastReaction = update;
|
||||||
});
|
});
|
||||||
|
|
@ -92,6 +93,7 @@ class _UserListItem extends State<GroupListItemComp> {
|
||||||
_lastMediaFilesStream = twonlyDB.mediaFilesDao
|
_lastMediaFilesStream = twonlyDB.mediaFilesDao
|
||||||
.watchNewestMediaFiles()
|
.watchNewestMediaFiles()
|
||||||
.listen((mediaFiles) {
|
.listen((mediaFiles) {
|
||||||
|
if (!mounted) return;
|
||||||
for (final mediaFile in mediaFiles) {
|
for (final mediaFile in mediaFiles) {
|
||||||
final index = _previewMediaFiles.indexWhere(
|
final index = _previewMediaFiles.indexWhere(
|
||||||
(t) => t.mediaId == mediaFile.mediaId,
|
(t) => t.mediaId == mediaFile.mediaId,
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,7 @@ class _ChatMessagesViewState extends State<ChatMessagesView> {
|
||||||
final groupStream = twonlyDB.groupsDao.watchGroup(widget.groupId);
|
final groupStream = twonlyDB.groupsDao.watchGroup(widget.groupId);
|
||||||
userSub = groupStream.listen((newGroup) {
|
userSub = groupStream.listen((newGroup) {
|
||||||
if (newGroup == null) return;
|
if (newGroup == null) return;
|
||||||
|
if (!mounted) return;
|
||||||
setState(() {
|
setState(() {
|
||||||
_group = newGroup;
|
_group = newGroup;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ class _AllReactionsViewState extends State<AllReactionsView> {
|
||||||
);
|
);
|
||||||
|
|
||||||
reactionsSub = stream.listen((update) {
|
reactionsSub = stream.listen((update) {
|
||||||
|
if (!mounted) return;
|
||||||
setState(() {
|
setState(() {
|
||||||
reactionsUsers = update;
|
reactionsUsers = update;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,7 @@ class _ChatListEntryState extends State<ChatListEntry> {
|
||||||
);
|
);
|
||||||
|
|
||||||
reactionsSub = stream.listen((update) {
|
reactionsSub = stream.listen((update) {
|
||||||
|
if (!mounted) return;
|
||||||
setState(() {
|
setState(() {
|
||||||
reactions = update;
|
reactions = update;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ class _InChatAudioPlayerState extends State<InChatAudioPlayer> {
|
||||||
DurationType.max,
|
DurationType.max,
|
||||||
);
|
);
|
||||||
_maxDuration = _displayDuration;
|
_maxDuration = _displayDuration;
|
||||||
setState(() {});
|
if (mounted) setState(() {});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,7 @@ class _MessageInputState extends State<MessageInput> {
|
||||||
void _initializeControllers() {
|
void _initializeControllers() {
|
||||||
recorderController = RecorderController();
|
recorderController = RecorderController();
|
||||||
recorderController.onCurrentDuration.listen((duration) {
|
recorderController.onCurrentDuration.listen((duration) {
|
||||||
|
if (!mounted) return;
|
||||||
setState(() {
|
setState(() {
|
||||||
_currentDuration = duration.inMilliseconds;
|
_currentDuration = duration.inMilliseconds;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@ class _MessageInfoViewState extends State<MessageInfoView> {
|
||||||
widget.message.messageId,
|
widget.message.messageId,
|
||||||
);
|
);
|
||||||
actionsStream = streamActions.listen((update) {
|
actionsStream = streamActions.listen((update) {
|
||||||
|
if (!mounted) return;
|
||||||
setState(() {
|
setState(() {
|
||||||
messageActions = update;
|
messageActions = update;
|
||||||
});
|
});
|
||||||
|
|
@ -67,6 +68,7 @@ class _MessageInfoViewState extends State<MessageInfoView> {
|
||||||
widget.message.groupId,
|
widget.message.groupId,
|
||||||
);
|
);
|
||||||
groupMemberStream = streamGroup.listen((update) {
|
groupMemberStream = streamGroup.listen((update) {
|
||||||
|
if (!mounted) return;
|
||||||
setState(() {
|
setState(() {
|
||||||
groupMembers = update;
|
groupMembers = update;
|
||||||
});
|
});
|
||||||
|
|
@ -76,6 +78,7 @@ class _MessageInfoViewState extends State<MessageInfoView> {
|
||||||
widget.message.messageId,
|
widget.message.messageId,
|
||||||
);
|
);
|
||||||
historyStream = streamHistory.listen((update) {
|
historyStream = streamHistory.listen((update) {
|
||||||
|
if (!mounted) return;
|
||||||
setState(() {
|
setState(() {
|
||||||
messageHistory = update;
|
messageHistory = update;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,7 @@ class _RetransmissionDataViewState extends State<RetransmissionDataView> {
|
||||||
subscriptionContacts = twonlyDB.contactsDao.watchAllContacts().listen((
|
subscriptionContacts = twonlyDB.contactsDao.watchAllContacts().listen((
|
||||||
updated,
|
updated,
|
||||||
) {
|
) {
|
||||||
|
if (!mounted) return;
|
||||||
for (final contact in updated) {
|
for (final contact in updated) {
|
||||||
contacts[contact.userId] = contact;
|
contacts[contact.userId] = contact;
|
||||||
}
|
}
|
||||||
|
|
@ -85,6 +86,7 @@ class _RetransmissionDataViewState extends State<RetransmissionDataView> {
|
||||||
subscriptionRetransmission = twonlyDB.receiptsDao.watchAll().listen((
|
subscriptionRetransmission = twonlyDB.receiptsDao.watchAll().listen((
|
||||||
updated,
|
updated,
|
||||||
) {
|
) {
|
||||||
|
if (!mounted) return;
|
||||||
retransmissions = updated.reversed.toList();
|
retransmissions = updated.reversed.toList();
|
||||||
if (contacts.isNotEmpty) {
|
if (contacts.isNotEmpty) {
|
||||||
messages = RetransMsg.fromRaw(retransmissions, contacts);
|
messages = RetransMsg.fromRaw(retransmissions, contacts);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue