Пример #1
0
 /// <summary>
 /// Clones the event and adds it (if necessary) to the project, then runs all enabled filters against it. Returns a string that is null if there was no error, or an error code such as "FILTER ERROR" if there was an error.
 /// </summary>
 /// <param name="p">Project to insert the event into.</param>
 /// <param name="eventOriginal">Event to clone and insert.  The event object is not changed by this method.</param>
 /// <returns>Returns a string that is null if there was no error, or an error code such as "FILTER ERROR" if there was an error.</returns>
 private SubmitResult InsertIntoProject(Project p, Event eventOriginal)
 {
     try
     {
         Event ev = JsonConvert.DeserializeObject <Event>(JsonConvert.SerializeObject(eventOriginal));
         using (FilterEngine fe = new FilterEngine(p.Name))
         {
             BasicEventTimer bet = fe.AddEventAndRunEnabledFilters(ev);
             if (Settings.data.verboseSubmitLogging)
             {
                 Util.SubmitLog(p.Name, "Event " + ev.EventId + " Submission Succeeded\r\n" + bet.ToString("\r\n"));
             }
         }
         PushManager.Notify(p.Name, ev);
         return(SubmitResult.OK);
     }
     catch (FilterException ex)
     {
         string timing = "\r\n" + ex.timer.ToString("\r\n");
         Util.SubmitLog(p.Name, "Event Submission Failed with FilterException" + timing + "\r\n" + ex.ToString());
         Logger.Debug(ex, "FilterEngine Error" + timing);
         Emailer.SendError(Context, "FilterEngine Error" + timing, ex);
         return(SubmitResult.FilterError);
     }
     catch (Exception ex)
     {
         Util.SubmitLog(p.Name, "Event Submission Failed with Exception\r\n" + ex.ToString());
         Logger.Debug(ex, "Unhandled exception thrown when inserting event into project \"" + p.Name + "\".");
         Emailer.SendError(Context, "Unhandled exception thrown when inserting event into project \"" + p.Name + "\".", ex);
         return(SubmitResult.FatalError);
     }
 }
Пример #2
0
    protected override bool OnSettingServer()
    {
        //amIntegrated and amMixed not supported yet
        Config.AuthenticationMethod = tagAuthenticationMethod.amOwn;

        PushManager.AddAChatGroup(1, "R&D Department");
        PushManager.AddAChatGroup(2, "Sales Department");
        PushManager.AddAChatGroup(3, "Management Department");
        PushManager.AddAChatGroup(7, "HR Department");

        //load socketpro async sqlite server plugin located at the directory ../socketpro/bin
        IntPtr p = CSocketProServer.DllManager.AddALibrary("ssqlite");

        if (p.ToInt64() != 0)
        {
            //monitoring sakila.db table events (DELETE, INSERT and UPDATE) for tables actor, language, category, country and film_actor
            SetSqliteDBGlobalConnectionString("usqlite.db+sakila.db.actor;sakila.db.language;sakila.db.category;sakila.db.country;sakila.db.film_actor");
        }
        //load socketpro async queue server plugin located at the directory ../socketpro/bin
        p = CSocketProServer.DllManager.AddALibrary("uasyncqueue", 24 * 1024); //24 * 1024 batch dequeuing size in bytes

        //load SocketPro file streaming server plugin located at the directory ../socketpro/bin
        p = CSocketProServer.DllManager.AddALibrary("ustreamfile");
        if (p.ToInt64() != 0)
        {
            SetRootDirectory("C:\\boost_1_60_0\\stage\\lib64");
        }

        return(true); //true -- ok; false -- no listening server
    }
Пример #3
0
    void Start()
    {
        Application.logMessageReceived += OnUnityLog;
        UnityEngine.Random.InitState(DateTime.UtcNow.Second);
        StaticDataLite.Init();
        UIEngine.Init();
        PlayerStatus.Read();
        UIEngine.Forward("LoadingPage", null, new Admission_None());
        //UIEngine.Forward<LevelCompletePage>();
        if (GameInfo.ForceDeveloper)
        {
            var commandline = UIEngine.ShowFloating <CommandLineFloating>(null, UIDepth.Top);
        }
        if (GameInfo.ForceRemoveAd)
        {
            PlayerStatus.removeAd = true;
        }
        PushManager.ResetNotification();

        // 摄像机渲染区域默认根据高去调整宽
        // 但是这里需要根据宽调整高
        // 因此需要手动设置摄像机的渲染高度,达到宽度固定 1080 效果

        heightScale = CameraUtil.SetCameraSizeByDecisionRevelutionAndFixAtWidth(1080, 1920);

        var silence = GameManifestFinal.Get("silence", "false");

        if (silence == "true")
        {
            AudioManager.Volume = 0;
        }
    }
Пример #4
0
        private async void PushManager_StateChanged(PushManager sender, PushManagerStateChangedEventArgs args)
        {
            if (args.NEW_STATE == PushManagerState.INITIALIZED)
            {
                PushNotificationChannel channel = PushManager.INSTANCE.GetChannel();
                channel.PushNotificationReceived -= WNS_PushNotificationReceived;
                channel.PushNotificationReceived += WNS_PushNotificationReceived;

                // Setup done, now send an updated list of all push accounts:
                if (PushManager.ShouldUpdatePushForAccounts())
                {
                    await PushManager.INSTANCE.InitPushForAccountsAsync();
                }
                else
                {
                    Logger.Info("No need to update push accounts on the push server.");
                }
            }
            else if (args.NEW_STATE == PushManagerState.DEAKTIVATED && args.OLD_STATE == PushManagerState.INITIALIZED)
            {
                // Setup done, now send an updated list of all push accounts:
                if (PushManager.ShouldUpdatePushForAccounts())
                {
                    await PushManager.INSTANCE.InitPushForAccountsAsync();
                }
                else
                {
                    Logger.Info("No need to update push accounts on the push server.");
                }
            }
        }
Пример #5
0
    protected override bool OnSettingServer()
    {
        //amIntegrated and amMixed not supported yet
        Config.AuthenticationMethod = tagAuthenticationMethod.amOwn;

        PushManager.AddAChatGroup(1, "R&D Department");
        PushManager.AddAChatGroup(2, "Sales Department");
        PushManager.AddAChatGroup(3, "Management Department");
        PushManager.AddAChatGroup(7, "HR Department");
        PushManager.AddAChatGroup(SocketProAdapter.UDB.DB_CONSTS.CACHE_UPDATE_CHAT_GROUP_ID, "Subscribe/publish for front clients");

        //load socketpro async sqlite library located at the directory ../bin/free_services/sqlite
        IntPtr p = CSocketProServer.DllManager.AddALibrary("ssqlite");

        if (p.ToInt64() != 0)
        {
            //monitoring sakila.db table events (DELETE, INSERT and UPDATE) for tables actor, language, category, country and film_actor
            SQLite_SetSPluginGlobalOptions("{\"monitored_tables\":\"sakila.db.actor;sakila.db.language;sakila.db.category;sakila.db.country;sakila.db.film_actor\"}");
        }
        //load socketPro asynchronous persistent message queue library at the directory ../bin/free_services/queue
        p = CSocketProServer.DllManager.AddALibrary("uasyncqueue", 24 * 1024); //24 * 1024 batch dequeuing size in bytes

        //load socketPro file streaming library at the directory ../bin/free_services/file
        p = CSocketProServer.DllManager.AddALibrary("ustreamfile");

        //load MySQL/MariaDB socketPro server plugin library at the directory ../bin/free_services/mm_middle
        p = CSocketProServer.DllManager.AddALibrary("smysql");

        //load ODBC socketPro server plugin library at the directory ../bin/win or ../bin/linux
        p = CSocketProServer.DllManager.AddALibrary("sodbc");

        bool ok = CSocketProServer.Router.SetRouting(piConst.sidPi, piConst.sidPiWorker);

        return(true); //true -- ok; false -- no listening server
    }
Пример #6
0
        public void push()
        {
            List <string> toUser = new List <string>(); //要推送的用户列表
            List <string> toPart = new List <string>(); //要推送的部门列表
            List <string> toTag  = new List <string>(); //要推送的标签列表

            //实例化 相应类型的新闻对象

            //文字类型
            PushMessage.Text msg = new PushMessage.Text(ConfigurationManager.AppSettings["AppID"], toUser, toPart, toTag, "推送一条文字信息", false);

            //图片类型
            //PushMessage.Image msg = new PushMessage.Image(ConfigurationManager.AppSettings["AppID"], toUser, toPart, toTag, "mediaId", true);

            //新闻类型
            //List<PushMessage.News.NewsItem> newsList = new List<PushMessage.News.NewsItem>();
            //newsList.Add(new PushMessage.News.NewsItem() { title = "标题", description = "摘要", picUrl = "图片url", url = "详情链接url" });
            //PushMessage.News msg = new PushMessage.News(ConfigurationManager.AppSettings["AppID"], toUser, toPart, toTag, newsList);

            //其他类型相同
            //......

            //调用PushManager.Push()静态方法进行消息推送
            try
            {
                PushManager.Push(msg);
            }
            catch (Exception ex)//ex.Message 异常信息
            {
                //todo...
                //...
            }
        }
Пример #7
0
        public void ProcessRequest(HttpContext context)
        {
            string userIDs = context.Request.QueryString["UserID"] ?? string.Empty;
            string partIDs = context.Request.QueryString["PartID"] ?? string.Empty;
            string tagIDs  = context.Request.QueryString["TagID"] ?? string.Empty;

            List <string> toUser = new List <string>(); //要推送的用户列表
            List <string> toPart = new List <string>(); //要推送的部门列表
            List <string> toTag  = new List <string>(); //要推送的标签列表

            if (!string.IsNullOrWhiteSpace(userIDs))
            {
                toUser = userIDs.Split('|').ToList();
            }
            if (!string.IsNullOrWhiteSpace(partIDs))
            {
                toPart = userIDs.Split('|').ToList();
            }
            if (!string.IsNullOrWhiteSpace(tagIDs))
            {
                toTag = userIDs.Split('|').ToList();
            }

            Text msg = new Text(ConfigurationManager.AppSettings["AppID"], toUser, toPart, toTag, "推送一条文字信息", false);
            var  ret = PushManager.Push(msg);

            context.Response.ContentType = "text/html";
            context.Response.Write("ErrorCode = " + ret.ErrorCode + "<br/>");
            context.Response.Write("ErrorMessage = " + ret.ErrorMessage + "<br/>");
            context.Response.Write("InvalidUser = "******"<br/>");
            context.Response.Write("InvalidParty = " + ret.InvalidParty + "<br/>");
            context.Response.Write("InvalidTag = " + ret.InvalidTag + "<br/>");
        }
Пример #8
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            mMessageReceiver          = new LocalMessageBroadcastReceiver();
            mMessageReceiver.activity = this;

            mRegisterReceiver          = new LocalRegisterBroadcastReceiver();
            mRegisterReceiver.activity = this;

            registerReceivers();

            PushManager manager = PushManager.GetInstance(this);

            manager.OnStartup(this);

            // Register for push!
            manager.RegisterForPushNotifications();

            // Reset application icon badge number
            manager.BadgeNumber = 0;

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.main);

            mGeneralStatus = FindViewById <TextView>(Resource.Id.general_status);
            mTagsStatus    = FindViewById <TextView>(Resource.Id.status);

            checkMessage(Intent);
        }
Пример #9
0
 public override void OnCreate()
 {
     base.OnCreate();
     // Log.d(TAG, "onCreate");
     PushManager.StartWork(ApplicationContext, PushConstants.LoginTypeApiKey,
             "hhN9CFi3gZPpm9LD5szBT8hn");
 }
Пример #10
0
 private void Start()
 {
     manager     = FindObjectOfType <PushManager>();
     combo       = FindObjectOfType <Combo>();
     sm          = FindObjectOfType <MJ.SoundManager>();
     spwanManger = FindObjectOfType <lbj.SpwanManager>();
 }
Пример #11
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);

            LoadApplication(new App());

            mMessageReceiver          = new LocalMessageBroadcastReceiver();
            mMessageReceiver.activity = this;

            registerReceivers();

            PushManager manager = PushManager.GetInstance(this);

            manager.OnStartup(this);

            // Register for push!
            manager.RegisterForPushNotifications();

            // Reset application icon badge number
            manager.BadgeNumber = 0;

            checkMessage(Intent);
        }
        public override void OnCreate()
        {
            var options = AirshipConfigOptions.LoadDefaultOptions(this);

            // Optionally, customize your config
            options.InProduction         = false;
            options.DevelopmentAppKey    = "";
            options.DevelopmentAppSecret = "";

            UAirship.TakeOff(this, options);

            //use CustomPushNotificationBuilder to specify a custom layout
            CustomPushNotificationBuilder nb = new CustomPushNotificationBuilder();

            nb.StatusBarIconDrawableId = Resource.Id.icon;            //custom status bar icon

            nb.Layout = Resource.Layout.notification;
            nb.LayoutIconDrawableId = Resource.Id.icon;            //custom layout icon
            nb.LayoutIconId         = Resource.Id.icon;
            nb.LayoutSubjectId      = Resource.Id.subject;
            nb.LayoutMessageId      = Resource.Id.message;

            PushManager.Shared().NotificationBuilder  = nb;
            PushManager.Shared().IntentReceiver       = Class.FromType(typeof(IntentReceiver));
            UALocationManager.Shared().IntentReceiver = Class.FromType(typeof(IntentReceiver));
        }
Пример #13
0
 //--------------------------------------------------------Events:---------------------------------------------------------------------\\
 #region --Events--
 private void PushManager_StateChanged(PushManager sender, Push.Classes.Events.PushManagerStateChangedEventArgs args)
 {
     MODEL.PushManagerState = args.NEW_STATE.ToString();
     MODEL.PushInitialized  = args.NEW_STATE == PushManagerState.INITIALIZED;
     MODEL.PushError        = args.NEW_STATE == PushManagerState.ERROR;
     LoadSettings();
 }
Пример #14
0
        /// <summary>
        /// Set Up the subscription to the Message Hub
        /// </summary>
        private async Task <bool> SetUpSubscription()
        {
            try
            {
                if (PushManager.IsSupported)
                {
                    var subscription = await PushManager.SubscribeAsync(dhp.PublicKey, "myChannel1");

                    _subscriptionJson = subscription.ToJson();
                    var applicationData = Windows.Storage.ApplicationData.Current;
                    var localSettings   = applicationData.LocalSettings;
                    //localSettings.Values["WNSChannelURI"] = _subscriptionJson.ToString();
                    localSettings.Values["WNSChannelRegistrationId"] = _subscriptionJson.ToString();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                App.LogException(ex);
                return(false);
            }
        }
Пример #15
0
        public void 特定カテゴリ通知API呼び出しテスト()
        {
            var notificationContent = new NotificationContent();

            notificationContent.Message = "test_message";
            notificationContent.Tags    = new List <string>();
            notificationContent.Tags.Add("tag1");
            notificationContent.Tags.Add("tag3");
            var json          = JsonConvert.SerializeObject(notificationContent);
            var stringContent = new StringContent(json, Encoding.UTF8, Constant.Http.ContentType);
            var expected      = stringContent.ReadAsStringAsync().ToString();
            HttpResponseMessage httpResponseMessage = this.CreateResponseMessage(Message.Ok, System.Net.HttpStatusCode.OK);

            this.httpHandler.Setup(m => m.PostAsync(Constant.Api.NotificationUrl, It.IsAny <StringContent>())).ReturnsAsync(httpResponseMessage);
            this.pushManager = new PushManager(this.httpHandler.Object);
            var categories = new List <NotificationCategory>();

            categories.Add(new NotificationCategory("tag1", "tag1", true));
            categories.Add(new NotificationCategory("tag2", "tag2", false));
            categories.Add(new NotificationCategory("tag3", "tag3", true));
            var result = this.pushManager.SendAsync("test_message", categories);

            this.httpHandler.Verify(m => m.PostAsync(Constant.Api.NotificationUrl, It.Is <StringContent>(x => x.ReadAsStringAsync().ToString().Equals(expected))));
            Assert.AreEqual(result.Result, Message.Ok);
        }
Пример #16
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.Init();
            LoadApplication(new App());
            PushManager.Init();

            return(base.FinishedLaunching(app, options));
        }
        /// <summary>
        /// Call this to initialize Baidu's push notification service for this device.
        /// 调用此功能开启百度推送通知服务。
        /// </summary>
        public static void InitializeBaiduPushManager(Context context)
        {
            string baiduPushApiKey = GetMetaDataValueByName("baidu_api_key");

            if (!string.IsNullOrWhiteSpace(baiduPushApiKey))
            {
                PushManager.StartWork(context, PushConstants.LoginTypeApiKey, baiduPushApiKey);
            }
        }
 /// <summary>
 /// This method will be called after calling PushManager.StarWork(). The channelId should be sent to your
 /// server; this value can be used to send push notifictions to this user.
 /// 调用PushManager.StartWork()以后,此功能要提供channelId。因为channelId让你发送本用户给通知,所以你应该把channelId
 /// 保存在服务器里。
 /// </summary>
 /// <param name="context"></param>
 /// <param name="errorCode"></param>
 /// <param name="appid"></param>
 /// <param name="userId"></param>
 /// <param name="channelId"></param>
 /// <param name="requestId"></param>
 public override void OnBind(Context context, int errorCode, string appid, string userId, string channelId, string requestId)
 {
     System.Diagnostics.Debug.WriteLine(string.Format(" OnBind === errorCode: {0} ---- appid: {1} userId: {2} channelId: {3}", errorCode, appid, userId, channelId));
     PushManager.SetTags(context, new List <string> {
         "aaa"
     });
     SendRegistrationToAppServer(userId, channelId);
     PushManager.ListTags(context);
 }
Пример #19
0
        /// <summary>
        /// Resubscribes to the service whenever the registration is invalid ( Expiration date is due)
        /// </summary>
        private async Task <bool> ReSubscription()
        {
            try
            {
                var      applicationData = Windows.Storage.ApplicationData.Current;
                var      localSettings   = applicationData.LocalSettings;
                var      registrationId  = localSettings.Values["WNSChannelRegistrationId"];
                DateTime regDateObject   = new DateTime(1, 1, 1);


                if (registrationId == null || registrationId == "")
                {
                    localSettings.Values["UWPUninstallCheck"] = true;
                }
                else
                {
                    if (PushManager.IsSupported)
                    {
                        var    regJson   = registrationId.ToString();
                        var    regObject = JsonObject.Parse(regJson);
                        string dateReg   = regObject["expirationTime"].ToString().Replace("{", "").Replace("}", "").Replace("\"", "");
                        regDateObject = Convert.ToDateTime(dateReg);

                        if (regDateObject < DateTime.Now)
                        {
                            var subscription = await PushManager.SubscribeAsync(dhp.PublicKey, "myChannel1");

                            _subscriptionJson = subscription.ToJson();
                            var _subscriptionJsonCheck = _subscriptionJson.ToString();


                            if (registrationId != _subscriptionJsonCheck)
                            {
                                localSettings.Values["WNSChannelRegistrationId"]      = _subscriptionJson;
                                localSettings.Values["WNSChannelRegistrationIdCheck"] = true;
                            }
                            else
                            {
                                localSettings.Values["WNSChannelRegistrationIdCheck"] = !true;
                            }
                        }
                        else
                        {
                            localSettings.Values["WNSChannelRegistrationIdCheck"] = !true;
                        }
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                App.LogException(ex);
                return(true);
            }
        }
Пример #20
0
        private async Task CheckEvents()
        {
            var newEventList = (await WebClient.GetEvents()).ToList();

            var flaggedEvents = RuleChecker.Enfocre(newEventList, EventList);

            PushManager.Send(flaggedEvents);

            EventList = new ConcurrentBag <IfiEvent>(newEventList);
        }
Пример #21
0
    protected override bool OnSettingServer()
    {
        //amIntegrated and amMixed not supported yet
        Config.AuthenticationMethod = tagAuthenticationMethod.amOwn;

        PushManager.AddAChatGroup(1, "R&D Department");
        PushManager.AddAChatGroup(2, "Sales Department");
        PushManager.AddAChatGroup(3, "Management Department");

        return(true); //true -- ok; false -- no listening server
    }
Пример #22
0
        /*private void RegisterActivityOpenNotification(PushManager pm, List<NormalActivityInstanceTemplate> activitys)
         * {
         *  foreach (NormalActivityInstanceTemplate activity in activitys)
         *  {
         *      SpecialActivityTemplate specialActivityTemplate = EventTemplateManager.Instance.GetSpecialActivity(activity.activity_id);
         *      if (string.IsNullOrEmpty(specialActivityTemplate.notification_title) || string.IsNullOrEmpty(specialActivityTemplate.notification_content))
         *      {
         *          continue;
         *      }
         *
         *      try
         *      {
         *          string[] start = activity.s.Split(':');
         *          string cronFormat = string.Format("{0} {1} * * {2}", start[1], start[0], specialActivityTemplate.open_time);
         *          TimerScheduler timerScheduler = new TimerScheduler();
         *          timerScheduler.m_TimerRegular = cronFormat;
         *          timerScheduler.ParseTimerRegular();
         *          if (!timerScheduler.isLegalTimer)
         *          {
         *              EB.Debug.LogError("ScheduleActivityLocalNotification: activity cronFormat is illegal");
         *              continue;
         *          }
         *          System.DateTime date = EB.Time.LocalNow;
         *          for (int i = 0; i < 7; ++i)
         *          {
         *              timerScheduler.GetNext(date, out date);
         *              ScheduleActivityLocalNotification(pm, specialActivityTemplate.display_name, specialActivityTemplate.notification_title, specialActivityTemplate.notification_content, date);
         *          }
         *      }
         *      catch
         *      {
         *          EB.Debug.LogError("ScheduleActivityLocalNotification: exception activityid = {0}", activity.activity_id);
         *      }
         *  }
         * }*/

        /*private void RegisterActivityOpenNotification(PushManager pm, LTDailyData activity)
         * {
         *  try
         *  {
         *      System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); // ����ʱ��
         *      DateTime dt = startTime.AddSeconds(activity.OpenTimeValue);
         *      string[] WeekStr = activity.OpenTimeWeek.Split(',');
         *      for (int i = 0; i < WeekStr.Length; i++)
         *      {
         *          string cronFormat = string.Format("{0} {1} * * {2}", dt.Minute, dt.Hour, WeekStr[i]);
         *          TimerScheduler timerScheduler = new TimerScheduler();
         *          timerScheduler.m_TimerRegular = cronFormat;
         *          timerScheduler.ParseTimerRegular();
         *          if (!timerScheduler.isLegalTimer)
         *          {
         *              EB.Debug.LogError("ScheduleActivityLocalNotification: activity cronFormat is illegal,index = {0}" , i );
         *              return;
         *          }
         *          DateTime date = EB.Time.LocalNow;
         *          for (int j = 0; j < 7; ++j)
         *          {
         *              timerScheduler.GetNext(date, out date);
         *              ScheduleActivityLocalNotification(pm, activity.ActivityData.display_name, activity.ActivityData.notification_title, activity.ActivityData.notification_content, date);
         *          }
         *      }
         *  }
         *  catch
         *  {
         *      EB.Debug.LogError("ScheduleActivityLocalNotification: exception activityid = {0}", activity.ActivityData.id);
         *  }
         * }*/


        private void ScheduleActivityLocalNotification(PushManager pm, string displayName, string title, string content, System.DateTime time)
        {
            if (!string.IsNullOrEmpty(title) && !string.IsNullOrEmpty(content))
            {
                //EB.Debug.Log("ScheduleActivityLocalNotification: notification activity title={0},time={1}", displayName, time.ToString());
                pm.ScheduleOnceLocalNotification(title, content, time);
            }
            else
            {
                EB.Debug.LogError("ScheduleActivityLocalNotification: activity notification = empty displayName={0}", displayName);
            }
        }
Пример #23
0
 // Start is called before the first frame update
 void Awake()
 {
     if (Instance != null)
     {
         Destroy(gameObject);
     }
     else
     {
         Instance = this;
     }
     DontDestroyOnLoad(gameObject);
 }
        public override void OnCreate()
        {
            UAirship.TakeOff(this);
            PushManager.Shared().IntentReceiver = Class.FromType(typeof(PushReceiver));
            RichPushManager.SetJavascriptInterface(Class.FromType(typeof(RichPushMessageJavaScript)), "urbanairship");

            // If running on Jelly Bean or higher, then use the inbox style notification builder
            if ((int)Build.VERSION.SdkInt >= (int)BuildVersionCodes.JellyBean)
            {
                PushManager.Shared().NotificationBuilder = new RichNotificationBuilder();
            }
        }
Пример #25
0
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.tabs;
            ToolbarResource   = Resource.Layout.toolbar;

            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);
            LoadApplication(new App(new AndroidInitializer()));

            PushManager.StartWork(this.ApplicationContext, PushConstants.LoginTypeApiKey, "trcK2e7vlMfN0StPx8n8Pb4M");
        }
Пример #26
0
        private void btnGonder_Click(object sender, EventArgs e)
        {
            if (comboBox1.SelectedIndex < 0)
            {
                return;
            }

            INotificator notify;    // İnstance ı burada degil hangi nesne secildiyse orada alır

            switch (comboBox1.SelectedIndex)
            {
            // Amacımız secitiğimiz cb degerine göre mesaj gondermek. Bunun icin o türde bir Inotificator tipinde instance oluşturuyoruz(notify). Notify instance send metoduna sahive ve o metod MessageBase tipinde bir parametre alıyor. Onun için secitigimiz mesaj tipine göre(sms,mail,push) messageBase tipinde bir orneklem alıyoruz.
            case 0:     //sms
                notify = new SmsManager();
                MessageBase sms = new SmsMessage()
                {
                    // Polymorphism sayesinde istediğimiz degisiklikleri yapıyoruz.Yani sectiğimiz mesaj tipindeki propertylere ulaşıp degerlerini degiştirdik.
                    Body   = "sms body",
                    Sender = "sms sender"
                };
                notify.Send(sms);       // Send metodu bizden messagebase tipinde bir degisken istiyor. onun icin yukarıda MessageBase tipinde smsMessage den orneklem aldık. Ve hangi tipte geldiyse o tipteki send metodu calısacak
                break;

            case 1:     //Email
                notify = new EmailManager();
                MessageBase email = new EmailMessage()
                {
                    Body    = "email body",
                    Sender  = "email sender",
                    Subject = "email subject"
                };
                notify.Send(email);
                break;

            default:      // push
                notify = new PushManager();
                MessageBase push = new PushMessage()
                {
                    Body    = "push body",
                    Sender  = "push sender",
                    Channel = "push channel"
                };
                notify.Send(push);
                break;
            }

            if (notify.MessageStates == MessageStates.Sent)
            {
                MessageBox.Show("Gonderildi");
            }
        }
Пример #27
0
        private void SetAlias(string alias)
        {
            alias = UAStringUtil.IsEmpty(alias) ? null : alias;

            PushManager.Shared().Alias = (alias);

            if (UAirship.Shared().AirshipConfigOptions.RichPushEnabled)
            {
                RichPushManager.Shared().RichPushUser.Alias = (alias);
                RichPushManager.Shared().UpdateUser();
            }

            currentAlias = alias;
        }
Пример #28
0
        private void BuildSyncManager()
        {
            try
            {
                // Synchronizer
                var impressionsCountSender = new ImpressionsCountSender(_impressionsSdkApiClient, _impressionsCounter, _tasksManager);
                var backOff      = new BackOff(backOffBase: 10, attempt: 0, maxAllowed: 60);
                var synchronizer = new Synchronizer(_splitFetcher, _selfRefreshingSegmentFetcher, _impressionsLog, _eventsLog, impressionsCountSender, _wrapperAdapter, _statusManager, _telemetrySyncTask, _tasksManager, _splitCache, backOff, _config.OnDemandFetchMaxRetries, _config.OnDemandFetchRetryDelayMs, _segmentCache);

                // Workers
                var splitsWorker   = new SplitsWorker(_splitCache, synchronizer, _tasksManager);
                var segmentsWorker = new SegmentsWorker(synchronizer, _tasksManager);

                // NotificationProcessor
                var notificationProcessor = new NotificationProcessor(splitsWorker, segmentsWorker);

                // NotificationParser
                var notificationParser = new NotificationParser();

                // NotificationManagerKeeper
                var notificationManagerKeeper = new NotificationManagerKeeper(_telemetryRuntimeProducer);

                // EventSourceClient
                var headers = GetHeaders();
                headers.Add(Constants.Http.SplitSDKClientKey, ApiKey.Substring(ApiKey.Length - 4));
                headers.Add(Constants.Http.Accept, Constants.Http.EventStream);
                var sseHttpClient     = new SplitioHttpClient(ApiKey, _config.HttpConnectionTimeout, headers);
                var eventSourceClient = new EventSourceClient(notificationParser, _wrapperAdapter, sseHttpClient, _telemetryRuntimeProducer, _tasksManager);

                // SSEHandler
                var sseHandler = new SSEHandler(_config.StreamingServiceURL, splitsWorker, segmentsWorker, notificationProcessor, notificationManagerKeeper, eventSourceClient: eventSourceClient);

                // AuthApiClient
                var httpClient    = new SplitioHttpClient(ApiKey, _config.HttpConnectionTimeout, GetHeaders());
                var authApiClient = new AuthApiClient(_config.AuthServiceURL, ApiKey, httpClient, _telemetryRuntimeProducer);

                // PushManager
                var backoff     = new BackOff(_config.AuthRetryBackoffBase, attempt: 1);
                var pushManager = new PushManager(sseHandler, authApiClient, _wrapperAdapter, _telemetryRuntimeProducer, backoff);

                // SyncManager
                _syncManager = new SyncManager(_config.StreamingEnabled, synchronizer, pushManager, sseHandler, notificationManagerKeeper, _telemetryRuntimeProducer, _statusManager, _tasksManager, _wrapperAdapter, _telemetrySyncTask);
            }
            catch (Exception ex)
            {
                _log.Error($"BuildSyncManager: {ex.Message}");
            }
        }
Пример #29
0
        private void btnGonder_Click(object sender, EventArgs e)
        {
            if (cmbMethod.SelectedIndex < 0)
            {
                return;
            }

            INotificator notify;

            switch (cmbMethod.SelectedIndex)
            {
            case 0:     //sms
                notify = new SmsManager();
                MessageBase sms = new SmsMessage()
                {
                    Body   = "sms body",
                    Sender = "sms sender"
                };
                notify.Send(sms);
                break;

            case 1:     //email
                notify = new EmailManager();
                MessageBase email = new EmailMessage()
                {
                    Body    = "email body",
                    Sender  = "email sender",
                    Subject = "email subject"
                };
                notify.Send(email);
                break;

            default:     //push
                notify = new PushManager();
                MessageBase push = new PushMessage()
                {
                    Body    = "push body",
                    Sender  = "push sender",
                    Channel = "push channel"
                };
                notify.Send(push);
                break;
            }
            if (notify.MessageState == MessageStates.Sent)
            {
                MessageBox.Show("Gonderildi");
            }
        }
Пример #30
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
            DontDestroyOnLoad(gameObject);
        }
        else
        {
            Destroy(gameObject);
        }
        UniLocalNotification.Initialize();
        ClearNotification();

        pushFlg = PlayerPrefs.GetInt("PUSH_FLG", 0);
    }
Пример #31
0
 static Constants()
 {
     PushManager = new PushManager();
 }
Пример #32
0
 public void RegisterDevice(PushManager.DeviceRegistration deviceRegistration)
 {
     Trace.TraceInformation("RegisterDevice called ");
     //ServerConstants.PushManager.RegisterDevice(deviceRegistration, Context.User.Identity.GetUserId()).Wait();
 }