forked from cwtch.im/cwtch-ui
Fix bug preventing scrolling to unread messages
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
|
||||
void selectConversation(BuildContext context, int handle) {
|
||||
// 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;
|
||||
if (previouslySelected != null) {
|
||||
Provider.of<ProfileInfoState>(context, listen: false).contactList.getContact(previouslySelected)!.unselected();
|
||||
}
|
||||
Provider.of<ProfileInfoState>(context, listen: false).contactList.getContact(handle)!.selected();
|
||||
// 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).selectedConversation = handle;
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
} else {
|
||||
showDown = false;
|
||||
}
|
||||
|
||||
});
|
||||
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!);
|
||||
}
|
||||
var initi = Provider.of<AppState>(outerContext, listen: false).initialScrollIndex;
|
||||
|
||||
bool isP2P = !Provider.of<ContactInfoState>(context).isGroup;
|
||||
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";
|
||||
|
|
Loading…
Reference in New Issue