markFCMNotificationsAsSeen method

  1. @override
Future<RequestResponse> markFCMNotificationsAsSeen(
  1. String messageId
)

Mark notification as seen in the backend.

Implementation

@override
Future<RequestResponse<dynamic>> markFCMNotificationsAsSeen(
    String messageId) async {
  await checkAppInstalled(features: ['markFCMNotificationsAsSeen']);

  final response = await Request.initiateRequest(
      url: config.hostUrl,
      method: HttpMethod.POST,
      contentType: ContentTypeLiterals.APPLICATION_JSON,
      data: <String, dynamic>{
        'cmd': 'renovation_core.utils.fcm.mark_notification_seen',
        'message_id': messageId,
        'seen': 1
      });

  if (response.isSuccess == true) {
    if (response.data != null && response.data!.message is String) {
      return RequestResponse.success<String?>(response.data!.message,
          rawResponse: response.rawResponse);
    }
  }
  response.isSuccess = false;
  return RequestResponse.fail<String>(handleError(
      'fcm_notification_mark',
      response.error ??
          ErrorDetail(
              info: Information(
                  data: response.data,
                  httpCode: response.httpCode,
                  rawResponse: response.rawResponse)
                ..rawError = response.error?.info?.rawError)));
}