setChatStatus method

dynamic setChatStatus()

Implementation

setChatStatus() async {
  if (await AppUtils.isNetConnected()) {
    if (profile.isGroupProfile.checkNull()) {
      debugPrint("value--> show group list");
      if (typingList.isNotEmpty) {
        var typ = await Member(jid: typingList.last).getUsername();
        userPresenceStatus("$typ ${AppConstants.typing}");
        //"${Member(jid: typingList.last).getUsername()} typing...");
      } else {
        getParticipantsNameAsCsv(profile.jid.checkNull());
      }
    } else {
      if (!profile.isBlockedMe.checkNull() ||
          !profile.isAdminBlocked.checkNull()) {
        Mirrorfly.getUserLastSeenTime(profile.jid.toString()).then((value) {
          debugPrint("date time flutter--->");
          var lastSeen = convertSecondToLastSeen(value!);
          groupParticipantsName(Constants.emptyString);
          userPresenceStatus(lastSeen.toString());
        }).catchError((er) {
          groupParticipantsName(Constants.emptyString);
          userPresenceStatus(Constants.emptyString);
        });
      } else {
        groupParticipantsName(Constants.emptyString);
        userPresenceStatus(Constants.emptyString);
      }
    }
  } else {
    userPresenceStatus(Constants.emptyString);
  }
}