From 2202cc1f498434220f010f3806a5030390f616ee Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期四, 15 四月 2021 17:57:39 +0800 Subject: [PATCH] 2021-04-15 1.Alexa相关页面标题修改。2.增加解绑按钮 --- Crabtree/SmartHome/UI/SimpleControl/Phone/User/UserSettingView.cs | 4 + Crabtree/ON/Assets/Language.ini | 6 ++ Crabtree/SmartHome/HDL/Common/CommonUtlis.cs | 6 ++ Crabtree/SmartHome/HDL/Common/HttpUtil/HttpServerRequest.cs | 11 +++ Crabtree/SmartHome/HDL/Common/HttpUtil/NewAPI.cs | 4 + Crabtree/SmartHome/UI/SimpleControl/MainPage.cs | 2 Crabtree/SmartHome/UI/SimpleControl/R.cs | 14 ++++ Crabtree/ON.Ios/Resources/Language.ini | 6 ++ Crabtree/SmartHome/UI/SimpleControl/Phone/Alexa/SmartSpeakertListPage.cs | 71 ++++++++++++++++++++++- Crabtree/SmartHome/UI/SimpleControl/Phone/Alexa/AlexaDeviceListPage.cs | 13 +++ Crabtree/ON/Properties/AndroidManifest.xml | 2 Crabtree/.vs/SmartHome/xs/UserPrefs.xml | 40 +++++++++++-- Crabtree/ON.Ios/ON.Ios.csproj | 1 13 files changed, 163 insertions(+), 17 deletions(-) diff --git a/Crabtree/.vs/SmartHome/xs/UserPrefs.xml b/Crabtree/.vs/SmartHome/xs/UserPrefs.xml index f11805c..240550b 100644 --- a/Crabtree/.vs/SmartHome/xs/UserPrefs.xml +++ b/Crabtree/.vs/SmartHome/xs/UserPrefs.xml @@ -1,17 +1,43 @@ 锘�<Properties StartupConfiguration="{1D83BF28-BA88-4152-BA41-D7EFE90A5437}|Default"> <MonoDevelop.Ide.ItemProperties.ON.Droid PreferredExecutionTarget="Android.Android_Accelerated_Oreo" /> - <MonoDevelop.Ide.Workbench> + <MonoDevelop.Ide.Workbench ActiveDocument="ON.Ios/Resources/Language.ini"> <Files> - <File FileName="SmartHome/UI/SimpleControl/Phone/Schedule/AddSchedule.cs" Line="1167" Column="53" /> - <File FileName="SmartHome/UI/SimpleControl/Phone/Scene/SceneMethod.cs" Line="62" Column="43" /> - <File FileName="SmartHome/UI/SimpleControl/Phone/Scene/UserAddSceneDevice.cs" Line="1850" Column="23" /> - <File FileName="SmartHome/HDL/Operation/Device/FanModule.cs" Line="6" Column="15" /> + <File FileName="SmartHome/UI/SimpleControl/Phone/Alexa/SmartSpeakertListPage.cs" Line="153" Column="48" /> + <File FileName="SmartHome/HDL/Common/HttpUtil/HttpUtil.cs" Line="236" Column="1" /> + <File FileName="SmartHome/HDL/Common/CommonUtlis.cs" Line="264" Column="27" /> + <File FileName="ON/Assets/Language.ini" Line="1114" Column="1" /> + <File FileName="SmartHome/UI/SimpleControl/R.cs" Line="1222" Column="44" /> + <File FileName="ON.Ios/Resources/Language.ini" Line="2230" Column="1" /> </Files> <Pads> <Pad Id="ProjectPad"> <State name="__root__"> <Node name="SmartHome" expanded="True"> - <Node name="ON.Droid" selected="True" /> + <Node name="ON.Droid" expanded="True"> + <Node name="Assets" expanded="True" /> + </Node> + <Node name="ON.Ios" expanded="True"> + <Node name="References" expanded="True" /> + <Node name="Resources" expanded="True"> + <Node name="Language.ini" selected="True" /> + </Node> + </Node> + <Node name="Shared" expanded="True"> + <Node name="HDL" expanded="True"> + <Node name="Common" expanded="True"> + <Node name="HttpUtil" expanded="True" /> + </Node> + </Node> + <Node name="UI" expanded="True"> + <Node name="SimpleControl" expanded="True"> + <Node name="Phone" expanded="True"> + <Node name="Alexa" expanded="True" /> + <Node name="Schedule" expanded="True" /> + <Node name="User" expanded="True" /> + </Node> + </Node> + </Node> + </Node> </Node> </State> </Pad> @@ -25,7 +51,7 @@ <String>IosService/IosService.csproj</String> <String>DroidService/DroidService.csproj</String> </DisabledProjects> - <MonoDevelop.Ide.Workspace ActiveConfiguration="Release|iPhone" /> + <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|iPhone" /> <MonoDevelop.Ide.ItemProperties.ON.Ios automaticSigning="False" PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.00008030-00014C392121802E" /> <MonoDevelop.Ide.DebuggingService.Breakpoints> <BreakpointStore> diff --git a/Crabtree/ON.Ios/ON.Ios.csproj b/Crabtree/ON.Ios/ON.Ios.csproj index 817459d..0e751cb 100644 --- a/Crabtree/ON.Ios/ON.Ios.csproj +++ b/Crabtree/ON.Ios/ON.Ios.csproj @@ -47,7 +47,6 @@ <MtouchExtraArgs>-gcc_flags="-dead_strip -ObjC"</MtouchExtraArgs> <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow> <DeviceSpecificBuild>true</DeviceSpecificBuild> -<CodesignProvision>iOS Team Provisioning Profile: *</CodesignProvision> <NoStdLib>false</NoStdLib> <MtouchUseThumb></MtouchUseThumb> </PropertyGroup> diff --git a/Crabtree/ON.Ios/Resources/Language.ini b/Crabtree/ON.Ios/Resources/Language.ini index 66da5b3..2a3c249 100644 --- a/Crabtree/ON.Ios/Resources/Language.ini +++ b/Crabtree/ON.Ios/Resources/Language.ini @@ -1111,6 +1111,9 @@ 20060=Failed to sync the device and scene data to the cloud! 20061=Do you want to synchronize all local devices and scenes to the cloud? This will be used for schedule and alexa control functions. 20062=Resend +20063=Are you sure to unbind? +20064=Unbind successfully +20065=Please enter content! [Chinese] 1=浣犲ソ @@ -2224,6 +2227,9 @@ 20060=Failed to sync the device and scene data to the cloud! 20061=Do you want to synchronize all local devices and scenes to the cloud? This will be used for schedule and alexa control functions. 20062=Resend +20063=Are you sure to unbind? +20064=Unbind successfully +20065=Please enter content! [Czech] 1=Nazdar diff --git a/Crabtree/ON/Assets/Language.ini b/Crabtree/ON/Assets/Language.ini index e5ca076..64b13cc 100644 --- a/Crabtree/ON/Assets/Language.ini +++ b/Crabtree/ON/Assets/Language.ini @@ -1111,6 +1111,9 @@ 20060=Failed to sync the device and scene data to the cloud! 20061=Do you want to synchronize all local devices and scenes to the cloud? This will be used for schedule and alexa control functions. 20062=Resend +20063=Are you sure to unbind? +20064=Unbind successfully +20065=Please enter content! [Chinese] 1=浣犲ソ @@ -2224,6 +2227,9 @@ 20060=Failed to sync the device and scene data to the cloud! 20061=Do you want to synchronize all local devices and scenes to the cloud? This will be used for schedule and alexa control functions. 20062=Resend +20063=Are you sure to unbind? +20064=Unbind successfully +20065=Please enter content! [Czech] diff --git a/Crabtree/ON/Properties/AndroidManifest.xml b/Crabtree/ON/Properties/AndroidManifest.xml index 1e2f85a..c76bc9c 100644 --- a/Crabtree/ON/Properties/AndroidManifest.xml +++ b/Crabtree/ON/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@ 锘�<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hdl.crabtreenew" android:versionName="2.603291" android:versionCode="202103291"> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hdl.crabtreenew" android:versionName="2.604151" android:versionCode="202104151"> <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="28" /> <!-- 鍦ㄥ畨鍗揚鐗堟湰涔嬪悗锛屽繀椤昏鎺堜簣FOREGROUND_SERVICE鏉冮檺锛屾墠鑳藉浣跨敤鍓嶅彴鏈嶅姟 --> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> diff --git a/Crabtree/SmartHome/HDL/Common/CommonUtlis.cs b/Crabtree/SmartHome/HDL/Common/CommonUtlis.cs index 827f722..50ab6c6 100644 --- a/Crabtree/SmartHome/HDL/Common/CommonUtlis.cs +++ b/Crabtree/SmartHome/HDL/Common/CommonUtlis.cs @@ -261,6 +261,12 @@ btnOption.MouseUpEventHandler += (sdf, fds) => { //淇敼鍚嶇О var newStr = etZoneName.Text.Trim (); + //杈撳叆鍐呭涓嶈兘涓虹┖ + if (string.IsNullOrEmpty (newStr)) { + Utlis.ShowTip (Language.StringByID(SimpleControl.R.MyInternationalizationString.PleaseEnterContent)); + return; + } + if (nameStr != newStr) { saveAction?.Invoke (newStr); } diff --git a/Crabtree/SmartHome/HDL/Common/HttpUtil/HttpServerRequest.cs b/Crabtree/SmartHome/HDL/Common/HttpUtil/HttpServerRequest.cs index a460f6c..0c2f234 100644 --- a/Crabtree/SmartHome/HDL/Common/HttpUtil/HttpServerRequest.cs +++ b/Crabtree/SmartHome/HDL/Common/HttpUtil/HttpServerRequest.cs @@ -915,6 +915,17 @@ } /// <summary> + /// 瑙i櫎闊崇缁戝畾 + /// </summary> + /// <returns></returns> + public ResponsePackNew UnbindSpeaker (string tokenId) + { + Dictionary<string, object> d = new Dictionary<string, object> (); + d.Add ("tokenId", tokenId); + var requestJson = HttpUtil.GetSignRequestJson (d); + return HttpUtil.RequestHttpsPostFroHome (NewAPI.API_POST_Speaker_Unbind, requestJson); + } + /// <summary> /// 鑾峰彇闊崇鍒嗛厤鐨勮澶囧拰鍦烘櫙鍒楄〃 /// </summary> /// <param name="getType">0 鏄煡璇㈠叏閮� 1鏄煡璇㈣澶� 2鏄煡璇㈠満鏅�</param> diff --git a/Crabtree/SmartHome/HDL/Common/HttpUtil/NewAPI.cs b/Crabtree/SmartHome/HDL/Common/HttpUtil/NewAPI.cs index cfa9723..68ba4ea 100644 --- a/Crabtree/SmartHome/HDL/Common/HttpUtil/NewAPI.cs +++ b/Crabtree/SmartHome/HDL/Common/HttpUtil/NewAPI.cs @@ -491,6 +491,10 @@ /// </summary> public const string API_POST_Speaker_Remark_Update = "/smart-footstone/app/token/update"; /// <summary> + /// 瑙g粦闊崇 + /// </summary> + public const string API_POST_Speaker_Unbind = "/smart-footstone/app/token/delete"; + /// <summary> /// 鑾峰彇闊崇鍒嗛厤鐨勮澶囧拰鍦烘櫙鍒楄〃 /// </summary> public const string API_POST_Speaker_DeviceList_Get = "/home-wisdom/app/tokenRelation/list"; diff --git a/Crabtree/SmartHome/UI/SimpleControl/MainPage.cs b/Crabtree/SmartHome/UI/SimpleControl/MainPage.cs index e1ec46e..8bd2e0c 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/MainPage.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/MainPage.cs @@ -38,7 +38,7 @@ //public static Button LogoButton = new Button (); - public static string RequestVersion = "2.603291"; + public static string RequestVersion = "2.604151"; public static UserInfo LoginUser; /// <summary> /// 鏄惁鏄鐞嗗憳鏉冮檺(鍙樻洿浜�,鎴愬憳鐨勬椂鍊�,杩欎釜涔熶负ture銆備负浠�涔堜細澹版槑杩欐牱鍙橀噺,鍥犱负鏈変簺鎺ュ彛蹇呴』浣跨敤鍘熸潵鐨凾oken) diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Alexa/AlexaDeviceListPage.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Alexa/AlexaDeviceListPage.cs index e1ddf4b..c7341bd 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Alexa/AlexaDeviceListPage.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Alexa/AlexaDeviceListPage.cs @@ -50,7 +50,16 @@ { #region ---TopView--- base.ShowPage (); - this.topTitleBtn.Text = "Alexa"; + //this.topTitleBtn.Text = "Alexa"; + + //璁剧疆鏍囬涓洪煶绠卞娉� + if (mAlexa != null) { + if (string.IsNullOrEmpty (mAlexa.remark)) { + this.topTitleBtn.Text = mAlexa.platformName; + } else { + this.topTitleBtn.Text = mAlexa.remark; + } + } //娣诲姞鎸夐挳鐐瑰嚮浜嬩欢 EventHandler<MouseEventArgs> addSubaccountHandler = (sender, e) => { OpenAlexaSettingPage (); @@ -60,7 +69,7 @@ #region 璁惧-鍦烘櫙 var topView = new FrameLayout () { - Height = Application.GetRealHeight (110), + Height = Application.GetRealWidth (110), BackgroundColor = SkinStyle.Current.TitileView, }; BaseContentView.AddChidren (topView); diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Alexa/SmartSpeakertListPage.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Alexa/SmartSpeakertListPage.cs index 9e54f20..1ef5006 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Alexa/SmartSpeakertListPage.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Alexa/SmartSpeakertListPage.cs @@ -21,7 +21,7 @@ { #region ---TopView--- base.ShowPage (); - this.topTitleBtn.Text = "Alexa list"; + this.topTitleBtn.Text = "Smart speaker"; this.topItemButton.RemoveFromParent (); #endregion @@ -140,19 +140,37 @@ #region 閲嶅懡鍚� var btnRename = new Button () { TextID = R.MyInternationalizationString.rename, - BackgroundColor = SkinStyle.Current.DelColor, + BackgroundColor = SkinStyle.Current.TitileView, TextSize = 11, }; //淇濆瓨浜嬩欢 Action<string> renameAction = (newName) => { - RenameAlexaRemark (newName, speakerInfo, btnName); + RenameAlexaRemark (newName, speakerInfo, btnName, rowView); }; btnRename.MouseUpEventHandler += (sender, e) => { CommonUtlis.Current.ShowEditTextDialog (speakerInfo.remark, renameAction, Language.StringByID (R.MyInternationalizationString.rename)); }; rowView.AddRightView (btnRename); + #endregion + + #region 鍒犻櫎 + var btnDelete = new Button () { + TextID = R.MyInternationalizationString.Delete, + BackgroundColor = SkinStyle.Current.DelColor, + TextSize = 11, + }; + + //鍒犻櫎浜嬩欢 + Action deleteAction = () => { + UnbindSpeaker (speakerInfo, rowView); + }; + + btnDelete.MouseUpEventHandler += (sender, e) => { + CommonUtlis.Current.ShowActionAlert (Language.StringByID (R.MyInternationalizationString.DoYouWantToUnbind), deleteAction); + }; + rowView.AddRightView (btnDelete); #endregion } @@ -163,7 +181,7 @@ /// <param name="newName"></param> /// <param name="speakerInfo"></param> /// <param name="btnName"></param> - void RenameAlexaRemark (string newName, SpeakerInfo speakerInfo, Button btnName) + void RenameAlexaRemark (string newName, SpeakerInfo speakerInfo, Button btnName, RowLayout rowView) { MainPage.Loading.Start (Language.StringByID (R.MyInternationalizationString.load)); @@ -181,6 +199,7 @@ Application.RunOnMainThread (() => { speakerInfo.remark = newName; btnName.Text = newName; + rowView.HideRightMenu (); Utlis.ShowAlertOnMainThread (Language.StringByID (R.MyInternationalizationString.AmendTheSuccess)); }); @@ -220,5 +239,49 @@ UserMiddle.SettingPageView.PageIndex = UserMiddle.SettingPageView.ChildrenCount - 1; } + /// <summary> + /// 璇锋眰瑙g粦闊崇 + /// </summary> + /// <param name="speakerInfo">闊崇鍙傛暟</param> + /// <param name="rowView">闊崇rowView</param> + void UnbindSpeaker (SpeakerInfo speakerInfo, RowLayout rowView) + { + if (speakerInfo == null || string.IsNullOrEmpty (speakerInfo.tokenId)) { + + Utlis.ShowTip (Language.StringByID (R.MyInternationalizationString.RequestFailedParameterException) + "(-3)"); + } + + MainPage.Loading.Start (Language.StringByID (R.MyInternationalizationString.load)); + + System.Threading.Tasks.Task.Run (() => { + try { + var revertObj = HttpServerRequest.Current.UnbindSpeaker (speakerInfo.tokenId); + if (revertObj.Code == StateCode.SUCCESS) { + //瑙g粦鎴愬姛 + Application.RunOnMainThread (() => { + //rowView + if (rowView != null) { + rowView.RemoveFromParent (); + } + + //鎻愮ず瑙g粦鎴愬姛 + Utlis.ShowTip (Language.StringByID (R.MyInternationalizationString.UnbindSuccessfully)); + + }); + } else { + //鎻愮ず閿欒 + IMessageCommon.Current.ShowErrorInfoAlter (revertObj.Code); + } + } catch { + + } finally { + Application.RunOnMainThread (() => { + MainPage.Loading.Hide (); + }); + } + }); + + } + } } diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/User/UserSettingView.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/User/UserSettingView.cs index d0d46eb..6046a51 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/Phone/User/UserSettingView.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/User/UserSettingView.cs @@ -360,6 +360,7 @@ }; CommonUtlis.Current.ShowActionAlert (Language.StringByID (R.MyInternationalizationString.DoYouWantToSynchronizeToTheCloud), okAction); + }; SyncDeviceView.MouseUpEventHandler += SyncDeviceEventHandler; btnSyncDeviceIcon.MouseUpEventHandler += SyncDeviceEventHandler; @@ -424,10 +425,11 @@ }; AlexaView.AddChidren (btnAlexaIcon); + //鏅鸿兘闊崇 Button btnAlexaTitle = new Button () { X = Application.GetRealWidth (125), TextAlignment = TextAlignment.CenterLeft, - Text = "Alexa Integration", + Text = "Smart speaker", TextColor = SkinStyle.Current.TextColor1, }; AlexaView.AddChidren (btnAlexaTitle); diff --git a/Crabtree/SmartHome/UI/SimpleControl/R.cs b/Crabtree/SmartHome/UI/SimpleControl/R.cs index df420a9..67b1f81 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/R.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/R.cs @@ -1208,6 +1208,20 @@ /// Resend /// </summary> public const int Resend = 20062; + /// <summary> + /// DoYouWantToUnbind + /// </summary> + public const int DoYouWantToUnbind = 20063; + /// <summary> + /// Unbind successfully + /// </summary> + public const int UnbindSuccessfully = 20064; + /// <summary> + /// Please enter content + /// </summary> + public const int PleaseEnterContent = 20065; + + #endregion } } \ No newline at end of file -- Gitblit v1.8.0