diff --git a/bgCalling.js b/bgCalling.js index 738c7d4..93bd5d3 100644 --- a/bgCalling.js +++ b/bgCalling.js @@ -1,7 +1,7 @@ // @flow import { Linking } from 'react-native'; export default async ({ name, callUUID, handle }) => { - Linking.openURL(`sylk://dialer/call/${callUUID}/${handle}/${name}`) + Linking.openURL(`sylk://outgoing/call/${callUUID}/${handle}/${name}`) return Promise.resolve(); -} \ No newline at end of file +} diff --git a/bgMessaging.js b/bgMessaging.js index 710cb29..314275f 100644 --- a/bgMessaging.js +++ b/bgMessaging.js @@ -1,30 +1,31 @@ //@flow import { NativeModules, AppState } from 'react-native'; const { SylkNative } = NativeModules; export default async (remoteMessage) => { - console.log("Data notification received in state " + AppState.currentState, remoteMessage, SylkNative); + console.log('Push notification received', remoteMessage.data.event); if (AppState.currentState == "background" && (remoteMessage.data.event === 'incoming_session' || remoteMessage.data.event === 'incoming_conference_request') ) { let event = remoteMessage.data.event; let callUUID = remoteMessage.data['session-id']; - let room = remoteMessage.data['to_uri'] + let to = remoteMessage.data['to_uri'] let from = remoteMessage.data['from_uri'] + let url; if (event === 'incoming_conference_request') { - let url = 'sylk://dialer/conference/' + callUUID + '/' + room + '/' + from; - } else if (event === 'incoming_conference_request') { - let url = 'sylk://dialer/call/' + callUUID + '/' + from + '/' + from; + url = 'sylk://outgoing/conference/' + callUUID + '/' + from + '/' + to; + } else if (event === 'incoming_session') { + url = 'sylk://incoming/call/' + callUUID + '/' + from + '/' + to; } - console.log('Wake up from push', url); - - SylkNative.launchMainActivity(url); - + if (url) { + console.log('Wake up from push with URL', url); + SylkNative.launchMainActivity(url); + } } return Promise.resolve(); }