Esempio n. 1
0
 public UserNotificationCenterDelegate(
     IPushNotificationsReceiver pushNotificationsReceiver,
     ForegroundNotificationOptions showForegroundNotificationsInSystemOptions)
 {
     _pushNotificationsReceiver = pushNotificationsReceiver;
     _showForegroundNotificationsInSystemOptions = showForegroundNotificationsInSystemOptions;
 }
        public override void Initialize(ForegroundNotificationOptions showForegroundNotificationsInSystemOptions)
        {
            if (_isInitialized)
            {
                throw new ArgumentException($"{nameof(IosPushNotificationsService)}: Already Initialized");
            }

            _isInitialized = true;

            UNUserNotificationCenter.Current.Delegate = new UserNotificationCenterDelegate(this, showForegroundNotificationsInSystemOptions);
            UNUserNotificationCenter.Current.SetNotificationCategories(new NSSet <UNNotificationCategory>(_notificationCategoriesProvider.NotificationCategories.ToArray()));
        }
Esempio n. 3
0
        public override void Initialize(ForegroundNotificationOptions showForegroundNotificationsInSystemOptions)
        {
            if (_isInitialized)
            {
                throw new ArgumentException($"{nameof(DroidPushNotificationsService)}: Already Initialized");
            }

            _isInitialized = true;
            _showForegroundNotificationsInSystemOptions = showForegroundNotificationsInSystemOptions;

            NotificationsHelper.CreateNotificationChannels(_appContext);

            FirebaseApp.InitializeApp(_appContext);
            XFirebaseMessagingService.OnTokenRefreshed       += OnPushTokenRefreshed;
            XFirebaseMessagingService.OnNotificationReceived += OnNotificationReceived;
        }
Esempio n. 4
0
 public abstract void Initialize(ForegroundNotificationOptions showForegroundNotificationsInSystemOptions);
 /// <summary>
 ///     Helper method to identify if we should show notifications in foreground for these options.
 /// </summary>
 /// <param name="foregroundOptions">Value of current foreground options.</param>
 /// <returns>
 ///     <see langword="true"/> if notifications should be shown in foreground,
 ///     <see langword="false"/> otherwise.
 /// </returns>
 public static bool ShouldShow(this ForegroundNotificationOptions foregroundOptions) =>
 foregroundOptions == ForegroundNotificationOptions.Show ||
 foregroundOptions == ForegroundNotificationOptions.ShowWithBadge;