Skip to content

Commit b73d9d3

Browse files
authored
fix(android): using correct topic name for storing subscriptions (#62)
* fix: unsubscribing listeners on android * fix(android): using truncated eventName for hash table
1 parent 9a8e4f8 commit b73d9d3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

android/src/main/java/io/ionic/portals/reactnative/ReactNativePortalsPubSub.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,16 @@ internal class PortalsPubSubModule(reactContext: ReactApplicationContext) :
2828
.emit(eventName, result.toJSObject().toReactMap())
2929
}
3030

31-
subscriptionRefs[eventName] = ref
31+
subscriptionRefs[topic] = ref
3232
}
3333

3434
@ReactMethod
3535
fun removeListeners(count: Int) {
36+
subscriptionRefs.forEach {
37+
PortalsPubSub.shared.unsubscribe(it.key, it.value)
38+
}
39+
40+
subscriptionRefs.clear()
3641
}
3742
}
3843

0 commit comments

Comments
 (0)