1234567891011121314151617181920212223242526 |
- using EyeSoft.Runtime.InteropServices;
- 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)
- {
- var _APNsService = AutofacIocManager.Instance.GetService<IAPNsService>();
- var rst = await _deviceTokenRep.Query(s => s.Number == Numbers).FirstAsync();
- //var rst = new Sys_DeviceToken() { DeviceToken = "08be7ba1ee42ecf36f695fd6b795b5e203295eaed0ba3857276141dbeee025ff" };
- Result rst2 = new Result() { Code = -1, Msg = "" };
- if (rst != null)
- {
- rst2 = await _APNsService.PushNotification("com.panamerican.oa2024", rst.DeviceToken, NotificationType.Alert, title, subtitle, body);
- }
- return rst2;
- }
- }
- }
|