From 2ef0e5416888a055b73344efe00a50d58574740d Mon Sep 17 00:00:00 2001 From: rhunk <101876869+rhunk@users.noreply.github.com> Date: Sun, 16 Mar 2025 21:06:38 +0100 Subject: [PATCH] fix(core): call recorder Support v13.32.0.43 Signed-off-by: rhunk <101876869+rhunk@users.noreply.github.com> --- .../core/features/impl/experiments/CallRecorder.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/experiments/CallRecorder.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/experiments/CallRecorder.kt index 38632710..247e7da7 100644 --- a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/experiments/CallRecorder.kt +++ b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/experiments/CallRecorder.kt @@ -33,7 +33,9 @@ class CallRecorder : Feature("Call Recorder") { val streamHandlers = ConcurrentHashMap Unit>>() // audioTrack -> handlers val participants = CopyOnWriteArrayList() - findClass("com.snapchat.talkcorev3.CallingSessionState").hookConstructor(HookStage.AFTER) { param -> + runCatching { + findClass("com.snapchat.talkcorev3.CallingSessionState") + }.getOrNull()?.hookConstructor(HookStage.AFTER) { param -> val instance = param.thisObject() val callingState = instance.getObjectFieldOrNull("mLocalUser")?.getObjectField("mCallingState") @@ -41,6 +43,13 @@ class CallRecorder : Feature("Call Recorder") { participants.clear() participants.addAll((instance.getObjectField("mParticipants") as Map<*, *>).keys.map { it.toString() }) } + } ?: findClass("com.snapchat.talkcorev3.TSCallingStateUpdateParams").hookConstructor(HookStage.AFTER) { param -> + val instance = param.thisObject() + + if (instance.getObjectFieldOrNull("mInCall") == true) { + participants.clear() + participants.addAll((instance.getObjectField("mParticipants") as Set<*>).map { it.toString() }) + } } AudioTrack::class.java.apply {