Example #1
0
        void ShowSeveralDevicesRestriction()
        {
            LogOutClass.log_out(this);
            MyCardActivity.DeviceRestricted = true;
            Intent intent = new Intent(this, typeof(MyCardActivity));

            intent.AddFlags(ActivityFlags.ClearTop); // Removes other Activities from stack
            StartActivity(intent);
        }
Example #2
0
        public static void log_out()
        {
            close_menu();
            LogOutClass.log_out();

            var vc = sb.InstantiateViewController(nameof(RootMyCardViewController));

            try
            {
                ViewController.navigationController.PushViewController(vc, true);
            }
            catch (Exception ex)
            {
            }
        }
Example #3
0
 private void ShowLogOutAlert()
 {
     Android.App.AlertDialog.Builder builder = new Android.App.AlertDialog.Builder(this);
     builder.SetTitle(TranslationHelper.GetString("logoutRequest", _ci));
     if (!QrActivity.IsPremium)
     {
         builder.SetMessage(TranslationHelper.GetString("logoutNotPremium", _ci));
         builder.SetNeutralButton(TranslationHelper.GetString("premium", _ci), (object sender1, DialogClickEventArgs e1) =>
         {
             StartActivity(typeof(PremiumActivity));
         });
     }
     builder.SetNegativeButton(TranslationHelper.GetString("cancel", _ci), (object sender1, DialogClickEventArgs e1) => { });
     builder.SetCancelable(true);
     builder.SetPositiveButton(TranslationHelper.GetString("logout", _ci), (object sender1, DialogClickEventArgs e1) =>
     {
         LogOutClass.log_out(this);
         try { _drawerLayout.CloseDrawer(_leftDrawer); } catch { }
         InitElements();
     });
     Android.App.AlertDialog dialog = builder.Create();
     dialog.Show();
 }
 void ShowSeveralDevicesRestriction()
 {
     LogOutClass.log_out();
     MyCardViewController.device_restricted = true;
     NavigationController.PushViewController(sb.InstantiateViewController(nameof(RootMyCardViewController)), true);
 }
Example #5
0
        void call_login_menu()
        {
            string[] constraintItems = new string[] { "Подробнее о Premium" };

            if (!databaseMethods.userExists())
            {
                constraintItems = new string[] { "Войти в учетную запись" }
            }
            ;
            var option_const = new UIActionSheet(null, null, "Отменить", null, constraintItems);

            option_const.Title    = "Для прибретения Premium-подписки необходимо войти в свою учетную запись";
            option_const.Clicked += (btn_sender, args) =>
            {
                if (args.ButtonIndex == 0)
                {
                    NavigationController.PushViewController(sb.InstantiateViewController(nameof(EmailViewControllerNew)), true);
                }
            };
            option_const.ShowInView(View);
        }

        void ShowSeveralDevicesRestriction()
        {
            LogOutClass.log_out();
            MyCardViewController.device_restricted = true;
            NavigationController.PushViewController(sb.InstantiateViewController(nameof(RootMyCardViewController)), true);
        }

        void AuthorizeAfterPurchase(string cards_remainingcontent)
        {
            var des_auth = JsonConvert.DeserializeObject <AuthorizeRootObject>(cards_remainingcontent);

            try
            {
                try
                {
                    foreach (var subscription in des_auth.subscriptions)
                    {
                        if (subscription.isTrial)
                        {
                            HideSubscriptionTill();
                            break;
                        }
                        if (subscription.id != 1)
                        {
                            if (maxValTill != null)
                            {
                                var res = DateTime.Compare(subscription.validTill, (DateTime)maxValTill);
                                if (res < 0)
                                {
                                    maxValTill = subscription.validTill;
                                }
                            }
                            else
                            {
                                maxValTill = subscription.validTill;
                            }
                        }
                        InvokeOnMainThread(() =>
                        {
                            if (maxValTill != null)
                            {
                                ShowSubscriptionTill();
                            }
                            else
                            {
                                ShowBuyElements();
                            }
                        });
                    }
                }
                catch (Exception ex)
                {
                }
                foreach (var subs in des_auth.subscriptions)
                {
                    if (subs.limitations != null)
                    {
                        if (subs.limitations.allowMultiClients)
                        {
                            QRViewController.is_premium = true;
                            break;
                        }
                    }
                }
                //if (!is_premium)
                foreach (var subscription in des_auth.subscriptions)
                {
                    if (subscription.limitations?.cardsRemaining == null)
                    {
                        QRViewController.cards_remaining = 10;
                        break;
                    }
                    else
                    {
                        if (subscription.limitations != null)
                        {
                            if (subscription.limitations.cardsRemaining > QRViewController.cards_remaining)
                            {
                                QRViewController.cards_remaining = subscription.limitations.cardsRemaining.Value;
                            }
                        }
                    }
                }
                try
                {
                    NativeMethods.ClearFeatures();
                    foreach (var subscription in des_auth.subscriptions)
                    {
                        if (subscription.features != null)
                        {
                            foreach (var feature in subscription.features)
                            {
                                if (String.IsNullOrEmpty(QRViewController.ExtraEmploymentData))
                                {
                                    if (feature == Constants.ExtraEmploymentData)
                                    {
                                        QRViewController.ExtraEmploymentData = feature;
                                    }
                                }
                                if (String.IsNullOrEmpty(QRViewController.CompanyLogoInQr))
                                {
                                    if (feature == Constants.CompanyLogoInQr)
                                    {
                                        QRViewController.CompanyLogoInQr = feature;
                                    }
                                }
                                if (String.IsNullOrEmpty(QRViewController.ExtraPersonData))
                                {
                                    if (feature == Constants.ExtraPersonData)
                                    {
                                        QRViewController.ExtraPersonData = feature;
                                    }
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                }
            }
            catch { }
            //SideMenuViewController.reloadOption();
        }

        void ShowSubscriptionTill()
        {
            subscriptionTillTV.Hidden = false;
            var dateTill = maxValTill?.ToLocalTime().Date.ToString().Split(' ')[0].Replace('/', '.');//.Substring(0, 10);

            subscriptionTillTV.Text = $"{"Подписка оплачена до:"} {dateTill}";
            HideBuyElements();
        }

        void HideSubscriptionTill()
        {
            subscriptionTillTV.Hidden = true;
            ShowBuyElements();
        }

        void ShowBuyElements()
        {
            ratesTV.Hidden              = false;
            month_bn.Hidden             = false;
            month_subscriptionTV.Hidden = false;
            year_bn.Hidden              = false;
            year_subscriptionTV.Hidden  = false;
        }

        void HideBuyElements()
        {
            ratesTV.Hidden              = true;
            month_bn.Hidden             = true;
            month_subscriptionTV.Hidden = true;
            year_bn.Hidden              = true;
            year_subscriptionTV.Hidden  = true;
        }
    }