report method

Future<void> report()

Reports the user.

Implementation

Future<void> report() async {
  String? encodeQueryParameters(Map<String, String> params) {
    return params.entries
        .map(
          (e) =>
              '${Uri.encodeComponent(e.key)}=${Uri.encodeComponent(e.value)}',
        )
        .join('&');
  }

  try {
    await launchUrl(
      Uri(
        scheme: 'mailto',
        path: Config.support,
        query: encodeQueryParameters({
          'subject': '[Abuse] Report on UserId($id)',
          'body': '${reporting.text}\n\n',
        }),
      ),
    );
  } catch (e) {
    await MessagePopup.error(
      'label_contact_us_via_provided_email'.l10nfmt({
        'email': Config.support,
      }),
    );
  }
}