checkArchiveList method
void
checkArchiveList(
- RecentChatData recent
Implementation
void checkArchiveList(RecentChatData recent) async {
Mirrorfly.isArchivedSettingsEnabled().then((value) {
if (value.checkNull()) {
var archiveIndex =
archivedChats.indexWhere((element) => recent.jid == element.jid);
mirrorFlyLog("checkArchiveList", "$archiveIndex");
if (!archiveIndex.isNegative) {
archivedChats.removeAt(archiveIndex);
archivedChats.insert(0, recent);
archivedChats.refresh();
} else {
archivedChats.insert(0, recent);
archivedChats.refresh();
}
} else {
var archiveIndex =
archivedChats.indexWhere((element) => recent.jid == element.jid);
if (!archiveIndex.isNegative) {
archivedChats.removeAt(archiveIndex);
/*var lastPinnedChat = dashboardController.recentChats.lastIndexWhere((element) =>
element.isChatPinned!);
var nxtIndex = lastPinnedChat.isNegative ? 0 : (lastPinnedChat + 1);
mirrorFlyLog("lastPinnedChat", lastPinnedChat.toString());
dashboardController.recentChats.insert(nxtIndex, recent);*/
}
}
});
}