Пример #1
0
        public void ShowAlertMessage(string message, ConfigurableAlertAction okAnsver, ConfigurableAlertAction dismissAnswer, ConfigurableAlertAction neutralAnsver)
        {
            Activity.RunOnUiThread(() =>
            {
                var alert = new Android.App.AlertDialog.Builder(Activity);

                alert.SetMessage(message);
                alert.SetPositiveButton(okAnsver.Text, (senderAlert, args) => { okAnsver.OnClickHandler?.Invoke(); });
                alert.SetNegativeButton(dismissAnswer.Text, (senderAlert, args) => { dismissAnswer.OnClickHandler?.Invoke(); });
                alert.SetNeutralButton(neutralAnsver.Text, (senderAlert, args) => { neutralAnsver.OnClickHandler?.Invoke(); });

                Dialog dialog = alert.Create();
                dialog.Show();
            });
        }
Пример #2
0
 public void ShowAlertMessage(string message, ConfigurableAlertAction okAnsver, ConfigurableAlertAction dismissAnswer, ConfigurableAlertAction neutralAnsver)
 {
     throw new NotImplementedException();
 }
Пример #3
0
        public void RefreshNotificationSettings()
        {
            var notificationStatus = SL.AppSettings.GetValueOrDefault("NotificationStatus", string.Empty);

            if ((notificationStatus != Enums.NotififcationStatus.Discarded.ToString()) && (notificationStatus != Enums.NotififcationStatus.Enabled.ToString()))
            {
                string message = "Challenges expire quickly - allow this app to send you push notifications to be notified about special opportunities";
                if (Constants.NeedFirebaseImpl)
                {
                    var _notificationService = Mvx.Resolve <IFirebaseService>();

                    if (_notificationService == null || !_notificationService.IsPushNotificationServiceAlailable())
                    {
                        _alertService.ShowToast("Push notification service isn't alailable");
                        return;
                    }
                    var notificationOkResponse = new ConfigurableAlertAction
                    {
                        Text           = "Yes",
                        OnClickHandler = new Action(() =>
                        {
                            _notificationService.RegisterPushNotificationService();
                            SL.AppSettings.AddOrUpdateValue("NotificationStatus", Enums.NotififcationStatus.Enabled.ToString());
                        })
                    };
                    var notificationCancelResponse = new ConfigurableAlertAction
                    {
                        Text           = "No",
                        OnClickHandler = new Action(() =>
                        {
                            SL.AppSettings.AddOrUpdateValue("NotificationStatus", Enums.NotififcationStatus.Disabled.ToString());
                        })
                    };
                    var notificationNeverResponse = new ConfigurableAlertAction
                    {
                        Text           = "Never",
                        OnClickHandler = new Action(() =>
                        {
                            SL.AppSettings.AddOrUpdateValue("NotificationStatus", Enums.NotififcationStatus.Discarded.ToString());
                        })
                    };
                    _alertService.ShowAlertMessage(message, notificationOkResponse, notificationCancelResponse, notificationNeverResponse);
                }
                else
                {
                    var _notificationService = Mvx.Resolve <IPushNotificationService>();
                    if (_notificationService == null || !_notificationService.IsPushNotificationServiceAlailable())
                    {
                        _alertService.ShowToast("Push notification service isn't alailable");
                        return;
                    }
                    var notificationOkResponse = new ConfigurableAlertAction
                    {
                        Text           = "Yes",
                        OnClickHandler = new Action(() => {
                            _notificationService.RegisterPushNotificationService();
                            SL.AppSettings.AddOrUpdateValue("NotificationStatus", Enums.NotififcationStatus.Enabled.ToString());
                        })
                    };
                    var notificationCancelResponse = new ConfigurableAlertAction
                    {
                        Text           = "No",
                        OnClickHandler = new Action(() => {
                            SL.AppSettings.AddOrUpdateValue("NotificationStatus", Enums.NotififcationStatus.Disabled.ToString());
                        })
                    };
                    var notificationNeverResponse = new ConfigurableAlertAction
                    {
                        Text           = "Never",
                        OnClickHandler = new Action(() => {
                            SL.AppSettings.AddOrUpdateValue("NotificationStatus", Enums.NotififcationStatus.Discarded.ToString());
                        })
                    };
                    _alertService.ShowAlertMessage(message, notificationOkResponse, notificationCancelResponse, notificationNeverResponse);
                }
            }
        }