From 8da95ae83bbc43b9f6c11224975de5214fa5d651 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期三, 22 二月 2023 15:25:26 +0800 Subject: [PATCH] 安卓版本,乐橙设备绑定限制,增加品牌认证 --- HDL-ON_Android/HDL-ON_Android.csproj | 2 HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/AddDevciePage.cs | 184 ++++++++++++++++++++++++++ HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs | 2 HDL-ON_Android/Properties/AndroidManifest.xml | 2 HDL-ON_iOS/Info.plist | 4 HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/SenesorMegahealth/AddSenesorMegahealthDirection1Page.cs | 2 DLL/LC/Android/LCDeviceAddModule.dll | 0 HDL_ON/DAL/Server/HttpServerRequest.cs | 3 HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/DeviceListPage.cs | 156 +++++---------------- HDL_ON/UI/UI1-Login/LoginPage.cs | 5 HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/SenesorEnvironment/AddSensorEnvironmentPage.cs | 2 11 files changed, 236 insertions(+), 126 deletions(-) diff --git a/DLL/LC/Android/LCDeviceAddModule.dll b/DLL/LC/Android/LCDeviceAddModule.dll index ca613e3..741b727 100644 --- a/DLL/LC/Android/LCDeviceAddModule.dll +++ b/DLL/LC/Android/LCDeviceAddModule.dll Binary files differ diff --git a/HDL-ON_Android/HDL-ON_Android.csproj b/HDL-ON_Android/HDL-ON_Android.csproj index bfd4a20..cfd34e6 100644 --- a/HDL-ON_Android/HDL-ON_Android.csproj +++ b/HDL-ON_Android/HDL-ON_Android.csproj @@ -65,7 +65,7 @@ <AndroidSigningStorePass>85521566</AndroidSigningStorePass> <AndroidSigningKeyPass>85521566</AndroidSigningKeyPass> <AndroidSigningKeyAlias>on_plus</AndroidSigningKeyAlias> - <AndroidSupportedAbis>armeabi-v7a;arm64-v8a</AndroidSupportedAbis> + <AndroidSupportedAbis>arm64-v8a</AndroidSupportedAbis> </PropertyGroup> <ItemGroup> <Reference Include="Shared.Droid.JPush"> diff --git a/HDL-ON_Android/Properties/AndroidManifest.xml b/HDL-ON_Android/Properties/AndroidManifest.xml index 742910f..362f1aa 100644 --- a/HDL-ON_Android/Properties/AndroidManifest.xml +++ b/HDL-ON_Android/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@ 锘�<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.6.4" package="com.hdl.onpro" xmlns:tools="http://schemas.android.com/tools" android:versionCode="202302151"> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.6.4" package="com.hdl.onpro" xmlns:tools="http://schemas.android.com/tools" android:versionCode="202302201"> <uses-sdk android:minSdkVersion="26" android:targetSdkVersion="29" /> <!--鍙嬬洘--> <!--<uses-sdk android:minSdkVersion="8"></uses-sdk>--> diff --git a/HDL-ON_iOS/Info.plist b/HDL-ON_iOS/Info.plist index cf97fe8..2f5ecb9 100644 --- a/HDL-ON_iOS/Info.plist +++ b/HDL-ON_iOS/Info.plist @@ -98,9 +98,9 @@ <key>UIStatusBarStyle</key> <string>UIStatusBarStyleLightContent</string> <key>CFBundleShortVersionString</key> - <string>1.6.302302021</string> + <string>1.6.402302221</string> <key>CFBundleVersion</key> - <string>1.6.302021</string> + <string>1.6.402171</string> <key>NSLocationWhenInUseUsageDescription</key> <string>Use geographic location to provide services such as weather</string> <key>NSAppleMusicUsageDescription</key> diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs index 4ba45b6..ac5de30 100644 --- a/HDL_ON/DAL/Server/HttpServerRequest.cs +++ b/HDL_ON/DAL/Server/HttpServerRequest.cs @@ -2078,7 +2078,7 @@ /// <param name="productPlatform"></param> /// <param name="productBrand"></param> /// <returns></returns> - public ResponsePackNew IndependentRegister3TyDevcie(string spk, string extDevId, string deviceName, string pairCode = "") + public ResponsePackNew IndependentRegister3TyDevcie(string spk, string extDevId, string deviceName,string productBrandIdentity, string pairCode = "") { Dictionary<string, object> d = new Dictionary<string, object>(); d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); @@ -2086,6 +2086,7 @@ d.Add("extDevId", extDevId); d.Add("name", deviceName); d.Add("code", pairCode); + d.Add("productBrandIdentity", productBrandIdentity); var requestJson = HttpUtil.GetSignRequestJson(d); diff --git a/HDL_ON/UI/UI1-Login/LoginPage.cs b/HDL_ON/UI/UI1-Login/LoginPage.cs index 5d79dec..6bf3817 100644 --- a/HDL_ON/UI/UI1-Login/LoginPage.cs +++ b/HDL_ON/UI/UI1-Login/LoginPage.cs @@ -232,6 +232,7 @@ //etAccount.Text = "13418062953"; etAccount.Text = "13138683659"; //etAccount.Text = "15217626103"; + etAccount.Text = "13377799637"; } else { @@ -282,6 +283,10 @@ { etPassword.Text = "wsad123321"; } + else if (etAccount.Text == "13377799637") + { + etPassword.Text = "lc392962649"; + } //etPassword.Text = "Hdl85521566"; btnLogin.IsSelected = true; }; diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/SenesorEnvironment/AddSensorEnvironmentPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/SenesorEnvironment/AddSensorEnvironmentPage.cs index 1efa651..02435eb 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/SenesorEnvironment/AddSensorEnvironmentPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/SenesorEnvironment/AddSensorEnvironmentPage.cs @@ -160,7 +160,7 @@ try { var pm = new HttpServerRequest(); - var pack = pm.IndependentRegister3TyDevcie(integratedDevice.spk, snCode,integratedDevice.ProductShowName, pairString);// Language.StringByID(StringId.SensorEnvironment) + var pack = pm.IndependentRegister3TyDevcie(integratedDevice.spk, snCode,integratedDevice.ProductShowName, integratedDevice.productBrand, pairString);// Language.StringByID(StringId.SensorEnvironment) if (pack.Code == StateCode.SUCCESS) { //var revData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<IntegratedBrandDevice>>(pack.Data.ToString()); diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/SenesorMegahealth/AddSenesorMegahealthDirection1Page.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/SenesorMegahealth/AddSenesorMegahealthDirection1Page.cs index d4501dc..0965e3d 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/SenesorMegahealth/AddSenesorMegahealthDirection1Page.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/SenesorMegahealth/AddSenesorMegahealthDirection1Page.cs @@ -115,7 +115,7 @@ try { var pm = new HttpServerRequest(); - var pack = pm.IndependentRegister3TyDevcie(device.spk, snCode,Language.StringByID(StringId.SenesorMillimeterWave)); + var pack = pm.IndependentRegister3TyDevcie(device.spk, snCode,Language.StringByID(StringId.SenesorMillimeterWave),device.productBrand); if (pack.Code == StateCode.SUCCESS) { //var revData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<IntegratedBrandDevice>>(pack.Data.ToString()); diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/AddDevciePage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/AddDevciePage.cs index f71ad7f..415b219 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/AddDevciePage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/AddDevciePage.cs @@ -1,5 +1,8 @@ 锘縰sing System; using System.Collections.Generic; +#if __ANDROID__ +using Android.Content; +#endif using HDL_ON.DAL.Server; using HDL_ON.Entity; using HDL_ON.UI.CSS; @@ -146,6 +149,187 @@ btnName.MouseUpEventHandler = (sender, e) => { switch (device.spk) { + case SPK.IpCam_Imou: +#if __ANDROID__ + FunctionList.List.GetIpCamImouList(); + if (string.IsNullOrEmpty(Com.Utils.HdlToLcUtils.Instance.SubAccessToken)) + { + + var waitPage = new Loading(); + MainPage.BaseView.AddChidren(waitPage); + waitPage.Start(""); + new System.Threading.Thread(() => + { + try + { + +#if DEBUG + Com.Utils.HdlToLcUtils.Instance.ShowErrorInfo(true); +#endif + + var http = new HttpServerRequest(); + var pack = http.GetLcSubAccountToken(); + if (pack.Code == StateCode.SUCCESS) + { + if (pack.Data == null || string.IsNullOrEmpty(pack.Data.ToString())) + { + Application.RunOnMainThread(() => + { + new PublicAssmebly().TipMsg(Language.StringByID(StringId.Tip), Language.StringByID(StringId.Get3tyIotInfoFailed)); + return; + }); + } + Com.Utils.HdlToLcUtils.Instance.InitData(Shared.Application.Activity, "HDL-HOME-APP-TEST", "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss", OnAppConfig.Instance.RequestHttpsHost); + Com.Utils.HdlToLcUtils.Instance.HomeId = DB_ResidenceData.Instance.CurrentRegion.id; + Com.Utils.HdlToLcUtils.Instance.Token = UserInfo.Current.AccessToken; + Com.Utils.HdlToLcUtils.Instance.SubAccessToken = pack.Data.ToString(); +#if __ANDROID__ + Application.RunOnMainThread(() => + { + try + { + var result = Com.Utils.HdlToLcUtils.Instance.CheckCameraPermissions(); + if (result) + { + var bindDeviceFeedback = new BindDeviceFeedback(); + bindDeviceFeedback.tipAction = (method, msg) => { + HDLUtils.WriteLine(method + "::" + msg); + if(method == "bindDevice") + { + var bindResult = Newtonsoft.Json.JsonConvert.DeserializeObject<ResponsePackNew>(msg); + if (bindResult != null) + { + if (bindResult.Code == "147021") { + string tipTitle = "鎻愮ず"; + string tipMsg = "鏃犳硶缁戝畾璇ヨ澶囷紝璇蜂粠娌充笢娓犻亾璐拱璇ョ被鍨嬩骇鍝�"; + if (Language.CurrentLanguage != "Chinese") + { + tipTitle = "Tip"; + tipMsg = "Unable to bind this device. Please purchase this type of product from HDL"; + } + new PublicAssmebly().TipMsg(tipTitle, tipMsg); + } + else + { + string tipTitle = "鎻愮ず"; + string tipMsg = $"{bindResult.message}({bindResult.Code})"; + if (Language.CurrentLanguage != "Chinese") + { + tipTitle = "Tip"; + } + new PublicAssmebly().TipMsg(tipTitle, tipMsg); + } + } + + } + }; + Hdl.Onpro.HdlData.Instance.InitData(bindDeviceFeedback, device.productBrand); + + var backTemp = new AddLcCam(); + backTemp.backAction = () => + { + refreshView.BeginHeaderRefreshing(); + this.RemoveFromParent(); + }; + Com.Utils.HdlToLcUtils.Instance.AddCamera(backTemp); + + } + else + { + Com.Utils.HdlToLcUtils.Instance.RequestCameraPermissions(); + } + } + catch (Exception ex) + { + + } + finally + { + } + }); +#endif + } + else + { + Application.RunOnMainThread(() => + { + new PublicAssmebly().TipMsg(Language.StringByID(StringId.Tip), Language.StringByID(StringId.huoqushujushibao) + $"({pack.Code})"); + }); + } + } + catch (Exception ex) + { + MainPage.Log("鍔犺浇涔愭鎽勫儚澶村紓甯�"); + } + finally + { + Application.RunOnMainThread(() => + { + if (waitPage != null) + { + waitPage.RemoveFromParent(); + waitPage = null; + } + }); + } + }) + { IsBackground = true }.Start(); + } + else + { + var result = Com.Utils.HdlToLcUtils.Instance.CheckCameraPermissions(); + if (result) + { + var bindDeviceFeedback = new BindDeviceFeedback(); + bindDeviceFeedback.tipAction = (method, msg) => { + HDLUtils.WriteLine(method + "::" + msg); + if (method == "bindDevice") + { + var bindResult = Newtonsoft.Json.JsonConvert.DeserializeObject<ResponsePackNew>(msg); + if (bindResult != null) + { + if (bindResult.Code == "147021") + { + string tipTitle = "鎻愮ず"; + string tipMsg = "鏃犳硶缁戝畾璇ヨ澶囷紝璇蜂粠娌充笢娓犻亾璐拱璇ョ被鍨嬩骇鍝�"; + if (Language.CurrentLanguage != "Chinese") + { + tipTitle = "Tip"; + tipMsg = "Unable to bind this device. Please purchase this type of product from HDL"; + } + new PublicAssmebly().TipMsg(tipTitle, tipMsg); + } + else + { + string tipTitle = "鎻愮ず"; + string tipMsg = $"{bindResult.message}({bindResult.Code})"; + if (Language.CurrentLanguage != "Chinese") + { + tipTitle = "Tip"; + } + new PublicAssmebly().TipMsg(tipTitle, tipMsg); + } + } + } + }; + Hdl.Onpro.HdlData.Instance.InitData(bindDeviceFeedback, device.productBrand); + + + var backTemp = new AddLcCam(); + backTemp.backAction = () => + { + refreshView.BeginHeaderRefreshing(); + this.RemoveFromParent(); + }; + Com.Utils.HdlToLcUtils.Instance.AddCamera(backTemp); + } + else + { + Com.Utils.HdlToLcUtils.Instance.RequestCameraPermissions(); + } + } +#endif + break; case SPK.IrModule: var form = new AddMiniRemoteControlDirection1Page(); form.AddForm(); diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/DeviceListPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/DeviceListPage.cs index 2d623a6..6708c7d 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/DeviceListPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/DeviceListPage.cs @@ -5,6 +5,8 @@ using HDL_ON.UI.CSS; #if __Android__ using Java.Interop; +using Android.Content; +using Hdl.Onpro; #endif using Shared; namespace HDL_ON.UI @@ -26,124 +28,10 @@ { Action<string, string> action = (s, a) => { - if (brand.productBrand == "IMOU") - { -#if __ANDROID__ - - FunctionList.List.GetIpCamImouList(); - - - if (string.IsNullOrEmpty(Com.Utils.HdlToLcUtils.Instance.SubAccessToken)) - { - - var waitPage = new Loading(); - MainPage.BaseView.AddChidren(waitPage); - waitPage.Start(""); - new System.Threading.Thread(() => - { - try - { - -#if DEBUG - Com.Utils.HdlToLcUtils.Instance.ShowErrorInfo(true); -#endif - - var http = new HttpServerRequest(); - var pack = http.GetLcSubAccountToken(); - if (pack.Code == StateCode.SUCCESS) - { - if (pack.Data == null || string.IsNullOrEmpty(pack.Data.ToString())) - { - Application.RunOnMainThread(() => - { - new PublicAssmebly().TipMsg(Language.StringByID(StringId.Tip), Language.StringByID(StringId.Get3tyIotInfoFailed)); - return; - }); - } - Com.Utils.HdlToLcUtils.Instance.InitData(Shared.Application.Activity, "HDL-HOME-APP-TEST", "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss", OnAppConfig.Instance.RequestHttpsHost); - Com.Utils.HdlToLcUtils.Instance.HomeId = DB_ResidenceData.Instance.CurrentRegion.id; - Com.Utils.HdlToLcUtils.Instance.Token = UserInfo.Current.AccessToken; - Com.Utils.HdlToLcUtils.Instance.SubAccessToken = pack.Data.ToString(); -#if __ANDROID__ - Application.RunOnMainThread(() => - { - try - { - - var result = Com.Utils.HdlToLcUtils.Instance.CheckCameraPermissions(); - if (result) - { - var backTemp = new AddLcCam(); - backTemp.backAction = () => - { - Load3tyBrandDeviceList(); - }; - Com.Utils.HdlToLcUtils.Instance.AddCamera(backTemp); - } - else - { - Com.Utils.HdlToLcUtils.Instance.RequestCameraPermissions(); - } - } - catch (Exception ex) - { - - } - }); -#endif - } - else - { - Application.RunOnMainThread(() => - { - new PublicAssmebly().TipMsg(Language.StringByID(StringId.Tip), Language.StringByID(StringId.huoqushujushibao) + $"({pack.Code})"); - }); - } - } - catch (Exception ex) - { - MainPage.Log("鍔犺浇涔愭鎽勫儚澶村紓甯�"); - } - finally - { - Application.RunOnMainThread(() => - { - if (waitPage != null) - { - waitPage.RemoveFromParent(); - waitPage = null; - } - }); - } - }) - { IsBackground = true }.Start(); - } - else - { - var result = Com.Utils.HdlToLcUtils.Instance.CheckCameraPermissions(); - if (result) - { - var backTemp = new AddLcCam(); - backTemp.backAction = () => - { - Load3tyBrandDeviceList(); - }; - Com.Utils.HdlToLcUtils.Instance.AddCamera(backTemp); - } - else - { - Com.Utils.HdlToLcUtils.Instance.RequestCameraPermissions(); - } - } -#endif - } - else - { - var page = new AddDevciePage(brand); - MainPage.BasePageView.AddChidren(page); - page.LoadPage(contentView); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - } + var page = new AddDevciePage(brand); + MainPage.BasePageView.AddChidren(page); + page.LoadPage(contentView); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; new TopViewDiv(bodyView, Language.StringByID(StringId.Devices)).LoadTopView_AddIcon("3ty", action); bodyView.BackgroundColor = CSS_Color.BackgroundColor; @@ -463,6 +351,23 @@ #if __Android__ + + //[Android.Content.BroadcastReceiver(Enabled = true, Exported = false)] + //public class ImouReceiver : Android.Content.BroadcastReceiver + //{ + // public override void OnReceive(Context context, Intent intent) + // { + // if (intent != null) + // { + // string action = intent.Action; + // if (action == "hdlUserDeviceBind") + // { + // string value = intent.GetStringExtra("data"); + // } + // } + // } + //} + public class AddLcCam : Java.Lang.Object, Com.CallBack.IAddCamera { @@ -523,6 +428,17 @@ { } } + + public class BindDeviceFeedback : Java.Lang.Object, Hdl.Onpro.IRegisterDeviceFeedback + { + public Action<string,string> tipAction; + + public void Feedback(string method, string msg) + { + tipAction?.Invoke(method, msg); + } + } + #else public class AddLcCam { @@ -534,4 +450,8 @@ } } #endif + + + + } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs index c58d221..b108f57 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs @@ -521,7 +521,7 @@ { if (!commandDic.ContainsKey(FunctionAttributeKey.Brightness)) { - commandDic.Add(FunctionAttributeKey.Brightness, lightCCT[0].GetAttrState(FunctionAttributeKey.Brightness)); + commandDic.Add(FunctionAttributeKey.Brightness, lightDimming[0].GetAttrState(FunctionAttributeKey.Brightness)); } } -- Gitblit v1.8.0