diff --git a/android/app/build.gradle b/android/app/build.gradle
index 7aef609b..3727217d 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -113,11 +113,11 @@ flutter {
}
dependencies {
- implementation 'com.google.crypto.tink:apps-webpush:1.3.0-rc1'
- implementation 'com.google.firebase:firebase-core:17.2.1'
+ implementation 'com.google.crypto.tink:apps-webpush:1.3.0'
+ implementation 'com.google.firebase:firebase-messaging:20.1.6'
implementation 'org.bouncycastle:bcprov-jdk16:1.46'
- testImplementation 'junit:junit:4.12'
+ testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 674c37b7..4f93f086 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -16,15 +16,16 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
tools:replace="android:label">
onBackgroundMessage(Map message) {
+ //TODO: Add functionality
+ _logger.info("onBackgroundMessage $message");
+ return Future(null);
+}
+
class PushManager {
final _firebaseMessaging = FirebaseMessaging();
final _notificationManager = DisplayNotificationManager();
- final _logger = Logger("push_manager");
BuildContext _buildContext;
PushBloc _pushBloc;
@@ -83,11 +90,13 @@ class PushManager {
final decryptedContent = await decryptAsync(notificationData.content);
if (_isValidationPush(decryptedContent)) {
final validation = _getPushValidation(decryptedContent).validation;
+ _logger.info("Validation message with state validation: $validation received");
_pushBloc.add(ValidateMetadata(validation: validation));
} else {
final pushChatMessage = _getPushChatMessage(decryptedContent);
final fromEmail = pushChatMessage.fromEmail;
final body = "I sent you a new chat message"; // TODO replace decrypt
+ _logger.info("Chat message received from: $fromEmail");
await _notificationManager.showNotificationFromPushAsync(fromEmail, body);
}
}
@@ -103,6 +112,7 @@ class PushManager {
_logger.info("onLaunch $message");
return Future(null);
},
+ onBackgroundMessage: onBackgroundMessage,
);
_firebaseMessaging.requestNotificationPermissions(const IosNotificationSettings(sound: true, badge: true, alert: true));
}