public Notification(
     IPlatformNotificationBuilder notificationBuilder,
     IIntentManager intentManager,
     IAndroidNotificationManager androidNotificationManager)
 {
     this.notificationBuilder        = notificationBuilder ?? throw new ArgumentNullException(nameof(notificationBuilder));
     this.intentManager              = intentManager;
     this.androidNotificationManager = androidNotificationManager;
 }
 internal NotificationManager(IToastOptions options)
 {
     this.options                    = options ?? throw new ArgumentNullException(nameof(options));
     this.snackbarExtension          = typeof(ISnackbarExtension);
     this.notificationExtension      = typeof(IDroidNotificationExtension);
     this.androidNotificationManager = NewAndroidNotificationManager();
     this.systemEventSource          = new SystemEventSource(null);
     this.intentManager              = new IntentManager(options, androidNotificationManager, systemEventSource, null);
     this.history                    = new History(intentManager, androidNotificationManager);
 }
        public IntentManager(
            IToastOptions options,
            IAndroidNotificationManager androidNotificationManager,
            ISystemEventSource systemEventSource,
            IServiceProvider?serviceProvider)
        {
            this.mutex = new object();
            this.tasksByNotificationId = new Dictionary <ToastId, TaskCompletionSource <NotificationResult> >();
            this.options = options ?? throw new ArgumentNullException(nameof(options));
            this.androidNotificationManager = androidNotificationManager;
            this.systemEventSource          = systemEventSource;
            this.logger       = serviceProvider?.GetService <ILogger <IntentManager> >();
            this.intentFilter = new IntentFilter();
            this.receiver     = new NotificationReceiver(this);

            intentFilter.AddAction(IntentConstants.KTapped);
            intentFilter.AddAction(IntentConstants.KDismissed);
            intentFilter.AddAction(IntentConstants.KScheduled);

            Application.Context.RegisterReceiver(receiver, intentFilter);
        }
Beispiel #4
0
        public NotificationBuilder(
            IToastOptions options,
            IIntentManager intentManager,
            IAndroidNotificationManager androidNotificationManager,
            IServiceProvider?serviceProvider)
        {
            this.options       = options ?? throw new ArgumentNullException(nameof(options));
            this.intentManager = intentManager ?? throw new ArgumentNullException(nameof(intentManager));
            this.androidNotificationManager = androidNotificationManager;
            this.serviceProvider            = serviceProvider;
            this.UseConfigurationFrom <IDroidNotificationExtension>(serviceProvider);
            this.UseConfigurationFrom <IPlatformSpecificExtension>(serviceProvider);
            if (serviceProvider != null)
            {
                this.logger = serviceProvider.GetService <ILogger <NotificationBuilder> >();
            }

            this.Timeout = TimeSpan.FromSeconds(7);
            builder      = new NotificationCompat.Builder(Application.Context, options.ChannelOptions.Id);
            customArgs   = new Dictionary <string, string>();
        }
 public History(IIntentManager intentManager, IAndroidNotificationManager androidNotificationManager)
 {
     this.intentManager = intentManager;
     this.androidNotificationManager = androidNotificationManager;
 }