From 23bbed132eea46eef51c6d01c21b346238e29ee2 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 30 六月 2022 13:39:12 +0800
Subject: [PATCH] Merge branch 'wxr0114' into V1.5.9

---
 HDL-ON_Android/Other/JPush/JPushReceiver.cs |  153 +++++++++-----------------------------------------
 1 files changed, 28 insertions(+), 125 deletions(-)

diff --git a/HDL-ON_Android/Other/JPush/JPushReceiver.cs b/HDL-ON_Android/Other/JPush/JPushReceiver.cs
index 3b0cf2b..b41aec6 100644
--- a/HDL-ON_Android/Other/JPush/JPushReceiver.cs
+++ b/HDL-ON_Android/Other/JPush/JPushReceiver.cs
@@ -37,13 +37,8 @@
             //2020-12-23 瑙e喅鐐瑰嚮閫氱煡鏍忔墦寮�涓嶄簡APP闂
             //base.OnNotifyMessageOpened(context, notificationMessage);
 
-            //NotificationManager NotifyManager = (NotificationManager)GetSystemService(Context.NotificationService);
-            //NotificationManager notificationManager = NotifyManager;
-
             OpenNotification(context, notificationMessage);
         }
-
-       static int msgId = 0;
 
         /// <summary>
         /// 鏀跺埌閫氱煡鍥炶皟
@@ -52,59 +47,34 @@
         /// <param name="p1"></param>
         public override void OnNotifyMessageArrived(Context context, NotificationMessage notificationMessage)
         {
-            try
+            base.OnNotifyMessageArrived(context, notificationMessage);
+
+            var pushMes = new JPushMessageInfo()
             {
+                Title = notificationMessage.NotificationTitle,
+                Content = notificationMessage.NotificationContent,
+                Extras = notificationMessage.NotificationExtras
+            };
 
-                NotificationManager nMgr = (NotificationManager)Shared.Application.Activity.GetSystemService(Context.NotificationService);
-                if (msgId != 0)
-                    nMgr.Cancel(msgId);
-                msgId = notificationMessage.NotificationId;
-                base.OnNotifyMessageArrived(context, notificationMessage); Console.WriteLine("123456789ghjsdjfasdfk");
-
-                var pushMes = new JPushMessageInfo()
-                {
-                    Title = notificationMessage.NotificationTitle,
-                    Content = notificationMessage.NotificationContent,
-                    Extras = notificationMessage.NotificationExtras
-                };
-
-                var jpushExpandData = GetJPushExpandData(pushMes);
-                if (jpushExpandData != null && jpushExpandData.messageType != null)
-                {
-                    pushMes.messageType = jpushExpandData.messageType;
-                    pushMes.expantContent = jpushExpandData.expantContent;//spk
-                    pushMes.HomeId = jpushExpandData.homeId;
-                    Utlis.WriteLine("PushMes messageType : " + pushMes.messageType);
-                }
-
-                Utlis.WriteLine("PushMes title : " + pushMes.Title);
-                Utlis.WriteLine("PushMes message : " + pushMes.Content);
-                Utlis.WriteLine("PushMes extras : " + pushMes.Extras);
-                Utlis.WriteLine("PushMes HomeId : " + pushMes.HomeId);
-
-                //UserInfo.Current.PushMesTitle = pushMes.Title;
-                //UserInfo.Current.PushMesMessage = pushMes.Content;
-                //UserInfo.Current.PushMesExtras = pushMes.Extras;
-                //UserInfo.Current.pushMesMessageType = pushMes.messageType;
-                //UserInfo.Current.pushMesExpantContent = pushMes.expantContent;
-                //UserInfo.Current.PushMesHomeId = pushMes.HomeId;
-                UserInfo.Current.pushMessageInfo = pushMes;
-                if (!string.IsNullOrEmpty(pushMes.spk))//鑷爺鍙瀵硅闇�瑕佽褰曟椂闂村弽鍛�
-                    UserInfo.Current.inCall = DateTime.Now;
-
-                if (!MainPage.IsEnterBackground)
-                {
-                    //NotificationManager nMgr = (NotificationManager)Shared.Application.Activity.GetSystemService(Context.NotificationService);
-                    //nMgr.CancelAll();
-                    Shared.Application.RunOnMainThread(() =>
-                    {
-                        HDLCommon.Current.AdjustPushMessage(pushMes);
-                    });
-                }
+            var jpushExpandData = GetJPushExpandData(pushMes);
+            if (jpushExpandData != null && jpushExpandData.messageType != null)
+            {
+                pushMes.messageType = jpushExpandData.messageType;
+                pushMes.expantContent = jpushExpandData.expantContent;
+                pushMes.HomeId = jpushExpandData.homeId;
+                Utlis.WriteLine("PushMes messageType : " + pushMes.messageType);
             }
-            catch (Exception wexx) {
-                Console.WriteLine("safsdf"+wexx.Message);
-            }
+
+            Utlis.WriteLine("PushMes title : " + pushMes.Title);
+            Utlis.WriteLine("PushMes message : " + pushMes.Content);
+            Utlis.WriteLine("PushMes extras : " + pushMes.Extras);
+            Utlis.WriteLine("PushMes HomeId : " + pushMes.HomeId);
+
+            Shared.Application.RunOnMainThread(() =>
+            {
+                HDLCommon.Current.AdjustPushMessage(pushMes);
+            });
+
         }
 
         /// <summary>
@@ -141,42 +111,6 @@
             Utlis.WriteLine("JPushOnRegister: " + p1);
         }
 
-        ///// <summary>
-        ///// 澶勭悊鏋佸厜淇℃伅鎺ㄩ��
-        ///// </summary>
-        ///// <param name="title">鏍囬</param>
-        ///// <param name="message">淇℃伅</param>
-        ///// <param name="extras">璐熻浇鏁版嵁</param>
-        //public void AdjustJiguangMsgPush(JPushMessageInfo JPushMessageInfo)
-        //{
-        //    try
-        //    {
-        //        if (JPushMessageInfo.Extras.Contains("Offline") == true)
-        //        {
-        //            Shared.Application.RunOnMainThread(() =>
-        //            {
-        //                //璐﹀彿鍦ㄥ埆澶勭櫥闄嗭紝琚涪涓嬬嚎 璺宠浆鍒扮櫥褰曢〉闈�
-        //                new Alert(Language.StringByID(StringId.Tip), Language.StringByID(StringId.LoggedOnOtherDevices), Language.StringByID(StringId.Close)).Show();
-        //                //2020-12-04 寰呭鍔犻��鍑虹櫥褰曟搷浣�
-        //            });
-        //            return;
-        //        }
-        //        else
-        //        {
-        //            Shared.Application.RunOnMainThread(() =>
-        //            {
-        //                new Alert(JPushMessageInfo.Title, JPushMessageInfo.Content, Language.StringByID(StringId.Close)).Show();
-        //            });
-        //            return;
-
-        //        }
-        //    }
-        //    catch
-        //    {
-
-        //    }
-        //}
-
         /// <summary>
         /// 鎵撳紑娑堟伅鏄剧ず鐣岄潰.010000
         /// </summary>
@@ -184,7 +118,6 @@
         /// <param name="notificationMessage"></param>
         public static void OpenNotification(Context context, NotificationMessage notificationMessage)
         {
-
             try
             {
                 var pushMes = new JPushMessageInfo()
@@ -208,47 +141,17 @@
                 Utlis.WriteLine("PushMes extras : " + pushMes.Extras);
                 Utlis.WriteLine("PushMes HomeId : " + pushMes.HomeId);
 
-
                 Intent i = new Intent(context, typeof(BaseActivity));//Intent intent=new Intent( 璧峰缁勪欢瀵硅薄 , 鐩爣 Service.class);
                 i.SetFlags(ActivityFlags.NewTask);
-                context.StartActivity(i);
+                context.StartActivity(i);
                 //瑙f瀽msg
-                AdjustPushMessage(pushMes);
-
-                //Shared.Application.RunOnMainThread(() =>
-                //{
-                //    if (Shared.Application.Activity == null)
-                //    {
-                //        var tempIntent = new Intent(context, typeof(Shared.BaseActivity));//Intent intent=new Intent( 璧峰缁勪欢瀵硅薄 , 鐩爣 Service.class);
-                //        tempIntent.SetFlags(ActivityFlags.BroughtToFront);
-                //        context.StartActivity(tempIntent);
-
-                //        HDLCommon.Current.AdjustPushMessage(pushMes);
-                //    }
-                //    else
-                //    {
-
-                //        (Shared.Application.Activity as BaseActivity).MoveToFront();
-                //        HDLCommon.Current.AdjustPushMessage(pushMes);
-                //    }
-                //});
-                if (!MainPage.IsEnterBackground)
-                {
-                    NotificationManager nMgr = (NotificationManager)Shared.Application.Activity.GetSystemService(Context.NotificationService);
-                    nMgr.CancelAll();
-                }
+                AdjustPushMessage(pushMes);
             }
             catch
             {
 
             }
-            //catch (Exception ex)
-            //{
-            //    Utlis.WriteLine(ex.ToString());
-            //}
         }
-
-
 
         public static void AdjustPushMessage(JPushMessageInfo pushMes)
         {
@@ -257,7 +160,7 @@
             {
                 while (MainPage.BasePageView == null)
                 {
-                    System.Threading.Thread.Sleep(300);
+                    System.Threading.Thread.Sleep(300);
                 }
                 Shared.Application.RunOnMainThread(() =>
                 {

--
Gitblit v1.8.0