titleArguments property

Map<String, String> get titleArguments

Constructs the arguments to pass to L10nExtension.l10nfmt to get the title of this OngoingCall.

Implementation

Map<String, String> get titleArguments {
  final Map<String, String> args = {
    'title': chat.value?.title ?? ('dot'.l10n * 3),
    'state': state.value.name,
  };

  switch (state.value) {
    case OngoingCallState.local:
    case OngoingCallState.pending:
      bool isOutgoing =
          (outgoing || state.value == OngoingCallState.local) && !started;
      if (isOutgoing) {
        args['type'] = 'outgoing';
      } else if (withVideo) {
        args['type'] = 'video';
      } else {
        args['type'] = 'audio';
      }
      break;

    case OngoingCallState.active:
      final Set<UserId> actualMembers =
          members.keys
              .where((e) => e.deviceId != null)
              .map((k) => k.userId)
              .toSet();
      args['members'] = '${actualMembers.length}';
      args['allMembers'] = '${chat.value?.chat.value.membersCount ?? 1}';

      if (Config.disableInfiniteAnimations) {
        args['duration'] = Duration.zero.hhMmSs();
      } else {
        args['duration'] = duration.value.hhMmSs();
      }
      break;

    case OngoingCallState.joining:
    case OngoingCallState.ended:
      // No-op.
      break;
  }

  return args;
}