protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                // Create your application here
                SetContentView(Resource.Layout.FirstLayout);

                //Get Value
                InitComponent();

                //OneSignal Notification
                //======================================
                if (string.IsNullOrEmpty(UserDetails.DeviceId))
                {
                    OneSignalNotification.RegisterNotificationDevice();
                }

                if (Methods.CheckConnectivity())
                {
                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                        () => ApiRequest.GetSettings_Api(this)
                    });
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
예제 #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                //Set Full screen
                View mContentView = Window.DecorView;
                var  uiOptions    = (int)mContentView.SystemUiVisibility;
                var  newUiOptions = uiOptions;

                newUiOptions |= (int)SystemUiFlags.Fullscreen;
                newUiOptions |= (int)SystemUiFlags.HideNavigation;
                mContentView.SystemUiVisibility = (StatusBarVisibility)newUiOptions;

                Window.AddFlags(WindowManagerFlags.Fullscreen);

                // Create your application here
                SetContentView(Resource.Layout.LoginLayout);

                //Get Value And Set Toolbar
                InitComponent();
                InitSocialLogins();

                if (string.IsNullOrEmpty(UserDetails.DeviceId))
                {
                    OneSignalNotification.RegisterNotificationDevice();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
예제 #3
0
        public OneSignalNotificationResponse SendSeletiva(NotificacaoSeletiva notificacao, string chaveAppId, string chaveGcm)
        {
            using (MiniProfiler.Current.Step("enviando seletiva")) {
                IDictionary <string, string> additionalInfo = new Dictionary <string, string> ();
                additionalInfo.Add("notificacaoTipoId", (notificacao.NotificacaoTipoId.Id).ToString());
                additionalInfo.Add("infoAdicional", notificacao.InfoAdicional);

                var oneSignalObject = new OneSignalNotification()
                {
                    AppId         = ConfigurationProvider.Get("Settings:" + chaveAppId),
                    GcmKey        = ConfigurationProvider.Get("Settings:" + chaveGcm),
                    Message       = new OneSignalMessage(notificacao.Mensagem),
                    Title         = new OneSignalMessage(notificacao.Titulo),
                    Devices       = notificacao.DevicesUsuarios,
                    Data          = additionalInfo,
                    DelayedOption = UseInteligentDelivery(notificacao.NotificacaoTipoId.Id) ? "last-active" : "null"
                };

                OneSignalNotificationResponse data = new OneSignalNotificationResponse();

                using (var client = HttpCalls.CreateClient(ConfigurationProvider.Get("Settings:oneSignalUrl"))) {
                    try {
                        var response = HttpCalls.PostData(client, ConfigurationProvider.Get("Settings:oneSignalNotificationResource"), oneSignalObject);
                        data.Sucesso = true;
                        data.Message = response;
                    } catch (Exception ex) {
                        data.Sucesso = false;
                        data.Message = ex.Message;
                    }
                }

                return(data);
            }
        }
예제 #4
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);
     }
 }
예제 #5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                SetTheme(AppSettings.SetTabDarkTheme ? Resource.Style.MyTheme_Dark_Base : Resource.Style.MyTheme_Base);
                Window?.SetSoftInputMode(SoftInput.AdjustResize);

                Methods.App.FullScreenApp(this);

                // Create your application here
                SetContentView(Resource.Layout.Register_Layout);

                //Get Value
                InitComponent();
                LoadConfigSettings();

                if (string.IsNullOrEmpty(UserDetails.DeviceId))
                {
                    OneSignalNotification.RegisterNotificationDevice();
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(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);
            }
        }
예제 #7
0
        public override void OnCreate()
        {
            try
            {
                base.OnCreate();
                //A great place to initialize Xamarin.Insights and Dependency Services!
                RegisterActivityLifecycleCallbacks(this);

                instance = this;

                Settings st = new Settings();

                Client.WebsiteUrl = st.WebsiteUrl;
                Current.CurrentInstance.ServerKey = st.ServerKey;
                Current.CurrentInstance.SetWebsiteURL(st.WebsiteUrl, st.ServerKey);

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

                if (Settings.TurnTrustFailureOn_WebException)
                {
                    //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();
                }

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

                // Check Created My Folder Or Not
                //======================================
                IMethods.IPath.Chack_MyFolder();
                //======================================

                //Init Settings
                WowTime_Main_Settings.Init();

                //Change the Lang
                WowTime_Main_Settings.SetApplicationLang(this, Settings.Lang);
                //======================================

                //App restarted after crash
                //======================================
                AndroidEnvironment.UnhandledExceptionRaiser += AndroidEnvironmentOnUnhandledExceptionRaiser;
            }
            catch (Exception exception)
            {
                Crashes.TrackError(exception);
            }
        }
예제 #8
0
파일: ApiRequest.cs 프로젝트: surnek/tm-15v
        public static async Task GetSettings_Api(Activity context)
        {
            if (Methods.CheckConnectivity())
            {
                (int apiStatus, var respond) = await Current.GetOptionsAsync();

                if (apiStatus == 200)
                {
                    if (respond is OptionsObject result)
                    {
                        ListUtils.SettingsSiteList = null;
                        ListUtils.SettingsSiteList = result.DataOptions;

                        AppSettings.OneSignalAppId = result.DataOptions.AndroidMPushId;
                        OneSignalNotification.RegisterNotificationDevice();

                        SqLiteDatabase dbDatabase = new SqLiteDatabase();
                        dbDatabase.InsertOrUpdateSettings(result.DataOptions);
                        dbDatabase.Dispose();
                    }
                    else
                    {
                        Methods.DisplayReportResult(context, respond);
                    }
                }
            }
        }
예제 #9
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);
     }
 }
예제 #10
0
        public static async Task GetSettings_Api(Activity activity)
        {
            if (Methods.CheckConnectivity())
            {
                await GetLanguages_Api(activity);

                var lang = ListUtils.LanguagesSiteList.FirstOrDefault(languages => languages.LanguagesName.ToLower() == UserDetails.LangName)?.LanguagesName ?? "";//english

                (int apiStatus, var respond) = await Current.GetOptionsAsync(lang);

                if (apiStatus == 200)
                {
                    if (respond is GetOptionsObject result)
                    {
                        if (result.Data != null)
                        {
                            AppSettings.OneSignalAppId = result.Data.PushId;
                            OneSignalNotification.RegisterNotificationDevice();

                            ListUtils.SettingsSiteList.Clear();
                            ListUtils.SettingsSiteList.Add(result.Data);

                            SqLiteDatabase dbDatabase = new SqLiteDatabase();
                            dbDatabase.InsertOrUpdateSettings(result.Data);
                            dbDatabase.Dispose();
                        }
                    }
                }
                //else Methods.DisplayReportResult(activity, respond);
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);
                Window?.SetSoftInputMode(SoftInput.AdjustResize);

                Methods.App.FullScreenApp(this, true);

                // Create your application here
                SetContentView(Resource.Layout.SelectRegisterLayout);

                //Get Value And Set Toolbar
                InitComponent();
                InitSocialLogins();

                if (string.IsNullOrEmpty(UserDetails.DeviceId))
                {
                    OneSignalNotification.RegisterNotificationDevice();
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
예제 #12
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                Methods.App.FullScreenApp(this);

                // Create your application here
                SetContentView(Resource.Layout.Login_Layout);

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

                //Get Value And Set Toolbar
                InitComponent();
                InitSocialLogins();
                GetTimezone();

                if (string.IsNullOrEmpty(UserDetails.DeviceId))
                {
                    OneSignalNotification.RegisterNotificationDevice();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
예제 #13
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);
            }
        }
예제 #14
0
        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);
            }
        }
예제 #15
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);
            }
        }
예제 #16
0
        public static async Task <GetSiteSettingsObject.Config> GetSettings_Api(Activity context)
        {
            if (Methods.CheckConnectivity())
            {
                await SetLangUserAsync(context).ConfigureAwait(false);

                (var apiStatus, dynamic respond) = await Current.GetSettings();

                if (apiStatus != 200 || !(respond is GetSiteSettingsObject result) || result.config == null)
                {
                    return(Methods.DisplayReportResult(context, respond));
                }

                ListUtils.SettingsSiteList = result.config;

                AppSettings.OneSignalAppId = result.config.AndroidMPushId;
                OneSignalNotification.RegisterNotificationDevice();

                //Products Categories
                var listProducts = result.config.ProductsCategories.Select(cat => new Classes.Categories
                {
                    CategoriesId    = cat.Key,
                    CategoriesName  = cat.Value,
                    CategoriesColor = "#ffffff"
                }).ToList();

                ListUtils.ListCategoriesProducts.Clear();
                ListUtils.ListCategoriesProducts = new ObservableCollection <Classes.Categories>(listProducts);

                SqLiteDatabase dbDatabase = new SqLiteDatabase();
                dbDatabase.InsertOrUpdateSettings(result.config);
                dbDatabase.Dispose();

                try
                {
                    if (ListUtils.ListCategoriesProducts.Count == 0)
                    {
                        Methods.DialogPopup.InvokeAndShowDialog(context, "ReportMode", "List Categories Products Not Found, Please check api get_site_settings ", "Close");
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }

                return(result.config);
            }
            else
            {
                Toast.MakeText(context, context.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show();
                return(null);
            }
        }
예제 #17
0
        private static async Task SendLotteryNotificationToAllUsers()
        {
            List <JackpotModel>          pools       = new List <JackpotModel>();
            List <OneSignalNotification> notifToSend = new List <OneSignalNotification>();

            var url = ConfigurationManager.AppSettings["JackpotApi"];

            if (!string.IsNullOrEmpty(url))
            {
                var json = await GetJsonResponse(TicketTypeId.Powerball, url);

                var model = JsonConvert.DeserializeObject <JackpotModel>(json);
                model.JackpotName = "Powerball";
                pools.Add(model);

                json = await GetJsonResponse(TicketTypeId.MegaMillion, url);

                model             = JsonConvert.DeserializeObject <JackpotModel>(json);
                model.JackpotName = "MegaMillion";
                pools.Add(model);
            }

            try
            {
                foreach (var item in pools)
                {
                    double jackot     = item.Jackpot;
                    string drawdate   = item.Next_draw;
                    string loteryname = item.JackpotName;
                    var    content    = "The " + loteryname + " jackpot is :" + jackot + "$ and the drawing data : " + drawdate;
                    OneSignalNotification _notificationItem = new OneSignalNotification();
                    _notificationItem.headings          = "HELLO FROM Poolu !";
                    _notificationItem.contents          = content;
                    _notificationItem.small_icon        = "icon.png";
                    _notificationItem.included_segments = new List <string> {
                        "PooluUserSegment"
                    };
                    //_notificationItem.include_player_ids = new List<string> { "OneSignal_playerid_fordevice", "Another_onesignal_playerid" };
                    //myNotification.Send();
                    notifToSend.Add(_notificationItem);
                }

                foreach (var item in notifToSend)
                {
                    item.Send();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
예제 #18
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                //Set Full screen
                Methods.App.FullScreenApp(this, true);

                // Create your application here
                SetContentView(Resource.Layout.Login_Layout);

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

                //Get Value And Set Toolbar
                InitComponent();
                InitSocialLogins();
                GetTimezone();

                // Check if we're running on Android 5.0 or higher
                if ((int)Build.VERSION.SdkInt < 23)
                {
                    LoadConfigSettings();
                }
                else
                {
                    if (CheckSelfPermission(Manifest.Permission.ReadExternalStorage) == Permission.Granted && CheckSelfPermission(Manifest.Permission.WriteExternalStorage) == Permission.Granted)
                    {
                        LoadConfigSettings();
                    }
                    else
                    {
                        RequestPermissions(new[]
                        {
                            Manifest.Permission.ReadExternalStorage,
                            Manifest.Permission.WriteExternalStorage
                        }, 101);
                    }
                }

                if (string.IsNullOrEmpty(UserDetails.DeviceId))
                {
                    OneSignalNotification.RegisterNotificationDevice();
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            //Set Full screen
            SetFullScreenWindow();

            Instance = this;

            if (string.IsNullOrEmpty(UserDetails.DeviceId))
            {
                OneSignalNotification.RegisterNotificationDevice();
            }
        }
예제 #20
0
        private async Task SendNotificationDeclinedAsync(long ticketId)
        {
            var confirmInfo = DataAccess.GetApproveConfirmInfo(ticketId);

            var client = new SendGridClient(ConfigurationManager.AppSettings["OneSignalApiKey"]);

            OneSignalNotification myNotification = new OneSignalNotification();

            myNotification.contents           = "Your Lottery Ticket: " + confirmInfo.LotteryNumbers + " have been declined !";
            myNotification.small_icon         = "icon.png";
            myNotification.include_player_ids = new List <string> {
                "OneSignal_playerid_fordevice", "Another_onesignal_playerid"
            };
            await myNotification.Send();
        }
예제 #21
0
        public HttpResponseMessage Post(NewsSentPostModel model)
        {
            List <string> PlayerIds = GetPlayerIds(model.Regions);

            if (PlayerIds.Count > 0)
            {
                var news = newsSvc.Load(model.NewsId);
                if (news != null)
                {
                    OneSignalNotification.SendNotification(news.Title, PlayerIds.ToArray(), news.ID);
                    newsSentSvc.Create(model);
                }
            }

            return(Request.CreateResponse(HttpStatusCode.OK));
        }
 //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();
         }
     }
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);
                Window?.SetSoftInputMode(SoftInput.AdjustResize);

                Methods.App.FullScreenApp(this, true);

                // Create your application here
                SetContentView(Resource.Layout.Login_Layout);

                //Get Value And Set Toolbar
                InitComponent();
                InitSocialLogins();
                GetTimezone();

                if ((int)Build.VERSION.SdkInt is < 23)
                {
                    LoadConfigSettings();
                    CheckCrossAppAuthentication();
                }
                else
                {
                    if (CheckSelfPermission(Manifest.Permission.ReadExternalStorage) == Permission.Granted &&
                        CheckSelfPermission(Manifest.Permission.WriteExternalStorage) == Permission.Granted)
                    {
                        LoadConfigSettings();
                        CheckCrossAppAuthentication();
                    }
                    else
                    {
                        RequestPermissions(new[]
                        {
                            Manifest.Permission.ReadExternalStorage,
                            Manifest.Permission.WriteExternalStorage
                        }, 101);
                    }
                }

                if (string.IsNullOrEmpty(UserDetails.DeviceId))
                {
                    OneSignalNotification.RegisterNotificationDevice();
                }
            }
예제 #24
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                Methods.App.FullScreenApp(this);

                Client a = new Client(AppSettings.TripleDesAppServiceProvider);

                SetContentView(Resource.Layout.First_Activity_Layout);

                LoginButton    = FindViewById <Button>(Resource.Id.LoginButton);
                RegisterButton = FindViewById <Button>(Resource.Id.RegisterButton);
                SkipButton     = FindViewById <Button>(Resource.Id.SkipButton);
                VideoViewer    = FindViewById <VideoView>(Resource.Id.videoView);

                Android.Net.Uri uri = Android.Net.Uri.Parse("android.resource://" + PackageName + "/" + Resource.Raw.MainVideo);
                VideoViewer.SetVideoURI(uri);
                VideoViewer.Start();

                if (!AppSettings.ShowSkipButton)
                {
                    SkipButton.Visibility = ViewStates.Gone;
                }

                //OneSignal Notification
                //======================================
                if (string.IsNullOrEmpty(UserDetails.DeviceId))
                {
                    OneSignalNotification.RegisterNotificationDevice();
                }

                PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                    () => ApiRequest.GetSettings_Api(this)
                });
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
예제 #25
0
        private void InitComponent()
        {
            try
            {
                ImageBackgroundGradation = FindViewById <ImageView>(Resource.Id.backgroundGradation);
                BtnLogin      = FindViewById <Button>(Resource.Id.LoginButton);
                BtnRegister   = FindViewById <Button>(Resource.Id.RegisterButton);
                TxtFirstTitle = FindViewById <TextView>(Resource.Id.firstTitle);
                BtnSkip       = FindViewById <Button>(Resource.Id.SkipButton);

                var display = WindowManager.DefaultDisplay;
                var size    = new Point();
                display.GetSize(size);
                int   width  = size.X;
                int   height = size.Y;
                int[] color  = { Color.ParseColor("#3033c6"), Color.ParseColor("#fb0049") };
                var(gradient, bitmap) = ColorUtils.GetGradientDrawable(this, color, width, height);
                if (bitmap != null)
                {
                    ImageBackgroundGradation.SetImageBitmap(bitmap);
                }

                Console.WriteLine(gradient);
                TxtFirstTitle.Text = GetText(Resource.String.Lbl_FirstSubTitle);

                if (!AppSettings.ShowSkipButton)
                {
                    BtnSkip.Visibility = ViewStates.Gone;
                }

                if (string.IsNullOrEmpty(UserDetails.DeviceId))
                {
                    OneSignalNotification.RegisterNotificationDevice();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
예제 #26
0
        private void InitComponent()
        {
            try
            {
                ImageView image1 = FindViewById <ImageView>(Resource.Id.Iconimage);
                ImageView image2 = FindViewById <ImageView>(Resource.Id.Iconimage2);

                LoginButton    = FindViewById <Button>(Resource.Id.LoginButton);
                RegisterButton = FindViewById <Button>(Resource.Id.RegisterButton);

                GlideImageLoader.LoadImage(this, "FirstImageOne", image1, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);
                GlideImageLoader.LoadImage(this, "FirstImageTwo", image2, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

                if (!string.IsNullOrEmpty(UserDetails.DeviceId))
                {
                    OneSignalNotification.RegisterNotificationDevice();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
예제 #27
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);
                // Create your application here
                SetContentView(Resource.Layout.First_Layout);
                //Get Value
                InitComponent();

                //Check and Get Settings
                GetSettingsSite();

                if (!string.IsNullOrEmpty(UserDetails.DeviceId))
                {
                    OneSignalNotification.RegisterNotificationDevice();
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);
                SetTheme(AppSettings.SetTabDarkTheme ? Resource.Style.MyTheme_Dark_Base : Resource.Style.MyTheme_Base);
                Methods.App.FullScreenApp(this);

                // Create your application here
                SetContentView(Resource.Layout.Main);

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

                //Get Value And Set Toolbar
                InitComponent();
                InitSocialLogins();

                //OneSignal Notification
                //======================================
                if (string.IsNullOrEmpty(UserDetails.DeviceId))
                {
                    OneSignalNotification.RegisterNotificationDevice();
                }

                if (Methods.CheckConnectivity())
                {
                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                        () => ApiRequest.GetSettings_Api(this), GetTimezone
                    });
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
예제 #29
0
        private static async Task RemoveData(string type)
        {
            try
            {
                if (type == "Logout")
                {
                    if (Methods.CheckConnectivity())
                    {
                        PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                            RequestsAsync.Global.User_logout_Http
                        });
                    }
                }
                else if (type == "Delete")
                {
                    Methods.Path.DeleteAll_MyFolder();

                    if (Methods.CheckConnectivity())
                    {
                        PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                            () => RequestsAsync.Global.Delete_User_Http(UserDetails.UserId, UserDetails.Password)
                        });
                    }
                }

                await Task.Delay(500);

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

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

                    UserDetails.IsLogin = false;

                    OneSignalNotification.UnRegisterNotificationDevice();

                    UserDetails.ClearAllValueUserDetails();

                    GC.Collect();
                }
                catch (Exception exception)
                {
                    Console.WriteLine(exception);
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
예제 #30
0
        //Get Settings Api
        public static async Task GetSettings_Api(Activity activity)
        {
            if (Methods.CheckConnectivity())
            {
                if (UserDetails.IsLogin)
                {
                    await SetLangUserAsync();
                }

                //site_settings
                var(apiStatus, respond) = await Current.Get_Settings_Http();

                if (apiStatus == 200)
                {
                    if (respond is GetSettingsObject result)
                    {
                        var settings = result.Data.SiteSettings;

                        ListUtils.MySettingsList = settings;

                        AppSettings.OneSignalAppId   = settings.PushId;
                        AppSettings.ShowButtonImport = string.IsNullOrWhiteSpace(settings.ImportSystem) ? AppSettings.ShowButtonImport : settings.ImportSystem == "on";
                        AppSettings.ShowButtonUpload = string.IsNullOrWhiteSpace(settings.UploadSystem) ? AppSettings.ShowButtonUpload : settings.UploadSystem == "on";

                        OneSignalNotification.RegisterNotificationDevice();

                        if (settings.Categories?.Count > 0)
                        {
                            //Categories >> New V.1.6
                            var listCategories = settings.Categories.Select(cat => new Classes.Category
                            {
                                Id      = cat.Key,
                                Name    = Methods.FunString.DecodeString(cat.Value),
                                Color   = "#212121",
                                Image   = CategoriesController.GetImageCategory(cat.Value),
                                SubList = new List <Classes.Category>()
                            }).ToList();

                            CategoriesController.ListCategories.Clear();
                            CategoriesController.ListCategories = new ObservableCollection <Classes.Category>(listCategories);
                        }
                        else
                        {
                            //Categories >> Old V.1.5
                            var listCategories = result.Data.Categories.Select(cat => new Classes.Category
                            {
                                Id      = cat.Key,
                                Name    = Methods.FunString.DecodeString(cat.Value),
                                Color   = "#212121",
                                Image   = CategoriesController.GetImageCategory(cat.Value),
                                SubList = new List <Classes.Category>()
                            }).ToList();

                            CategoriesController.ListCategories.Clear();
                            CategoriesController.ListCategories = new ObservableCollection <Classes.Category>(listCategories);
                        }

                        if (settings.SubCategories?.SubCategoriessList?.Count > 0)
                        {
                            //Sub Categories
                            foreach (var sub in settings.SubCategories?.SubCategoriessList)
                            {
                                var subCategories = ListUtils.MySettingsList?.SubCategories?.SubCategoriessList?.FirstOrDefault(a => a.Key == sub.Key).Value;
                                if (subCategories?.Count > 0)
                                {
                                    var cat = CategoriesController.ListCategories.FirstOrDefault(a => a.Id == sub.Key);
                                    if (cat != null)
                                    {
                                        foreach (var pairs in subCategories.SelectMany(pairs => pairs))
                                        {
                                            cat.SubList.Add(new Classes.Category()
                                            {
                                                Id    = pairs.Key,
                                                Name  = Methods.FunString.DecodeString(pairs.Value),
                                                Color = "#212121",
                                            });
                                        }
                                    }
                                }
                            }
                        }

                        if (settings.MoviesCategories?.Count > 0)
                        {
                            //Movies Categories
                            var listMovies = settings.MoviesCategories.Select(cat => new Classes.Category
                            {
                                Id      = cat.Key,
                                Name    = Methods.FunString.DecodeString(cat.Value),
                                Color   = "#212121",
                                SubList = new List <Classes.Category>()
                            }).ToList();

                            CategoriesController.ListCategoriesMovies.Clear();
                            CategoriesController.ListCategoriesMovies = new ObservableCollection <Classes.Category>(listMovies);
                        }

                        //Insert MySettings in Database
                        var sqlEntity = new SqLiteDatabase();
                        sqlEntity.InsertOrUpdate_Settings(settings);
                        sqlEntity.Dispose();
                    }
                }
                else
                {
                    Methods.DisplayReportResult(activity, respond);
                }
            }
        }