Exemplo n.º 1
0
        public async Task UpdateNotificationSettings(UpdateNotificationSettingsInput input)
        {
            await SettingManager.ChangeSettingForUserAsync(AbpSession.ToUserIdentifier(), NotificationSettingNames.ReceiveNotifications, input.ReceiveNotifications.ToString());

            foreach (var notification in input.Notifications)
            {
                if (notification.IsSubscribed)
                {
                    await _notificationSubscriptionManager.SubscribeAsync(AbpSession.ToUserIdentifier(), notification.Name);
                }
                else
                {
                    await _notificationSubscriptionManager.UnsubscribeAsync(AbpSession.ToUserIdentifier(), notification.Name);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 更新通知设置
        /// </summary>
        public async Task UpdateNotificationSettings(UpdateNotificationSettingsInput input)
        {
            var currentUserId = AbpSession.ToUserIdentifier();

            //是否接收通知
            await SettingManager.ChangeSettingForUserAsync(currentUserId, NotificationSettingNames.ReceiveNotifications, input.ReceiveNotifications.ToString());

            foreach (var notification in input.Notifications)
            {
                if (notification.IsSubscribed)
                {
                    //订阅通知
                    await _notificationSubscriptionManager.SubscribeAsync(currentUserId, notification.Name);
                }
                else
                {
                    //关闭通知订阅
                    await _notificationSubscriptionManager.UnsubscribeAsync(currentUserId, notification.Name);
                }
            }
        }