toggleHand method

  1. @override
Future<void> toggleHand(
  1. ChatId chatId,
  2. ChatCallDeviceId deviceId,
  3. bool raised
)
override

Raises/lowers a hand of the authenticated MyUser in the specified ChatCall.

Implementation

@override
Future<void> toggleHand(
  ChatId chatId,
  ChatCallDeviceId deviceId,
  bool raised,
) async {
  Log.debug('toggleHand($chatId, $deviceId, $raised)', '$runtimeType');

  try {
    await Backoff.run(
      () async {
        await _graphQlProvider.toggleChatCallHand(chatId, deviceId, raised);
      },
      retryIf: (e) => e.isNetworkRelated,
      retries: 10,
    );
  } on ToggleChatCallHandException catch (e) {
    switch (e.code) {
      case ToggleChatCallHandErrorCode.notCallMember:
      case ToggleChatCallHandErrorCode.noCall:
      case ToggleChatCallHandErrorCode.unknownChat:
        WebUtils.removeCall(chatId);
        remove(chatId);
        break;

      case ToggleChatCallHandErrorCode.artemisUnknown:
        rethrow;
    }
  }
}