unregisterPushDevice method

Future<void> unregisterPushDevice()

Unregisters a device (Android, iOS, or Web) from receiving notifications.

Implementation

Future<void> unregisterPushDevice() async {
  Log.debug('unregisterPushDevice()', '$runtimeType');

  Log.debug('unregisterPushDevice() -> _token: $_token', '$runtimeType');
  Log.debug('unregisterPushDevice() -> _apns: $_apns', '$runtimeType');
  Log.debug('unregisterPushDevice() -> _voip: $_voip', '$runtimeType');

  try {
    await Future.wait([
      if (_token != null)
        _graphQlProvider.unregisterPushDevice(
          PushDeviceToken(fcm: FcmRegistrationToken(_token!)),
        ),
      if (_apns != null)
        _graphQlProvider.unregisterPushDevice(
          PushDeviceToken(apns: ApnsDeviceToken(_apns!)),
        ),
      if (_voip != null)
        _graphQlProvider.unregisterPushDevice(
          PushDeviceToken(apnsVoip: ApnsVoipDeviceToken(_voip!)),
        ),
    ]);
  } finally {
    _pushNotifications = false;
  }
}