Ver Fonte

轻会员-高级功能取消网络请求,多设备挤下,启动APP时登出,卡顿优化

lvle há 1 ano atrás
pai
commit
ce45fab4b0

+ 2 - 8
PDF Office/Helper/ServiceHelper.cs

@@ -314,7 +314,7 @@ namespace PDF_Master.Helper
         /// <summary>
         /// 高级功能前弹出比较表
         /// </summary>
-        /// <param name="post">是否请求服务器,默认false为请求</param>
+        /// <param name="post">是否请求服务器,true为请求</param>
         public static bool IAPBeforeFunction(bool post = false)
         {
             if (!App.IsLogin)
@@ -332,7 +332,7 @@ namespace PDF_Master.Helper
 
             }
         
-            if (!post)
+            if (post)
             {
                 //判断本地有没有token,没有显示登录,有再判断登录状态
                 if (Settings.Default.AppProperties.LoginToken != "")
@@ -345,12 +345,6 @@ namespace PDF_Master.Helper
                         App.mainWindowViewModel.RegisterVis = Visibility.Collapsed;
                         App.mainWindowViewModel.OphVis = Visibility.Visible;
 
-                        if (Settings.Default.UserDate.IsLoginoff == false)
-                        {
-                            App.mainWindowViewModel.OpenLoginoff();
-                            Settings.Default.UserDate.IsLoginoff = true;
-                            Settings.Default.Save();
-                        }
                     }
                 }
                 else

+ 6 - 33
PDF Office/ViewModels/MainWindowViewModel.cs

@@ -374,43 +374,10 @@ namespace PDF_Master.ViewModels
                 }
                 ));
 
-                App.IsFirstOpen = false;
                 //因为远程广告模块没有时间测试正式环境,暂时取消
                 //ADServiceHelper.GetAD("PDFMasterWindows");
 
 
-            }
-            //判断本地有没有token,没有显示登录,有再判断登录状态
-            if (Settings.Default.AppProperties.LoginToken != "")
-            {
-                string code = ServiceHelper.GetUser();
-                if (code == "330" || code == "304")
-                {
-                    UpgradeVis = Visibility.Visible;
-                    LoginVis = Visibility.Visible;
-                    RegisterVis = Visibility.Collapsed;
-                    OphVis = Visibility.Visible;
-                }
-                else
-                {
-                    App.IsLogin = true;
-                    Useremailchar = Settings.Default.UserDate.Email.Substring(0, 1);
-                    UserVis = Visibility.Visible;
-                }
-            }
-            else if(Settings.Default.UserDate.Email!="")
-            {
-                UpgradeVis = Visibility.Visible;
-                LoginVis = Visibility.Visible;
-                RegisterVis = Visibility.Collapsed;
-                OphVis = Visibility.Visible;
-            }
-            else
-            {
-                UpgradeVis = Visibility.Visible;
-                RegisterVis = Visibility.Visible;
-                LoginVis = Visibility.Collapsed;
-                OphVis = Visibility.Visible;
             }
             InitString();
         }
@@ -465,11 +432,17 @@ namespace PDF_Master.ViewModels
           
         }
 
+        /// <summary>
+        /// 注册成功弹窗
+        /// </summary>
         public void OpenRegisterOK()
         {
             dialogs.ShowDialog(DialogNames.RegisterOKRegion);
         }
 
+        /// <summary>
+        /// 登录超出设备数限制,重新登录提示弹窗
+        /// </summary>
         public void OpenLoginoff()
         {
             dialogs.ShowDialog(DialogNames.LoginoffDialog);

+ 11 - 11
PDF Office/ViewModels/PageEdit/PageEditContentViewModel.cs

@@ -779,7 +779,7 @@ namespace PDF_Master.ViewModels.PageEdit
             if ((bool)dialog.ShowDialog())
             {
                 //付费锁
-                if (!ServiceHelper.IAPBeforeFunction(true))
+                if (!ServiceHelper.IAPBeforeFunction())
                 {
                     return;
                 }
@@ -865,7 +865,7 @@ namespace PDF_Master.ViewModels.PageEdit
                 if (e.Result == ButtonResult.OK && e.Parameters != null)
                 {
                     //付费锁
-                    if (!ServiceHelper.IAPBeforeFunction(true))
+                    if (!ServiceHelper.IAPBeforeFunction())
                     {
                         return;
                     }
@@ -905,7 +905,7 @@ namespace PDF_Master.ViewModels.PageEdit
                 if (e.Result == ButtonResult.OK && e.Parameters != null)
                 {
                     //付费锁
-                    if (!ServiceHelper.IAPBeforeFunction(true))
+                    if (!ServiceHelper.IAPBeforeFunction())
                     {
                         return;
                     }
@@ -971,7 +971,7 @@ namespace PDF_Master.ViewModels.PageEdit
             if ((string)type == ParameterNames.InsertType_Blank)
             {
                 //付费锁
-                if (!ServiceHelper.IAPBeforeFunction(true))
+                if (!ServiceHelper.IAPBeforeFunction())
                 {
                     return;
                 }
@@ -1032,7 +1032,7 @@ namespace PDF_Master.ViewModels.PageEdit
                 if ((bool)dialog.ShowDialog())
                 {
                     //付费锁
-                    if (!ServiceHelper.IAPBeforeFunction(true))
+                    if (!ServiceHelper.IAPBeforeFunction())
                     {
                         return;
                     }
@@ -1079,7 +1079,7 @@ namespace PDF_Master.ViewModels.PageEdit
                       if (e.Result == ButtonResult.OK && e.Parameters != null)
                       {
                           //付费锁
-                          if (!ServiceHelper.IAPBeforeFunction(true))
+                          if (!ServiceHelper.IAPBeforeFunction())
                           {
                               return;
                           }
@@ -1408,7 +1408,7 @@ namespace PDF_Master.ViewModels.PageEdit
                 return;
             }
             //付费锁
-            if (!ServiceHelper.IAPBeforeFunction(true))
+            if (!ServiceHelper.IAPBeforeFunction())
             {
                 return;
             }
@@ -1950,7 +1950,7 @@ namespace PDF_Master.ViewModels.PageEdit
             DataTrackingHelper.AddFirstAndSecondaryPath(DataTrackingHelper.FirstPath.Reading, DataTrackingHelper.SecondaryPath.Copy);
             DataTrackingHelper.IsClearEntryPath = true;
             DataTrackingHelper.SendEvent(DataTrackingHelper.EventType.SubTbr_PageEdit, "SubTbr_Btn", "Btn_SubTbr_Copy");
-            if (!ServiceHelper.IAPBeforeFunction(true))
+            if (!ServiceHelper.IAPBeforeFunction())
             {
                 return;
             }
@@ -2008,7 +2008,7 @@ namespace PDF_Master.ViewModels.PageEdit
         /// </summary>
         private void Paste(int Index = -1)
         {
-            if (!ServiceHelper.IAPBeforeFunction(true))
+            if (!ServiceHelper.IAPBeforeFunction())
             {
                 return;
             }
@@ -2326,7 +2326,7 @@ namespace PDF_Master.ViewModels.PageEdit
         {
             PageEditItem pageEditItem = null;
             int index = -1;
-            if (!ServiceHelper.IAPBeforeFunction(true))
+            if (!ServiceHelper.IAPBeforeFunction())
             {
                 return index;
             }
@@ -3102,7 +3102,7 @@ namespace PDF_Master.ViewModels.PageEdit
         /// <param name="rightRotate"></param>
         private async void RotateSelectedPages(bool rightRotate = true, List<int> pageitems = null, bool isFromUndoRedo = false)
         {
-            if (!ServiceHelper.IAPBeforeFunction(true))
+            if (!ServiceHelper.IAPBeforeFunction())
             {
                 return;
             }

+ 29 - 3
PDF Office/Views/MainWindow.xaml.cs

@@ -191,22 +191,48 @@ namespace PDF_Master.Views
             App.mainWindowViewModel = this.DataContext as MainWindowViewModel;
             aggregator?.GetEvent<DragablzWindowEvent>().Publish(new DragablzWindowEventArgs() { TabControl = TabablzControl, Type = DragablzWindowEventType.Activated });
             //只需要第一次激活时获取一次信息
+
             if(App.IsFirstOpen)
-            {
+            {            
                 //判断本地有没有token,没有显示登录,有再判断登录状态
                 if (Settings.Default.AppProperties.LoginToken != "")
                 {
-
                     string code = ServiceHelper.GetUser();
                     if (code == "330" || code == "304")
                     {
-
+                        App.mainWindowViewModel.UpgradeVis = Visibility.Visible;
+                        App.mainWindowViewModel.LoginVis = Visibility.Visible;
+                        App.mainWindowViewModel.RegisterVis = Visibility.Collapsed;
+                        App.mainWindowViewModel.OphVis = Visibility.Visible;
                         if (Settings.Default.UserDate.IsLoginoff == false)
                         {
                             App.mainWindowViewModel.OpenLoginoff();
+                            Settings.Default.UserDate.IsLoginoff = true;
+                            Settings.Default.Save();
                         }
                     }
+                    else
+                    {
+                        App.IsLogin = true;
+                        App.mainWindowViewModel.Useremailchar = Settings.Default.UserDate.Email.Substring(0, 1);
+                        App.mainWindowViewModel.UserVis = Visibility.Visible;
+                    }
+                }
+                else if (Settings.Default.UserDate.Email != "")
+                {
+                    App.mainWindowViewModel.UpgradeVis = Visibility.Visible;
+                    App.mainWindowViewModel.LoginVis = Visibility.Visible;
+                    App.mainWindowViewModel.RegisterVis = Visibility.Collapsed;
+                    App.mainWindowViewModel.OphVis = Visibility.Visible;
+                }
+                else
+                {
+                    App.mainWindowViewModel.UpgradeVis = Visibility.Visible;
+                    App.mainWindowViewModel.RegisterVis = Visibility.Visible;
+                    App.mainWindowViewModel.LoginVis = Visibility.Collapsed;
+                    App.mainWindowViewModel.OphVis = Visibility.Visible;
                 }
+                App.IsFirstOpen = false;
             }
             //控制首页UPgrade按钮的显示与否
             if (Settings.Default.UserDate.subscribestatus == 1)

+ 2 - 2
PDF Office/Views/PageEdit/PageEditContent.xaml.cs

@@ -503,7 +503,7 @@ namespace PDF_Master.Views.PageEdit
                         //页面 是App内的拖拽 ,还是拖拽 页面 出 App 是一起处理
 
                         //将付费锁逻辑提前,避免拖拽出窗体成功
-                        if (!ServiceHelper.IAPBeforeFunction(true))
+                        if (!ServiceHelper.IAPBeforeFunction())
                         {
                             return;
                         }
@@ -803,7 +803,7 @@ namespace PDF_Master.Views.PageEdit
                 {
                     //不能将付费锁 放到 grid_DragOver,会卡顿
                     //将付费锁逻辑提前,避免因弹窗显示后导致虚影无法消失问题
-                    if (!ServiceHelper.IAPBeforeFunction(true))
+                    if (!ServiceHelper.IAPBeforeFunction())
                     {
                         LineInset.Visibility = Visibility.Collapsed;
                         ImgPicture.Visibility = Visibility.Collapsed;