From 25429f085093d89d543a0b90e30d0d62d1b7dac9 Mon Sep 17 00:00:00 2001
From: hxb <hxb@hdlchina.com.cn>
Date: 星期二, 30 八月 2022 09:37:38 +0800
Subject: [PATCH] 合并了IOS的代码
---
ZigbeeApp/Shared/Phone/UserCenter/Abount/AbountForm.cs | 139 ++++++++++++++++++++++------------------------
1 files changed, 67 insertions(+), 72 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Abount/AbountForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Abount/AbountForm.cs
index 193e28e..e10d95a 100644
--- a/ZigbeeApp/Shared/Phone/UserCenter/Abount/AbountForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Abount/AbountForm.cs
@@ -42,12 +42,13 @@
/// <summary>
/// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓)
/// </summary>
- public void ShowForm()
+ /// <param name="autoUpdate">鎵撳紑鐣岄潰涔嬪悗,濡傛灉鏈夋柊鐗堟湰,鏄惁鐩存帴鍗囩骇</param>
+ public void ShowForm(bool autoUpdate)
{
//璁剧疆鏍囬淇℃伅
base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAboutMe));
//鍒濆鍖栦腑閮ㄦ帶浠�
- this.InitMiddleFrame();
+ this.InitMiddleFrame(autoUpdate);
}
/// <summary>
/// Closes the form.
@@ -65,32 +66,28 @@
/// <summary>
/// 鍒濆鍖栦腑閮ㄦ帶浠�
/// </summary>
- private void InitMiddleFrame()
+ /// <param name="autoUpdate">鎵撳紑鐣岄潰涔嬪悗,濡傛灉鏈夋柊鐗堟湰,鏄惁鐩存帴鍗囩骇</param>
+ private void InitMiddleFrame(bool autoUpdate)
{
//澶撮儴鐧借壊鑳屾櫙
var frameLogo = new FrameLayoutBase();
frameLogo.Height = Application.GetRealHeight(484);
frameLogo.BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
bodyFrameLayout.AddChidren(frameLogo);
- //鍥炬爣鐨勫鍣�
- var frameLogoBackground = new FrameLayoutBase();
- frameLogoBackground.Y = Application.GetRealHeight(104);
- frameLogoBackground.Width = this.GetPictrueRealSize(167);
- frameLogoBackground.Height = this.GetPictrueRealSize(167);
- frameLogoBackground.Gravity = Gravity.CenterHorizontal;
- frameLogoBackground.BackgroundColor = ZigbeeColor.Current.GXCButtonBlackSelectedColor;
- frameLogoBackground.Radius = (uint)Application.GetRealHeight(37);
- frameLogo.AddChidren(frameLogoBackground);
//鍥炬爣
- var btnLogo = new IconViewControl(144);
- btnLogo.UnSelectedImagePath = "Account/Logo_White.png";
- btnLogo.Gravity = Gravity.Center;
- frameLogoBackground.AddChidren(btnLogo);
- //HDL Home
+ var btnLogo = new ImageView();
+ btnLogo.Y = Application.GetRealHeight(104);
+ btnLogo.Width = this.GetPictrueRealSize(167);
+ btnLogo.Height = this.GetPictrueRealSize(167);
+ btnLogo.Radius = (uint)Application.GetRealHeight(37);
+ btnLogo.ImagePath = "Account/Logo_Evoyo.png";
+ btnLogo.Gravity = Gravity.CenterHorizontal;
+ frameLogo.AddChidren(btnLogo);
+ //Evoyo Home
var btnName = new NormalViewControl(700, 60, true);
btnName.Y = Application.GetRealHeight(294);
btnName.Gravity = Gravity.CenterHorizontal;
- btnName.Text = "HDL Home";
+ btnName.Text = "Evoyo Home";
btnName.TextSize = 15;
btnName.TextColor = ZigbeeColor.Current.GXCTextDeepBlackColor;
btnName.TextAlignment = TextAlignment.Center;
@@ -111,11 +108,17 @@
listView.Height = Application.GetRealHeight(500);
bodyFrameLayout.AddChidren(listView);
//鏈嶅姟鍗忚
- //var rowService = new FrameRowControl(listView.rowSpace / 2);
- //listView.AddChidren(rowService);
- //rowService.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.SLA), 400);
- //rowService.AddRightArrow();
- //rowService.AddBottomLine();
+ var rowService = new FrameRowControl(listView.rowSpace / 2);
+ listView.AddChidren(rowService);
+ rowService.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.SLA), 400);
+ rowService.AddRightArrow();
+ rowService.AddBottomLine();
+ rowService.ButtonClickEvent += (sender, e) =>
+ {
+ var form = new SLAForm();
+ form.AddForm();
+ };
+
//鐗堟湰鏇存柊
this.rowUpdate = new FrameRowControl(listView.rowSpace / 2);
listView.AddChidren(rowUpdate);
@@ -156,6 +159,11 @@
//鏇存柊鏈�鏂扮増
btnRightView.TextID = R.MyInternationalizationString.Update;
rowUpdate.CanClick = true;
+ if (autoUpdate == true)
+ {
+ //鐩存帴鍗囩骇
+ rowUpdate.ButtonClickEvent?.Invoke(null, null);
+ }
}
else
{
@@ -166,18 +174,6 @@
});
}
- /// <summary>
- /// CheckVersion
- /// </summary>
- private void CheckVersion()
- {
- new System.Threading.Thread(async () =>
- {
-
- })
- { IsBackground = true }.Start();
-
- }
/// <summary>
/// 璁剧疆杩涘害鎺т欢涓嶅彲瑙�
/// </summary>
@@ -204,39 +200,40 @@
{
#if iOS
try
- {
- var versionResult = await RequestHttpsiOSAppVersionAsync();
- if (versionResult == null || versionResult.Results == null)
- {
- return false;
- }
- var results = Newtonsoft.Json.Linq.JArray.Parse(versionResult.Results.ToString());
- if (results[0] == null)
- {
- return false;
- }
+ {
+ var versionResult = await RequestHttpsiOSAppVersionAsync();
+ if (versionResult == null || versionResult.Results == null)
+ {
+ return false;
+ }
+ var results = Newtonsoft.Json.Linq.JArray.Parse(versionResult.Results.ToString());
+ if (results[0] == null)
+ {
+ return false;
+ }
var newVersion = results[0]["version"]?.ToString();
- var updateContent = results[0]["releaseNotes"]?.ToString();
- if (newVersion.CompareTo(CommonPage.CodeIDString) > 0)
- {
- return true;
- }
- return false;
- }
- catch
- {
- return false;
- }
+
+ var updateContent = results[0]["releaseNotes"]?.ToString();
+ if (newVersion.CompareTo(CommonPage.CodeIDString) > 0)
+ {
+ return true;
+ }
+ return false;
+ }
+ catch
+ {
+ return false;
+ }
#elif Android
try
{
- var versionResult = await RequestHttpsAndroidAppVersionAsync();
+ var versionResult = RequestHttpsAndroidAppVersionAsync();
if (versionResult == null)
{
return false;
}
- if (int.Parse(versionResult.FirmwareVersion.Replace(".", "")) > int.Parse(CommonPage.CodeIDString.Replace(".", "")))
+ if (versionResult.FirmwareVersion.CompareTo(CommonPage.CodeIDString) > 0)
{
distributedMark = versionResult.DistributedMark;
return true;
@@ -267,7 +264,7 @@
};
var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestObj);
- var bytesTotalLengthResult = await CommonPage.Instance.RequestHttpsZigbeeAsync("FirmwareMana/DownloadPlatformUploadFirmwarePreLength", Encoding.UTF8.GetBytes(requestJson));
+ var bytesTotalLengthResult = CommonPage.Instance.RequestHttpsZigbeeAsync("FirmwareMana/DownloadPlatformUploadFirmwarePreLength", Encoding.UTF8.GetBytes(requestJson));
if (bytesTotalLengthResult == null || bytesTotalLengthResult.ResponseData == null)
{
CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.UpdateAppFail);
@@ -312,7 +309,7 @@
try
{
var webClient = new WebClient { };
- var result = await webClient.DownloadDataTaskAsync("https://itunes.apple.com/lookup?id=1461693569");
+ var result = await webClient.DownloadDataTaskAsync("https://itunes.apple.com/lookup?id=1528702586");
if (result == null)
{
return null;
@@ -329,7 +326,7 @@
/// </summary>
public void OpenUrl()
{
- Uri url = new Uri("https://itunes.apple.com/cn/app/hdl-home/id1461693569?mt=8");
+ Uri url = new Uri("https://itunes.apple.com/cn/app/hdl-home/id1528702586?mt=8");
UIKit.UIApplication.SharedApplication.OpenUrl(url);
}
#elif Android
@@ -350,7 +347,7 @@
if (Android.OS.BuildVersionCodes.M < Android.OS.Build.VERSION.SdkInt)
{
//鍙傛暟1 涓婁笅鏂�, 鍙傛暟2 Provider涓绘満鍦板潃 鍜岄厤缃枃浠朵腑淇濇寔涓�鑷� 鍙傛暟3 鍏变韩鐨勬枃浠�
- var apkUri = Android.Support.V4.Content.FileProvider.GetUriForFile(context, "com.hdl.home.fileProvider", file);
+ var apkUri = Android.Support.V4.Content.FileProvider.GetUriForFile(context, "com.evoyo.home.fileProvider", file);
//娣诲姞杩欎竴鍙ヨ〃绀哄鐩爣搴旂敤涓存椂鎺堟潈璇ri鎵�浠h〃鐨勬枃浠�
intent.AddFlags(Android.Content.ActivityFlags.GrantReadUriPermission);
intent.SetDataAndType(apkUri, "application/vnd.android.package-archive");
@@ -366,7 +363,7 @@
/// 鑾峰彇 Android-APP 鐗堟湰淇℃伅
/// </summary>
/// <returns>The https app version async.</returns>
- private async System.Threading.Tasks.Task<Common.ResponseEntity.ApkInfoOBJ> RequestHttpsAndroidAppVersionAsync()
+ private Common.ResponseEntity.ApkInfoOBJ RequestHttpsAndroidAppVersionAsync()
{
try
{
@@ -376,7 +373,7 @@
RequestVersion = CommonPage.CodeIDString
};
var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestOBJ);
- var result = await CommonPage.Instance.RequestHttpsZigbeeAsync("FirmwareMana/DetectionPlatformUploadFirmware", System.Text.Encoding.UTF8.GetBytes(requestJson));
+ var result = CommonPage.Instance.RequestHttpsZigbeeAsync("FirmwareMana/DetectionPlatformUploadFirmware", System.Text.Encoding.UTF8.GetBytes(requestJson));
if (result == null)
{
return null;
@@ -393,19 +390,17 @@
{
return null;
}
- int MaxIndex = 0;
- int NewVersion = 0;
+
+ Common.ResponseEntity.ApkInfoOBJ apkInfoOBJ = null;
for (int i = 0; i < responeData.pageData.Count; i++)
{
var apkInfo = responeData.pageData[i];
- var version = int.Parse(apkInfo.FirmwareVersion.Replace(".", ""));
- if (version > NewVersion)
+ if (apkInfoOBJ == null || apkInfo.FirmwareVersion.CompareTo(apkInfoOBJ.FirmwareVersion) > 0)
{
- NewVersion = version;
- MaxIndex = i;
+ apkInfoOBJ = apkInfo;
}
}
- return responeData.pageData[MaxIndex];
+ return apkInfoOBJ;
}
return null;
}
--
Gitblit v1.8.0