notification 60%
This commit is contained in:
@@ -117,4 +117,4 @@ dependencies {
|
||||
implementation jscFlavor
|
||||
}
|
||||
}
|
||||
apply plugin: "com.google.gms.google-services"
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"project_info": {
|
||||
"project_number": "590063852259",
|
||||
"project_id": "abin-91b63",
|
||||
"storage_bucket": "abin-91b63.firebasestorage.app"
|
||||
"project_number": "292002292889",
|
||||
"project_id": "fund-collection-2c008",
|
||||
"storage_bucket": "fund-collection-2c008.firebasestorage.app"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:590063852259:android:14cddf7965aeab364183d6",
|
||||
"mobilesdk_app_id": "1:292002292889:android:06df68f8ee9adb1974c408",
|
||||
"android_client_info": {
|
||||
"package_name": "com.circlecollect"
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyAV4WtB8_ZnQgsOgrVnz_J9-5-zlGdTG0I"
|
||||
"current_key": "AIzaSyBjiKrvmQoqtSmKutyIY-hcIEMxDxRIUuw"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
|
||||
@@ -23,4 +23,4 @@ export const CONTRIBUTE = `${BASE_URL}payments/groups/`;
|
||||
export const TRANSACTION = `${BASE_URL}payments/my-transactions`;
|
||||
export const UPLOAD_GROUP_IMAGE = `${BASE_URL}fund/groups/`;
|
||||
export const STORE_FCM_TOKEN = `${BASE_URL}token/store?fcmToken=`
|
||||
|
||||
export const REMOVE_FCM_TOKEN = `${BASE_URL}token/remove?fcmToken=`
|
||||
@@ -2,6 +2,7 @@ import messaging from '@react-native-firebase/messaging';
|
||||
import notifee, { AndroidImportance } from '@notifee/react-native';
|
||||
import axios from 'axios';
|
||||
import { apiCall } from '../ApiHelper';
|
||||
import { REMOVE_FCM_TOKEN, STORE_FCM_TOKEN } from '../ApiUrls';
|
||||
|
||||
// replace with your backend
|
||||
|
||||
@@ -30,10 +31,13 @@ class FirebaseService {
|
||||
|
||||
// 🔹 Get & send token to backend
|
||||
static async getFcmToken(userId: string) {
|
||||
console.log('FCM Token o');
|
||||
try {
|
||||
console.log('FCM Token 1');
|
||||
const token = await messaging().getToken();
|
||||
console.log('FCM Token:', token);
|
||||
await apiCall(`https://api.godemo.in/FundCollect/api/token/store?fcmToken=${token}&userId=${userId}`, 'POST');
|
||||
console.log('FCM Token 2');
|
||||
console.log('FCM Token login: ', token);
|
||||
await apiCall(STORE_FCM_TOKEN+token, 'POST');
|
||||
console.log('FCM Token sent to backend');
|
||||
return token;
|
||||
} catch (error) {
|
||||
@@ -45,8 +49,11 @@ class FirebaseService {
|
||||
// 🔹 Delete token from backend
|
||||
static async deleteFcmToken() {
|
||||
try {
|
||||
console.log('FCM Token 1');
|
||||
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');
|
||||
} catch (error) {
|
||||
console.error('Error deleting FCM token:', error);
|
||||
|
||||
Reference in New Issue
Block a user