screenShareControl method

void screenShareControl(
  1. String role,
  2. dynamic map
)

Implementation

void screenShareControl(String role, map) {
  try {
    var shareObject = map['sharePermissions'];
    var screenShareObject = shareObject['screen'];

    if (role.toLowerCase() == 'moderator') {
      var approvedJsonArray = screenShareObject["approved"];
      var pendingJsonArray = screenShareObject["pending"];
      screenShareMode.value = screenShareObject['mode'];

      if (screenShareMode.value == "all") {
        selected.value = 'Everyone';
      } else if (screenShareMode.value == "moderators") {
        selected.value = 'Moderator Only';
      } else if (screenShareMode.value == "authorize") {
        selected.value = 'Moderator grants Permission';
      }

      //
      if (pendingJsonArray != null) {
        if (kDebugMode) {
          print('sharControl${jsonEncode(pendingJsonArray)}');
        }
        pendingJsonArray.forEach((item) {
          var clientId = item;
          var floorRequestModel = FloorRequestModel(clientId,
              getNameFromId(clientId), true, true, false, false, false);
          shareRequestList.add(floorRequestModel);
        });
      }
      if (kDebugMode) {
        print('sharControl.1${shareRequestList.length}');
      }

      if (approvedJsonArray != null) {
        approvedJsonArray.forEach((item) {
          var clientId = item;
          var floorRequestModel = FloorRequestModel(clientId,
              getNameFromId(clientId), false, false, true, true, false);
          shareRequestList.add(floorRequestModel);
        });
      }
    } else {
      screenShareMode.value = screenShareObject['mode'];
      screenShareState.value = screenShareObject['state'];
    }

    shareRequestList.refresh();
  } on Exception catch (_, exe) {}
}