confirmReport static method
- OverlayItem item, {
- void onComplete(
- GemError error
Confirm an existing report as in effect.
Parameters
- IN item The report overlay item
- IN onComplete Callback to be called when the request is completed, provides the error code:
- GemError.invalidInput - invalid item ( not a social report overlay item ) or item is not a result of alarm notification
- GemError.accessDenied - already confirmed or denied
- GemError.success - report confirmed
Returns
- The operation handler if the operation could be started, null otherwise
Throws
- An exception if it fails.
Implementation
static EventHandler? confirmReport(
final OverlayItem item, {
final void Function(GemError error)? onComplete,
}) {
final EventDrivenProgressListener progListener =
EventDrivenProgressListener();
GemKitPlatform.instance.registerEventHandler(progListener.id, progListener);
progListener.registerOnCompleteWithDataCallback((final int err, _, __) {
GemKitPlatform.instance.unregisterEventHandler(progListener.id);
onComplete?.call(GemErrorExtension.fromCode(err));
});
final OperationResult result = staticMethod(
'SocialOverlay',
'confirmReport',
args: <String, dynamic>{
'item': item.pointerId,
'listener': progListener.id,
},
);
final GemError errorCode = GemErrorExtension.fromCode(result['result']);
if (errorCode != GemError.scheduled) {
GemKitPlatform.instance.unregisterEventHandler(progListener.id);
onComplete?.call(errorCode);
return null;
}
return progListener;
}