Skip to content

Commit

Permalink
Quick-fix for additional extended profile fields on v8.17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ElJaviLuki committed Sep 15, 2022
1 parent e2bf193 commit 113c4b9
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion app/src/main/java/com/eljaviluki/grindrplus/Hooks.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.eljaviluki.grindrplus

import android.util.AttributeSet
import android.view.View
import android.view.Window
import de.robv.android.xposed.XC_MethodHook
Expand All @@ -11,6 +12,9 @@ import com.eljaviluki.grindrplus.Constants.Returns.RETURN_INTEGER_MAX_VALUE
import com.eljaviluki.grindrplus.Constants.Returns.RETURN_LONG_MAX_VALUE
import com.eljaviluki.grindrplus.Obfuscation.GApp
import com.eljaviluki.grindrplus.decorated.persistence.model.Profile
import de.robv.android.xposed.XC_MethodReplacement
import de.robv.android.xposed.XposedBridge
import de.robv.android.xposed.XposedHelpers
import de.robv.android.xposed.XposedHelpers.*
import kotlin.time.Duration

Expand Down Expand Up @@ -68,6 +72,13 @@ object Hooks {
) //I tried using Continuation::class.java, but that only gives a different Class instance (does not work)


val class_Intrinsics = findClass(
"kotlin.jvm.internal.Intrinsics",
Hooker.pkgParam.classLoader
)

val checkNotNullParameterMethod = findMethodExact(class_Intrinsics, "checkNotNullParameter", Object::class.java, String::class.java)

findAndHookMethod(
class_ProfileFieldsView,
GApp.ui.profileV2.ProfileFieldsView_.setProfile,
Expand Down Expand Up @@ -133,8 +144,10 @@ object Hooks {

//By default, the views are added to the end of the list.
private fun addProfileFieldUi(label: CharSequence, value: CharSequence, where: Int = -1) {
val hooked = XposedBridge.hookMethod(checkNotNullParameterMethod, XC_MethodReplacement.DO_NOTHING)
val extendedProfileFieldView =
newInstance(class_ExtendedProfileFieldView, context)
newInstance(class_ExtendedProfileFieldView, context, null as AttributeSet?)
hooked.unhook()

callMethod(
extendedProfileFieldView,
Expand Down

0 comments on commit 113c4b9

Please sign in to comment.