Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat(android): update WritableNativeMap to convert Bundle data type

Calin-Teodor5c3ea9613108
diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/BroadcastAction.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/BroadcastAction.java
index f02cd1b25a..aa199a1ba6 100644
--- a/android/sdk/src/main/java/org/jitsi/meet/sdk/BroadcastAction.java
+++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/BroadcastAction.java
@@ -44,6 +44,8 @@ public class BroadcastAction {
nativeMap.putDouble(key, (Double) this.data.get(key));
} else if (this.data.get(key) instanceof String) {
nativeMap.putString(key, (String) this.data.get(key));
+ } else if (this.data.get(key) instanceof Bundle) {
+ nativeMap.putMap(key, bundleToWritableMap((Bundle) this.data.get(key)));
} else {
throw new Exception("Unsupported extra data type");
}
@@ -55,6 +57,21 @@ public class BroadcastAction {
return nativeMap;
}
+ // Converts(only String values) an Android Bundle to a WritableNativeMap
+ // that can be consumed by React Native.
+ private WritableNativeMap bundleToWritableMap(Bundle bundle) {
+ WritableNativeMap map = new WritableNativeMap();
+
+ for (String key : bundle.keySet()) {
+ Object value = bundle.get(key);
+ if (value instanceof String) {
+ map.putString(key, (String) value);
+ }
+ }
+
+ return map;
+ }
+
private static HashMap<String, Object> buildDataFromBundle(Bundle bundle) {
HashMap<String, Object> map = new HashMap<>();