From 98637c6d9c019506b00586eab4876f6d348e414a Mon Sep 17 00:00:00 2001 From: Patrick Britton Date: Tue, 3 Feb 2026 17:33:45 -0600 Subject: [PATCH] feat: finalize notification system (android manifest, token revocation, backend logs) --- go-backend/internal/services/push_service.go | 2 ++ .../android/app/src/main/AndroidManifest.xml | 2 +- .../lib/services/notification_service.dart | 17 +++++++++++++++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/go-backend/internal/services/push_service.go b/go-backend/internal/services/push_service.go index a2fb029..750220e 100644 --- a/go-backend/internal/services/push_service.go +++ b/go-backend/internal/services/push_service.go @@ -43,6 +43,8 @@ func NewPushService(userRepo *repository.UserRepository, credentialsFile string) return nil, fmt.Errorf("error getting Messaging client: %v", err) } + log.Info().Msg("[INFO] PushService initialized successfully") + return &PushService{ client: client, userRepo: userRepo, diff --git a/sojorn_app/android/app/src/main/AndroidManifest.xml b/sojorn_app/android/app/src/main/AndroidManifest.xml index ab7b198..c7d8a3b 100644 --- a/sojorn_app/android/app/src/main/AndroidManifest.xml +++ b/sojorn_app/android/app/src/main/AndroidManifest.xml @@ -1,4 +1,4 @@ - + diff --git a/sojorn_app/lib/services/notification_service.dart b/sojorn_app/lib/services/notification_service.dart index 4f6f5b4..eb8a8dd 100644 --- a/sojorn_app/lib/services/notification_service.dart +++ b/sojorn_app/lib/services/notification_service.dart @@ -88,8 +88,21 @@ class NotificationService { Future removeToken() async { if (_currentToken == null) return; - // Migrate this to Go API - _currentToken = null; + try { + debugPrint('[FCM] Revoking token...'); + await ApiService.instance.callGoApi( + '/notifications/device', + method: 'DELETE', + body: { + 'fcm_token': _currentToken, + }, + ); + debugPrint('[FCM] Token revoked successfully'); + } catch (e) { + debugPrint('[FCM] Failed to revoke token: $e'); + } finally { + _currentToken = null; + } } Future _upsertToken(String token) async {