chore: init background handler

This commit is contained in:
GleidsonDaniel 2023-09-28 09:11:23 -03:00
parent b3a07570ab
commit b624112f8b
2 changed files with 8 additions and 12 deletions

View File

@ -53,6 +53,7 @@ export const backgroundNotificationHandler = async (): Promise<void> => {
{ cancelable: false }
);
// videoConf channel
await notifee.createChannel({
id: 'call',
name: 'Video Call',
@ -63,16 +64,9 @@ export const backgroundNotificationHandler = async (): Promise<void> => {
});
}
notifee.registerForegroundService(
notification =>
new Promise(() => {
console.log('registerForegroundService', notification);
})
);
notifee.registerForegroundService(notification => new Promise(() => {}));
notifee.onBackgroundEvent(async event => {
console.log('onBackgroundEvent', event);
});
notifee.onBackgroundEvent(e => new Promise(() => {}));
};
const setBackgroundNotificationHandler = async (): Promise<void> => {

View File

@ -1,10 +1,11 @@
import EJSON from 'ejson';
import { store } from '../store/auxStore';
import { deepLinkingOpen } from '../../actions/deepLinking';
import { isFDroidBuild } from '../constants';
import { deviceToken, pushNotificationConfigure, setNotificationsBadgeCount, removeAllNotifications } from './push';
import { INotification, SubscriptionType } from '../../definitions';
import { isFDroidBuild } from '../constants';
import { store } from '../store/auxStore';
import { deviceToken, pushNotificationConfigure, removeAllNotifications, setNotificationsBadgeCount } from './push';
import { backgroundNotificationHandler } from './backgroundNotificationHandler';
interface IEjson {
rid: string;
@ -56,6 +57,7 @@ export const removeNotificationsAndBadge = () => {
export const initializePushNotifications = (): Promise<INotification> | undefined => {
if (!isFDroidBuild) {
setBadgeCount();
backgroundNotificationHandler();
return pushNotificationConfigure(onNotification);
}
};