updatePushPreferences static method

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

Updates the push notification preferences for the logged-in user.

This method asynchronously sends the updated PushPreferences to the CometChat server. If the update is successful, onSuccess is called with the updated PushPreferences object. If an error occurs during the update, onError is called with a CometChatException.

Returns a Future<PushPreferences?> that resolves to the updated preferences, or null if an error occurs.

Implementation

@Deprecated('This method has been deprecated. Please use [updatePreferences] instead.')
static Future<PushPreferences?> updatePushPreferences(
    final PushPreferences pushPreferences,
    {Function(PushPreferences pushPreferences)? onSuccess,
    Function(CometChatException e)? onError}) async {
  try {
    final result = await channel.invokeMethod(
        'updatePreferences', pushPreferences.toMap());
    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;
}