Ejemplo n.º 1
0
    public void Cancelnotification(string channel)
    {
        AlarmClockMenuEventListerner.instance.newAlarm = false;

        if (PlayerPrefs.GetInt("AlarmStatus" + id) == 0)
        {
            ButtonImage.color = on;
            ButtonText.text   = "On";
            PlayerPrefs.SetInt("AlarmStatus" + id, 1);

            AlarmClockMenuEventListerner.instance.StatusOfAlarms[id] = true;
            GleyNotifications.SendNotification
            (
                "MediatativeBowl", "Time To Meditate",
                new System.TimeSpan(AlarmClockMenuEventListerner.instance.HoursList[id],
                                    AlarmClockMenuEventListerner.instance.MinList[id], AlarmClockMenuEventListerner.instance.SecList[id])
            );
            print("mmmm");
        }
        else
        {
            ButtonImage.color = off;
            ButtonText.text   = "Off";

            PlayerPrefs.SetInt("AlarmStatus" + id, 0);
            AlarmClockMenuEventListerner.instance.StatusOfAlarms[id] = false;
            try{ NotificationManager.Instance.CancelANotiFication(AlarmClockMenuEventListerner.instance.ChannelId[id]); }
            catch (Exception e) {};
            AlarmClockMenuEventListerner.instance.SaveNotificationList();
            print("kashif");
        }
    }
Ejemplo n.º 2
0
    private void Start()
    {
        GleyNotifications.Initialize();

        if (GleyNotifications.AppWasOpenFromNotification() != null)
        {
            AppMetricaManager.SendOpenFromPushNotification();
        }
    }
Ejemplo n.º 3
0
 private void OnApplicationFocus(bool focus)
 {
     if (focus == false)
     {
         GleyNotifications.SendNotification($"Dices {_dice}", GetLocalizedText(PushTextType.Basic), new TimeSpan(6, 0, 0), "icon_0", "icon_1", "from notification");
         GleyNotifications.SendNotification($"Dices {_dice}", GetLocalizedText(PushTextType.DailyReward), new TimeSpan(24, 0, 0), "icon_0", "icon_1", "from notification");
         GleyNotifications.SendNotification($"Dices {_dice}", GetLocalizedText(PushTextType.Basic), new TimeSpan(48, 0, 0), "icon_0", "icon_1", "from notification");
         GleyNotifications.SendNotification($"Dices {_dice}", GetLocalizedText(PushTextType.Basic), new TimeSpan(72, 0, 0), "icon_0", "icon_1", "from notification");
     }
 }
    /// <summary>
    /// Associated with UI button
    /// </summary>
    public void SendNotification()
    {
        int minutes = 0;

        int.TryParse(input.text, out minutes);
        if (minutes > 0)
        {
            GleyNotifications.SendNotification("Game Title", "Notification body", new System.TimeSpan(0, minutes, 0), null, null, "Opened from Gley Notification");
        }
    }
 // Code implementing the effect of the action
 protected override void OnExecute()
 {
     base.OnExecute();
     if (string.IsNullOrEmpty(GleyNotifications.AppWasOpenFromNotification()))
     {
         _output.SetValue(false);
     }
     else
     {
         _output.SetValue(true);
     }
 }
Ejemplo n.º 6
0
 public override void OnEnter()
 {
     if (string.IsNullOrEmpty(GleyNotifications.AppWasOpenFromNotification()))
     {
         Fsm.Event(FsmEventTarget.Self, no);
     }
     else
     {
         Fsm.Event(FsmEventTarget.Self, yes);
     }
     Finish();
 }
 /// <summary>
 /// The best way to schedule notifications is from OnApplicationFocus method
 /// when this is called user left your app
 /// when you trigger notifications when user is still in app, maybe your notification will be delivered when user is still inside the app and that is not good practice
 /// </summary>
 /// <param name="focus"></param>
 private void OnApplicationFocus(bool focus)
 {
     if (focus == false)
     {
         //if user left your app schedule all your notifications
         GleyNotifications.SendNotification("Game Title", "App was minimized", new System.TimeSpan(0, 1, 0), null, null, "Opened from Gley Minimized Notification");
     }
     else
     {
         //call initialize when user returns to your app to cancel all pending notifications
         GleyNotifications.Initialize();
     }
 }
Ejemplo n.º 8
0
    public void OnClickSetAlarmButton()
    {
        GleyNotifications.Initialize(false);

        int tempHours = selectedTime.hours + (selectedTime.am_pm.Equals("AM") ? 0 : 12);

        DateTime current  = DateTime.Now;
        DateTime selected = new DateTime(selectedDate.year, selectedDate.month + 1, selectedDate.day, tempHours, selectedTime.minutes, 0);

        TimeSpan reqTime = selected.Subtract(current);

        Debug.Log("Difference: " + (reqTime.Hours + reqTime.Days * 24) + ":" + reqTime.Minutes + ":" + reqTime.Seconds);

        Hou = reqTime.Hours + reqTime.Days * 24;
        Mi  = reqTime.Minutes;
        Se  = reqTime.Seconds;

        if (Hou < 0 || Mi < 0 || Se < 0)
        {
            PopupManager.Instance.messagePopup.Show("Invalid Date/Time!", "Please set reminder for future Date/Time only.");
            return;
        }

        AlarmSettings.SetActive(false);
        for (int i = 0; i < AlarmList.Count; i++)
        {
            if (AlarmList[i] == (Hou.ToString() + Mi.ToString() + Se.ToString()))
            {
                PopupManager.Instance.messagePopup.Show("Duplicate Notification", "Notification Already Exits");
                return;
            }
        }
        // var ms = new System.TimeSpan(Hou, Mi, Se);
        var ms = new System.TimeSpan(reqTime.Hours);

        newAlarm = true;
        NotificationManager.Instance.GetAllNotifications();

        GleyNotifications.SendNotification("MeditativeBowls", "Time To Meditate", new System.TimeSpan(Hou, Mi, Se));
        string TotalTimeString = (Hou.ToString() + ":" + Mi.ToString() + ":" + Se.ToString());

        print(TotalTimeString);
        ShowingTile(TotalTimeString, true, Hou, Mi, Se, selected.ToString("dd/MM/yyyy hh:mm tt"));
    }
Ejemplo n.º 9
0
 void Start()
 {
     instance = this;
     GleyNotifications.Initialize();
     LoadNotificationList();
 }
 // Code implementing the effect of the action
 protected override void OnExecute()
 {
     // Do something with the declared property
     GleyNotifications.SendNotification(gameTitle, notificationBody, new System.TimeSpan(hours, minutes, seconds), smallIconName, largeIconName, "Opened from Notification");
 }
 public override void OnEnter()
 {
     GleyNotifications.SendNotification(gameTitle, notificationBody, new System.TimeSpan(hours, minutes, seconds), smallIcon, largeIcon, "Opened from Notification");
     Finish();
 }
Ejemplo n.º 12
0
 public override void OnEnter()
 {
     GleyNotifications.Initialize();
     Finish();
 }
Ejemplo n.º 13
0
 // Code implementing the effect of the action
 protected override void OnExecute()
 {
     // Do something with the declared property
     GleyNotifications.Initialize();
 }