fetchInviteData method

Future<void> fetchInviteData(
  1. BuildContext context,
  2. String data,
  3. String atsign
)

show the OTP dialog and fetch the invite data

Implementation

Future<void> fetchInviteData(BuildContext context, String data, String atsign) async {
  String otp = await showDialog(
    context: context,
    builder: (context) => const OTPDialog(),
  );
  AtKey atKey = AtKey()..metadata = Metadata();
  atKey.key = '$invitationAckKey.$data';
  atKey.sharedWith = atsign;
  atKey.metadata.ttr = -1;
  MessageShareModel messageContent =
      MessageShareModel(passcode: otp, identifier: data, message: 'invite acknowledgement');
  await AtClientManager.getInstance().atClient.put(atKey, jsonEncode(messageContent)).catchError((e) {
    _logger.severe('Error in saving acknowledge message => $e');
    throw e;
  });
}