notification 60%

This commit is contained in:
Abin Toppo
2025-10-06 12:56:59 +05:30
parent bcbad282b0
commit ba3d4f7579
4 changed files with 17 additions and 10 deletions
+1 -1
View File
@@ -117,4 +117,4 @@ dependencies {
implementation jscFlavor implementation jscFlavor
} }
} }
apply plugin: "com.google.gms.google-services" apply plugin: 'com.google.gms.google-services'
+5 -5
View File
@@ -1,13 +1,13 @@
{ {
"project_info": { "project_info": {
"project_number": "590063852259", "project_number": "292002292889",
"project_id": "abin-91b63", "project_id": "fund-collection-2c008",
"storage_bucket": "abin-91b63.firebasestorage.app" "storage_bucket": "fund-collection-2c008.firebasestorage.app"
}, },
"client": [ "client": [
{ {
"client_info": { "client_info": {
"mobilesdk_app_id": "1:590063852259:android:14cddf7965aeab364183d6", "mobilesdk_app_id": "1:292002292889:android:06df68f8ee9adb1974c408",
"android_client_info": { "android_client_info": {
"package_name": "com.circlecollect" "package_name": "com.circlecollect"
} }
@@ -15,7 +15,7 @@
"oauth_client": [], "oauth_client": [],
"api_key": [ "api_key": [
{ {
"current_key": "AIzaSyAV4WtB8_ZnQgsOgrVnz_J9-5-zlGdTG0I" "current_key": "AIzaSyBjiKrvmQoqtSmKutyIY-hcIEMxDxRIUuw"
} }
], ],
"services": { "services": {
+1 -1
View File
@@ -23,4 +23,4 @@ export const CONTRIBUTE = `${BASE_URL}payments/groups/`;
export const TRANSACTION = `${BASE_URL}payments/my-transactions`; export const TRANSACTION = `${BASE_URL}payments/my-transactions`;
export const UPLOAD_GROUP_IMAGE = `${BASE_URL}fund/groups/`; export const UPLOAD_GROUP_IMAGE = `${BASE_URL}fund/groups/`;
export const STORE_FCM_TOKEN = `${BASE_URL}token/store?fcmToken=` export const STORE_FCM_TOKEN = `${BASE_URL}token/store?fcmToken=`
export const REMOVE_FCM_TOKEN = `${BASE_URL}token/remove?fcmToken=`
+10 -3
View File
@@ -2,6 +2,7 @@ import messaging from '@react-native-firebase/messaging';
import notifee, { AndroidImportance } from '@notifee/react-native'; import notifee, { AndroidImportance } from '@notifee/react-native';
import axios from 'axios'; import axios from 'axios';
import { apiCall } from '../ApiHelper'; import { apiCall } from '../ApiHelper';
import { REMOVE_FCM_TOKEN, STORE_FCM_TOKEN } from '../ApiUrls';
// replace with your backend // replace with your backend
@@ -30,10 +31,13 @@ class FirebaseService {
// 🔹 Get & send token to backend // 🔹 Get & send token to backend
static async getFcmToken(userId: string) { static async getFcmToken(userId: string) {
console.log('FCM Token o');
try { try {
console.log('FCM Token 1');
const token = await messaging().getToken(); const token = await messaging().getToken();
console.log('FCM Token:', token); console.log('FCM Token 2');
await apiCall(`https://api.godemo.in/FundCollect/api/token/store?fcmToken=${token}&userId=${userId}`, 'POST'); console.log('FCM Token login: ', token);
await apiCall(STORE_FCM_TOKEN+token, 'POST');
console.log('FCM Token sent to backend'); console.log('FCM Token sent to backend');
return token; return token;
} catch (error) { } catch (error) {
@@ -45,8 +49,11 @@ class FirebaseService {
// 🔹 Delete token from backend // 🔹 Delete token from backend
static async deleteFcmToken() { static async deleteFcmToken() {
try { try {
console.log('FCM Token 1');
const token = await messaging().getToken(); const token = await messaging().getToken();
await apiCall(`https://api.godemo.in/FundCollect/api/token/remove?fcmToken=${token}`, 'DELETE'); console.log('FCM Token 2');
console.log("fcm token logout -",token)
await apiCall(REMOVE_FCM_TOKEN+token, 'POST');
console.log('FCM Token deleted from backend'); console.log('FCM Token deleted from backend');
} catch (error) { } catch (error) {
console.error('Error deleting FCM token:', error); console.error('Error deleting FCM token:', error);