Fix bug preventing scrolling to unread messages
continuous-integration/drone/pr Build is pending
Details
continuous-integration/drone/pr Build is pending
Details
This commit is contained in:
parent
a5b253f185
commit
f848316db9
|
@ -29,13 +29,13 @@ class ContactsView extends StatefulWidget {
|
||||||
// selectConversation can be called from anywhere to set the active conversation
|
// selectConversation can be called from anywhere to set the active conversation
|
||||||
void selectConversation(BuildContext context, int handle) {
|
void selectConversation(BuildContext context, int handle) {
|
||||||
// requery instead of using contactinfostate directly because sometimes listview gets confused about data that resorts
|
// requery instead of using contactinfostate directly because sometimes listview gets confused about data that resorts
|
||||||
|
var unread = Provider.of<ProfileInfoState>(context, listen: false).contactList.getContact(handle)!.unreadMessages;
|
||||||
var previouslySelected = Provider.of<AppState>(context, listen: false).selectedConversation;
|
var previouslySelected = Provider.of<AppState>(context, listen: false).selectedConversation;
|
||||||
if (previouslySelected != null) {
|
if (previouslySelected != null) {
|
||||||
Provider.of<ProfileInfoState>(context, listen: false).contactList.getContact(previouslySelected)!.unselected();
|
Provider.of<ProfileInfoState>(context, listen: false).contactList.getContact(previouslySelected)!.unselected();
|
||||||
}
|
}
|
||||||
Provider.of<ProfileInfoState>(context, listen: false).contactList.getContact(handle)!.selected();
|
Provider.of<ProfileInfoState>(context, listen: false).contactList.getContact(handle)!.selected();
|
||||||
// triggers update in Double/TripleColumnView
|
// triggers update in Double/TripleColumnView
|
||||||
var unread = Provider.of<ProfileInfoState>(context, listen: false).contactList.getContact(handle)!.unreadMessages;
|
|
||||||
Provider.of<AppState>(context, listen: false).initialScrollIndex = unread;
|
Provider.of<AppState>(context, listen: false).initialScrollIndex = unread;
|
||||||
Provider.of<AppState>(context, listen: false).selectedConversation = handle;
|
Provider.of<AppState>(context, listen: false).selectedConversation = handle;
|
||||||
Provider.of<AppState>(context, listen: false).selectedIndex = null;
|
Provider.of<AppState>(context, listen: false).selectedIndex = null;
|
||||||
|
|
|
@ -55,14 +55,11 @@ class _MessageViewState extends State<MessageView> {
|
||||||
Provider.of<AppState>(context, listen: false).unreadMessagesBelow = false;
|
Provider.of<AppState>(context, listen: false).unreadMessagesBelow = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (scrollListener.itemPositions.value.length != 0 && !scrollListener.itemPositions.value.any((element) => element.index == 0)) {
|
||||||
if (scrollListener.itemPositions.value.length != 0 &&
|
|
||||||
!scrollListener.itemPositions.value.any((element) => element.index == 0)) {
|
|
||||||
showDown = true;
|
showDown = true;
|
||||||
} else {
|
} else {
|
||||||
showDown = false;
|
showDown = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,6 @@ class _MessageListState extends State<MessageList> {
|
||||||
ByIndex(0).loadUnsynced(Provider.of<FlwtchState>(context, listen: false).cwtch, Provider.of<AppState>(outerContext, listen: false).selectedProfile!, conversationId, cache!);
|
ByIndex(0).loadUnsynced(Provider.of<FlwtchState>(context, listen: false).cwtch, Provider.of<AppState>(outerContext, listen: false).selectedProfile!, conversationId, cache!);
|
||||||
}
|
}
|
||||||
var initi = Provider.of<AppState>(outerContext, listen: false).initialScrollIndex;
|
var initi = Provider.of<AppState>(outerContext, listen: false).initialScrollIndex;
|
||||||
|
|
||||||
bool isP2P = !Provider.of<ContactInfoState>(context).isGroup;
|
bool isP2P = !Provider.of<ContactInfoState>(context).isGroup;
|
||||||
bool isGroupAndSyncing = Provider.of<ContactInfoState>(context).isGroup == true && Provider.of<ContactInfoState>(context).status == "Authenticated";
|
bool isGroupAndSyncing = Provider.of<ContactInfoState>(context).isGroup == true && Provider.of<ContactInfoState>(context).status == "Authenticated";
|
||||||
bool isGroupAndSynced = Provider.of<ContactInfoState>(context).isGroup && Provider.of<ContactInfoState>(context).status == "Synced";
|
bool isGroupAndSynced = Provider.of<ContactInfoState>(context).isGroup && Provider.of<ContactInfoState>(context).status == "Synced";
|
||||||
|
|
Loading…
Reference in New Issue