pinChats method

dynamic pinChats()

Implementation

pinChats() {
  if (isSelectedPositionsValidForPin()) {
    mirrorFlyLog("pinChat", "isSelectedPositionsValidForPin");
    if (selectedChats.length == 1) {
      _itemPin(0);
      clearAllChatSelection();
      toToast(AppConstants.chatPinned);
    } else {
      selected(false);
      for (var index = 0; index < selectedChats.length; index++) {
        var selectedChat = recentChats.indexWhere((p0) =>
            p0.jid == selectedChats[index] && p0.isChatPinned.checkNull());
        if (selectedChat.isNegative) {
          mirrorFlyLog(
              "pinChat", "$selectedChat selected chat is have to pinned");
          _itemPin(index);
        } else {
          mirrorFlyLog(
              "pinChat", "$selectedChat selected chat is already pinned");
        }
      }
      clearAllChatSelection();
      toToast(AppConstants.chatsPinned);
    }
  } else {
    toToast(AppConstants.pinUpTo3);
  }
}