setInboxNotificationRead method
Set the notification as read. Use this function when the user tap into the notification details screen.
Implementation
@override
Future<DataResult> setInboxNotificationRead({List<String>? notificationId, bool isRead = true}) async{
final userId = _userId;
final device = await getDeviceInfo();
final platform = device?.platform;
final req = NUINotificationReadPayload(notifId: notificationId ?? [], isRead: isRead);
final result = await NUIWeb.get(module: NUIWEB_MODULE).doPOST(url: "notification/setNotificationRead", params: {
"userId": userId
}, headers: {
"Authorization": platform ?? "-",
"X-DeviceOs": platform ?? "-"
}, bodyEnt: req, entity: NUIPushStandardResponseEnt(NUIEntType.OBJECT, (data) => data));
if(result.success == true){
logNUI(_MODULE, "Set notification read successful");
return DataResult(
success: true,
message: result.message,
code: NUIPushCode.UPDATE_NOTI_READ_SUCCESS.name
);
}
else{
logNUI(_MODULE, "Failed to set notification read");
return DataResult(
success: false,
message: result.message,
code: NUIPushCode.UPDATE_NOTI_READ_FAILED.name
);
}
}