// Start is called before the first frame update
    void Start()
    {
        if (!instance)
        {
            instance = this;
            DontDestroyOnLoad(gameObject);
        }
        else
        {
            Destroy(gameObject);
        }

        if (!RuntimeManager.IsInitialized())
        {
            RuntimeManager.Init();
        }

        Notifications.GrantDataPrivacyConsent();

        int areNotificationsSet = PlayerPrefs.GetInt("RepeatigNotificationsSet", 0);

        if (areNotificationsSet == 0)
        {
            Invoke("ScheduleRepeatingLocalNotificationAfterDelay", 2f);
            PlayerPrefs.SetInt("RepeatigNotificationsSet", 1);
        }
    }
Exemplo n.º 2
0
    public void ResetNotificationCount()
    {
        NotificationsHandler notificationHandler = NotificationsHandler.NotificationsHandlerInstance;

        if (notificationHandler != null)
        {
            notificationHandler.ResetNotificationCount();
        }
    }
Exemplo n.º 3
0
        protected virtual bool RaiseNotification(Notification notification)
        {
            if (NotificationThrowException)
            {
                throw new Exception(notification.Key + " - " + notification.Value);
            }
            else
            {
                NotificationsHandler?.Handle(notification);
            }

            return(true);
        }
Exemplo n.º 4
0
    void Animate()
    {
        this.gameObject.transform.DOMove(Destination, AnimateTime)
        .SetEase(EaseType)
        .OnComplete(() =>
        {
            NotificationsHandler notificationHandler = FindObjectOfType <NotificationsHandler>();

            if (notificationHandler != null)
            {
                notificationHandler.ShowNotification();
            }

            this.gameObject.SetActive(false);
        });
    }
Exemplo n.º 5
0
        protected internal async Task <bool> CommitAsync()
        {
            if (NotificationsHandler?.HasEvents() == true)
            {
                return(false);
            }

            if (CanCommit?.Invoke() == true)
            {
                await UnitOfWork.CommitAsync();

                return(true);
            }

            return(false);
        }
        private static void StartServer(string merchantNotificationsWebhook)
        {
            string domain    = ConfigurationManager.AppSettings["MerchantDomain"];
            string authToken = ConfigurationManager.AppSettings["MerchantAuthenticationToken"];

            // setup of a notification server listening to incoming notification from riskified
            // the webhook is the url on the local server which the httpServer will be listening at
            // make sure the url is correct (internet reachable ip/address and port, firewall rules etc.)
            _notificationServer = new NotificationsHandler(merchantNotificationsWebhook, NotificationReceived, authToken, domain);
            // the call to notifier.ReceiveNotifications() is blocking and will not return until we call StopReceiveNotifications
            // so we run it on a different task in this example
            var t = new Task(_notificationServer.ReceiveNotifications);

            t.Start();
            Console.WriteLine("Notification server up and running and listening to notifications on webhook: " + merchantNotificationsWebhook);
        }
        public void CallbackUrlFromattingTest()
        {
            string url1 = "https://test.domain/noPlaceholder";
            string url2 = "https://test.domain/{callbackreason}";
            string url3 = "https://test.domain/{CALLBACKREASON}";
            string url4 = "https://test.domain/{callbackReason}/addedPath";

            var resultUrl = NotificationsHandler.FormatCallbackUrl(url1, "TEST");

            Assert.AreEqual(url1, resultUrl);

            resultUrl = NotificationsHandler.FormatCallbackUrl(url2, "TEST");
            Assert.AreEqual("https://test.domain/TEST", resultUrl);

            resultUrl = NotificationsHandler.FormatCallbackUrl(url3, "TEST");
            Assert.AreEqual("https://test.domain/TEST", resultUrl);

            resultUrl = NotificationsHandler.FormatCallbackUrl(url4, "TEST");
            Assert.AreEqual("https://test.domain/TEST/addedPath", resultUrl);
        }
Exemplo n.º 8
0
        public void Configure(
            IApplicationBuilder app,
            IHostingEnvironment env,
            NotificationsHandler notifications,
            NeoConfig neoConfig)
        {
            neoConfig.Init();
            notifications.Init();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                app.UseHsts();
            }

            app.UseCors(builder =>
                        builder
                        .WithOrigins("http://localhost:8111", "http://localhost:4200")
                        .AllowAnyMethod()
                        .AllowAnyHeader()
                        .AllowCredentials());

            app.UseStaticFiles();
            app.UseCookiePolicy();

            app.UseSignalR(routes =>
            {
                routes.MapHub <ValuesHub>("/hubs/values");
                routes.MapHub <GameHub>("/hubs/game");
            });


            app.UseAuthentication();

            app.UseMvc();
        }
Exemplo n.º 9
0
    public void UpdateNotification()
    {
        NotificationsHandler notificationHandler = NotificationsHandler.NotificationsHandlerInstance;

        if (notificationHandler != null)
        {
            NotificationCount = notificationHandler.GetUpdatedCount();
        }

        Debug.Log("notificationCount: " + NotificationCount);

        if (!NotificationGameObject.activeSelf)
        {
            NotificationGameObject.SetActive(true);
        }

        UpdateCountText();
        SfxHandler sfx = SfxHandler.SfxIns;

        if (sfx != null)
        {
            sfx.PlaySound("notification_s");
        }
    }