feat: finalize notification system (android manifest, token revocation, backend logs)
This commit is contained in:
parent
87523428a7
commit
98637c6d9c
|
|
@ -43,6 +43,8 @@ func NewPushService(userRepo *repository.UserRepository, credentialsFile string)
|
||||||
return nil, fmt.Errorf("error getting Messaging client: %v", err)
|
return nil, fmt.Errorf("error getting Messaging client: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Info().Msg("[INFO] PushService initialized successfully")
|
||||||
|
|
||||||
return &PushService{
|
return &PushService{
|
||||||
client: client,
|
client: client,
|
||||||
userRepo: userRepo,
|
userRepo: userRepo,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.gosojorn.app">
|
||||||
<!-- Location permissions for Beacon Network -->
|
<!-- Location permissions for Beacon Network -->
|
||||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||||
|
|
|
||||||
|
|
@ -88,9 +88,22 @@ class NotificationService {
|
||||||
Future<void> removeToken() async {
|
Future<void> removeToken() async {
|
||||||
if (_currentToken == null) return;
|
if (_currentToken == null) return;
|
||||||
|
|
||||||
// Migrate this to Go API
|
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;
|
_currentToken = null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> _upsertToken(String token) async {
|
Future<void> _upsertToken(String token) async {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue