diff --git a/src/RNTwilioPhone.ts b/src/RNTwilioPhone.ts index 832cc4b9..f0ef41d0 100644 --- a/src/RNTwilioPhone.ts +++ b/src/RNTwilioPhone.ts @@ -1,4 +1,3 @@ -import messaging from '@react-native-firebase/messaging'; import { Platform } from 'react-native'; import RNCallKeep, { IOptions } from 'react-native-callkeep'; import { @@ -10,6 +9,22 @@ import { import VoipPushNotification from 'react-native-voip-push-notification'; import ramdomUuid from 'uuid-random'; +type callback = (param: any) => any; + +interface FirebaseMessagingModule { + (): FirebaseMessagingModule; + setBackgroundMessageHandler: (handler: callback) => any; + getToken: () => Promise; + onTokenRefresh: (handler: callback) => any; + onMessage: (handler: callback) => any; +}; + +let messaging: FirebaseMessagingModule; + +if (Platform.OS === 'android') { + messaging = require('@react-native-firebase/messaging') +} + export type RNTwilioPhoneOptions = { requestPermissionsOnInit: boolean; // Default: true };