Exemple #1
0
 //Notification >> Popup
 private void NotificationPopupPref_OnPreferenceChange(object sender,
                                                       Preference.PreferenceChangeEventArgs eventArgs)
 {
     try
     {
         if (eventArgs.Handled)
         {
             var etp   = (SwitchPreference)sender;
             var value = eventArgs.NewValue.ToString();
             etp.Checked = bool.Parse(value);
             if (etp.Checked)
             {
                 OneSignalNotification.RegisterNotificationDevice();
             }
             else
             {
                 OneSignalNotification.Un_RegisterNotificationDevice();
             }
         }
     }
     catch (Exception e)
     {
         Crashes.TrackError(e);
     }
 }
        //Notification >> Popup
        private void NotifcationPopupPrefOnPreferenceChange(object sender, Preference.PreferenceChangeEventArgs eventArgs)
        {
            try
            {
                switch (eventArgs.Handled)
                {
                case true:
                {
                    var etp   = (SwitchPreferenceCompat)sender;
                    var value = eventArgs.NewValue.ToString();
                    etp.Checked = bool.Parse(value);
                    switch (etp.Checked)
                    {
                    case true:
                        UserDetails.NotificationPopup = true;
                        OneSignalNotification.RegisterNotificationDevice();
                        break;

                    default:
                        UserDetails.NotificationPopup = false;
                        OneSignalNotification.Un_RegisterNotificationDevice();
                        break;
                    }

                    break;
                }
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
Exemple #3
0
 //Notification >> Popup
 private void NotifcationPopupPrefOnPreferenceChange(object sender, Preference.PreferenceChangeEventArgs eventArgs)
 {
     try
     {
         if (eventArgs.Handled)
         {
             var etp   = (SwitchPreferenceCompat)sender;
             var value = eventArgs.NewValue.ToString();
             etp.Checked = bool.Parse(value);
             if (etp.Checked)
             {
                 UserDetails.NotificationPopup = true;
                 OneSignalNotification.RegisterNotificationDevice();
             }
             else
             {
                 UserDetails.NotificationPopup = false;
                 OneSignalNotification.Un_RegisterNotificationDevice();
             }
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
Exemple #4
0
        private static async Task RemoveData(string type)
        {
            try
            {
                if (type == "Logout")
                {
                    if (Methods.CheckConnectivity())
                    {
                        await RequestsAsync.Global.Get_Delete_Token();
                    }
                }
                else if (type == "Delete")
                {
                    Methods.Path.DeleteAll_FolderUser();

                    if (Methods.CheckConnectivity())
                    {
                        await RequestsAsync.Global.Delete_User(UserDetails.Password);
                    }
                }

                if (AppSettings.ShowGoogleLogin && LoginActivity.MGoogleApiClient != null)
                {
                    if (Auth.GoogleSignInApi != null)
                    {
                        Auth.GoogleSignInApi.SignOut(LoginActivity.MGoogleApiClient);
                        LoginActivity.MGoogleApiClient = null !;
                    }
                }

                if (AppSettings.ShowFacebookLogin)
                {
                    var accessToken = AccessToken.CurrentAccessToken;
                    var isLoggedIn  = accessToken != null && !accessToken.IsExpired;
                    if (isLoggedIn && Profile.CurrentProfile != null)
                    {
                        LoginManager.Instance.LogOut();
                    }
                }

                OneSignalNotification.Un_RegisterNotificationDevice();

                ListUtils.ClearAllList();
                Reset();

                UserDetails.ClearAllValueUserDetails();

                Methods.DeleteNoteOnSD();

                GC.Collect();
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
 //Notifcation >> Popup
 private void Notifcation_Popup_Pref_PreferenceChange(object sender, Preference.PreferenceChangeEventArgs e)
 {
     if (e.Handled)
     {
         SwitchPreference etp = (SwitchPreference)sender;
         var value            = e.NewValue.ToString();
         etp.Checked = Boolean.Parse(value);
         if (etp.Checked)
         {
             OneSignalNotification.RegisterNotificationDevice();
         }
         else
         {
             OneSignalNotification.Un_RegisterNotificationDevice();
         }
     }
 }
        private static async Task RemoveData(string type)
        {
            try
            {
                if (type == "Logout")
                {
                    if (Methods.CheckConnectivity())
                    {
                        PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                            RequestsAsync.Global.Get_Delete_Token
                        });
                    }
                }
                else if (type == "Delete")
                {
                    if (Methods.CheckConnectivity())
                    {
                        PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                            () => RequestsAsync.Global.Delete_User(UserDetails.Password)
                        });
                    }
                }

                try
                {
                    if (AppSettings.ShowGoogleLogin && LoginActivity.MGoogleApiClient != null)
                    {
                        if (Auth.GoogleSignInApi != null)
                        {
                            Auth.GoogleSignInApi.SignOut(LoginActivity.MGoogleApiClient);
                            LoginActivity.MGoogleApiClient.Disconnect();
                            LoginActivity.MGoogleApiClient = null;
                        }
                    }

                    if (AppSettings.ShowFacebookLogin)
                    {
                        var accessToken = AccessToken.CurrentAccessToken;
                        var isLoggedIn  = accessToken != null && !accessToken.IsExpired;
                        if (isLoggedIn && Profile.CurrentProfile != null)
                        {
                            LoginManager.Instance.LogOut();
                        }
                    }

                    OneSignalNotification.Un_RegisterNotificationDevice();

                    ListUtils.ClearAllList();

                    UserDetails.ClearAllValueUserDetails();

                    Methods.DeleteNoteOnSD();

                    TabbedMainActivity.Receiver = null;

                    GC.Collect();
                }
                catch (Exception exception)
                {
                    Console.WriteLine(exception);
                }
                await Task.Delay(0);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }