notifyAll method
- @override
- @Deprecated('Use NotificationService')
- AtKey atKey,
- String value,
- OperationEnum operation, {
- bool isDedicated = false,
override
Notifies the AtKey with the list of sharedWith
user's of the atsign. Optionally, operation, value and metadata can be set along with the key to notify.
e.g alice is the current atsign
notify:all:update:@bob,@colin:phone@alice:+1 999 9999
var key = AtKey()..key='phone'
..sharedWith= json.encode(['@bob',@colin])
var value='+1 999 9999'
var operation=OperationEnum.update
notify(key, value, operation);
notify:update:ttl:60000:ttb:30000:@bob,@colin:phone@alice:+1 999 9999
var metaData = Metadata()..ttl='60000'
..ttb='30000'
var key = AtKey()..key='phone'
..sharedWith= json.encode(['@bob',@colin])
..metadata=metaData
var value='+1 999 9999'
var operation=OperationEnum.update
notify(key, value, operation);
Implementation
@override
@Deprecated('Use NotificationService')
Future<String> notifyAll(AtKey atKey, String value, OperationEnum operation,
{bool isDedicated = false}) async {
var returnMap = {};
var sharedWithList = jsonDecode(atKey.sharedWith!);
for (var sharedWith in sharedWithList) {
atKey.sharedWith = sharedWith;
final notificationParams =
NotificationParams.forUpdate(atKey, value: value);
final notifyResult = await notificationService.notify(notificationParams);
returnMap.putIfAbsent(
sharedWith,
() => (notifyResult.notificationStatusEnum ==
NotificationStatusEnum.delivered));
}
return jsonEncode(returnMap);
}