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(); //private static readonly IAPNsService _APNsService = AutofacIocManager.Instance.GetService(); public static async Task iOS_PushNotifications(string Numbers, string title, string subtitle, string body) { Result rst2 = new Result() { Code = -1, Msg = "" }; try { var _APNsService = AutofacIocManager.Instance.GetService(); 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 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(); 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; } } }