Beispiel #1
0
        public override void OnCreate()
        {
            try
            {
                Instance = this;

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

                //Bypass Web Errors
                //======================================
                if (AppSettings.TurnSecurityProtocolType3072On)
                {
                    ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
                    var client = new HttpClient(new AndroidClientHandler());
                    ServicePointManager.Expect100Continue = true;
                    ServicePointManager.SecurityProtocol  = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls13;
                    Console.WriteLine(client);
                }

                if (AppSettings.TurnTrustFailureOnWebException)
                {
                    //If you are Getting this error >>> System.Net.WebException: Error: TrustFailure /// then Set it to true
                    ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
                    var b = new AesCryptoServiceProvider();
                    Console.WriteLine(b);
                }

                //OneSignal Notification
                //======================================
                OneSignalNotification.RegisterNotificationDevice();

                // Check Created My Folder Or Not
                //======================================
                Methods.Path.Chack_MyFolder();
                //======================================

                //Init Settings
                MainSettings.Init();

                ClassMapper.SetMappers();

                //App restarted after crash
                AndroidEnvironment.UnhandledExceptionRaiser += AndroidEnvironmentOnUnhandledExceptionRaiser;
                AppDomain.CurrentDomain.UnhandledException  += CurrentDomainOnUnhandledException;
                TaskScheduler.UnobservedTaskException       += TaskSchedulerOnUnobservedTaskException;

                AppCompatDelegate.CompatVectorFromResourcesEnabled = true;

                FirebaseApp.InitializeApp(this);

                Methods.AppLifecycleObserver appLifecycleObserver = new Methods.AppLifecycleObserver();
                ProcessLifecycleOwner.Get().Lifecycle.AddObserver(appLifecycleObserver);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
        public override void OnCreate()
        {
            try
            {
                base.OnCreate();

                Instance = this;

                //A great place to initialize Xamarin.Insights and Dependency Services!
                RegisterActivityLifecycleCallbacks(this);

                Instance = this;

                Client client = new Client(AppSettings.Cert);
                Console.WriteLine(client);

                if (AppSettings.TurnSecurityProtocolType3072On)
                {
                    ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
                    HttpClient clientHttp = new HttpClient(new Xamarin.Android.Net.AndroidClientHandler());
                    Console.WriteLine(clientHttp);
                    ServicePointManager.Expect100Continue = true;
                    ServicePointManager.SecurityProtocol  = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls13 | SecurityProtocolType.Ssl3;
                }

                if (AppSettings.TurnTrustFailureOnWebException)
                {
                    //If you are Getting this error >>> System.Net.WebException: Error: TrustFailure /// then Set it to true
                    ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
                    System.Security.Cryptography.AesCryptoServiceProvider b = new System.Security.Cryptography.AesCryptoServiceProvider();
                    Console.WriteLine(b);
                }

                //OneSignal Notification
                //======================================
                OneSignalNotification.RegisterNotificationDevice();

                //Init Settings
                SharedPref.Init();

                ClassMapper.SetMappers();

                //App restarted after crash
                AndroidEnvironment.UnhandledExceptionRaiser += AndroidEnvironmentOnUnhandledExceptionRaiser;
                AppDomain.CurrentDomain.UnhandledException  += CurrentDomainOnUnhandledException;
                TaskScheduler.UnobservedTaskException       += TaskSchedulerOnUnobservedTaskException;

                FirebaseApp.InitializeApp(this);
                Methods.Path.Chack_MyFolder();

                Methods.AppLifecycleObserver appLifecycleObserver = new Methods.AppLifecycleObserver();
                ProcessLifecycleOwner.Get().Lifecycle.AddObserver(appLifecycleObserver);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
        private void FirstRunExcite()
        {
            try
            {
                //AppCenter.Start("9f8cf987-8bfc-4895-a18b-bd4a86ef9ae3", typeof(Analytics), typeof(Crashes));

                AdsGoogle.InitializeAdsGoogle.Initialize(this);

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

                InitRtcEngine();
                InitConfig();

                switch (AppSettings.TurnSecurityProtocolType3072On)
                {
                //Bypass Web Errors
                //======================================
                case true:
                {
                    ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
                    var client = new HttpClient(new AndroidClientHandler());
                    ServicePointManager.Expect100Continue = true;
                    ServicePointManager.SecurityProtocol  = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls13;
                    Console.WriteLine(client);
                    break;
                }
                }


                switch (AppSettings.TurnTrustFailureOnWebException)
                {
                case true:
                {
                    //If you are Getting this error >>> System.Net.WebException: Error: TrustFailure /// then Set it to true
                    ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
                    var b = new AesCryptoServiceProvider();
                    Console.WriteLine(b);
                    break;
                }
                }

                //OneSignal Notification
                //======================================
                OneSignalNotification.RegisterNotificationDevice();

                //Init Settings
                MainSettings.Init();

                ClassMapper.SetMappers();

                //App restarted after crash
                AndroidEnvironment.UnhandledExceptionRaiser += AndroidEnvironmentOnUnhandledExceptionRaiser;
                AppDomain.CurrentDomain.UnhandledException  += CurrentDomainOnUnhandledException;
                TaskScheduler.UnobservedTaskException       += TaskSchedulerOnUnobservedTaskException;

                AppCompatDelegate.CompatVectorFromResourcesEnabled = true;
                FirebaseApp.InitializeApp(this);

                AXEmojiManager.Install(this, new AXIOSEmojiProvider(this));

                Methods.AppLifecycleObserver appLifecycleObserver = new Methods.AppLifecycleObserver();
                ProcessLifecycleOwner.Get().Lifecycle.AddObserver(appLifecycleObserver);

                if (Methods.CheckConnectivity())
                {
                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                        ApiRequest.GetTimeZoneAsync
                    });
                }

                var sqLiteDatabase = new SqLiteDatabase();
                if (!string.IsNullOrEmpty(UserDetails.AccessToken))
                {
                    ListUtils.MuteList     = sqLiteDatabase.Get_MuteList();
                    ListUtils.PinList      = sqLiteDatabase.Get_PinList();
                    ListUtils.ArchiveList  = sqLiteDatabase.Get_ArchiveList();
                    ListUtils.StickersList = sqLiteDatabase.Get_From_StickersTb();

                    if (AppSettings.LastChatSystem == SystemApiGetLastChat.New)
                    {
                        ListUtils.UserList = sqLiteDatabase.Get_LastUsersChat_List();
                    }
                    else
                    {
                        ListUtils.UserChatList = sqLiteDatabase.GetLastUsersChatList();
                    }
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
                Toast.MakeText(this, exception.Message, ToastLength.Short)?.Show();
            }
        }
        private void FirstRunExcite()
        {
            try
            {
                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);
                }

                InitRtcEngine();
                InitConfig();

                //Bypass Web Errors
                //======================================
                if (AppSettings.TurnSecurityProtocolType3072On)
                {
                    ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
                    var client = new HttpClient(new AndroidClientHandler());
                    ServicePointManager.Expect100Continue = true;
                    ServicePointManager.SecurityProtocol  = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls13;
                    Console.WriteLine(client);
                }

                if (AppSettings.TurnTrustFailureOnWebException)
                {
                    //If you are Getting this error >>> System.Net.WebException: Error: TrustFailure /// then Set it to true
                    ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
                    var b = new AesCryptoServiceProvider();
                    Console.WriteLine(b);
                }

                //OneSignal Notification
                //======================================
                OneSignalNotification.RegisterNotificationDevice();

                //Init Settings
                MainSettings.Init();

                ClassMapper.SetMappers();

                //App restarted after crash
                AndroidEnvironment.UnhandledExceptionRaiser += AndroidEnvironmentOnUnhandledExceptionRaiser;
                AppDomain.CurrentDomain.UnhandledException  += CurrentDomainOnUnhandledException;
                TaskScheduler.UnobservedTaskException       += TaskSchedulerOnUnobservedTaskException;

                AppCompatDelegate.CompatVectorFromResourcesEnabled = true;
                FirebaseApp.InitializeApp(this);

                Methods.AppLifecycleObserver appLifecycleObserver = new Methods.AppLifecycleObserver();
                ProcessLifecycleOwner.Get().Lifecycle.AddObserver(appLifecycleObserver);

                var sqLiteDatabase = new SqLiteDatabase();
                if (AppSettings.LastChatSystem == SystemApiGetLastChat.New)
                {
                    ListUtils.UserList = sqLiteDatabase.Get_LastUsersChat_List();
                }
                else
                {
                    ListUtils.UserChatList = sqLiteDatabase.GetLastUsersChatList();
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
                Toast.MakeText(this, exception.Message, ToastLength.Short)?.Show();
            }
        }