| 11 | import de.robv.android.xposed.XposedBridge |
| 12 | |
| 13 | @FunctionHookEntry |
| 14 | object AddInfoContainer : CommonDynamicHook() { |
| 15 | |
| 16 | //非管理员也可查看一些信息。。。 |
| 17 | override fun initOnce(): Boolean = tryOrLogFalse { |
| 18 | val ProfileActivity = loadClass("org.telegram.ui.ProfileActivity") |
| 19 | findMethod(ProfileActivity) { |
| 20 | name == "createActionBarMenu" && parameterTypes.size == 1 |
| 21 | }.hookAfter { |
| 22 | try { |
| 23 | |
| 24 | val getMessagesController = |
| 25 | getMethodAndInvoke("getMessagesController", it.thisObject, true)!! |
| 26 | val chatId = getField("chatId", it.thisObject) as Long |
| 27 | val chat = getMethodAndInvoke("getChat", getMessagesController, true, 1, chatId) |
| 28 | |
| 29 | val hasAdminRights = findMethod("org.telegram.messenger.ChatObject") { |
| 30 | name == "hasAdminRights" && parameterTypes.size == 1 |
| 31 | }.invoke(null, chat) as Boolean |
| 32 | |
| 33 | var megagroup = getField("megagroup", chat, true) as Boolean? |
| 34 | |
| 35 | if (megagroup == null) { |
| 36 | megagroup = false |
| 37 | } |
| 38 | |
| 39 | if (hasAdminRights || megagroup) { |
| 40 | val editItemVisible = findField(it.thisObject::class.java) { |
| 41 | name == "editItemVisible" |
| 42 | }.get(it.thisObject) as Boolean |
| 43 | |
| 44 | if (editItemVisible) { |
| 45 | return@hookAfter |
| 46 | } |
| 47 | |
| 48 | findField(it.thisObject::class.java) { |
| 49 | name == "editItemVisible" |
| 50 | }.set(it.thisObject, true) |
| 51 | |
| 52 | //editItem.setVisibility(View.VISIBLE); |
| 53 | |
| 54 | val editItem = findField(it.thisObject::class.java) { |
| 55 | name == "editItem" |
| 56 | }.get(it.thisObject) as View |
| 57 | editItem.visibility = View.VISIBLE |
| 58 | |
| 59 | getMethodAndInvoke("setIcon", editItem, false, 1, R.drawable.ic_setting_hex_outline_24) |
| 60 | } |
| 61 | |
| 62 | } catch (e: Throwable) { |
| 63 | |
| 64 | XposedBridge.log(e) |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | |
| 69 | val actions_addadmin = android.R.drawable.ic_lock_idle_alarm |
| 70 |
nothing calls this directly
no outgoing calls
no test coverage detected