Skip to content

Commit c4b63a6

Browse files
committed
chore: review approve
1 parent 6a0274c commit c4b63a6

File tree

1 file changed

+3
-20
lines changed

1 file changed

+3
-20
lines changed

sample/src/direct-call/callHandler/android.ts

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,8 @@ import { DirectRouteWithParams, DirectRoutes } from '../navigations/routes';
1111
/** Firebase RemoteMessage handler **/
1212
export function setFirebaseMessageHandlers() {
1313
const firebaseListener = async (message: FirebaseMessagingTypes.RemoteMessage) => {
14-
const convertedData: Record<string, string> = Object.entries(
15-
(message.data as Record<string, string | object>) ?? {},
16-
).reduce((acc, [key, value]) => {
17-
acc[key] = typeof value === 'object' ? JSON.stringify(value) : value;
18-
return acc;
19-
}, {} as Record<string, string>);
20-
21-
SendbirdCalls.android_handleFirebaseMessageData(convertedData);
14+
// @ts-ignore
15+
SendbirdCalls.android_handleFirebaseMessageData(message.data);
2216
};
2317
messaging().setBackgroundMessageHandler(firebaseListener);
2418
messaging().onMessage(firebaseListener);
@@ -38,18 +32,7 @@ export async function setNotificationForegroundService() {
3832
const onNotificationAction = async ({ type, detail }: Event) => {
3933
if (type !== EventType.ACTION_PRESS || !detail.notification?.data?.call) return;
4034

41-
const callData = detail.notification.data.call;
42-
43-
let callString: string;
44-
if (typeof callData === 'string') {
45-
callString = callData;
46-
} else if (typeof callData === 'object') {
47-
callString = JSON.stringify(callData);
48-
} else {
49-
callString = String(callData);
50-
}
51-
52-
const callProps: DirectCallProperties = JSON.parse(callString);
35+
const callProps = detail.notification.data.call as unknown as DirectCallProperties;
5336

5437
const directCall = await SendbirdCalls.getDirectCall(callProps.callId);
5538
if (directCall.isEnded) {

0 commit comments

Comments
 (0)