Esempio n. 1
0
        public async Task CreateOrUpdateSubscriptionAsync(PushDeviceRequest request)
        {
            Ensure.That(request, nameof(request)).IsNotNull();

            await CheckUserProfile(request.UserId);

            var tags = new List <string> {
                TagHelper.GetUserTag(request.UserId)
            };
            await _pushSubscriber.CreateOrUpdatePushSubscriptionAsync(new PushSubscriptionRequest(request.DeviceToken, (PushPlatformEnum)request.Platform, tags));
        }
Esempio n. 2
0
        public async Task CreateOrUpdatePushSubscriptionAsync(CreatePushTokenRequest request)
        {
            Ensure.That(request, nameof(request)).IsNotNull();

            var member = await _memberService.GetMemberBySaasUserIdAsync(request.SaasUserId);

            var subscribedChannels = await _channelService.GetAllowedChannelsAsync(request.SaasUserId);

            var tags = new List <string> {
                PushNotificationsTagTemplates.GetMemberSubscriptionTag(member.SaasUserId)
            };

            // add user subscribed channels tags
            tags.AddRange(subscribedChannels.Select(x => PushNotificationsTagTemplates.GetChatChannelTag(x.Id.ToString())));

            await _pushNotificationSubscriber.CreateOrUpdatePushSubscriptionAsync(new PushSubscriptionRequest(request.Token, request.DevicePlatform, tags));
        }