confirmDelivered static method

Future<bool> confirmDelivered(
  1. String token,
  2. String messageId,
  3. String transport
)

Implementation

static Future<bool> confirmDelivered(
    String token, String messageId, String transport) async {
  var result = true;
  var basicAuth = "Basic ${base64.encode(utf8.encode('$token:$messageId'))}";
  try {
    await http
        .post(
            Uri.parse(
                'https://pub.pushed.ru/v1/confirm?transportKind=$transport'),
            headers: {
              "Content-Type": "application/json",
              "Authorization": basicAuth
            },
            body: "")
        .timeout(const Duration(seconds: 10),
            onTimeout: (() => throw Exception("TimeOut")));
  } catch (e) {
    result = false;
  }
  return (result);
}