From 309caa2f83cba9b9feeb11540d1b5a9f398659ce Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 28 May 2019 12:03:41 -0400 Subject: [PATCH] fix ios handler --- src/iOS/Services/iOSPushNotificationHandler.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/iOS/Services/iOSPushNotificationHandler.cs b/src/iOS/Services/iOSPushNotificationHandler.cs index 85345c148..8592e2c0c 100644 --- a/src/iOS/Services/iOSPushNotificationHandler.cs +++ b/src/iOS/Services/iOSPushNotificationHandler.cs @@ -1,4 +1,5 @@ -using Foundation; +using Bit.App.Abstractions; +using Foundation; using Newtonsoft.Json.Linq; using System; using System.Diagnostics; @@ -11,12 +12,12 @@ namespace Bit.iOS.Services private const string TokenSetting = "token"; private const string DomainName = "iOSPushNotificationService"; - private readonly IPushNotificationListener _pushNotificationListener; + private readonly IPushNotificationListenerService _pushNotificationListenerService; public iOSPushNotificationHandler( - IPushNotificationListener pushNotificationListener) + IPushNotificationListenerService pushNotificationListenerService) { - _pushNotificationListener = pushNotificationListener; + _pushNotificationListenerService = pushNotificationListenerService; } public void OnMessageReceived(NSDictionary userInfo) @@ -34,13 +35,13 @@ namespace Bit.iOS.Services } } } - _pushNotificationListener.OnMessage(values, Device.iOS); + _pushNotificationListenerService.OnMessageAsync(values, Device.iOS); } public void OnErrorReceived(NSError error) { Debug.WriteLine("{0} - Registration Failed.", DomainName); - _pushNotificationListener.OnError(error.LocalizedDescription, Device.iOS); + _pushNotificationListenerService.OnError(error.LocalizedDescription, Device.iOS); } public void OnRegisteredSuccess(NSData token) @@ -52,7 +53,7 @@ namespace Bit.iOS.Services trimmedDeviceToken = trimmedDeviceToken.Trim('<').Trim('>').Trim().Replace(" ", string.Empty); } Console.WriteLine("{0} - Token: {1}", DomainName, trimmedDeviceToken); - _pushNotificationListener.OnRegistered(trimmedDeviceToken, Device.iOS); + _pushNotificationListenerService.OnRegisteredAsync(trimmedDeviceToken, Device.iOS); NSUserDefaults.StandardUserDefaults.SetString(trimmedDeviceToken, TokenSetting); NSUserDefaults.StandardUserDefaults.Synchronize(); }