From 9c8baf7e7e1169ebdf7d5f7ed33ab29dd5fcbf18 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期一, 14 十二月 2020 17:45:17 +0800
Subject: [PATCH] 2020-12-14 1.解锁设置问题修复,增加面容ID验证。2.错误码对接增加。

---
 HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockSettingsPageBLL.cs |  283 +++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 198 insertions(+), 85 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockSettingsPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockSettingsPageBLL.cs
index 01125ba..496648d 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockSettingsPageBLL.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockSettingsPageBLL.cs
@@ -44,48 +44,19 @@
                     unlockOptionView.Visible = false;
                     refreshAction();
                 };
-                Action action1 = () => {
+                Action action1 = () =>
+                {
                     if (!btnUnprotectedBg.IsSelected)
                     {
                         //1:楠岃瘉鎸囩汗
                         if (UserInfo.Current.appUnlockType.Contains("3"))
                         {
-                            TouchIDUtils.Instance.showTouchIDWithDescribe(null, Language.StringByID(StringId.PleaseVerifyTheFingerprint));
-                            TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent = (sender1, e) =>
-                            {
-                                if (e == TouchIDUtils.TouchIDState.NotSupport)
-                                {
-                                    MainPage.Log("KK:褰撳墠璁惧涓嶆敮鎸乀ouchID楠岃瘉,璇疯緭鍏ュ瘑鐮佹潵楠岃瘉");
-                                }
-                                else if (e == TouchIDUtils.TouchIDState.Success)
-                                {
-                                    MainPage.Log("KK:TouchID楠岃瘉鎴愬姛");
-                                    action();
-                                }
-                                else if (e == TouchIDUtils.TouchIDState.InputPassword || e == TouchIDUtils.TouchIDState.TouchIDLockout)
-                                {
-                                    MainPage.Log("KK:鐢ㄦ埛閫夋嫨鎵嬪姩杈撳叆瀵嗙爜");
-                                    if (UserInfo.Current.appUnlockType.Contains("1"))
-                                    {
-                                        var page = new AppUnlockPasswordPage(UserInfo.Current.appUnlockPasswrod, action);
-                                        MainPage.BasePageView.AddChidren(page);
-                                        page.LoadPage("4");
-                                        MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
-                                    }
-                                    else if (UserInfo.Current.appUnlockType.Contains("1"))
-                                    {
-                                        var page = new AppUnlockGesturePage(UserInfo.Current.appUnlockPasswrod, action);
-                                        MainPage.BasePageView.AddChidren(page);
-                                        page.LoadPage("4");
-                                        MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
-                                    }
-                                }
-                            };
+                            TouchIDVerification_TurnOffUnlock(action);
                         }
                         else if (UserInfo.Current.appUnlockType.Contains("4"))
                         {
                             //Face ID楠岃瘉
-                            //
+                            FaceIDVerification_TurnOffUnlock(action);
                         }
                         else if (UserInfo.Current.appUnlockType.Contains("1"))
                         {
@@ -319,64 +290,14 @@
             {
                 btnFingerprintUnlockSwtichIcon.MouseUpEventHandler = (sender, e1) =>
                 {
-                    Action fingerAction = () => {
-                        TouchIDUtils.Instance.showTouchIDWithDescribe(null, Language.StringByID(StringId.PleaseVerifyTheFingerprint));
-                    };
-                    new AppUnlockPage().LoadGesturePage("5",fingerAction);
-
-                    TouchIDUtils.Instance.showTouchIDWithDescribe(null, Language.StringByID(StringId.PleaseVerifyTheFingerprint));
-
-                    TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent = (sender1, e) =>
-                    {
-                        if (e == TouchIDUtils.TouchIDState.Success)
-                        {
-                            var result = btnFingerprintUnlockSwtichIcon.IsSelected = !btnFingerprintUnlockSwtichIcon.IsSelected;
-                            if (result)
-                            {
-                                if (!UserInfo.Current.appUnlockType.Contains("3"))
-                                {
-                                    UserInfo.Current.appUnlockType.Add("3");
-                                    UserInfo.Current.SaveUserInfo();
-                                }
-                            }
-                            else
-                            {
-                                if (UserInfo.Current.appUnlockType.Contains("3"))
-                                {
-                                    UserInfo.Current.appUnlockType.Remove("3");
-                                    UserInfo.Current.SaveUserInfo();
-                                }
-                            }
-                            //MainPage.BasePageView.RemoveAt(MainPage.BasePageView.ChildrenCount - 1);
-                            MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent();
-                        }
-                        else// if (e == TouchIDUtils.TouchIDState.InputPassword || e == TouchIDUtils.TouchIDState.TouchIDLockout)
-                        {
-                            if (UserInfo.Current.appUnlockType.Contains("1"))
-                            {
-                                var page = new AppUnlockPasswordPage(UserInfo.Current.appUnlockPasswrod, refreshAction);
-                                MainPage.BasePageView.AddChidren(page);
-                                page.LoadPage("5");
-                                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
-                            }
-                            else if (UserInfo.Current.appUnlockType.Contains("2"))
-                            {
-                                var page = new AppUnlockGesturePage(UserInfo.Current.appUnlockPasswrod, refreshAction);
-                                MainPage.BasePageView.AddChidren(page);
-                                page.LoadPage("5");
-                                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
-                            }
-                        }
-                    };
+                    TouchIDVerification_SwtichOnOff();
                 };
             }
             if (sFaceID)
             {
                 btnFaceIdUnlockSwtichIcon.MouseUpEventHandler = (sender, e1) =>
                 {
-                    //btnFaceIdUnlockSwtichIcon.IsSelected = !btnFaceIdUnlockSwtichIcon.IsSelected;
-                    if (!btnFaceIdUnlockSwtichIcon.IsSelected)
-                    { }
+                    FaceIDVerification_SwtichOnOff();
                 };
             }
         }
@@ -396,5 +317,197 @@
             return true;
         }
 
+        /// <summary>
+        /// 闈㈠ID寮�鍚拰鍏抽棴
+        /// </summary>
+        void FaceIDVerification_SwtichOnOff()
+        {
+            //6:闈㈠ID寮�鍏�
+            string optionType = "6";
+            //4:闈㈠ID
+            string faceIDUnlockType = "4";
+
+            Action fingerAction = () =>
+            {
+                TouchIDUtils.Instance.showTouchIDWithDescribe(null, Language.StringByID(StringId.VerifyFaceID));
+            };
+            new AppUnlockPage().LoadFaceIDGesturePage(optionType, fingerAction);
+
+            TouchIDUtils.Instance.showTouchIDWithDescribe(null, Language.StringByID(StringId.VerifyFaceID));
+
+            TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent = (sender1, e) =>
+            {
+                if (e == TouchIDUtils.TouchIDState.Success)
+                {
+                    var result = btnFaceIdUnlockSwtichIcon.IsSelected = !btnFaceIdUnlockSwtichIcon.IsSelected;
+                    if (result)
+                    {
+                        if (!UserInfo.Current.appUnlockType.Contains(faceIDUnlockType))
+                        {
+                            UserInfo.Current.appUnlockType.Add(faceIDUnlockType);
+                            UserInfo.Current.SaveUserInfo();
+                        }
+                    }
+                    else
+                    {
+                        if (UserInfo.Current.appUnlockType.Contains(faceIDUnlockType))
+                        {
+                            UserInfo.Current.appUnlockType.Remove(faceIDUnlockType);
+                            UserInfo.Current.SaveUserInfo();
+                        }
+                    }
+                    //MainPage.BasePageView.RemoveAt(MainPage.BasePageView.ChildrenCount - 1);
+                    MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent();
+                }
+                else// if (e == TouchIDUtils.TouchIDState.InputPassword || e == TouchIDUtils.TouchIDState.TouchIDLockout)
+                {
+                    ///灏嗛獙璇侀潰瀹笽D鐨勯〉闈㈢Щ闄�
+                    MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent();
+
+                    GotogoToVerifyPasswordPage(optionType, refreshAction);
+                }
+            };
+        }
+
+        /// <summary>
+        /// FaceID楠岃瘉 鍏抽棴瑙i攣璁剧疆
+        /// </summary>
+        /// <param name="action">楠岃瘉鎴愬姛浜嬩欢</param>
+        void FaceIDVerification_TurnOffUnlock(Action successAction)
+        {
+            //浣跨敤瀵嗙爜楠岃瘉
+            Action goToVerifyPasswordAction = () =>
+            {
+                //鍏抽棴瑙i攣楠岃瘉
+                GotogoToVerifyPasswordPage("4", successAction);
+            };
+
+            TouchIDUtils.Instance.showTouchIDWithDescribe(null, Language.StringByID(StringId.VerifyFaceID));
+            TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent = (sender1, e) =>
+            {
+                if (e == TouchIDUtils.TouchIDState.Success)
+                {
+                    MainPage.Log("KK:FaceID楠岃瘉鎴愬姛");
+                    successAction?.Invoke();
+                }
+                else if (e == TouchIDUtils.TouchIDState.NotSupport)
+                {
+                    MainPage.Log("KK:褰撳墠璁惧涓嶆敮鎸丗aceID楠岃瘉,璇疯緭鍏ュ瘑鐮佹潵楠岃瘉");
+                    goToVerifyPasswordAction();
+                }
+                else if (e == TouchIDUtils.TouchIDState.InputPassword || e == TouchIDUtils.TouchIDState.TouchIDLockout)
+                {
+                    MainPage.Log("KK:鐢ㄦ埛閫夋嫨鎵嬪姩杈撳叆瀵嗙爜");
+                    goToVerifyPasswordAction();
+                }
+            };
+        }
+
+        /// <summary>
+        /// 鎸囩汗ID寮�鍚拰鍏抽棴
+        /// </summary>
+        void TouchIDVerification_SwtichOnOff()
+        {
+            //5:鎸囩汗ID寮�鍏�
+            string optionType = "5";
+
+            Action fingerAction = () =>
+            {
+                TouchIDUtils.Instance.showTouchIDWithDescribe(null, Language.StringByID(StringId.PleaseVerifyTheFingerprint));
+            };
+            new AppUnlockPage().LoadGesturePage(optionType, fingerAction);
+
+            TouchIDUtils.Instance.showTouchIDWithDescribe(null, Language.StringByID(StringId.PleaseVerifyTheFingerprint));
+
+            TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent = (sender1, e) =>
+            {
+                if (e == TouchIDUtils.TouchIDState.Success)
+                {
+                    var result = btnFingerprintUnlockSwtichIcon.IsSelected = !btnFingerprintUnlockSwtichIcon.IsSelected;
+                    if (result)
+                    {
+                        if (!UserInfo.Current.appUnlockType.Contains("3"))
+                        {
+                            UserInfo.Current.appUnlockType.Add("3");
+                            UserInfo.Current.SaveUserInfo();
+                        }
+                    }
+                    else
+                    {
+                        if (UserInfo.Current.appUnlockType.Contains("3"))
+                        {
+                            UserInfo.Current.appUnlockType.Remove("3");
+                            UserInfo.Current.SaveUserInfo();
+                        }
+                    }
+                    MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent();
+                }
+                else// if (e == TouchIDUtils.TouchIDState.InputPassword || e == TouchIDUtils.TouchIDState.TouchIDLockout)
+                {
+                    ///灏嗛獙璇佹寚绾笽D鐨勯〉闈㈢Щ闄�
+                    MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent();
+                    
+                    GotogoToVerifyPasswordPage(optionType, refreshAction);
+                }
+            };
+        }
+
+        /// <summary>
+        /// TouchID楠岃瘉 鍏抽棴瑙i攣璁剧疆
+        /// </summary>
+        /// <param name="action">楠岃瘉鎴愬姛浜嬩欢</param>
+        void TouchIDVerification_TurnOffUnlock(Action successAction)
+        {
+            //浣跨敤瀵嗙爜楠岃瘉
+            Action goToVerifyPasswordAction = () =>
+            {
+                //鍏抽棴瑙i攣楠岃瘉
+                GotogoToVerifyPasswordPage("4", successAction);
+            };
+
+            TouchIDUtils.Instance.showTouchIDWithDescribe(null, Language.StringByID(StringId.PleaseVerifyTheFingerprint));
+            TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent = (sender1, e) =>
+            {
+                if (e == TouchIDUtils.TouchIDState.NotSupport)
+                {
+                    MainPage.Log("KK:褰撳墠璁惧涓嶆敮鎸乀ouchID楠岃瘉,璇疯緭鍏ュ瘑鐮佹潵楠岃瘉");
+                    goToVerifyPasswordAction?.Invoke();
+                }
+                else if (e == TouchIDUtils.TouchIDState.Success)
+                {
+                    MainPage.Log("KK:TouchID楠岃瘉鎴愬姛");
+                    successAction?.Invoke();
+                }
+                else if (e == TouchIDUtils.TouchIDState.InputPassword || e == TouchIDUtils.TouchIDState.TouchIDLockout)
+                {
+                    MainPage.Log("KK:鐢ㄦ埛閫夋嫨鎵嬪姩杈撳叆瀵嗙爜");
+                    goToVerifyPasswordAction?.Invoke();
+                }
+
+            };
+        }
+
+        /// <summary>
+        /// 璺宠浆鎵嬪娍鎴栬�呭瘑鐮侀獙璇佺晫闈�
+        /// </summary>
+        /// <param name="optionType">1:璁剧疆瀵嗙爜锛�2:楠岃瘉瀵嗙爜;3:鍏抽棴瀵嗙爜;4:鍏抽棴瑙i攣璁剧疆;5:鎸囩汗ID寮�鍏筹紱6:闈㈠ID寮�鍏�;7:瑙i攣楠岃瘉</param>
+        /// <param name="successAction"></param>
+        void GotogoToVerifyPasswordPage(string optionType, Action successAction)
+        {
+            if (UserInfo.Current.appUnlockType.Contains("1"))
+            {
+                var page = new AppUnlockPasswordPage(UserInfo.Current.appUnlockPasswrod, successAction);
+                MainPage.BasePageView.AddChidren(page);
+                page.LoadPage(optionType);
+                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+            }
+            else if (UserInfo.Current.appUnlockType.Contains("2"))
+            {
+                var page = new AppUnlockGesturePage(UserInfo.Current.appUnlockPasswrod, successAction);
+                MainPage.BasePageView.AddChidren(page);
+                page.LoadPage(optionType);
+                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+            }
+        }
     }
 }
\ No newline at end of file

--
Gitblit v1.8.0