sendNotify method
Future<bool>
sendNotify(
- String sendToAtSign,
- Notify notify,
- NotifyEnum notifyType, {
- int noOfDays = 30,
Call Notify in NotificationService, send notify to others
Implementation
Future<bool> sendNotify(String sendToAtSign, Notify notify, NotifyEnum notifyType, {int noOfDays = 30}) async {
if (!sendToAtSign.contains('@')) {
sendToAtSign = '@$sendToAtSign';
}
var metadata = Metadata();
metadata.ttr = -1;
metadata.ttl = 30 * 24 * 60 * 60000; // in milliseconds
var key = AtKey()
..key = storageKey
..sharedBy = currentAtSign
..sharedWith = sendToAtSign
..metadata = metadata;
var notificationResponse = await atClientManager.atClient.notificationService.notify(
NotificationParams.forUpdate(key, value: notify.toJson()),
);
if (notificationResponse.notificationStatusEnum == NotificationStatusEnum.delivered) {
print(notificationResponse.toString());
} else {
print(notificationResponse.atClientException.toString());
return false;
}
return true;
}