import { Platform } from 'react-native'; import { videoLoggerSystem } from '@stream-io/video-client'; import { StreamVideoConfig } from '../StreamVideoRN/types'; import { getCallingxLib } from './libs'; import { onRingNotificationReceived } from './internal/android'; export function setupAndroidPushEvents( pushConfig: NonNullable, ) { const logger = videoLoggerSystem.getLogger('setupAndroidPushEvents'); if (Platform.OS !== 'android' || !pushConfig.android?.pushProviderName) { logger.debug( `setupAndroidPushEvents skipped: platform=${Platform.OS} pushProviderName=${pushConfig.android?.pushProviderName}`, ); return; } const callingx = getCallingxLib(); callingx.addEventListener('ringCallPushReceived', (params) => { logger.debug(`ringCallPushReceived event call_cid: ${params?.call_cid}`); onRingNotificationReceived(params).catch((error) => { logger.error(`Error in onRingNotificationReceived: ${error}`); }); }); }