From 8e54c77b6e0d2d87cdbad1a81a75d39bab1648d6 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期一, 16 十月 2023 10:08:47 +0800 Subject: [PATCH] 场景闪退修复 --- OnPro/HDL_ON/UI/UI2/4-PersonalCenter/AboutOn/AboutOnPage.cs | 268 ++++++++++------------------------------------------- 1 files changed, 53 insertions(+), 215 deletions(-) diff --git a/OnPro/HDL_ON/UI/UI2/4-PersonalCenter/AboutOn/AboutOnPage.cs b/OnPro/HDL_ON/UI/UI2/4-PersonalCenter/AboutOn/AboutOnPage.cs index 863d94e..deb0ff1 100644 --- a/OnPro/HDL_ON/UI/UI2/4-PersonalCenter/AboutOn/AboutOnPage.cs +++ b/OnPro/HDL_ON/UI/UI2/4-PersonalCenter/AboutOn/AboutOnPage.cs @@ -17,10 +17,6 @@ /// /// </summary> FrameLayout bodyView; - /// <summary> - /// 鐗堟湰鏇存柊ListCellView - /// </summary> - ListCellView versionUpdateView; /// <summary> /// 鏂扮増鏈殑鐗堟湰鍙凤紝鏌ヨ鍒版柊鐗堟湰鎵嶈祴鍊� @@ -32,6 +28,10 @@ /// Android 浜戠杩斿洖鍦板潃 /// </summary> string newAppVersionUrl = ""; + /// <summary> + /// 鐗堟湰鏇存柊ListCellView + /// </summary> + ListCellView versionUpdateView; /// <summary> /// @@ -65,25 +65,13 @@ Y = Application.GetRealWidth(184), Height = Application.GetRealWidth(28), TextAlignment = TextAlignment.Center, - Text = "On Pro", + Text = "鑽f偊鏅鸿兘", TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.EmphasisFontSize_Secondary, IsBold = true, }; bodyView.AddChidren(btnOnTitle); -#if DEBUG - //btnOnIcon.MouseUpEventHandler += (sender, e) => - //{ - // ESOnVideo.Current.Test(); - //}; - - //btnOnTitle.MouseUpEventHandler += (sender, e) => - //{ - // ESOnVideo.Current.Test(false); - //}; - -#endif Button btnOnVersion = new Button() { @@ -109,60 +97,32 @@ }; bodyView.AddChidren(lineView); - #region 鍔熻兘浠嬬粛 - //var functionView = new ListCellView() - //{ - // Y = lineView.Bottom, - //}; - //bodyView.AddChidren(functionView); - //functionView.BtnTilte.TextID = StringId.FunctionIntroduced; - //Action functionAction = () => - //{ - // var mPage = new FunctionIntroductionPage(); - // MainPage.BasePageView.AddChidren(mPage); - // mPage.LoadPage(); - // MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - //}; - //functionView.GoAction = functionAction; - #endregion - - #region 鎶曡瘔 - var complaintsView = new ListCellView() - { - Y = lineView.Bottom, - }; - bodyView.AddChidren(complaintsView); - complaintsView.BtnTilte.TextID = StringId.Complaints; - Action complaintsAction = () => - { - var mPage = new ComplaintsPage(); - MainPage.BasePageView.AddChidren(mPage); - mPage.LoadPage(); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - }; - complaintsView.GoAction = complaintsAction; - #endregion - #region 鐗堟湰鏇存柊 versionUpdateView = new ListCellView() { - Y = complaintsView.Bottom, + Y = lineView.Bottom, }; +#if __ANDROID__ bodyView.AddChidren(versionUpdateView); + CheckIfNeedUpdateAsync(false); +#endif versionUpdateView.BtnTilte.TextID = StringId.VersionUpdate; Action versionUpdateAction = () => { OpenUrl(); - //TestDDDDD(); - //HDLCommon.Current.CheckIfNeedForceUpdate(); }; versionUpdateView.GoAction = versionUpdateAction; #endregion + #region 杞欢鏈嶅姟鍗忚 var serviceAgreementView = new ListCellView() { +#if __ANDROID__ Y = versionUpdateView.Bottom, +#else + Y = lineView.Bottom, +#endif }; bodyView.AddChidren(serviceAgreementView); serviceAgreementView.BtnTilte.TextID = StringId.UserAgreement; @@ -172,7 +132,7 @@ new WebViewDialog().LoadPageWithdrawalConsent(titleStr, url); }; serviceAgreementView.GoAction = serviceAgreementAction; - #endregion +#endregion #region 鐢ㄦ埛淇℃伅淇濇姢鍗忚 var privacyPolicyView = new ListCellView() @@ -188,43 +148,7 @@ }; #endregion privacyPolicyView.GoAction = privacyPolicyAction; - CheckIfNeedUpdateAsync(); -#if __IOS__ - #region 鍥轰欢鍗囩骇 - var firUpdateView = new ListCellView() - { - Y = privacyPolicyView.Bottom, - }; - firUpdateView.BtnTilte.TextID = StringId.FirmwareUpdate; - bodyView.AddChidren(firUpdateView); - Action firmwareUpdateAction = () => - { - var mPage = new HDL_ON.UI.UI2.PersonalCenter.AboutOn.FirmwareUpdateView(); - MainPage.BasePageView.AddChidren(mPage); - mPage.ShowPage(); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - }; - firUpdateView.GoAction = firmwareUpdateAction; - #endregion - - - #region HomeKit鏀寔璇存槑 - var homeKitView = new ListCellView() - { - Y = firUpdateView.Bottom, - }; - bodyView.AddChidren(homeKitView); - homeKitView.BtnTilte.TextID = StringId.SupportHomeKitNotes; - Action homeKitSupportViewAction = () => { - var mPage = new HDL_ON.UI.UI2.PersonalCenter.AboutOn.SupportHomeKitNotesPage(); - MainPage.BasePageView.AddChidren(mPage); - mPage.ShowPage(); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - }; - homeKitView.GoAction = homeKitSupportViewAction; - #endregion -#endif } @@ -245,11 +169,11 @@ } /// <summary> - /// 妫�娴嬫槸鍚﹂渶瑕佹洿鏂� - /// Android绛夋帴鍙e疄鐜� - /// </summary> - /// <returns></returns> - void CheckIfNeedUpdateAsync(bool isTip = false) +聽聽聽聽聽聽聽聽/// 妫�娴嬫槸鍚﹂渶瑕佹洿鏂� +聽聽聽聽聽聽聽聽/// Android绛夋帴鍙e疄鐜� +聽聽聽聽聽聽聽聽/// </summary> +聽聽聽聽聽聽聽聽/// <returns></returns> +聽聽聽聽聽聽聽聽void CheckIfNeedUpdateAsync(bool isTip = false) { new System.Threading.Thread(() => { @@ -258,14 +182,14 @@ { if (!string.IsNullOrEmpty(newAppVersion)) { - //鍙戠幇鏂扮増鏈� - versionUpdateView.BtnSubtitle.TextColor = CSS_Color.MainColor; +聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽//鍙戠幇鏂扮増鏈� +聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽versionUpdateView.BtnSubtitle.TextColor = CSS_Color.MainColor; versionUpdateView.BtnSubtitle.Text = Language.StringByID(StringId.DiscoverNewVersion) + "(" + newAppVersion + ")"; } else { - //宸茬粡鏄渶鏂扮増鏈� - versionUpdateView.BtnSubtitle.TextColor = CSS_Color.PromptingColor1; +聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽//宸茬粡鏄渶鏂扮増鏈� +聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽versionUpdateView.BtnSubtitle.TextColor = CSS_Color.PromptingColor1; versionUpdateView.BtnSubtitle.Text = Language.StringByID(StringId.IsLatestVersion); } }); @@ -275,97 +199,37 @@ } /// <summary> - /// 妫�鏌ョ増鏈� - /// </summary> - /// <returns></returns> - string CanUpdateAsync() - { -#if __IOS__ - try - { - var versionResult = RequestHttpsiOSAppVersionAsync(); - if (versionResult == null || versionResult.Results == null) - { - return ""; - } - var results = Newtonsoft.Json.Linq.JArray.Parse(versionResult.Results.ToString()); - if (results[0] == null) - { - return ""; - } - var newVersion = results[0]["version"]?.ToString(); - //var updateContent = results[0]["releaseNotes"]?.ToString(); - if (newVersion.CompareTo(MainPage.VersionString) > 0) - { - newAppVersionUrl = Constant.URL_APPSTORE; - return newVersion; - } - return ""; - } - catch - { - return ""; - } - -#else - try - { - var versionResult = CheckAppVersion(); - if (versionResult == null) - { - return ""; - } - var newVersion = versionResult.version; - if (newVersion.CompareTo(MainPage.VersionString) > 0) - { - newAppVersionUrl = versionResult.packageUrl; - return newVersion; - } - return ""; - } - catch (Exception ex) - { - return ""; - } -#endif - } - - -#if __IOS__ - /// <summary> - /// 鑾峰彇iOS-APP鐗堟湰淇℃伅 - /// </summary> - /// <returns>The https app version async.</returns> - ResultPack RequestHttpsiOSAppVersionAsync() - { - try - { - var webClient = new WebClient { }; - var result = webClient.DownloadData("https://itunes.apple.com/cn/lookup?id=1532353432"); - if (result == null) - { - return null; - } - return Newtonsoft.Json.JsonConvert.DeserializeObject<ResultPack>(Encoding.UTF8.GetString(result)); - } - catch - { - return null; - } - } - - //#else - - - - -#endif +聽聽聽聽聽聽聽聽/// 妫�鏌ョ増鏈� +聽聽聽聽聽聽聽聽/// </summary> +聽聽聽聽聽聽聽聽/// <returns></returns> +聽聽聽聽聽聽聽聽string CanUpdateAsync() +聽聽聽聽聽聽聽聽{ +聽聽聽聽聽聽聽聽聽聽聽聽try +聽聽聽聽聽聽聽聽聽聽聽聽{ +聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽var versionResult = CheckAppVersion(); +聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽if (versionResult == null) +聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽{ +聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽return ""; +聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽} +聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽var newVersion = versionResult.version; +聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽if (newVersion.CompareTo(MainPage.VersionString) > 0) +聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽{ +聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽newAppVersionUrl = versionResult.packageUrl; +聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽return newVersion; +聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽} +聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽return ""; +聽聽聽聽聽聽聽聽聽聽聽聽} +聽聽聽聽聽聽聽聽聽聽聽聽catch (Exception ex) +聽聽聽聽聽聽聽聽聽聽聽聽{ +聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽return ""; +聽聽聽聽聽聽聽聽聽聽聽聽} +聽聽聽聽聽聽聽聽} /// <summary> - /// 妫�娴嬫柊鐗堟湰 - /// </summary> - /// <returns>The https app version async.</returns> - private AppVersionResNew CheckAppVersion() +聽聽聽聽聽聽聽聽/// 妫�娴嬫柊鐗堟湰 +聽聽聽聽聽聽聽聽/// </summary> +聽聽聽聽聽聽聽聽/// <returns>The https app version async.</returns> +聽聽聽聽聽聽聽聽private AppVersionResNew CheckAppVersion() { try { @@ -388,31 +252,5 @@ } } - int updateType = 0; - void TestDDDDD() - { - updateType = 1; - - UpdateDialogInfo forceUpdateInfo = new UpdateDialogInfo() - { - UpdateType = updateType, - NewVersionUrl = Constant.URL_APPSTORE, - NewVersion = "1.0.0925", - ReasonStr = "1銆侀椤靛叏鏂版敼鐗堣璁★紝UI鏇存竻鏅� \n2銆佷慨澶岯UG \n3銆佹柊澧為煶绠卞姛鑳� \n3銆佹柊澧為煶绠卞姛鑳� \n3銆佹柊澧為煶绠卞姛鑳� \n3銆佹柊澧為煶绠卞姛鑳� \n3銆佹柊澧為煶绠卞姛鑳� \n3銆佹柊澧為煶绠卞姛鑳� \n3銆佹柊澧為煶绠卞姛鑳� \n3銆佹柊澧為煶绠卞姛鑳� \n3銆佹柊澧為煶绠卞姛鑳� \n3銆佹柊澧為煶绠卞姛鑳� \n3銆佹柊澧為煶绠卞姛鑳� \n3銆佹柊澧為煶绠卞姛鑳� \n3銆佹柊澧為煶绠卞姛鑳�" - }; - - HDLCommon.Current.ShowForceUpdateDialog(forceUpdateInfo); - } - - } - - /// <summary> - /// 鑻规灉鍟嗗簵鏌ヨ鍝嶅簲鍖呮牸寮� - /// </summary> - [System.Serializable] - public class ResultPack - { - public int ResultCount { get; set; } - public object Results { get; set; } } } -- Gitblit v1.8.0