JLChen
2020-06-03 0b616cd842c3066767cc6ea8f709c5fd6e0c2d99
2020-06-03 1.增加极光推送功能。
8个文件已修改
257 ■■■■ 已修改文件
README.md 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SmartHome/ON/Application.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SmartHome/ON/Properties/AndroidManifest.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SmartHome/SmartHome/Net/API.cs 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SmartHome/SmartHome/UI/SimpleControl/MainPage.cs 70 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SmartHome/SmartHome/UI/SimpleControl/Phone/Register/AccountLogin.cs 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SmartHome/SmartHome/UI/SimpleControl/Phone/Register/AccountView.cs 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SmartHome/SmartHome/UI/SimpleControl/Phone/User/UserMiddle.cs 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
README.md
@@ -1,4 +1,8 @@
## ControlIn
极光推送
Key:782f3eae4e52dab57c6dfdcc
Secert:02e1d515612ea44b87952b84
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 (() => {
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">
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>
    /// 提交极光推送ID
    /// </summary>
    public class AddRegIDObj
    {
        public string RegID;
        public string Alias;
        public string Account;
        /// <summary>
        /// 推送APP标识
        /// 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
}
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>
        /// 请求服务器方法
        /// 指定一个Url,和请求方法,数据,Cookie,得到响应的数据
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
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)) {
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)) {
                                        //可视对讲