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 | 452 +++++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 361 insertions(+), 91 deletions(-)
diff --git a/HDL_ON/UI/UI0-Public/AppUnlockPage.cs b/HDL_ON/UI/UI0-Public/AppUnlockPage.cs
index 9bb97e4..637798b 100644
--- a/HDL_ON/UI/UI0-Public/AppUnlockPage.cs
+++ b/HDL_ON/UI/UI0-Public/AppUnlockPage.cs
@@ -5,87 +5,157 @@
/// <summary>
/// app瑙i攣鐣岄潰
/// </summary>
- public static class AppUnlockPage
+ public class AppUnlockPage
{
- static DateTime unlockTime = DateTime.MinValue;
- static Dialog Dialog;
- static void LoadOption()
+ void LoadOption()
{
-
- Action action = () => {
- unlockTime = DateTime.Now;
- };
- //1:楠岃瘉鎸囩汗
- if (MainPage.LoginUser.appUnlockType.Contains("3"))
- {
- TouchIDUtils.Instance.showTouchIDWithDescribe(null, Language.StringByID(StringId.PleaseVerifyTheFingerprint));
- TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent = (sender1, e) =>
- {
- if (e == TouchIDUtils.TouchIDState.Success)
- {
- MainPage.Log("KK:TouchID楠岃瘉鎴愬姛");
- unlockTime = DateTime.Now;
- MainPage.BasePageView.RemoveAt(MainPage.BasePageView.ChildrenCount - 1);
- }
- else
- {
- ///灏嗛獙璇佹寚绾圭殑椤甸潰绉婚櫎
- MainPage.BasePageView.RemoveAt( MainPage.BasePageView.ChildrenCount - 1);
-
- if (MainPage.LoginUser.appUnlockType.Contains("1"))
- {
- var page = new AppUnlockPasswordPage(MainPage.LoginUser.appUnlockPasswrod, action);
- MainPage.BasePageView.AddChidren(page);
- page.LoadPage("7");
- MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
- }
- else if (MainPage.LoginUser.appUnlockType.Contains("1"))
- {
- var page = new AppUnlockGesturePage(MainPage.LoginUser.appUnlockPasswrod, action);
- MainPage.BasePageView.AddChidren(page);
- page.LoadPage("7");
- MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
- }
- }
- };
- }
- else if (MainPage.LoginUser.appUnlockType.Contains("4"))
- {
- //Face ID楠岃瘉
- //
- }
- else if (MainPage.LoginUser.appUnlockType.Contains("1"))
- {
- var page = new AppUnlockPasswordPage(MainPage.LoginUser.appUnlockPasswrod, action);
- MainPage.BasePageView.AddChidren(page);
- page.LoadPage("7");
- MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
- }
- else if (MainPage.LoginUser.appUnlockType.Contains("2"))
- {
- var page = new AppUnlockGesturePage(MainPage.LoginUser.appUnlockPasswrod, action);
- MainPage.BasePageView.AddChidren(page);
- page.LoadPage("7");
- MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
- }
- }
-
-
- public static void LoadPage()
- {
- if (unlockTime.AddSeconds(60) > DateTime.Now || MainPage.LoginUser.appUnlockPasswrod == "" || MainPage.LoginUser.appUnlockPage.Count == 0)
+ //2020-12-12 鏈櫥褰曟垨鑰匒PP鏈惎鍔ㄩ兘杩斿洖锛岃В鍐抽棯閫�闂
+ if (UserInfo.Current == null || !UserInfo.Current.IsLogin || MainPage.BasePageView == null)
{
return;
}
+ Action action = () =>
+ {
+ UserInfo.Current.unlockTime = DateTime.Now;
+ };
+ //1:楠岃瘉鎸囩汗
+ if (UserInfo.Current.appUnlockType.Contains("3"))
+ {
+ TouchIDVerification();
+ }
+ else if (UserInfo.Current.appUnlockType.Contains("4"))
+ {
+ //Face ID楠岃瘉
+ //2020-12-11 寰呭鍔犻潰瀹瑰け璐ラ獙璇侀〉闈紝涓嶇劧浼氬鑷撮攣灞忓姞瀵嗘棤鏁�
+ FaceIDVerification();
+ }
+ else if (UserInfo.Current.appUnlockType.Contains("1"))
+ {
+ var page = new AppUnlockPasswordPage(UserInfo.Current.appUnlockPasswrod, action);
+ MainPage.BasePageView.AddChidren(page);
+ page.LoadPage("7");
+ }
+ else if (UserInfo.Current.appUnlockType.Contains("2"))
+ {
+ var page = new AppUnlockGesturePage(UserInfo.Current.appUnlockPasswrod, action);
+ MainPage.BasePageView.AddChidren(page);
+ page.LoadPage("7");
+ }
+#if __ANDROID__
+ new System.Threading.Thread(() =>
+ {
+ int i = 0;
+ while (i > 1)
+ {
+ MainPage.Log($"鍊掕鏃讹細{i} sec");
+ System.Threading.Thread.Sleep(1000);
+ i++;
+ }
+ Application.RunOnMainThread(() =>
+ {
+ MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+ });
+ })
+ { IsBackground = true }.Start();
+#else
+ MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+#endif
+
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="isFirstOpen">濡傛灉鏄涓�娆″惎鍔ㄧ洿鎺ュ脊绐楅獙璇佸瘑鐮�</param>
+ public void LoadPage(bool isFirstOpen = false)
+ {
+ try
+ {
+ if (!isFirstOpen)
+ {
+ if (UserInfo.Current.unlockTime.AddMinutes(5) > DateTime.Now || UserInfo.Current.appUnlockPasswrod == "" || UserInfo.Current.appUnlockPage.Count == 0)
+ {
+ return;
+ }
+ }
+ LoadOption();
+ }
+ catch
+ {
+ Utlis.WriteLine("AppUnlockPage error");
+ }
+ }
+
+ /// <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>
+ /// <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()
{
BackgroundColor = CSS.CSS_Color.MainBackgroundColor
};
MainPage.BasePageView.AddChidren(bodyView);
- MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
-
- bodyView.AddChidren(new Button() {
+ bodyView.AddChidren(new Button()
+ {
Height = Application.GetRealHeight(64),
BackgroundColor = CSS.CSS_Color.BackgroundColor,
});
@@ -106,12 +176,13 @@
Gravity = Gravity.CenterHorizontal,
Width = Application.GetRealWidth(102),
Height = Application.GetRealWidth(102),
- UnSelectedImagePath = "PersonalCenter/AppUnlockSetting/FingerIconRed.png",
+ UnSelectedImagePath = "PersonalCenter/AppUnlockSetting/FingerIconBlue.png",
};
bodyView.AddChidren(btnFingerIcon);
- btnFingerIcon.MouseUpEventHandler = (sender, e) => {
- LoadOption();
+ btnFingerIcon.MouseUpEventHandler = (sender, e) =>
+ {
+ fingerAction();
};
var btnOtherVerify = new Button()
@@ -121,34 +192,233 @@
TextAlignment = TextAlignment.Center,
TextColor = CSS.CSS_Color.MainColor,
TextSize = CSS.CSS_FontSize.TextFontSize,
- TextID = MainPage.LoginUser.appUnlockType.Contains("1") ? StringId.VerifyDigitalPassword : StringId.VerifyGesturePassword
+ TextID = UserInfo.Current.appUnlockType.Contains("1") ? StringId.VerifyDigitalPassword : StringId.VerifyGesturePassword,
};
bodyView.AddChidren(btnOtherVerify);
- btnOtherVerify.MouseUpEventHandler = (sender, e) => {
+ btnOtherVerify.MouseUpEventHandler = (sender, e) =>
+ {
///灏嗛獙璇佹寚绾圭殑椤甸潰绉婚櫎
- MainPage.BasePageView.RemoveAt(MainPage.BasePageView.ChildrenCount - 1);
+ MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent();
+ //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;
+ //}
- Action action = () => {
- unlockTime = DateTime.Now;
- };
- if (MainPage.LoginUser.appUnlockType.Contains("1"))
+ if (successAction == null)
{
- var page = new AppUnlockPasswordPage(MainPage.LoginUser.appUnlockPasswrod, action);
- MainPage.BasePageView.AddChidren(page);
- page.LoadPage("7");
- MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+ Action action = () =>
+ {
+ UserInfo.Current.unlockTime = DateTime.Now;
+ };
+ GotogoToVerifyPasswordPage(optionType, action);
}
- else if (MainPage.LoginUser.appUnlockType.Contains("2"))
+ else
{
- var page = new AppUnlockGesturePage(MainPage.LoginUser.appUnlockPasswrod, action);
- MainPage.BasePageView.AddChidren(page);
- page.LoadPage("7");
- MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+ GotogoToVerifyPasswordPage(optionType, successAction);
}
};
- LoadOption();
+
+ 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;
}
+
+ /// <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