1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-10 05:13:31 +00:00

update firebase messaging lib and implementation (#1383)

* update firebase messaging lib and implementation

* update clean-fdroid script for updated firebase
This commit is contained in:
Matt Portune
2021-05-03 13:36:09 -04:00
committed by GitHub
parent c27da8e7c4
commit faa6904ce3
5 changed files with 17 additions and 53 deletions

View File

@@ -1,7 +1,7 @@
#if !FDROID
using Android.App;
using Android.Content;
using Bit.App.Abstractions;
using Bit.Core.Abstractions;
using Bit.Core.Utilities;
using Firebase.Messaging;
using Newtonsoft.Json;
@@ -10,10 +10,19 @@ using Xamarin.Forms;
namespace Bit.Droid.Push
{
[Service]
[Service(Exported=false)]
[IntentFilter(new[] { "com.google.firebase.MESSAGING_EVENT" })]
public class FirebaseMessagingService : Firebase.Messaging.FirebaseMessagingService
{
public async override void OnNewToken(string token)
{
var storageService = ServiceContainer.Resolve<IStorageService>("storageService");
var pushNotificationService = ServiceContainer.Resolve<IPushNotificationService>("pushNotificationService");
await storageService.SaveAsync(Core.Constants.PushRegisteredTokenKey, token);
await pushNotificationService.RegisterAsync();
}
public async override void OnMessageReceived(RemoteMessage message)
{
if (message?.Data == null)