enableNotifications static method

Future<bool> enableNotifications()

Enables push notifications for the end user, across both OneSignal and FCM - both SDKs stay installed and active permanently (OneSignal is intentionally never removed, only unused for sending after the FCM cutover), so a toggle that only touched one would leave the user still (or no longer) subscribed on the other.

Returns whether the user actually ended up opted in (mirrors AdhubFcm.enableNotifications()), so a caller like a Settings toggle can reflect the real OS permission result instead of assuming success.

Implementation

static Future<bool> enableNotifications() async {
  OneSignal.User.pushSubscription.optIn();
  if (AdhubFcm.isInitialized) {
    return AdhubFcm.enableNotifications();
  }
  return true;
}