Exemple #1
0
        public async Task SendDataNotificationToAllDevicesAsync(string[] notificationIds, NotificationType type, string entity, string id = "")
        {
            var apnsMessage = new IosNotification
            {
                Aps = new DataNotificationFields
                {
                    Type = type
                }
            };

            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);
        }
Exemple #2
0
        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);
        }