From 9f7c6524d417df47b44979befb650131e0cb0cac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Hertault?= Date: Fri, 10 Dec 2021 16:40:57 +0100 Subject: [PATCH] Fix incoming push types --- .../java/com/reactnativetwiliophone/TwilioPhoneModule.kt | 8 ++++---- example/ios/Podfile.lock | 4 ++-- ios/TwilioPhone.swift | 2 +- package.json | 2 +- src/index.ts | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/android/src/main/java/com/reactnativetwiliophone/TwilioPhoneModule.kt b/android/src/main/java/com/reactnativetwiliophone/TwilioPhoneModule.kt index be50b5c8..7420e8ca 100644 --- a/android/src/main/java/com/reactnativetwiliophone/TwilioPhoneModule.kt +++ b/android/src/main/java/com/reactnativetwiliophone/TwilioPhoneModule.kt @@ -3,7 +3,6 @@ package com.reactnativetwiliophone import android.content.Context import android.content.pm.PackageManager import android.media.AudioManager -import android.os.Bundle import android.util.Log import androidx.core.app.ActivityCompat import androidx.core.content.ContextCompat @@ -59,10 +58,11 @@ class TwilioPhoneModule(reactContext: ReactApplicationContext) : fun handleMessage(payload: ReadableMap) { Log.i(tag, "Handling message") - val data = Bundle() + val data = Arguments.toBundle(payload) - for (entry in payload.entryIterator) { - data.putString(entry.key, entry.value as String) + if (data == null) { + Log.e(tag, "The message was not a valid Twilio Voice SDK payload") + return } val valid = Voice.handleMessage(reactApplicationContext, data, object : MessageListener { diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 324f35b1..9b02257a 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -311,7 +311,7 @@ PODS: - React-jsi (= 0.64.1) - React-perflogger (= 0.64.1) - React-jsinspector (0.64.1) - - react-native-twilio-phone (1.8.0): + - react-native-twilio-phone (1.8.1): - React - TwilioVoice (~> 6.2) - React-perflogger (0.64.1) @@ -581,7 +581,7 @@ SPEC CHECKSUMS: React-jsi: 5de8204706bd872b78ea646aee5d2561ca1214b6 React-jsiexecutor: 124e8f99992490d0d13e0649d950d3e1aae06fe9 React-jsinspector: 500a59626037be5b3b3d89c5151bc3baa9abf1a9 - react-native-twilio-phone: 94008e77d6fcd10a5469941f1d6023d679577fd4 + react-native-twilio-phone: aa149e7b7ef82e8a1d03eaeab9183a78f2347d13 React-perflogger: aad6d4b4a267936b3667260d1f649b6f6069a675 React-RCTActionSheet: fc376be462c9c8d6ad82c0905442fd77f82a9d2a React-RCTAnimation: ba0a1c3a2738be224a08092fa7f1b444ab77d309 diff --git a/ios/TwilioPhone.swift b/ios/TwilioPhone.swift index 4d1ca677..d8aff057 100644 --- a/ios/TwilioPhone.swift +++ b/ios/TwilioPhone.swift @@ -64,7 +64,7 @@ class TwilioPhone: RCTEventEmitter { } @objc(handleMessage:) - func handleMessage(payload: [String: String]) { + func handleMessage(payload: [AnyHashable: Any]) { NSLog("[TwilioPhone] Handling message") TwilioVoiceSDK.handleNotification(payload, delegate: self, delegateQueue: nil) diff --git a/package.json b/package.json index c19f7dae..e054c62d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-twilio-phone", - "version": "1.8.0", + "version": "1.8.1", "description": "Twilio Voice React Native module.", "main": "lib/commonjs/index.js", "module": "lib/module/index.js", diff --git a/src/index.ts b/src/index.ts index efe3a49e..65ac0838 100644 --- a/src/index.ts +++ b/src/index.ts @@ -14,7 +14,7 @@ export enum PermissionStatus { Unknown = 'UNKNOWN', } -export type MessagePayload = Record; +export type MessagePayload = Record; export type ConnectParams = Record; export type Permissions = Record;