コード例 #1
0
 public HomeController(IOptions <PlatformOptions> platformOptions, IOptions <WebAnalyticsOptions> webAnalyticsOptions, IOptions <LocalStorageModuleCatalogOptions> localStorageModuleCatalogOptions, IOptions <PushNotificationOptions> pushNotificationOptions, LicenseProvider licenseProvider, ISettingsManager settingsManager)
 {
     _platformOptions     = platformOptions.Value;
     _webAnalyticsOptions = webAnalyticsOptions.Value;
     _localStorageModuleCatalogOptions = localStorageModuleCatalogOptions.Value;
     _pushNotificationOptions          = pushNotificationOptions.Value;
     _licenseProvider = licenseProvider;
     _settingsManager = settingsManager;
 }
        public static PushNotificationOptions UseFirebase(this PushNotificationOptions options, Action <FirebaseOptions> configure)
        {
            if (configure == null)
            {
                throw new ArgumentNullException(nameof(configure));
            }

            options.RegisterExtension(new FirebaseOptionsImpl(configure));

            return(options);
        }
コード例 #3
0
 /// <summary>
 /// Adds an instance of <see cref="IPushNotificationService"/> using Microsoft.Azure.NotificationHubs for sending push notifications
 /// </summary>
 /// <param name="services">Specifies the contract for a collection of service descriptors.</param>
 /// <param name="configure">Configure the available options. Null to use defaults.</param>
 internal static IServiceCollection AddPushNotificationServiceAzure(this IServiceCollection services, Action <PushNotificationOptions> configure = null)
 {
     services.AddTransient <IPushNotificationService, PushNotificationServiceAzure>(serviceProvider => {
         var options = new PushNotificationOptions {
             ConnectionString    = serviceProvider.GetRequiredService <IConfiguration>().GetConnectionString(PushNotificationServiceAzure.CONNECTION_STRING_NAME),
             NotificationHubPath = serviceProvider.GetRequiredService <IConfiguration>().GetValue <string>(PushNotificationServiceAzure.NOTIFICATIONS_HUB_PATH)
         };
         configure?.Invoke(options);
         return(new PushNotificationServiceAzure(options));
     });
     return(services);
 }
コード例 #4
0
        public void SetNotificationProperties(ISubscriptionService SubscriptionsService, PushServiceClient pushClient)
        {
            PushNotificationOptions options = new PushNotificationOptions()
            {
                PublicKey  = System.Configuration.ConfigurationManager.AppSettings["Publickey"],
                PrivateKey = System.Configuration.ConfigurationManager.AppSettings["PrivateKey"]
            };

            _subscriptionsService = SubscriptionsService;
            _pushClient           = pushClient;

            _pushClient.DefaultAuthentication = new VapidAuthentication(options.PublicKey, options.PrivateKey)
            {
                Subject = "https://angular-aspnetmvc-pushnotifications.demo.io"
            };
        }
コード例 #5
0
        public NotificationService(PushServiceClient pushClient)
        {
            options = new PushNotificationOptions()
            {
                PublicKey  = ConfigurationManager.AppSettings["Publickey"],
                PrivateKey = ConfigurationManager.AppSettings["PrivateKey"]
            };

            _subscriptionsService = new SubscriptionService();
            _pushClient           = pushClient;

            _pushClient.DefaultAuthentication = new VapidAuthentication(options.PublicKey, options.PrivateKey)
            {
                Subject = "https://angular-aspnetmvc-pushnotifications.demo.io"
            };
        }
コード例 #6
0
        public static void AddPushNotifications(this IServiceCollection services,
                                                Action <PushNotificationOptions> setupAction)
        {
            if (setupAction == null)
            {
                throw new ArgumentNullException(nameof(setupAction));
            }

            //Options and extension service
            var options = new PushNotificationOptions();

            setupAction(options);

            foreach (var serviceExtension in options.Extensions)
            {
                serviceExtension.AddServices(services);
            }

            services.AddScoped <IPushNotificationFactory, PushNotificationsFactory>();
            services.AddScoped <IPushNotificationsFacade, PushNotificationFacade>();
            services.AddSingleton(options);
        }
コード例 #7
0
 public PushSubscriptionController(IOptions <PushNotificationOptions> options, IPushSubscriptionService pushSubscriptionsService, PushNotificationService pushNotificationService)
 {
     _options = options.Value;
     _pushSubscriptionsService = pushSubscriptionsService;
     _pushNotificationService  = pushNotificationService;
 }