From a1b0ab7044100daaa7e0f1da2d2ca45e38098963 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期一, 29 三月 2021 09:13:25 +0800
Subject: [PATCH] 2021-3-29-2
---
HDL_ON/UI/UI0-Public/AppUnlockPage.cs | 328 +++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 273 insertions(+), 55 deletions(-)
diff --git a/HDL_ON/UI/UI0-Public/AppUnlockPage.cs b/HDL_ON/UI/UI0-Public/AppUnlockPage.cs
index 4edda15..637798b 100644
--- a/HDL_ON/UI/UI0-Public/AppUnlockPage.cs
+++ b/HDL_ON/UI/UI0-Public/AppUnlockPage.cs
@@ -10,7 +10,7 @@
void LoadOption()
{
//2020-12-12 鏈櫥褰曟垨鑰匒PP鏈惎鍔ㄩ兘杩斿洖锛岃В鍐抽棯閫�闂
- if ( UserInfo.Current == null || !UserInfo.Current.IsLogin || MainPage.BasePageView == null)
+ if (UserInfo.Current == null || !UserInfo.Current.IsLogin || MainPage.BasePageView == null)
{
return;
}
@@ -21,46 +21,13 @@
//1:楠岃瘉鎸囩汗
if (UserInfo.Current.appUnlockType.Contains("3"))
{
- Action fAction = () =>
- {
- LoadOption();
- };
- LoadGesturePage("7", fAction);
- TouchIDUtils.Instance.showTouchIDWithDescribe(null, Language.StringByID(StringId.PleaseVerifyTheFingerprint));
- TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent = (sender1, e) =>
- {
- if (e == TouchIDUtils.TouchIDState.Success)
- {
- MainPage.Log("KK:TouchID楠岃瘉鎴愬姛");
- UserInfo.Current.unlockTime = DateTime.Now;
- MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent();
- }
- else
- {
- ///灏嗛獙璇佹寚绾圭殑椤甸潰绉婚櫎
- MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent();
- if (UserInfo.Current.appUnlockType.Contains("1"))
- {
- var page = new AppUnlockPasswordPage(UserInfo.Current.appUnlockPasswrod, action);
- MainPage.BasePageView.AddChidren(page);
- page.LoadPage("7");
- MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
- }
- else if (UserInfo.Current.appUnlockType.Contains("2"))
- {
- var page = new AppUnlockGesturePage(UserInfo.Current.appUnlockPasswrod, action);
- MainPage.BasePageView.AddChidren(page);
- page.LoadPage("7");
- MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
- }
-
- }
- };
+ TouchIDVerification();
}
else if (UserInfo.Current.appUnlockType.Contains("4"))
{
//Face ID楠岃瘉
//2020-12-11 寰呭鍔犻潰瀹瑰け璐ラ獙璇侀〉闈紝涓嶇劧浼氬鑷撮攣灞忓姞瀵嗘棤鏁�
+ FaceIDVerification();
}
else if (UserInfo.Current.appUnlockType.Contains("1"))
{
@@ -106,7 +73,7 @@
{
if (!isFirstOpen)
{
- if (UserInfo.Current.unlockTime.AddSeconds(5) > DateTime.Now || UserInfo.Current.appUnlockPasswrod == "" || UserInfo.Current.appUnlockPage.Count == 0)
+ if (UserInfo.Current.unlockTime.AddMinutes(5) > DateTime.Now || UserInfo.Current.appUnlockPasswrod == "" || UserInfo.Current.appUnlockPage.Count == 0)
{
return;
}
@@ -120,9 +87,66 @@
}
/// <summary>
+ /// 鎸囩汗楠岃瘉
+ /// </summary>
+ void TouchIDVerification()
+ {
+ //楠岃瘉鎴愬姛Action
+ Action successAction = () =>
+ {
+ UserInfo.Current.unlockTime = DateTime.Now;
+ };
+
+ //鎻愮ず鏁板瓧瀵嗙爜楠岃瘉杩樻槸缁樺埗鎵嬪娍楠岃瘉
+ string verificationTitleString = GetVerificationTitleString();
+
+ //寮瑰嚭鎸囩汗楠岃瘉瀵硅瘽妗�
+ Action fingerAction = () =>
+ {
+ TouchIDUtils.Instance.showTouchIDWithDescribe(verificationTitleString, Language.StringByID(StringId.PleaseVerifyTheFingerprint));
+ };
+ //鍔犺浇UI椤甸潰
+ LoadGesturePage("7", fingerAction, null);
+
+ TouchIDUtils.Instance.showTouchIDWithDescribe(verificationTitleString, Language.StringByID(StringId.PleaseVerifyTheFingerprint));
+ TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent = (sender1, e) =>
+ {
+ if (e == TouchIDUtils.TouchIDState.Success)
+ {
+ MainPage.Log("KK:TouchID楠岃瘉鎴愬姛");
+ UserInfo.Current.unlockTime = DateTime.Now;
+ MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent();
+ }
+ else
+ {
+ ///灏嗛獙璇佹寚绾圭殑椤甸潰绉婚櫎
+ MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent();
+ if (UserInfo.Current.appUnlockType.Contains("1"))
+ {
+ var page = new AppUnlockPasswordPage(UserInfo.Current.appUnlockPasswrod, successAction);
+ MainPage.BasePageView.AddChidren(page);
+ page.LoadPage("7");
+ 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("7");
+ MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+ }
+
+ }
+ };
+ }
+
+ /// <summary>
/// 鍔犺浇鎸囩汗楠岃瘉鐣岄潰
/// </summary>
- public void LoadGesturePage(string optionType, Action fingerAction)
+ /// <param name="optionType"></param>
+ /// <param name="fingerAction"></param>
+ /// <param name="successAction"></param>
+ public void LoadGesturePage(string optionType, Action fingerAction, Action successAction)
{
var bodyView = new FrameLayout()
{
@@ -152,7 +176,7 @@
Gravity = Gravity.CenterHorizontal,
Width = Application.GetRealWidth(102),
Height = Application.GetRealWidth(102),
- UnSelectedImagePath = "PersonalCenter/AppUnlockSetting/FingerIconRed.png",
+ UnSelectedImagePath = "PersonalCenter/AppUnlockSetting/FingerIconBlue.png",
};
bodyView.AddChidren(btnFingerIcon);
@@ -176,31 +200,225 @@
{
///灏嗛獙璇佹寚绾圭殑椤甸潰绉婚櫎
MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent();
- Action action = () =>
+ //Action action = () =>
+ //{
+ // UserInfo.Current.unlockTime = DateTime.Now;
+ //};
+ //if (UserInfo.Current.appUnlockType.Contains("1"))
+ //{
+ // var page = new AppUnlockPasswordPage(UserInfo.Current.appUnlockPasswrod, action);
+ // 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, action);
+ // MainPage.BasePageView.AddChidren(page);
+ // page.LoadPage(optionType);
+ // MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+ //}
+
+ if (successAction == null)
{
- UserInfo.Current.unlockTime = DateTime.Now;
- };
- if (UserInfo.Current.appUnlockType.Contains("1"))
- {
- var page = new AppUnlockPasswordPage(UserInfo.Current.appUnlockPasswrod, action);
- MainPage.BasePageView.AddChidren(page);
- page.LoadPage(optionType);
- MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+ Action action = () =>
+ {
+ UserInfo.Current.unlockTime = DateTime.Now;
+ };
+ GotogoToVerifyPasswordPage(optionType, action);
}
- else if (UserInfo.Current.appUnlockType.Contains("2"))
+ else
{
- var page = new AppUnlockGesturePage(UserInfo.Current.appUnlockPasswrod, action);
- MainPage.BasePageView.AddChidren(page);
- page.LoadPage(optionType);
- MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+ GotogoToVerifyPasswordPage(optionType, successAction);
+ }
+ };
+
+ MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+
+ //dialog.Show();
+ //Console.WriteLine("-0987654321");
+ }
+
+ /// <summary>
+ /// 闈㈠ID楠岃瘉
+ /// </summary>
+ void FaceIDVerification()
+ {
+ //楠岃瘉鎴愬姛Action
+ Action successAction = () =>
+ {
+ UserInfo.Current.unlockTime = DateTime.Now;
+ };
+
+ //鎻愮ず鏁板瓧瀵嗙爜楠岃瘉杩樻槸缁樺埗鎵嬪娍楠岃瘉
+ string verificationTitleString = GetVerificationTitleString();
+
+ //寮瑰嚭鎸囩汗楠岃瘉瀵硅瘽妗�
+ Action faceIDAction = () =>
+ {
+ TouchIDUtils.Instance.showTouchIDWithDescribe(verificationTitleString, Language.StringByID(StringId.VerifyFaceID));
+ };
+ //鍔犺浇UI椤甸潰
+ LoadFaceIDGesturePage("7", faceIDAction, null);
+
+ TouchIDUtils.Instance.showTouchIDWithDescribe(verificationTitleString, Language.StringByID(StringId.VerifyFaceID));
+ TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent = (sender1, e) =>
+ {
+ if (e == TouchIDUtils.TouchIDState.Success)
+ {
+ MainPage.Log("KK:TouchID楠岃瘉鎴愬姛");
+ UserInfo.Current.unlockTime = DateTime.Now;
+ MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent();
+ }
+ else
+ {
+ ///灏嗛獙璇佹寚绾圭殑椤甸潰绉婚櫎
+ MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent();
+ if (UserInfo.Current.appUnlockType.Contains("1"))
+ {
+ var page = new AppUnlockPasswordPage(UserInfo.Current.appUnlockPasswrod, successAction);
+ MainPage.BasePageView.AddChidren(page);
+ page.LoadPage("7");
+ 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("7");
+ MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+ }
+
+ }
+ };
+ }
+
+ /// <summary>
+ /// 鍔犺浇闈㈠ID楠岃瘉鐣岄潰
+ /// </summary>
+ /// <param name="optionType"></param>
+ /// <param name="faceIDAction"></param>
+ /// <param name="successAction">鎸囧畾鎴愬姛鐨勪簨浠跺洖璋�</param>
+ public void LoadFaceIDGesturePage(string optionType, Action faceIDAction, Action successAction)
+ {
+ var bodyView = new FrameLayout()
+ {
+ BackgroundColor = CSS.CSS_Color.MainBackgroundColor
+ };
+ MainPage.BasePageView.AddChidren(bodyView);
+
+ bodyView.AddChidren(new Button()
+ {
+ Height = Application.GetRealHeight(64),
+ BackgroundColor = CSS.CSS_Color.BackgroundColor,
+ });
+
+ bodyView.AddChidren(new Button()
+ {
+ Y = Application.GetRealHeight(196),
+ Height = Application.GetRealHeight(42),
+ TextAlignment = TextAlignment.Center,
+ TextColor = CSS.CSS_Color.FirstLevelTitleColor,
+ TextSize = CSS.CSS_FontSize.SubheadingFontSize,
+ TextID = StringId.VerifyFaceID,
+ });
+
+ var btnFaceIdIcon = new Button()
+ {
+ Y = Application.GetRealHeight(260),
+ Gravity = Gravity.CenterHorizontal,
+ Width = Application.GetRealWidth(102),
+ Height = Application.GetRealWidth(102),
+ UnSelectedImagePath = "PersonalCenter/AppUnlockSetting/FaceIdIconBig.png",
+ };
+ bodyView.AddChidren(btnFaceIdIcon);
+
+ btnFaceIdIcon.MouseUpEventHandler = (sender, e) =>
+ {
+ faceIDAction();
+ };
+
+ var btnOtherVerify = new Button()
+ {
+ Y = Application.GetRealHeight(527),
+ Height = Application.GetRealHeight(40),
+ TextAlignment = TextAlignment.Center,
+ TextColor = CSS.CSS_Color.MainColor,
+ TextSize = CSS.CSS_FontSize.TextFontSize,
+ TextID = UserInfo.Current.appUnlockType.Contains("1") ? StringId.VerifyDigitalPassword : StringId.VerifyGesturePassword,
+ };
+ bodyView.AddChidren(btnOtherVerify);
+
+ btnOtherVerify.MouseUpEventHandler = (sender, e) =>
+ {
+ ///灏嗛獙璇侀潰瀹笽D鐨勯〉闈㈢Щ闄�
+ MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent();
+
+ if (successAction == null)
+ {
+ Action action = () =>
+ {
+ UserInfo.Current.unlockTime = DateTime.Now;
+ };
+ GotogoToVerifyPasswordPage(optionType, action);
+ }
+ else
+ {
+ GotogoToVerifyPasswordPage(optionType, successAction);
}
};
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
- //dialog.Show();
- Console.WriteLine("-0987654321");
+ }
+
+ /// <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;
+ }
+ }
+
+ /// <summary>
+ /// 鍒ゆ柇鏄惁鏁板瓧楠岃瘉銆佸惁鍒欑粯鍒舵墜鍔块獙璇�
+ /// </summary>
+ /// <returns></returns>
+ bool CheckIfUnlockPassword()
+ {
+ return UserInfo.Current.appUnlockType.Contains("1");
+ }
+
+ /// <summary>
+ /// 鍒ゆ柇鏄惁鏁板瓧楠岃瘉銆佸惁鍒欑粯鍒舵墜鍔块獙璇�
+ /// </summary>
+ /// <returns></returns>
+ string GetVerificationTitleString()
+ {
+ if (CheckIfUnlockPassword())
+ {
+ return Language.StringByID(StringId.PasswordVerification);
+ }
+ else
+ {
+ return Language.StringByID(StringId.GestureVerification);
+ }
}
}
}
\ No newline at end of file
--
Gitblit v1.8.0