commit 2ef0e5416888a055b73344efe00a50d58574740d parent c7a2d0268796638661c54f724c8f08f1a2676a9d Author: rhunk <101876869+rhunk@users.noreply.github.com> Date: Sun, 16 Mar 2025 21:06:38 +0100 fix(core): call recorder Support v13.32.0.43 Signed-off-by: rhunk <101876869+rhunk@users.noreply.github.com> Diffstat:
M | core/src/main/kotlin/me/rhunk/snapenhance/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 @@ -33,7 +33,9 @@ class CallRecorder : Feature("Call Recorder") { val streamHandlers = ConcurrentHashMap<Int, MutableList<(data: ByteArray) -> Unit>>() // audioTrack -> handlers val participants = CopyOnWriteArrayList<String>() - findClass("com.snapchat.talkcorev3.CallingSessionState").hookConstructor(HookStage.AFTER) { param -> + runCatching { + findClass("com.snapchat.talkcorev3.CallingSessionState") + }.getOrNull()?.hookConstructor(HookStage.AFTER) { param -> val instance = param.thisObject<Any>() 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<Any>() + + if (instance.getObjectFieldOrNull("mInCall") == true) { + participants.clear() + participants.addAll((instance.getObjectField("mParticipants") as Set<*>).map { it.toString() }) + } } AudioTrack::class.java.apply {