mirror of
https://github.com/rhunk/SnapEnhance.git
synced 2025-05-03 16:04:30 +02:00
refactor: ProfilePictureDownloader
This commit is contained in:
parent
dd755af5be
commit
1b566db184
@ -59,15 +59,8 @@ class ProfilePictureDownloader : Feature("ProfilePictureDownloader", loadParams
|
||||
|
||||
context.event.subscribe(NetworkApiRequestEvent::class) { event ->
|
||||
if (!event.url.endsWith("/rpc/getPublicProfile")) return@subscribe
|
||||
Hooker.ephemeralHookObjectMethod(event.callback::class.java, event.callback, "onSucceeded", HookStage.BEFORE) { methodParams ->
|
||||
val content = methodParams.arg<ByteBuffer>(2).run {
|
||||
ByteArray(capacity()).also {
|
||||
get(it)
|
||||
position(0)
|
||||
}
|
||||
}
|
||||
|
||||
ProtoReader(content).followPath(1, 1, 2) {
|
||||
event.onSuccess { buffer ->
|
||||
ProtoReader(buffer ?: return@onSuccess).followPath(1, 1, 2) {
|
||||
friendUsername = getString(2) ?: return@followPath
|
||||
followPath(4) {
|
||||
backgroundUrl = getString(2)
|
||||
|
Loading…
x
Reference in New Issue
Block a user