| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 | using EyeSoft.Runtime.InteropServices;using OASystem.API.Controllers;using OASystem.API.OAMethodLib.Hub.Hubs;using OASystem.Domain.Entities.Groups;using OASystem.Infrastructure.Repositories.Login;namespace OASystem.API.OAMethodLib.APNs{    public static class APNsTools    {        private static readonly DeviceTokenRepository _deviceTokenRep = AutofacIocManager.Instance.GetService<DeviceTokenRepository>();                //private static readonly IAPNsService _APNsService = AutofacIocManager.Instance.GetService<IAPNsService>();        public static async Task<Result> iOS_PushNotifications(string Numbers, string title, string subtitle, string body)        {                        Result rst2 = new Result() { Code = -1, Msg = "" };            try            {                var _APNsService = AutofacIocManager.Instance.GetService<IAPNsService>();            var rst = await _deviceTokenRep.Query(s => s.Number == Numbers).FirstAsync();            //var rst = new Sys_DeviceToken() { DeviceToken = "08be7ba1ee42ecf36f695fd6b795b5e203295eaed0ba3857276141dbeee025ff" }            if (rst != null)            {                rst2 = await _APNsService.PushNotification("com.panamerican.oa2024", rst.DeviceToken, NotificationType.Alert, title, subtitle, body);            }            }            catch (Exception ex)            {            }            return rst2;        }        public static async Task<Result> iOS_PushNotifications1(string Numbers, string title, string subtitle, string body, bool isTarget, string viewCode, PageParam_PriceAuditH5 pageParam)        {            Result rst2 = new Result() { Code = -1, Msg = "" };            try            {                var _APNsService = AutofacIocManager.Instance.GetService<IAPNsService>();                var rst = await _deviceTokenRep.Query(s => s.Number == Numbers).FirstAsync();                //var rst = new Sys_DeviceToken() { DeviceToken = "08be7ba1ee42ecf36f695fd6b795b5e203295eaed0ba3857276141dbeee025ff" }                if (rst != null)                {                    rst2 = await _APNsService.PushNotification1("com.panamerican.oa2024", rst.DeviceToken, NotificationType.Alert, title, subtitle, body, isTarget, viewCode, pageParam);                }            }            catch (Exception ex)            {                rst2.Msg = $"[iOS_PushNotifications1] --> MSG:{ex.Message}";                rst2.Msg = $"[iOS_PushNotifications1] --> InnerException:{ex.InnerException .Message}";            }            return rst2;        }    }}
 |