mirror of
https://github.com/bitwarden/mobile
synced 2025-12-12 06:13:21 +00:00
[SG-703] Login request is not removed after dismissing push notification (#2134)
* [SG-703] Added category to iOS notifications in order to be able to receive dismiss actions * [SG-703] PR Fix
This commit is contained in:
@@ -5,6 +5,7 @@ using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.App.Abstractions;
|
||||
using Bit.App.Models;
|
||||
using Bit.App.Resources;
|
||||
using Bit.App.Services;
|
||||
using Bit.Core;
|
||||
using Bit.Core.Services;
|
||||
@@ -84,7 +85,8 @@ namespace Bit.iOS.Services
|
||||
var content = new UNMutableNotificationContent()
|
||||
{
|
||||
Title = title,
|
||||
Body = message
|
||||
Body = message,
|
||||
CategoryIdentifier = Constants.iOSNotificationCategoryId
|
||||
};
|
||||
|
||||
if (data != null)
|
||||
@@ -92,6 +94,10 @@ namespace Bit.iOS.Services
|
||||
content.UserInfo = NSDictionary.FromObjectAndKey(NSData.FromString(JsonConvert.SerializeObject(data), NSStringEncoding.UTF8), new NSString(Constants.NotificationData));
|
||||
}
|
||||
|
||||
var actions = new UNNotificationAction[] { UNNotificationAction.FromIdentifier(Constants.iOSNotificationClearActionId, AppResources.Clear, UNNotificationActionOptions.Foreground) };
|
||||
var category = UNNotificationCategory.FromIdentifier(Constants.iOSNotificationCategoryId, actions, new string[] { }, UNNotificationCategoryOptions.CustomDismissAction);
|
||||
UNUserNotificationCenter.Current.SetNotificationCategories(new NSSet<UNNotificationCategory>(category));
|
||||
|
||||
var request = UNNotificationRequest.FromIdentifier(data.Id, content, null);
|
||||
UNUserNotificationCenter.Current.AddNotificationRequest(request, (err) =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user