removeSharedActivity method
Drops a kept shared activity and deletes its cached files.
Parameters
recipientUserID: The user who kept it.shareToken: The Activity.shareToken of the activity.onComplete: Called with GemError.success, or another GemError when the activity could not be dropped.
Returns
- The ProgressListener of the call, or null when it could not start.
Implementation
ProgressListener? removeSharedActivity({
required String recipientUserID,
required String shareToken,
void Function(GemError error)? onComplete,
}) {
final EventDrivenProgressListener progressListener =
EventDrivenProgressListener();
GemKitPlatform.instance.registerEventHandler(
progressListener.id,
progressListener,
);
progressListener.registerOnCompleteWithData((
int err,
String hint,
Map<dynamic, dynamic> json,
) {
GemKitPlatform.instance.unregisterEventHandler(progressListener.id);
onComplete?.call(GemErrorExtension.fromCode(err));
});
final OperationResult resultString = objectMethod(
pointerId,
'ActivityStore',
'removeSharedActivity',
args: <String, dynamic>{
'recipientUserID': recipientUserID,
'shareToken': shareToken,
'listener': progressListener.id,
},
);
final GemError errorCode = GemErrorExtension.fromCode(
resultString['result'],
);
if (errorCode != GemError.success) {
onComplete?.call(errorCode);
return null;
}
return progressListener;
}