From 0b616cd842c3066767cc6ea8f709c5fd6e0c2d99 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期三, 03 六月 2020 10:10:28 +0800
Subject: [PATCH] 2020-06-03 1.增加极光推送功能。

---
 SmartHome/SmartHome/Net/API.cs                                      |   84 ++++++++++++++++
 SmartHome/ON/Application.cs                                         |    3 
 SmartHome/SmartHome/UI/SimpleControl/Phone/Register/AccountLogin.cs |   29 ++++-
 SmartHome/ON/Properties/AndroidManifest.xml                         |    4 
 SmartHome/SmartHome/UI/SimpleControl/Phone/Register/AccountView.cs  |   42 ++++++--
 SmartHome/SmartHome/UI/SimpleControl/MainPage.cs                    |   70 ++++++++++---
 SmartHome/SmartHome/UI/SimpleControl/Phone/User/UserMiddle.cs       |   21 +++-
 README.md                                                           |    4 
 8 files changed, 211 insertions(+), 46 deletions(-)

diff --git a/README.md b/README.md
index c7909d7..889de31 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,8 @@
 ## ControlIn
 
+鏋佸厜鎺ㄩ��
+Key锛�782f3eae4e52dab57c6dfdcc
+Secert锛�02e1d515612ea44b87952b84
+
 
 
diff --git a/SmartHome/ON/Application.cs b/SmartHome/ON/Application.cs
index 9600210..8b1230b 100644
--- a/SmartHome/ON/Application.cs
+++ b/SmartHome/ON/Application.cs
@@ -178,7 +178,8 @@
             //璁剧疆鏋佸厜璋冭瘯妯″紡锛屼负false鏃跺彧鎵撳嵃璀﹀憡淇℃伅
             JPushInterface.SetDebugMode (false);
             JPushInterface.Init (this);//淇濆瓨鎵嬫満鍚嶇О鍒版湰鍦版枃浠�
-            //鑾峰彇缁忕含搴� 
+            //鑾峰彇缁忕含搴�
+            MainPage.AirQuality = new AirQuality ();
             Shared.Application.LocationAction = (arg1, arg2) => {
                 Shared.Application.LocationAction = null;
                 System.Threading.Tasks.Task.Run (() => {
diff --git a/SmartHome/ON/Properties/AndroidManifest.xml b/SmartHome/ON/Properties/AndroidManifest.xml
index a51dbce..8889cd5 100644
--- a/SmartHome/ON/Properties/AndroidManifest.xml
+++ b/SmartHome/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" android:versionCode="2020052801" android:versionName="2.505281" package="com.hdl.in">
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="2020060101" android:versionName="2.506011" package="com.hdl.in">
 	<uses-sdk android:minSdkVersion="23" android:targetSdkVersion="26" />
 	<!--Ezviz 鏉冮檺 -->
 	<uses-permission android:name="android.permission.FLASHLIGHT" />
@@ -252,7 +252,7 @@
 		<activity android:name="cn.jpush.android.ui.PopWinActivity" android:exported="false" />
 		<receiver android:name="cn.jpush.android.service.AlarmReceiver" android:exported="false" />
 		<meta-data android:name="JPUSH_CHANNEL" android:value="developer-default" />
-		<meta-data android:name="JPUSH_APPKEY" android:value="bcb35a1721fb9edfe9756329" />
+		<meta-data android:name="JPUSH_APPKEY" android:value="782f3eae4e52dab57c6dfdcc" />
 		<!-- 鏋佸厜 -->
 		<!-- 鑷姩鏇存柊 -->
 		<provider android:name="android.support.v4.content.FileProvider" android:authorities="com.hdl.in.fileProvider" android:grantUriPermissions="true" android:exported="false">
diff --git a/SmartHome/SmartHome/Net/API.cs b/SmartHome/SmartHome/Net/API.cs
index fc4683f..57e73b1 100644
--- a/SmartHome/SmartHome/Net/API.cs
+++ b/SmartHome/SmartHome/Net/API.cs
@@ -135,6 +135,90 @@
 
 
 
+    public class FindCityObj
+    {
+        /// <summary>
+        /// 鍩庡競ID
+        /// </summary>
+        public string Cid;
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string Location;
+
+        /// <summary>
+        /// 鍩庡競
+        /// </summary>
+        public string City;
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string Province;
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string Country;
+
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string TimeZone;
+    }
+
+    public class GetWeatherObj
+    {
+
+
+        public string Temperature;
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string Humidity;
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string PM25;
+        /// <summary>
+        /// 
+        /// </summary>
+        public string Weather;
+
+    }
+
+    /// <summary>
+    /// 鎻愪氦鏋佸厜鎺ㄩ�両D
+    /// </summary>
+    public class AddRegIDObj
+    {
+        public string RegID;
+        public string Alias;
+        public string Account;
+        /// <summary>
+        /// 鎺ㄩ�丄PP鏍囪瘑
+        /// 0 HDL ON
+        /// 1 ZigBee
+        /// 2 Control In
+        /// </summary>
+        public int UserMode;
+
+    }
+
+    /// <summary>
+    /// 鎻愪氦鍒锋柊缃戝叧杩滅▼杩炴帴瀵嗙爜
+    /// </summary>
+    public class UpdateRemoteSwitchPasswordObj
+    {
+        public string Token;
+        public string MAC;
+        public string Password;
+
+    }
 
     #endregion
 }
\ No newline at end of file
diff --git a/SmartHome/SmartHome/UI/SimpleControl/MainPage.cs b/SmartHome/SmartHome/UI/SimpleControl/MainPage.cs
index 9b0d536..9a84137 100644
--- a/SmartHome/SmartHome/UI/SimpleControl/MainPage.cs
+++ b/SmartHome/SmartHome/UI/SimpleControl/MainPage.cs
@@ -48,9 +48,9 @@
         public static string sendTime = "";
         public static string recTime = "";
 #if wallon
-        public static string CodeIDString = "202005281";
+        public static string CodeIDString = "202006011";
 #else
-        public static string CodeIDString = "2.505281";
+        public static string CodeIDString = "2.506011";
 #endif
         public static UserInfo LoginUser;
         public static string RequestSource = "1"; //0:Zigbee銆�1:HdlOn銆�2:GraphicsMonitor銆�3:BusproSoft銆�4:AgentWeb
@@ -146,34 +146,70 @@
             }
         }
 
-        static Button btnTipMsg = new Button () {
-            Height = Application.GetRealHeight (126), BackgroundColor = SkinStyle.Current.AddTipButtonColor,
-            Y = Application.GetRealHeight(30),
-            TextAlignment = TextAlignment.Center,
-        };
+        static Button btnTipMsg;
 
         public static void AddTip (string tip, int time = 3000)
         {
+
             if (MainFrameLayout == null) {
                 return;
             }
             Application.RunOnMainThread (() => {
-                btnTipMsg.Text = tip;
-                MainFrameLayout.AddChidren (btnTipMsg);
-                btnTipMsg.MouseUpEventHandler += (sender, e) => {
-                    if (btnTipMsg.Parent != null)
-                        btnTipMsg.RemoveFromParent ();
-                };
-                System.Threading.Tasks.Task.Run (() => {
-                    System.Threading.Thread.Sleep (time);
-                    Application.RunOnMainThread (() => {
+                try {
+                    if (btnTipMsg == null) {
+                        btnTipMsg = new Button () {
+                            Height = Application.GetRealHeight (90),
+                            BackgroundColor = SkinStyle.Current.AddTipButtonColor,
+                            Y = Application.GetRealHeight (36),
+                            TextAlignment = TextAlignment.Center,
+                        };
+                    }
+
+                    btnTipMsg.Text = tip;
+                    MainFrameLayout.AddChidren (btnTipMsg);
+                    btnTipMsg.MouseUpEventHandler += (sender, e) => {
                         if (btnTipMsg.Parent != null)
                             btnTipMsg.RemoveFromParent ();
+                    };
+                    System.Threading.Tasks.Task.Run (() => {
+                        System.Threading.Thread.Sleep (time);
+                        Application.RunOnMainThread (() => {
+                            if (btnTipMsg.Parent != null)
+                                btnTipMsg.RemoveFromParent ();
+                        });
                     });
-                });
+                } catch { }
             });
         }
 
+        //static Button btnTipMsg = new Button () {
+        //    Height = Application.GetRealHeight (126), BackgroundColor = SkinStyle.Current.AddTipButtonColor,
+        //    Y = Application.GetRealHeight(30),
+        //    TextAlignment = TextAlignment.Center,
+        //};
+
+        //public static void AddTip (string tip, int time = 3000)
+        //{
+        //    if (MainFrameLayout == null) {
+        //        return;
+        //    }
+        //    Application.RunOnMainThread (() => {
+        //        btnTipMsg.Text = tip;
+        //        MainFrameLayout.AddChidren (btnTipMsg);
+        //        btnTipMsg.MouseUpEventHandler += (sender, e) => {
+        //            if (btnTipMsg.Parent != null)
+        //                btnTipMsg.RemoveFromParent ();
+        //        };
+        //        System.Threading.Tasks.Task.Run (() => {
+        //            System.Threading.Thread.Sleep (time);
+        //            Application.RunOnMainThread (() => {
+        //                if (btnTipMsg.Parent != null)
+        //                    btnTipMsg.RemoveFromParent ();
+        //            });
+        //        });
+        //    });
+        //}
+
         /// <summary>
         /// 璇锋眰鏈嶅姟鍣ㄦ柟娉�
         /// 鎸囧畾涓�涓猆rl,鍜岃姹傛柟娉曪紝鏁版嵁锛孋ookie锛屽緱鍒板搷搴旂殑鏁版嵁
diff --git a/SmartHome/SmartHome/UI/SimpleControl/Phone/Register/AccountLogin.cs b/SmartHome/SmartHome/UI/SimpleControl/Phone/Register/AccountLogin.cs
index 46b42ab..2191c74 100644
--- a/SmartHome/SmartHome/UI/SimpleControl/Phone/Register/AccountLogin.cs
+++ b/SmartHome/SmartHome/UI/SimpleControl/Phone/Register/AccountLogin.cs
@@ -71,7 +71,8 @@
                 Text = account,
             };
 #if DEBUG
-            etAccount.Text = "751083166@qq.com";
+            etAccount.Text = "2791308028@qq.com";
+            //etAccount.Text = "751083166@qq.com";
             //etAccount.Text = "18520468203";
             //etAccount.Text = "13585007789-debug";
             //etAccount.Text = "balina3ban72-debug@gmail.com";
@@ -111,7 +112,7 @@
                 Text = password,
             };
 #if DEBUG
-            etPasswrod.Text = "85521566";
+            etPasswrod.Text = "123456";
 #endif
             passwrodView.AddChidren (etPasswrod);
 
@@ -278,13 +279,25 @@
                                string DeviceType = "android";
 #if __IOS__
                                DeviceType = "iphone";
+
+
 #endif
-                               string jsonString = "{" +
-                                                      "\"RegID\":" + "\"" + UserConfig.Instance.tokenID + "\"" + "," +
-                                                      "\"Alias\":" + "\"" + UserConfig.Instance.phoneName + "\"" + "," +
-                                                      "\"Account\":" + "\"" + account + "\"" +
-                                                      "}";
-                               MainPage.RequestHttps (@"AddRegID", jsonString, true);
+                               var mAddRegIDObj = new AddRegIDObj () {
+                                   RegID = UserConfig.Instance.tokenID,
+                                   Alias = UserConfig.Instance.phoneName,
+                                   Account = account,
+                                   UserMode = 2,
+                               };
+                               var mAddRegIDObjJson = Newtonsoft.Json.JsonConvert.SerializeObject (mAddRegIDObj);
+                               MainPage.RequestHttps (@"AddRegID", mAddRegIDObjJson, true, false);
+
+
+                               //string jsonString = "{" +
+                               //                       "\"RegID\":" + "\"" + UserConfig.Instance.tokenID + "\"" + "," +
+                               //                       "\"Alias\":" + "\"" + UserConfig.Instance.phoneName + "\"" + "," +
+                               //                       "\"Account\":" + "\"" + account + "\"" +
+                               //                       "}";
+                               //MainPage.RequestHttps (@"AddRegID", jsonString, true);
 
 #if wallon
 #else
diff --git a/SmartHome/SmartHome/UI/SimpleControl/Phone/Register/AccountView.cs b/SmartHome/SmartHome/UI/SimpleControl/Phone/Register/AccountView.cs
index 434a3b6..7ef2e37 100644
--- a/SmartHome/SmartHome/UI/SimpleControl/Phone/Register/AccountView.cs
+++ b/SmartHome/SmartHome/UI/SimpleControl/Phone/Register/AccountView.cs
@@ -252,12 +252,21 @@
 #if __IOS__
                                                 DeviceType = "iphone";
 #endif
-                                                string jsonString = "{" +
-                                                      "\"RegID\":" + "\"" + UserConfig.Instance.tokenID + "\"" + "," +
-                                                      "\"Alias\":" + "\"" + UserConfig.Instance.phoneName + "\"" + "," +
-                                                      "\"Account\":" + "\"" + account + "\"" +
-                                                                       "}";
-                                                MainPage.RequestHttps (@"AddRegID", jsonString, true);
+                                                var mAddRegIDObj = new AddRegIDObj () {
+                                                    RegID = UserConfig.Instance.tokenID,
+                                                    Alias = UserConfig.Instance.phoneName,
+                                                    Account = account,
+                                                    UserMode = 2,
+                                                };
+                                                var mAddRegIDObjJson = Newtonsoft.Json.JsonConvert.SerializeObject (mAddRegIDObj);
+                                                MainPage.RequestHttps (@"AddRegID", mAddRegIDObjJson, true, false);
+
+                                                //string jsonString = "{" +
+                                                //      "\"RegID\":" + "\"" + UserConfig.Instance.tokenID + "\"" + "," +
+                                                //      "\"Alias\":" + "\"" + UserConfig.Instance.phoneName + "\"" + "," +
+                                                //      "\"Account\":" + "\"" + account + "\"" +
+                                                //                       "}";
+                                                //MainPage.RequestHttps (@"AddRegID", jsonString, true);
 #if wallon
 #else
                                                 if (!string.IsNullOrEmpty (MainPage.LoginUser.AllVisionRegisterDevUserNameGuid)) {
@@ -1391,12 +1400,21 @@
 #if __IOS__
                                 DeviceType = "iphone";
 #endif
-                                string jsonString = "{" +
-                                                      "\"RegID\":" + "\"" + UserConfig.Instance.tokenID + "\"" + "," +
-                                                      "\"Alias\":" + "\"" + UserConfig.Instance.phoneName + "\"" + "," +
-                                                      "\"Account\":" + "\"" + account + "\"" +
-                                                       "}";
-                                MainPage.RequestHttps (@"AddRegID", jsonString, true);
+                                var mAddRegIDObj = new AddRegIDObj () {
+                                    RegID = UserConfig.Instance.tokenID,
+                                    Alias = UserConfig.Instance.phoneName,
+                                    Account = account,
+                                    UserMode = 2,
+                                };
+                                var mAddRegIDObjJson = Newtonsoft.Json.JsonConvert.SerializeObject (mAddRegIDObj);
+                                MainPage.RequestHttps (@"AddRegID", mAddRegIDObjJson, true, false);
+
+                                //string jsonString = "{" +
+                                //                      "\"RegID\":" + "\"" + UserConfig.Instance.tokenID + "\"" + "," +
+                                //                      "\"Alias\":" + "\"" + UserConfig.Instance.phoneName + "\"" + "," +
+                                //                      "\"Account\":" + "\"" + account + "\"" +
+                                //                       "}";
+                                //MainPage.RequestHttps (@"AddRegID", jsonString, true);
 #if wallon
 #else
                                 if (!string.IsNullOrEmpty (MainPage.LoginUser.AllVisionRegisterDevUserNameGuid)) {
diff --git a/SmartHome/SmartHome/UI/SimpleControl/Phone/User/UserMiddle.cs b/SmartHome/SmartHome/UI/SimpleControl/Phone/User/UserMiddle.cs
index eab1e71..0e341ab 100644
--- a/SmartHome/SmartHome/UI/SimpleControl/Phone/User/UserMiddle.cs
+++ b/SmartHome/SmartHome/UI/SimpleControl/Phone/User/UserMiddle.cs
@@ -228,12 +228,21 @@
 #if __IOS__
                                     DeviceType = "iphone";
 #endif
-                                    string jsonString = "{" +
-                                                      "\"RegID\":" + "\"" + UserConfig.Instance.tokenID + "\"" + "," +
-                                                      "\"Alias\":" + "\"" + UserConfig.Instance.phoneName + "\"" + "," +
-                                                      "\"Account\":" + "\"" + MainPage.LoginUser.AccountString + "\"" +
-                                                           "}";
-                                    MainPage.RequestHttps (@"AddRegID", jsonString, true);
+                                    var mAddRegIDObj = new AddRegIDObj () {
+                                        RegID = UserConfig.Instance.tokenID,
+                                        Alias = UserConfig.Instance.phoneName,
+                                        Account = MainPage.LoginUser.AccountString,
+                                        UserMode = 2,
+                                    };
+                                    var mAddRegIDObjJson = Newtonsoft.Json.JsonConvert.SerializeObject (mAddRegIDObj);
+                                    MainPage.RequestHttps (@"AddRegID", mAddRegIDObjJson, true, false);
+
+                                    //string jsonString = "{" +
+                                    //                  "\"RegID\":" + "\"" + UserConfig.Instance.tokenID + "\"" + "," +
+                                    //                  "\"Alias\":" + "\"" + UserConfig.Instance.phoneName + "\"" + "," +
+                                    //                  "\"Account\":" + "\"" + MainPage.LoginUser.AccountString + "\"" +
+                                    //                       "}";
+                                    //MainPage.RequestHttps (@"AddRegID", jsonString, true);
 
                                     if (!string.IsNullOrEmpty (MainPage.LoginUser.AllVisionRegisterDevUserNameGuid)) {
                                         //鍙瀵硅

--
Gitblit v1.8.0