mirror of
https://github.com/bitwarden/android.git
synced 2024-12-24 18:08:26 +03:00
UNUserNotificationCenterDelegate
This commit is contained in:
parent
6040c7768f
commit
04e42c4a75
2 changed files with 20 additions and 2 deletions
|
@ -21,6 +21,7 @@ using Google.Analytics;
|
|||
using FFImageLoading.Forms.Touch;
|
||||
using SimpleInjector;
|
||||
using XLabs.Ioc.SimpleInjectorContainer;
|
||||
using UserNotifications;
|
||||
|
||||
namespace Bit.iOS
|
||||
{
|
||||
|
@ -36,6 +37,8 @@ namespace Bit.iOS
|
|||
{
|
||||
global::Xamarin.Forms.Forms.Init();
|
||||
|
||||
UNUserNotificationCenter.Current.Delegate = new UserNotificationCenterDelegate();
|
||||
|
||||
if(!Resolver.IsSet)
|
||||
{
|
||||
SetIoc();
|
||||
|
|
|
@ -7,6 +7,7 @@ using System.Collections.Generic;
|
|||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using UIKit;
|
||||
using UserNotifications;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Bit.iOS.Services
|
||||
|
@ -104,6 +105,20 @@ namespace Bit.iOS.Services
|
|||
void OnUnregisteredSuccess();
|
||||
}
|
||||
|
||||
public class UserNotificationCenterDelegate : UNUserNotificationCenterDelegate
|
||||
{
|
||||
public override void WillPresentNotification(UNUserNotificationCenter center,
|
||||
UNNotification notification, Action<UNNotificationPresentationOptions> completionHandler)
|
||||
{
|
||||
Debug.WriteLine("WillPresentNotification: {0}", notification);
|
||||
|
||||
if(CrossPushNotification.Current is IPushNotificationHandler)
|
||||
{
|
||||
//((IPushNotificationHandler)CrossPushNotification.Current).OnMessageReceived();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal class CrossPushNotification
|
||||
{
|
||||
private static Lazy<IPushNotificationService> Implementation = new Lazy<IPushNotificationService>(
|
||||
|
|
Loading…
Reference in a new issue