resetPushPreferences static method

  1. @Deprecated('This method has been deprecated. Please use [resetPreferences] instead.')
Future<PushPreferences?> resetPushPreferences({
  1. dynamic onSuccess(
    1. PushPreferences pushPreferences
    )?,
  2. dynamic onError(
    1. CometChatException e
    )?,
})

Resets push notification preferences to their default values for the logged-in user.

This method makes an asynchronous call to the CometChat server to reset the PushPreferences. Upon successful reset, onSuccess is invoked with the reset PushPreferences object. If an error occurs, onError is called with a CometChatException.

Returns a Future<PushPreferences?> which completes with the reset preferences, or null if an error occurs.

Implementation

@Deprecated('This method has been deprecated. Please use [resetPreferences] instead.')
static Future<PushPreferences?> resetPushPreferences(
    {Function(PushPreferences pushPreferences)? onSuccess,
    Function(CometChatException e)? onError}) async {
  try {
    final result = await channel.invokeMethod('resetPreferences');
    final pushPreferencesObj = PushPreferences.fromMap(result);
    if (onSuccess != null) onSuccess(pushPreferencesObj);
    return pushPreferencesObj;
  } on PlatformException catch (p) {
    _errorCallbackHandler(null, p, null, onError);
  } catch (e) {
    _errorCallbackHandler(null, null, e, onError);
  }
  return null;
}