| | |
| | | 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:当前设备不支持TouchID验证,请输入密码来验证"); |
| | | } |
| | | 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")) |
| | | { |
| | |
| | | { |
| | | 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(); |
| | | }; |
| | | } |
| | | } |
| | |
| | | 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) |
| | | { |
| | | ///将验证面容ID的页面移除 |
| | | MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); |
| | | |
| | | GotogoToVerifyPasswordPage(optionType, refreshAction); |
| | | } |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// FaceID验证 关闭解锁设置 |
| | | /// </summary> |
| | | /// <param name="action">验证成功事件</param> |
| | | void FaceIDVerification_TurnOffUnlock(Action successAction) |
| | | { |
| | | //使用密码验证 |
| | | Action goToVerifyPasswordAction = () => |
| | | { |
| | | //关闭解锁验证 |
| | | 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:当前设备不支持FaceID验证,请输入密码来验证"); |
| | | 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) |
| | | { |
| | | ///将验证指纹ID的页面移除 |
| | | MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); |
| | | |
| | | GotogoToVerifyPasswordPage(optionType, refreshAction); |
| | | } |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// TouchID验证 关闭解锁设置 |
| | | /// </summary> |
| | | /// <param name="action">验证成功事件</param> |
| | | void TouchIDVerification_TurnOffUnlock(Action successAction) |
| | | { |
| | | //使用密码验证 |
| | | Action goToVerifyPasswordAction = () => |
| | | { |
| | | //关闭解锁验证 |
| | | GotogoToVerifyPasswordPage("4", successAction); |
| | | }; |
| | | |
| | | TouchIDUtils.Instance.showTouchIDWithDescribe(null, Language.StringByID(StringId.PleaseVerifyTheFingerprint)); |
| | | TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent = (sender1, e) => |
| | | { |
| | | if (e == TouchIDUtils.TouchIDState.NotSupport) |
| | | { |
| | | MainPage.Log("KK:当前设备不支持TouchID验证,请输入密码来验证"); |
| | | 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:关闭解锁设置;5:指纹ID开关;6:面容ID开关;7:解锁验证</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; |
| | | } |
| | | } |
| | | } |
| | | } |