delegateCallHandler method

  1. @visibleForTesting
Future delegateCallHandler(
  1. MethodCall call
)

Implementation

@visibleForTesting
Future<dynamic> delegateCallHandler(MethodCall call) async {
  switch (call.method) {
    case "bridgefyDidStart":
      _delegate?.bridgefyDidStart(
          currentUserID: call.arguments['userId'] as String);
      break;
    case "bridgefyDidFailToStart":
      _delegate?.bridgefyDidFailToStart(
        error: _bridgefyError(call.arguments)!,
      );
      break;
    case "bridgefyDidStop":
      _delegate?.bridgefyDidStop();
      break;
    case "bridgefyDidFailToStop":
      _delegate?.bridgefyDidFailToStop(
        error: _bridgefyError(call.arguments)!,
      );
      break;
    case "bridgefyDidDestroySession":
      _delegate?.bridgefyDidDestroySession();
      break;
    case "bridgefyDidFailToDestroySession":
      _delegate?.bridgefyDidFailToDestroySession();
      break;
    case "bridgefyDidConnect":
      _delegate?.bridgefyDidConnect(
          userID: call.arguments['userId'] as String);
      break;
    case "bridgefyDidDisconnect":
      _delegate?.bridgefyDidDisconnect(
          userID: call.arguments['userId'] as String);
      break;
    case "bridgefyDidEstablishSecureConnection":
      _delegate?.bridgefyDidEstablishSecureConnection(
          userID: call.arguments['userId'] as String);
      break;
    case "bridgefyDidFailToEstablishSecureConnection":
      _delegate?.bridgefyDidFailToEstablishSecureConnection(
        userID: call.arguments['userId'] as String,
        error: _bridgefyError(call.arguments)!,
      );
      break;
    case "bridgefyDidSendMessage":
      _delegate?.bridgefyDidSendMessage(
          messageID: call.arguments['messageId'] as String);
      break;
    case "bridgefyDidFailSendingMessage":
      _delegate?.bridgefyDidFailSendingMessage(
        messageID: call.arguments['messageId'] as String,
        error: _bridgefyError(call.arguments),
      );
      break;
    case "bridgefyDidReceiveData":
      _delegate?.bridgefyDidReceiveData(
        data: call.arguments['data'] as Uint8List,
        messageId: call.arguments['messageId'] as String,
        transmissionMode: _transmissionMode(call.arguments),
      );
      break;
    case "bridgefyDidSendDataProgress":
      _delegate?.bridgefyDidSendDataProgress(
        messageID: call.arguments['messageId'] as String,
        position: call.arguments['position'] as int,
        of: call.arguments['of'] as int,
      );
      break;
    default:
      break;
  }
}