registerFCMToken method
Register the currently signed in user with an FCM Token.
If the token is already registered, the backend will silently returning a success.
Implementation
@override
Future<RequestResponse<String?>> registerFCMToken(String token) async {
await checkAppInstalled(features: ['registerFCMToken']);
final response = await Request.initiateRequest(
url: config.hostUrl,
method: HttpMethod.POST,
contentType: ContentTypeLiterals.APPLICATION_JSON,
data: <String, dynamic>{
'cmd': 'renovation_core.utils.fcm.register_client',
'token': token
});
if (response.isSuccess == true) {
return RequestResponse.success(response.data!.message,
rawResponse: response.rawResponse);
}
response.isSuccess = false;
return RequestResponse.fail(handleError(
'fcm_register_client',
response.error ??
ErrorDetail(
info: Information(
data: response.data,
httpCode: response.httpCode,
rawResponse: response.rawResponse)
..rawError = response.error?.info?.rawError)));
}