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();
            }
        }
        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);
            }
        }
Пример #3
0
        private void SimulateStartup()
        {
            try
            {
                DbDatabase = new SqLiteDatabase();
                DbDatabase.Connect();

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

                Methods.Path.Chack_MyFolder();

                var result = DbDatabase.Get_data_Login();
                if (result != null)
                {
                    UserDetails.UserId      = Client.UserId = result.UserId;
                    UserDetails.AccessToken = Current.AccessToken = result.AccessToken;
                    UserDetails.Cookie      = result.Cookie;

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

                    case "Pending":
                        StartActivity(new Intent(this, typeof(TabbedMainActivity)));
                        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));
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
Пример #4
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();
            }
        }
Пример #5
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();
            }
        }
Пример #6
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);
            }
        }
        private void FirstRunExcite()
        {
            try
            {
                switch (string.IsNullOrEmpty(AppSettings.Lang))
                {
                case false:
                    LangController.SetApplicationLang(this, AppSettings.Lang);
                    break;

                default:
                        #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);
                    break;
                }

                switch (string.IsNullOrEmpty(UserDetails.AccessToken))
                {
                case false when Intent?.Data?.Path != null:
                {
                    if (Intent.Data.Path.Contains("register") && UserDetails.Status != "Active" && UserDetails.Status != "Pending")
                    {
                        StartActivity(new Intent(Application.Context, typeof(RegisterActivity)));
                    }
                    else if (Intent.Data.Path.Contains("post") && (UserDetails.Status == "Active" || UserDetails.Status == "Pending"))
                    {
                        var postId = Intent.Data.Path.Split("/").Last().Replace("/", "").Split("_").First();

                        var intent = new Intent(Application.Context, typeof(ViewFullPostActivity));
                        intent.PutExtra("Id", postId);
                        StartActivity(intent);
                    }
                    else
                    {
                        switch (UserDetails.Status)
                        {
                        case "Active":
                        case "Pending":
                            StartActivity(new Intent(Application.Context, typeof(TabbedMainActivity)));
                            break;

                        default:
                            StartActivity(new Intent(Application.Context, typeof(LoginActivity)));
                            break;
                        }
                    }

                    break;
                }

                case false:
                    switch (UserDetails.Status)
                    {
                    case "Active":
                    case "Pending":
                        StartActivity(new Intent(Application.Context, typeof(TabbedMainActivity)));
                        break;

                    default:
                        StartActivity(new Intent(Application.Context, typeof(LoginActivity)));
                        break;
                    }
                    break;

                default:
                    StartActivity(new Intent(Application.Context, typeof(LoginActivity)));
                    break;
                }

                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();
            }
        }
        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);
            }
        }