Exemplo n.º 1
0
        private void CheckToRegisterAppForRemoteNotifications()
        {
            var notificationStatus = SL.AppSettings.GetValueOrDefault("NotificationStatus", string.Empty);

            if (!RegistrationNotification.CheckIfPushNotificationsEnabled() && (notificationStatus != Enums.NotififcationStatus.Discarded.ToString()) && (notificationStatus != Enums.NotififcationStatus.Enabled.ToString()))
            {
                var alertController = UIAlertController.Create("Challenges expire quickly - allow this app to send you push notifications to be notified about special opportunities", string.Empty, UIAlertControllerStyle.Alert);

                // Add Actions
                alertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, /*async*/ (a) =>
                {
                    //SL.Profile.isNotificationEnabled = true;
                    // await SaveProfile(true);
                    //await SL.Manager.SaveProfileAsync(SL.Profile, SaveProfileComplete);
                    RegistrationNotification.Register(null);
                    SL.AppSettings.AddOrUpdateValue("NotificationStatus", Enums.NotififcationStatus.Enabled.ToString());
                    //Platform.ShowAlert("Go into your IOS Settings>SocialLadder>Notifications and make sure Allow Notifications is enabled.",string.Empty);
                }));
                alertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Default, (a) =>
                {
                    SL.AppSettings.AddOrUpdateValue("NotificationStatus", Enums.NotififcationStatus.Disabled.ToString());
                }));
                alertController.AddAction(UIAlertAction.Create("Never", UIAlertActionStyle.Default, (a) =>
                {
                    SL.AppSettings.AddOrUpdateValue("NotificationStatus", Enums.NotififcationStatus.Discarded.ToString());
                }));

                // Show the alert
                NavigationController.PresentViewController(alertController, true, null);
            }
        }
 public void RegisterPushNotificationService()
 {
     RegistrationNotification.Register(null);
 }
Exemplo n.º 3
0
 private async Task SendRegistrationSiteNotification(string userID)
 {
     RegistrationNotification nc = new RegistrationNotification();
     await nc.CreateRegistrationNotificationAsync(userID);
 }