loadPushNotificationsFromMobile method
Implementation
Future<List<PamPushMessage>?> loadPushNotificationsFromMobile(
String mobileNumber) async {
Response? response;
var db = await Pam.shared.getDatabaseAlias();
var contact = await Pam.shared.getContactID();
Pam.log([
"LOAD PUSH NOTIFICATION",
"_database=$db&_contact_id=$contact&sms=$mobileNumber"
]);
try {
var uri = Uri.parse(
"$baseURL/api/app-notifications?_database=$db&_contact_id=$contact&sms=$mobileNumber");
response = await HttpClient.get(uri);
Pam.log([
"LOAD PUSH NOTIFICATION",
uri,
"mobile number = $mobileNumber",
"π₯π₯π₯π₯π₯ RESULT π₯π₯π₯π₯π₯",
"Status Code: ${response.statusCode}",
"----- Response Body -----",
response.body,
]);
} catch (e, stackTrace) {
Pam.log(["ERROR", stackTrace, e]);
}
if (response != null) {
return PamPushMessage.parse(response.body);
}
return null;
}