public async Task SendAssetsCreditedNotification(string[] notificationsIds, double amount, string assetId, string message) { var apnsMessage = new IosNotification { Aps = new AssetsCreditedFieldsIos { Alert = message, Amount = amount, AssetId = assetId, Type = NotificationType.AssetsCredited } }; var gcmMessage = new AndoridPayloadNotification { Data = new AssetsCreditedFieldsAndroid { Entity = EventsAndEntities.GetEntity(NotificationType.AssetsCredited), Event = EventsAndEntities.GetEvent(NotificationType.AssetsCredited), BalanceItem = new AssetsCreditedFieldsAndroid.BalanceItemModel { AssetId = assetId, Amount = amount, }, Message = message, } }; await SendIosNotificationAsync(notificationsIds, apnsMessage); await SendAndroidNotificationAsync(notificationsIds, gcmMessage); }
public async Task SendLimitOrderNotification(string[] notificationsIds, string message, OrderType orderType, OrderStatus status) { var apnsMessage = new IosNotification { Aps = new LimitOrderFieldsIos() { Alert = message, Type = NotificationType.LimitOrderEvent, OrderStatus = status, OrderType = orderType } }; var gcmMessage = new AndoridPayloadNotification { Data = new AndroidPayloadFields { Entity = EventsAndEntities.GetEntity(NotificationType.LimitOrderEvent), Event = EventsAndEntities.GetEvent(NotificationType.LimitOrderEvent), Message = message, } }; await SendIosNotificationAsync(notificationsIds, apnsMessage); await SendAndroidNotificationAsync(notificationsIds, gcmMessage); }
public async Task SendDataNotificationToAllDevicesAsync(string[] notificationIds, NotificationType type, string entity, string id = "") { var apnsMessage = new IosNotification { Aps = new DataNotificationFields { Type = type, Sound = null } }; var gcmMessage = new AndoridPayloadNotification { Data = new AndroidPayloadFields { Entity = EventsAndEntities.GetEntity(type), Event = EventsAndEntities.GetEvent(type), Id = id } }; await SendIosNotificationAsync(notificationIds, apnsMessage); await SendAndroidNotificationAsync(notificationIds, gcmMessage); }
private async Task SendAndroidNotificationAsync(string notificationsId, NotificationType notificationType, string message, OrderHistoryBackendContract order = null) { var gcmMessage = new AndroidNotification { Data = new AndroidPositionFields { Entity = EventsAndEntities.GetEntity(notificationType), Event = EventsAndEntities.GetEvent(notificationType), Order = order, Message = message } }; var payload = gcmMessage.ToJson(ignoreNulls: true); try { var hub = CustomNotificationHubClient.CreateClientFromConnectionString(_connectionString, _hubName); await hub.SendGcmNativeNotificationAsync(payload, new[] { notificationsId }); } catch (Exception e) { _log.WriteError(nameof(SendAndroidNotificationAsync), payload, e); } }
public async Task SendTextNotificationAsync(string[] notificationIds, NotificationType type, string message) { var apnsMessage = new IosNotification { Aps = new IosFields { Alert = message, Type = type } }; var gcmMessage = new AndoridPayloadNotification { Data = new AndroidPayloadFields { Entity = EventsAndEntities.GetEntity(type), Event = EventsAndEntities.GetEvent(type), Message = message, } }; await SendIosNotificationAsync(notificationIds, apnsMessage); await SendAndroidNotificationAsync(notificationIds, gcmMessage); }
public async Task SendPushTxDialogAsync(string[] notificationsIds, double amount, string assetId, string addressFrom, string addressTo, string message) { var apnsMessage = new IosNotification { Aps = new PushTxDialogFieldsIos { Alert = message, Amount = amount, AssetId = assetId, Type = NotificationType.PushTxDialog, AddressFrom = addressFrom, AddressTo = addressTo } }; var gcmMessage = new AndoridPayloadNotification { Data = new PushTxDialogFieldsAndroid { Entity = EventsAndEntities.GetEntity(NotificationType.PushTxDialog), Event = EventsAndEntities.GetEvent(NotificationType.PushTxDialog), PushTxItem = new PushTxDialogFieldsAndroid.PushDialogTxItemModel { Amount = amount, AssetId = assetId, AddressFrom = addressFrom, AddressTo = addressTo }, Message = message, } }; await SendIosNotificationAsync(notificationsIds, apnsMessage); await SendAndroidNotificationAsync(notificationsIds, gcmMessage); }