| | |
| | | |
| | | namespace HDL_ON.UI |
| | | { |
| | | /// <summary> |
| | | /// 关于页面 |
| | | /// </summary> |
| | | public class AboutOnPage : FrameLayout |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | FrameLayout bodyView; |
| | | /// <summary> |
| | | /// 版本更新ListCellView |
| | | /// </summary> |
| | | ListCellView versionUpdateView; |
| | | |
| | | /// <summary> |
| | | /// 新版本的版本号,查询到新版本才赋值 |
| | | /// </summary> |
| | | string newAppVersion; |
| | | /// <summary> |
| | | /// 新版本的下载地址 |
| | | /// iOS 默认为苹果商店地址 |
| | | /// Android 云端返回地址 |
| | | /// </summary> |
| | | string newAppVersionUrl = ""; |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public AboutOnPage() |
| | | { |
| | | bodyView = this; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public void LoadPage() |
| | | { |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.About)).LoadTopView(); |
| | |
| | | }; |
| | | 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() |
| | | { |
| | | Y = btnOnTitle.Bottom, |
| | |
| | | Y = lineView.Bottom, |
| | | }; |
| | | bodyView.AddChidren(functionView); |
| | | functionView.btnTilte.TextID = StringId.FunctionIntroduced; |
| | | functionView.BtnTilte.TextID = StringId.FunctionIntroduced; |
| | | Action functionAction = () => |
| | | { |
| | | var mPage = new FunctionIntroductionPage(); |
| | |
| | | mPage.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | functionView.goAction = functionAction; |
| | | functionView.GoAction = functionAction; |
| | | #endregion |
| | | |
| | | #region 投诉 |
| | |
| | | Y = functionView.Bottom, |
| | | }; |
| | | bodyView.AddChidren(complaintsView); |
| | | complaintsView.btnTilte.TextID = StringId.Complaints; |
| | | complaintsView.BtnTilte.TextID = StringId.Complaints; |
| | | Action complaintsAction = () => |
| | | { |
| | | var mPage = new ComplaintsPage(); |
| | |
| | | mPage.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | complaintsView.goAction = complaintsAction; |
| | | complaintsView.GoAction = complaintsAction; |
| | | #endregion |
| | | |
| | | #region 版本更新 |
| | | var versionUpdateView = new ListCellView() |
| | | versionUpdateView = new ListCellView() |
| | | { |
| | | Y = complaintsView.Bottom, |
| | | }; |
| | | bodyView.AddChidren(versionUpdateView); |
| | | versionUpdateView.btnTilte.TextID = StringId.VersionUpdate; |
| | | versionUpdateView.BtnTilte.TextID = StringId.VersionUpdate; |
| | | Action versionUpdateAction = () => |
| | | { |
| | | CheckIfNeedUpdateAsync(); |
| | | }; |
| | | versionUpdateView.goAction = versionUpdateAction; |
| | | { |
| | | OpenUrl(); |
| | | //TestDDDDD(); |
| | | //HDLCommon.Current.CheckIfNeedForceUpdate(); |
| | | }; |
| | | versionUpdateView.GoAction = versionUpdateAction; |
| | | #endregion |
| | | |
| | | CheckIfNeedUpdateAsync(); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 判断是否需要调整新版本下载地址 |
| | | /// </summary> |
| | | void OpenUrl() |
| | | { |
| | | if (!string.IsNullOrEmpty(newAppVersion)) |
| | | { |
| | | HDLUtils.OpenUrl(newAppVersionUrl); |
| | | } |
| | | else |
| | | { |
| | | Utlis.ShowTip(Language.StringByID(StringId.IsLatestVersion)); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 检测是否需要更新 |
| | | /// Android等接口实现 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | void CheckIfNeedUpdateAsync() |
| | | void CheckIfNeedUpdateAsync(bool isTip = false) |
| | | { |
| | | new System.Threading.Thread(() => |
| | | { |
| | | var newVersion = CanUpdateAsync(); |
| | | newAppVersion = CanUpdateAsync(); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (!string.IsNullOrEmpty(newVersion)) |
| | | if (!string.IsNullOrEmpty(newAppVersion)) |
| | | { |
| | | Action okAction = () => |
| | | { |
| | | OpenUrl(); |
| | | }; |
| | | var mesStr = Language.StringByID(StringId.DiscoverNewVersion) + "(" + newVersion + ")"; |
| | | new ConfirmDialog().ShowDialog(Language.StringByID(StringId.Tip), mesStr, okAction, null, StringId.Cancel, StringId.Update); |
| | | //发现新版本 |
| | | versionUpdateView.BtnSubtitle.TextColor = CSS_Color.MainColor; |
| | | versionUpdateView.BtnSubtitle.Text = Language.StringByID(StringId.DiscoverNewVersion) + "(" + newAppVersion + ")"; |
| | | } |
| | | else |
| | | { |
| | | Utlis.ShowTip(Language.StringByID(StringId.IsLatestVersion)); |
| | | //已经是最新版本 |
| | | versionUpdateView.BtnSubtitle.TextColor = CSS_Color.PromptingColor1; |
| | | versionUpdateView.BtnSubtitle.Text = Language.StringByID(StringId.IsLatestVersion); |
| | | } |
| | | }); |
| | | |
| | |
| | | //var updateContent = results[0]["releaseNotes"]?.ToString(); |
| | | if (newVersion.CompareTo(MainPage.VersionString) > 0) |
| | | { |
| | | newAppVersionUrl = Constant.URL_APPSTORE; |
| | | return newVersion; |
| | | } |
| | | return ""; |
| | |
| | | #else |
| | | try |
| | | { |
| | | var versionResult = GetAndroidAppVersion(); |
| | | var versionResult = CheckAppVersion(); |
| | | if (versionResult == null) |
| | | { |
| | | return ""; |
| | | } |
| | | var newVersion = versionResult.AndroidVersion; |
| | | var newVersion = versionResult.version; |
| | | if (newVersion.CompareTo(MainPage.VersionString) > 0) |
| | | { |
| | | AndroidUrl = versionResult.AndroidUrl; |
| | | newAppVersionUrl = versionResult.androidUrl; |
| | | return newVersion; |
| | | } |
| | | return ""; |
| | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 跳转到APP Store |
| | | /// </summary> |
| | | void OpenUrl() |
| | | { |
| | | HDLUtils.OpenUrl("https://apps.apple.com/cn/app/on/id1532353432"); |
| | | } |
| | | #else |
| | | //#else |
| | | |
| | | string AndroidUrl = ""; |
| | | /// <summary> |
| | | /// 跳转到Android 下载地址 |
| | | /// </summary> |
| | | void OpenUrl() |
| | | { |
| | | HDLUtils.OpenUrl(AndroidUrl); |
| | | } |
| | | |
| | | |
| | | |
| | | #endif |
| | | |
| | | /// <summary> |
| | | /// 获取 Android-APP 版本信息 |
| | | /// 检测新版本 |
| | | /// </summary> |
| | | /// <returns>The https app version async.</returns> |
| | | private APPVersion GetAndroidAppVersion() |
| | | private AppVersionRes CheckAppVersion() |
| | | { |
| | | try |
| | | { |
| | | var result = new HttpServerRequest().GetAppVersion(); |
| | | var result = new HttpServerRequest().CheckAppVersion(); |
| | | if (result.Code == StateCode.SUCCESS) |
| | | { |
| | | if (result.Data == null) |
| | |
| | | return null; |
| | | } |
| | | |
| | | var responeData = Newtonsoft.Json.JsonConvert.DeserializeObject<APPVersion>(result.Data.ToString()); |
| | | var responeData = Newtonsoft.Json.JsonConvert.DeserializeObject<AppVersionRes>(result.Data.ToString()); |
| | | return responeData; |
| | | } |
| | | return null; |
| | |
| | | } |
| | | } |
| | | |
| | | int updateType = 0; |
| | | void TestDDDDD() |
| | | { |
| | | updateType = 1; |
| | | |
| | | #endif |
| | | UpdateDialogInfo forceUpdateInfo = new UpdateDialogInfo() |
| | | { |
| | | UpdateType = updateType, |
| | | NewVersionUrl = Constant.URL_APPSTORE, |
| | | NewVersion = "1.0.0925", |
| | | ReasonStr = "1、首页全新改版设计,UI更清晰 \n2、修复BUG \n3、新增音箱功能 \n3、新增音箱功能 \n3、新增音箱功能 \n3、新增音箱功能 \n3、新增音箱功能 \n3、新增音箱功能 \n3、新增音箱功能 \n3、新增音箱功能 \n3、新增音箱功能 \n3、新增音箱功能 \n3、新增音箱功能 \n3、新增音箱功能 \n3、新增音箱功能" |
| | | }; |
| | | |
| | | HDLCommon.Current.ShowForceUpdateDialog(forceUpdateInfo); |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 苹果商店查询响应包格式 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class ResultPack |
| | | { |