registerIOSPushNotificationHandlers function

Future<void> registerIOSPushNotificationHandlers(
  1. IOSSettings iosSettings
)

Implementation

Future<void> registerIOSPushNotificationHandlers(
    IOSSettings iosSettings) async {
  final connector = ApnsPushConnectorOnly();

  connector.configureApns(
    onLaunch: (data) => _onPush('onLaunch', data),
    onResume: (data) => _onPush('onResume', data),
    onMessage: (data) => _onPush('onMessage', data),
    onBackgroundMessage: (data) => _onPush('onBackgroundMessage', data),
  );

  if (iosSettings.useFirebase) {
    fcmToken = await FirebaseMessaging.instance.getToken();

    print('📘 apns token refresh: $fcmToken');
  } else {
    connector.token.addListener(() {
      print('📘 apns token refresh: ${connector.token.value}');

      apnsToken = connector.token.value;
    });
  }
}