private void FirstRunExcite()
        {
            try
            {
                DbDatabase = new SqLiteDatabase();
                DbDatabase.CheckTablesStatus();

                if (!string.IsNullOrEmpty(AppSettings.Lang))
                {
                    UserDetails.LangName = AppSettings.Lang;
                    LangController.SetApplicationLang(Application.Context, AppSettings.Lang);
                }
                else
                {
                    UserDetails.LangName = Resources.Configuration.Locale.Language.ToLower();
                    LangController.SetApplicationLang(Application.Context, UserDetails.LangName);
                }

                PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                    () => ApiRequest.GetSettings_Api(this)
                });

                var result = DbDatabase.Get_data_Login_Credentials();
                if (result != null)
                {
                    Current.AccessToken = result.AccessToken;
                    switch (result.Status)
                    {
                    case "Active":
                    case "Pending":
                        StartActivity(new Intent(this, typeof(HomeActivity)));
                        break;

                    default:
                        StartActivity(new Intent(this, typeof(FirstActivity)));
                        break;
                    }
                }
                else
                {
                    StartActivity(new Intent(this, typeof(FirstActivity)));
                }

                DbDatabase.Dispose();

                if (AppSettings.ShowAdMobBanner || AppSettings.ShowAdMobInterstitial || AppSettings.ShowAdMobRewardVideo || AppSettings.ShowAdMobNative)
                {
                    MobileAds.Initialize(this, GetString(Resource.String.admob_app_id));
                }

                if (AppSettings.ShowFbBannerAds || AppSettings.ShowFbInterstitialAds || AppSettings.ShowFbRewardVideoAds)
                {
                    InitializeFacebook.Initialize(this);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        public static async void Init()
        {
            try
            {
                SqLiteDatabase dbDatabase = new SqLiteDatabase();
                var            ss         = await dbDatabase.CheckTablesStatus();

                dbDatabase.OpenConnection();

                Shared_Data  = PreferenceManager.GetDefaultSharedPreferences(Application.Context);
                App_Language = Shared_Data.GetString("Lang_key", "");

                if (string.IsNullOrEmpty(App_Language))
                {
                    SetDefaultSettings();
                    if (App_Language.Contains("ar"))
                    {
                        AppSettings.Lang = "ar";
                        AppSettings.FlowDirection_RightToLeft = true;
                    }
                    else
                    {
                        AppSettings.Lang = "";
                        AppSettings.FlowDirection_RightToLeft = false;
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        private void FirstRunExcite()
        {
            try
            {
                DbDatabase = new SqLiteDatabase();
                DbDatabase.CheckTablesStatus();

                if (!string.IsNullOrEmpty(AppSettings.Lang))
                {
                    LangController.SetApplicationLang(this, AppSettings.Lang);
                }
                else
                {
                    #pragma warning disable 618
                    UserDetails.LangName = (int)Build.VERSION.SdkInt < 25 ? Resources?.Configuration?.Locale?.Language.ToLower() : Resources?.Configuration?.Locales.Get(0)?.Language.ToLower() ?? Resources?.Configuration?.Locale?.Language.ToLower();
                    #pragma warning restore 618
                    LangController.SetApplicationLang(this, UserDetails.LangName);
                }

                var result = DbDatabase.Get_data_Login_Credentials();
                if (result != null)
                {
                    switch (result.Status)
                    {
                    case "Active":
                    case "Pending":
                        StartActivity(new Intent(Application.Context, typeof(TabbedMainActivity)));
                        break;

                    default:
                        StartActivity(new Intent(Application.Context, typeof(FirstActivity)));
                        break;
                    }
                }
                else
                {
                    StartActivity(new Intent(Application.Context, typeof(FirstActivity)));
                }

                DbDatabase.Dispose();

                if (AppSettings.ShowAdMobBanner || AppSettings.ShowAdMobInterstitial || AppSettings.ShowAdMobRewardVideo || AppSettings.ShowAdMobNative || AppSettings.ShowAdMobNativePost)
                {
                    MobileAds.Initialize(this, GetString(Resource.String.admob_app_id));
                }

                if (AppSettings.ShowFbBannerAds || AppSettings.ShowFbInterstitialAds || AppSettings.ShowFbRewardVideoAds)
                {
                    InitializeFacebook.Initialize(this);
                }

                OverridePendingTransition(Resource.Animation.abc_fade_in, Resource.Animation.abc_fade_out);
                Finish();
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
                Toast.MakeText(this, exception.Message, ToastLength.Short)?.Show();
            }
        }
        public static async void Init()
        {
            try
            {
                SqLiteDatabase dbDatabase = new SqLiteDatabase();
                var            ss         = await dbDatabase.CheckTablesStatus();

                dbDatabase.OpenConnection();
                dbDatabase.Get_MyProfile_CredentialList();

                Shared_Data = PreferenceManager.GetDefaultSharedPreferences(Application.Context);
                var data = Classes.MyProfileList.FirstOrDefault(a => a.user_id == UserDetails.User_id);
                if (data != null)
                {
                    Shared_Data.Edit().PutString("whocanfollow_key", data.follow_privacy).Commit();
                    Shared_Data.Edit().PutString("whocanMessage_key", data.message_privacy).Commit();
                    Shared_Data.Edit().PutString("whoCanSeeMyfriends_key", data.friend_privacy).Commit();
                    Shared_Data.Edit().PutString("whoCanPostOnMyTimeline_key", data.post_privacy).Commit();
                    Shared_Data.Edit().PutString("whoCanSeeMyBirthday_key", data.birth_privacy).Commit();
                    Shared_Data.Edit().PutString("ConfirmRequestFollows_key", data.confirm_followers).Commit();
                    Shared_Data.Edit().PutString("ShowMyActivities_key", data.show_activities_privacy).Commit();
                    Shared_Data.Edit().PutString("Status_key", data.status).Commit();
                    Shared_Data.Edit().PutString("ShareMyLocation_key", data.share_my_location).Commit();
                }

                SetDefaultSettings();
            }
            catch (Exception exception)
            {
                Crashes.TrackError(exception);
            }
        }
Example #5
0
        public override void OnCreate()
        {
            try
            {
                base.OnCreate();
                //A great place to initialize Xamarin.Insights and Dependency Services!
                RegisterActivityLifecycleCallbacks(this);

                Instance = this;

                Client a = new Client(AppSettings.TripleDesAppServiceProvider);
                Console.WriteLine(a);

                var sqLiteDatabase = new SqLiteDatabase();
                sqLiteDatabase.CheckTablesStatus();
                sqLiteDatabase.Get_data_Login_Credentials();

                new Handler(Looper.MainLooper).PostDelayed(new Runnable(FirstRunExcite), 100);

                StartService(new Intent(this, typeof(ScheduledApiService)));
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
                Methods.DialogPopup.InvokeAndShowDialog(Activity, "ReportMode", exception.Message, "Close");
            }
        }
Example #6
0
        public async void OnClick(MaterialDialog p0, DialogAction p1)
        {
            if (TypeDialog == "PlayList")
            {
                if (p1 == DialogAction.Positive)
                {
                }
                else if (p1 == DialogAction.Negative)
                {
                    p0.Dismiss();
                }
            }
            else if (TypeDialog == "Login")
            {
                if (p1 == DialogAction.Positive)
                {
                    ActivityContext.StartActivity(new Intent(ActivityContext, typeof(Login_Activity)));
                }
                else if (p1 == DialogAction.Negative)
                {
                    p0.Dismiss();
                }
            }
            else if (TypeDialog == "DeleteAcount")
            {
                if (p1 == DialogAction.Positive)
                {
                    // ActivityContext.StartActivity(new Intent(ActivityContext, typeof(DeleteAcount_Activity)));
                }
                else if (p1 == DialogAction.Negative)
                {
                    p0.Dismiss();
                }
            }
            else if (TypeDialog == "Logout")
            {
                if (p1 == DialogAction.Positive)
                {
                    await RemoveData("Logout");

                    SqLiteDatabase dbDatabase = new SqLiteDatabase();
                    var            ss         = await dbDatabase.CheckTablesStatus();

                    dbDatabase.Dispose();

                    Intent intent = new Intent(ActivityContext, typeof(First_Activity));
                    intent.AddCategory(Intent.CategoryHome);
                    intent.SetAction(Intent.ActionMain);
                    intent.AddFlags(ActivityFlags.ClearTop | ActivityFlags.NewTask | ActivityFlags.ClearTask);
                    ActivityContext.StartActivity(intent);
                    ActivityContext.FinishAffinity();
                }
                else if (p1 == DialogAction.Negative)
                {
                    p0.Dismiss();
                }
            }
        }
Example #7
0
        private void FirstRunExcite()
        {
            try
            {
                DbDatabase = new SqLiteDatabase();
                DbDatabase.CheckTablesStatus();

                if (!string.IsNullOrEmpty(AppSettings.Lang))
                {
                    LangController.SetApplicationLang(this, AppSettings.Lang);
                }
                else
                {
                    UserDetails.LangName = Resources.Configuration.Locales.Get(0).Language.ToLower();
                    LangController.SetApplicationLang(this, UserDetails.LangName);
                }

                var result = DbDatabase.Get_data_Login_Credentials();
                if (result != null)
                {
                    Current.AccessToken = result.AccessToken;

                    switch (result.Status)
                    {
                    case "Active":
                        UserDetails.IsLogin = true;
                        StartActivity(new Intent(this, typeof(HomeActivity)));
                        break;

                    case "Pending":
                        UserDetails.IsLogin = false;
                        StartActivity(new Intent(this, typeof(HomeActivity)));
                        break;

                    default:
                        StartActivity(new Intent(this, typeof(FirstActivity)));
                        break;
                    }
                }
                else
                {
                    StartActivity(new Intent(this, typeof(FirstActivity)));
                }
                DbDatabase.Dispose();

                if (AppSettings.ShowAdMobBanner || AppSettings.ShowAdMobInterstitial || AppSettings.ShowAdMobRewardVideo)
                {
                    MobileAds.Initialize(this, GetString(Resource.String.admob_app_id));
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                Toast.MakeText(this, e.Message, ToastLength.Short).Show();
            }
        }
        public static async void Logout(Activity context)
        {
            try
            {
                if (RunLogout == false)
                {
                    RunLogout = true;

                    await RemoveData("Logout");

                    context.RunOnUiThread(() =>
                    {
                        Methods.Path.DeleteAll_MyFolderDisk();

                        SqLiteDatabase dbDatabase = new SqLiteDatabase();

                        Runtime.GetRuntime().RunFinalization();
                        Runtime.GetRuntime().Gc();
                        TrimCache(context);

                        dbDatabase.ClearAll();
                        dbDatabase.DropAll();

                        ListUtils.ClearAllList();

                        UserDetails.ClearAllValueUserDetails();

                        dbDatabase.CheckTablesStatus();
                        dbDatabase.Dispose();

                        var intentService = new Intent(context, typeof(ScheduledApiService));
                        context.StopService(intentService);

                        HomeActivity.GetInstance()?.NewsFeedFragment?.MainHandler?.RemoveCallbacks(HomeActivity.GetInstance().NewsFeedFragment.Runnable);
                        HomeActivity.GetInstance().NewsFeedFragment.MainHandler = null;

                        MainSettings.SharedData.Edit().Clear().Commit();

                        Intent intent = new Intent(context, typeof(FirstActivity));
                        intent.AddCategory(Intent.CategoryHome);
                        intent.SetAction(Intent.ActionMain);
                        intent.AddFlags(ActivityFlags.ClearTop | ActivityFlags.NewTask | ActivityFlags.ClearTask);
                        context.StartActivity(intent);
                        context.FinishAffinity();
                        context.Finish();
                    });

                    RunLogout = false;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #9
0
        private void FirstRunExcite()
        {
            try
            {
                DbDatabase = new SqLiteDatabase();
                DbDatabase.CheckTablesStatus();

                if (!string.IsNullOrEmpty(AppSettings.Lang))
                {
                    LangController.SetApplicationLang(this, AppSettings.Lang);
                }
                else
                {
                    UserDetails.LangName = Resources.Configuration.Locale.Language.ToLower();
                    LangController.SetApplicationLang(this, UserDetails.LangName);
                }

                var result = DbDatabase.Get_data_Login_Credentials();
                if (result != null)
                {
                    switch (result.Status)
                    {
                    case "Active":
                    case "Pending":
                        StartActivity(new Intent(Application.Context, typeof(TabbedMainActivity)));
                        break;

                    default:
                        StartActivity(new Intent(Application.Context, typeof(FirstActivity)));
                        break;
                    }
                }
                else
                {
                    StartActivity(new Intent(Application.Context, typeof(FirstActivity)));
                }

                DbDatabase.Dispose();

                if (AppSettings.ShowAdMobBanner || AppSettings.ShowAdMobInterstitial || AppSettings.ShowAdMobRewardVideo || AppSettings.ShowAdMobNative || AppSettings.ShowAdMobNativePost)
                {
                    MobileAds.Initialize(this, GetString(Resource.String.admob_app_id));
                }

                if (AppSettings.ShowFbBannerAds || AppSettings.ShowFbInterstitialAds || AppSettings.ShowFbRewardVideoAds)
                {
                    InitializeFacebook.Initialize(this);
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
                Toast.MakeText(this, exception.Message, ToastLength.Short).Show();
            }
        }
Example #10
0
        public static async void Logout(Activity context)
        {
            try
            {
                if (RunLogout == false)
                {
                    RunLogout = true;

                    await RemoveData("Logout");


                    context?.RunOnUiThread(() =>
                    {
                        Methods.Path.DeleteAll_MyFolderDisk();

                        SqLiteDatabase dbDatabase = new SqLiteDatabase();

                        Runtime.GetRuntime()?.RunFinalization();
                        Runtime.GetRuntime()?.Gc();
                        TrimCache(context);

                        dbDatabase.ClearAll();
                        dbDatabase.DropAll();

                        ListUtils.ClearAllList();

                        UserDetails.ClearAllValueUserDetails();

                        dbDatabase.CheckTablesStatus();
                        dbDatabase.Dispose();

                        context.StopService(new Intent(context, typeof(ScheduledApiService)));

                        MainSettings.SharedData.Edit()?.Clear()?.Commit();
                        MainSettings.InAppReview.Edit()?.Clear()?.Commit();

                        Intent intent = new Intent(context, typeof(FirstActivity));
                        intent.AddCategory(Intent.CategoryHome);
                        intent.SetAction(Intent.ActionMain);
                        intent.AddFlags(ActivityFlags.ClearTop | ActivityFlags.NewTask | ActivityFlags.ClearTask);
                        context.StartActivity(intent);
                        context.FinishAffinity();
                        context.Finish();
                    });

                    RunLogout = false;
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
Example #11
0
        public static async void Delete(Activity context)
        {
            try
            {
                if (RunLogout == false)
                {
                    RunLogout = true;

                    await RemoveData("Delete");

                    context.RunOnUiThread(() =>
                    {
                        Methods.Path.DeleteAll_MyFolderDisk();

                        SqLiteDatabase dbDatabase = new SqLiteDatabase();

                        Runtime.GetRuntime().RunFinalization();
                        Runtime.GetRuntime().Gc();
                        TrimCache(context);

                        dbDatabase.ClearAll();
                        dbDatabase.DropAll();

                        ListUtils.ClearAllList();

                        UserDetails.ClearAllValueUserDetails();

                        dbDatabase.CheckTablesStatus();
                        dbDatabase.Dispose();

                        SharedPref.SharedData.Edit().Clear().Commit();

                        Intent intent = new Intent(context, typeof(FirstActivity));
                        intent.AddCategory(Intent.CategoryHome);
                        intent.SetAction(Intent.ActionMain);
                        intent.AddFlags(ActivityFlags.ClearTop | ActivityFlags.NewTask | ActivityFlags.ClearTask);
                        context.StartActivity(intent);
                        context.FinishAffinity();
                        context.Finish();
                    });

                    RunLogout = false;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        public static async void Logout(Activity context)
        {
            try
            {
                if (RunLogout == false)
                {
                    RunLogout = true;

                    await RemoveData("Logout");

                    context?.RunOnUiThread(() =>
                    {
                        Methods.Path.DeleteAll_MyFolderDisk();

                        SqLiteDatabase dbDatabase = new SqLiteDatabase();

                        Runtime.GetRuntime().RunFinalization();
                        Runtime.GetRuntime().Gc();
                        TrimCache(context);

                        dbDatabase.ClearAll();
                        dbDatabase.DropAll();

                        dbDatabase.CheckTablesStatus();
                        dbDatabase.Dispose();

                        context.StopService(new Intent(context, typeof(ScheduledApiService)));
                        context.StopService(new Intent(context, typeof(ChatHeadService)));

                        MainSettings.SharedData.Edit().Clear().Commit();
                        MainSettings.LastPosition.Edit().Clear().Commit();

                        Intent intent = new Intent(context, typeof(LoginActivity));
                        intent.AddCategory(Intent.CategoryHome);
                        intent.SetAction(Intent.ActionMain);
                        intent.AddFlags(ActivityFlags.ClearTop | ActivityFlags.NewTask | ActivityFlags.ClearTask);
                        context.StartActivity(intent);
                        context.FinishAffinity();
                        context.Finish();
                    });

                    RunLogout = false;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        protected override void OnResume()
        {
            try
            {
                base.OnResume();
                DbDatabase = new SqLiteDatabase();
                DbDatabase.CheckTablesStatus();

                new Handler(Looper.MainLooper).Post(new Runnable(FirstRunExcite));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #14
0
        public static async void Logout(Activity context)
        {
            try
            {
                if (RunLogout == false)
                {
                    RunLogout = true;

                    await RemoveData("Logout");

                    context.RunOnUiThread(async() =>
                    {
                        IMethods.IPath.DeleteAll_MyFolderDisk();

                        SqLiteDatabase dbDatabase = new SqLiteDatabase();
                        dbDatabase.ClearAll();
                        dbDatabase.DropAll();



                        Last_Messages_Fragment.mAdapter.Clear();


                        Java.Lang.Runtime.GetRuntime().RunFinalization();
                        Java.Lang.Runtime.GetRuntime().Gc();
                        TrimCache(context);

                        var ss = await dbDatabase.CheckTablesStatus();
                        dbDatabase.Dispose();

                        Intent intent = new Intent(context, typeof(MainActivity));
                        intent.AddCategory(Intent.CategoryHome);
                        intent.SetAction(Intent.ActionMain);
                        intent.AddFlags(ActivityFlags.ClearTop | ActivityFlags.NewTask | ActivityFlags.ClearTask);
                        context.StartActivity(intent);
                        context.FinishAffinity();
                    });

                    Wo_Main_Settings.Shared_Data.Edit().Clear().Commit();

                    RunLogout = false;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                DbDatabase = new SqLiteDatabase();
                DbDatabase.CheckTablesStatus();

                new Handler(Looper.MainLooper).Post(new Runnable(FirstRunExcite));
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
Example #16
0
        public static void Init()
        {
            try
            {
                SqLiteDatabase dbDatabase = new SqLiteDatabase();
                dbDatabase.CheckTablesStatus();
                SharedData = PreferenceManager.GetDefaultSharedPreferences(Application.Context);

                string getValue = SharedData.GetString("Night_Mode_key", string.Empty);
                ApplyTheme(getValue);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
        public static async void Logout(Activity context)
        {
            try
            {
                if (RunLogout == false)
                {
                    RunLogout = true;

                    await RemoveData("Logout");

                    context.RunOnUiThread(async() =>
                    {
                        IMethods.IPath.DeleteAll_MyFolderDisk();

                        SqLiteDatabase dbDatabase = new SqLiteDatabase();
                        dbDatabase.ClearAll();
                        dbDatabase.DropAll();

                        Classes.ClearAllList();

                        Java.Lang.Runtime.GetRuntime().RunFinalization();
                        Java.Lang.Runtime.GetRuntime().Gc();
                        TrimCache(context);

                        var ss = await dbDatabase.CheckTablesStatus();
                        dbDatabase.Dispose();

                        Intent intent = new Intent(context, typeof(First_Activity));
                        intent.AddCategory(Intent.CategoryHome);
                        intent.SetAction(Intent.ActionMain);
                        intent.AddFlags(ActivityFlags.ClearTop | ActivityFlags.NewTask | ActivityFlags.ClearTask);
                        context.StartActivity(intent);
                        context.FinishAffinity();

                        ((Tabbed_Main_Activity)context).JobRescheduble.StopJob();
                    });

                    WowTime_Main_Settings.Shared_Data.Edit().Clear().Commit();

                    RunLogout = false;
                }
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }
        public override void OnCreate()
        {
            try
            {
                base.OnCreate();
                //A great place to initialize Xamarin.Insights and Dependency Services!
                RegisterActivityLifecycleCallbacks(this);

                Instance = this;

                Client a = new Client(AppSettings.TripleDesAppServiceProvider);
                Console.WriteLine(a);

                var sqLiteDatabase = new SqLiteDatabase();
                sqLiteDatabase.CheckTablesStatus();
                sqLiteDatabase.Get_data_Login_Credentials();

                new Handler(Looper.MainLooper).Post(new Runnable(FirstRunExcite));
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
Example #19
0
        //Event Delete
        private async void BtnDeleteOnClick(object sender, EventArgs e)
        {
            try
            {
                if (Chk_Delete.Checked)
                {
                    if (!IMethods.CheckConnectivity())
                    {
                        Toast.MakeText(this, GetText(Resource.String.Lbl_Error_check_internet_connection),
                                       ToastLength.Short).Show();
                    }
                    else
                    {
                        var localdata = Classes.DataUserLoginList.FirstOrDefault(a => a.UserID == UserDetails.User_id);
                        if (localdata != null)
                        {
                            if (Txt_Password.Text == localdata.Password)
                            {
                                var(apiStatus, respond) = await Global.Delete_User(Txt_Password.Text);

                                if (apiStatus == 200)
                                {
                                    if (respond is MessageObject result)
                                    {
                                        API_Request.Delete(this);

                                        var dbDatabase = new SqLiteDatabase();
                                        var ss         = await dbDatabase.CheckTablesStatus();

                                        dbDatabase.Dispose();

                                        IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                 GetText(Resource.String.Lbl_Deleted),
                                                                                 GetText(Resource.String.Lbl_Your_account_was_successfully_deleted),
                                                                                 GetText(Resource.String.Lbl_Ok));
                                    }
                                }
                                else if (apiStatus == 400)
                                {
                                    if (respond is ErrorObject error)
                                    {
                                        var errortext = error._errors.Error_text;


                                        if (errortext.Contains("Invalid or expired access_token"))
                                        {
                                            API_Request.Logout(this);
                                        }
                                    }
                                }
                                else if (apiStatus == 404)
                                {
                                    var error = respond.ToString();
                                }
                            }
                            else
                            {
                                IMethods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Warning),
                                                                         GetText(Resource.String.Lbl_Please_confirm_your_password),
                                                                         GetText(Resource.String.Lbl_Ok));
                            }
                        }
                    }
                }
                else
                {
                    IMethods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Warning),
                                                             GetText(Resource.String.Lbl_Error_Terms),
                                                             GetText(Resource.String.Lbl_Ok));
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
Example #20
0
        //Event Delete
        private async void BtnDeleteOnClick(object sender, EventArgs e)
        {
            try
            {
                if (Chk_Delete.Checked)
                {
                    if (!IMethods.CheckConnectivity())
                    {
                        Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection),
                                       ToastLength.Short).Show();
                    }
                    else
                    {
                        var localdata = Classes.DataUserLoginList.FirstOrDefault(a => a.UserID == UserDetails.User_id);
                        if (localdata != null)
                        {
                            if (Txt_Password.Text == localdata.Password)
                            {
                                var(apiStatus, respond) = await Client.Global.Delete_User(Txt_Password.Text);

                                if (apiStatus == 200)
                                {
                                    if (respond is Update_Page_Data_Object result)
                                    {
                                        await API_Request.RemoveData("Delete");

                                        var dbDatabase = new SqLiteDatabase();
                                        var ss         = await dbDatabase.CheckTablesStatus();

                                        dbDatabase.Dispose();

                                        IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                 GetText(Resource.String.Lbl_Deleted),
                                                                                 GetText(Resource.String.Lbl_Your_account_was_successfully_deleted),
                                                                                 GetText(Resource.String.Lbl_Ok));

                                        //wael change function to delete all data in app
                                        API_Request.Logout(this);
                                    }
                                }
                                else if (apiStatus == 400)
                                {
                                    if (respond is Error_Object error)
                                    {
                                        var errortext = error._errors.Error_text;
                                        //Toast.MakeText(this, errortext, ToastLength.Short).Show();

                                        if (errortext.Contains("Invalid or expired access_token"))
                                        {
                                            API_Request.Logout(this);
                                        }
                                    }
                                }
                                else if (apiStatus == 404)
                                {
                                    var error = respond.ToString();
                                    //Toast.MakeText(this, error, ToastLength.Short).Show();
                                }
                            }
                            else
                            {
                                IMethods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Warning),
                                                                         GetText(Resource.String.Lbl_Please_confirm_your_password),
                                                                         GetText(Resource.String.Lbl_Ok));
                            }
                        }
                    }
                }
                else
                {
                    IMethods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Warning),
                                                             GetText(Resource.String.Lbl_You_can_not_access_your_disapproval),
                                                             GetText(Resource.String.Lbl_Ok));
                }
            }
            catch (Exception exception)
            {
                Crashes.TrackError(exception);
            }
        }
        private void FirstRunExcite()
        {
            try
            {
                DbDatabase = new SqLiteDatabase();
                DbDatabase.CheckTablesStatus();

                if (!string.IsNullOrEmpty(AppSettings.Lang))
                {
                    LangController.SetApplicationLang(this, AppSettings.Lang);
                }
                else
                {
                    UserDetails.LangName = Resources.Configuration.Locale.Language.ToLower();
                    LangController.SetApplicationLang(this, UserDetails.LangName);
                }

                var result = DbDatabase.Get_data_Login_Credentials();
                if (result != null)
                {
                    var settingsData = DbDatabase.GetSettings();
                    if (settingsData != null)
                    {
                        ListUtils.SettingsSiteList = settingsData;
                    }

                    DbDatabase = new SqLiteDatabase();

                    if (AppSettings.LastChatSystem == SystemApiGetLastChat.New)
                    {
                        ListUtils.UserList = DbDatabase.Get_LastUsersChat_List();
                    }
                    else
                    {
                        ListUtils.UserChatList = DbDatabase.GetLastUsersChatList();
                    }

                    var data = Intent.GetStringExtra("UserID") ?? "Data not available";
                    if (data != "Data not available" && !string.IsNullOrEmpty(data))
                    {
                        Intent intent = new Intent(this, typeof(ChatWindowActivity));
                        intent.PutExtra("UserID", data); // to_id
                        intent.PutExtra("Notifier", "Notifier");
                        intent.PutExtra("App", "Timeline");
                        intent.PutExtra("Name", Intent.GetStringExtra("Name"));
                        intent.PutExtra("Username", Intent.GetStringExtra("Username"));
                        intent.PutExtra("Time", Intent.GetStringExtra("Time"));
                        intent.PutExtra("LastSeen", Intent.GetStringExtra("LastSeen"));
                        intent.PutExtra("About", Intent.GetStringExtra("About"));
                        intent.PutExtra("Address", Intent.GetStringExtra("Address"));
                        intent.PutExtra("Phone", Intent.GetStringExtra("Phone"));
                        intent.PutExtra("Website", Intent.GetStringExtra("Website"));
                        intent.PutExtra("Working", Intent.GetStringExtra("Working"));
                        StartActivity(intent);
                    }
                    else
                    {
                        switch (result.Status)
                        {
                        case "Active":
                            StartActivity(new Intent(this, typeof(TabbedMainActivity)));
                            break;

                        default:
                            StartActivity(CrossAppAuthentication() ? new Intent(this, typeof(FirstActivity)) : new Intent(this, typeof(LoginActivity)));
                            break;
                        }
                    }
                }
                else
                {
                    var data = Intent.GetStringExtra("UserID") ?? "Data not available";
                    if (data != "Data not available" && !string.IsNullOrEmpty(data))
                    {
                        Intent intent = new Intent(this, typeof(ChatWindowActivity));
                        intent.PutExtra("UserID", data); // to_id
                        intent.PutExtra("Notifier", "Notifier");
                        intent.PutExtra("App", "Timeline");
                        intent.PutExtra("Name", Intent.GetStringExtra("Name"));
                        intent.PutExtra("Username", Intent.GetStringExtra("Username"));
                        intent.PutExtra("Time", Intent.GetStringExtra("Time"));
                        intent.PutExtra("LastSeen", Intent.GetStringExtra("LastSeen"));
                        intent.PutExtra("About", Intent.GetStringExtra("About"));
                        intent.PutExtra("Address", Intent.GetStringExtra("Address"));
                        intent.PutExtra("Phone", Intent.GetStringExtra("Phone"));
                        intent.PutExtra("Website", Intent.GetStringExtra("Website"));
                        intent.PutExtra("Working", Intent.GetStringExtra("Working"));
                        StartActivity(intent);
                    }
                    else
                    {
                        StartActivity(CrossAppAuthentication() ? new Intent(this, typeof(FirstActivity)) : new Intent(this, typeof(LoginActivity)));
                    }
                }

                DbDatabase.Dispose();

                if (AppSettings.ShowAdMobBanner || AppSettings.ShowAdMobInterstitial || AppSettings.ShowAdMobRewardVideo || AppSettings.ShowAdMobNative)
                {
                    MobileAds.Initialize(this, GetString(Resource.String.admob_app_id));
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #22
0
        private void FirstRunExcite()
        {
            try
            {
                DbDatabase = new SqLiteDatabase();
                DbDatabase.CheckTablesStatus();

                if (!string.IsNullOrEmpty(AppSettings.Lang))
                {
                    LangController.SetApplicationLang(this, AppSettings.Lang);
                }
                else
                {
                    UserDetails.LangName = Resources.Configuration.Locale.Language.ToLower();
                    LangController.SetApplicationLang(this, UserDetails.LangName);
                }

                var result = DbDatabase.Get_data_Login_Credentials();
                if (result != null)
                {
                    var settingsData = DbDatabase.GetSettings();
                    if (settingsData != null)
                    {
                        ListUtils.SettingsSiteList = settingsData;
                    }

                    if (AppSettings.LastChatSystem == SystemApiGetLastChat.New)
                    {
                        ListUtils.UserList = DbDatabase.Get_LastUsersChat_List();
                    }
                    else
                    {
                        ListUtils.UserChatList = DbDatabase.GetLastUsersChatList();
                    }

                    var userId = Intent.GetStringExtra("UserID") ?? "";
                    if (!string.IsNullOrEmpty(userId))
                    {
                        var type = Intent.GetStringExtra("type") ?? ""; //SendMsgProduct , OpenChat , OpenChatApp , OpenChatPage
                        OpenChat(type);
                    }
                    else
                    {
                        switch (result.Status)
                        {
                        case "Active":
                            StartActivity(new Intent(this, typeof(TabbedMainActivity)));
                            break;

                        default:
                            StartActivity(CrossAppAuthentication() ? new Intent(this, typeof(FirstActivity)) : new Intent(this, typeof(LoginActivity)));
                            break;
                        }
                    }
                }
                else
                {
                    var userId = Intent.GetStringExtra("UserID") ?? "";
                    if (!string.IsNullOrEmpty(userId))
                    {
                        var type = Intent.GetStringExtra("type") ?? ""; //SendMsgProduct , OpenChat , OpenChatApp , OpenChatPage
                        OpenChat(type);
                    }
                    else
                    {
                        StartActivity(CrossAppAuthentication() ? new Intent(this, typeof(FirstActivity)) : new Intent(this, typeof(LoginActivity)));
                    }
                }

                DbDatabase.Dispose();

                if (AppSettings.ShowAdMobBanner || AppSettings.ShowAdMobInterstitial || AppSettings.ShowAdMobRewardVideo || AppSettings.ShowAdMobNative)
                {
                    MobileAds.Initialize(this, GetString(Resource.String.admob_app_id));
                }

                if (AppSettings.ShowFbBannerAds || AppSettings.ShowFbInterstitialAds || AppSettings.ShowFbRewardVideoAds)
                {
                    InitializeFacebook.Initialize(this);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }