Retrieve User List

Get User List#

To retrive all registered users on MirrorFly SDK use below method. User list can also be retrived based on search key word, also this method supports pagination. This function will return total page of users.

warning

User presence and Profile instant update will not happen until a messege is sent to that particular user.

    ContactManager.shared.getUsersList(PAGE_NUMBER, PER_PAGE_RESULT_SIZE, SEARCH_TERM){ isSuccess,flyError,flyData in
    if isSuccess{
    var data = flyData
    if let profileArray = data.getData() as? [ProfileDetails]{}
    let totalPages = data["totalPages"] as? Int
    let totalUsers = data["totalRecords"] as? Int
    } else {
    //print error
    }
    }

    Refer this doc to know more about Profile Details Class

    ArgumentTypeDescription
    PAGE_NUMBERintPage number of user list default value 1
    PER_PAGE_RESULT_SIZEintNumber of users per page default value 50
    SEARCH_TERMStringmodel class which filters the results by metadata default value is empty
    META_DATAMetaDataUserListFlyCompletionHandler used as completion Handler
    CALLBACKFlyCompletionHandlerFlyCompletionHandler used as completion Handler

    Get Registered Phonebook Contact Users#

    Note : The registered contacts who are in your contacts will retrieved after the contact sync, those people's only observe your profile,user presence updates.

    Once we started communicating , we can get the list of contact with chat data with whom we communicated so far.

      ContactManager.shared.getRegisteredUsers(FETCH_FROM_SERVER) { isSuccess, flyError, flyData in
      var data = flyData
      if isSuccess {
      let profileDetailsArray = data.getData() as! [ProfileDetails]
      } else{
      print(flyError!.localizedDescription)
      }
      }

      Refer this doc to know more about Profile Details Class

      ArgumentTypeDescription
      FETCH_FROM_SERVERBooltrue to fetch from server false will fetch from local database
      CALLBACKFlyCompletionHandlerFlyCompletionHandler used as completion Handler
      caution

      FlyCompletionHandler which is used as a callback for most of the i/o operation is being expressed as lambda expression for easy reading.