Skip to content

Commit

Permalink
fix: more NoSuchMethodError (#1570)
Browse files Browse the repository at this point in the history
修复更多NoSuchMethodError
移除“禁止自动转到动态”功能,b站 v8.1x+ 起不会再自动勾选转发到动态,因此该功能没有存在的必要
  • Loading branch information
CodePwn2021 authored Nov 19, 2024
1 parent 05e0848 commit 2879601
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 12 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/me/iacn/biliroaming/XposedInit.kt
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class XposedInit : IXposedHookLoadPackage, IXposedHookZygoteInit {
startHook(DanmakuHook(lpparam.classLoader))
startHook(BangumiPageAdHook(lpparam.classLoader))
startHook(VideoQualityHook(lpparam.classLoader))
startHook(PublishToFollowingHook(lpparam.classLoader))
// startHook(PublishToFollowingHook(lpparam.classLoader))
startHook(UposReplaceHook(lpparam.classLoader))
startHook(SpeedHook(lpparam.classLoader))
startHook(MultiWindowHook(lpparam.classLoader))
Expand Down
12 changes: 6 additions & 6 deletions app/src/main/java/me/iacn/biliroaming/hook/DynamicHook.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class DynamicHook(classLoader: ClassLoader) : BaseHook(classLoader) {
val hidden = sPrefs.getBoolean("hidden", false)
if (hidden && (needFilterDynamic || removeTopicOfAll || removeUpOfAll)) {
dynamicMossV2?.hookAfterMethod(
"dynAll",
if (instance.useNewMossFunc) "executeDynAll" else "dynAll",
"com.bapis.bilibili.app.dynamic.v2.DynAllReq"
) { param ->
param.result?.let {
Expand All @@ -52,7 +52,7 @@ class DynamicHook(classLoader: ClassLoader) : BaseHook(classLoader) {
}
}
dynamicMossV2?.hookBeforeMethod(
"dynAll",
if (instance.useNewMossFunc) "executeDynAll" else "dynAll",
"com.bapis.bilibili.app.dynamic.v2.DynAllReq",
instance.mossResponseHandlerClass
) {
Expand All @@ -70,7 +70,7 @@ class DynamicHook(classLoader: ClassLoader) : BaseHook(classLoader) {
}
if (hidden && ((filterApplyToVideo && needFilterDynamic) || removeUpOfVideo)) {
dynamicMossV2?.hookAfterMethod(
"dynVideo",
if (instance.useNewMossFunc) "executeDynVideo" else "dynVideo",
"com.bapis.bilibili.app.dynamic.v2.DynVideoReq"
) { param ->
param.result?.let {
Expand All @@ -81,7 +81,7 @@ class DynamicHook(classLoader: ClassLoader) : BaseHook(classLoader) {
}
}
dynamicMossV2?.hookBeforeMethod(
"dynVideo",
if (instance.useNewMossFunc) "executeDynVideo" else "dynVideo",
"com.bapis.bilibili.app.dynamic.v2.DynVideoReq",
instance.mossResponseHandlerClass
) {
Expand All @@ -97,13 +97,13 @@ class DynamicHook(classLoader: ClassLoader) : BaseHook(classLoader) {
}
if (hidden && preferVideoTab) {
dynamicMossV1?.hookAfterMethod(
"dynRed",
if (instance.useNewMossFunc) "executeDynRed" else "dynRed",
"com.bapis.bilibili.app.dynamic.v1.DynRedReq"
) { param ->
param.result?.callMethod("setDefaultTab", "video")
}
dynamicMossV2?.hookBeforeMethod(
"dynTab",
if (instance.useNewMossFunc) "executeDynTab" else "dynTab",
"com.bapis.bilibili.app.dynamic.v2.DynTabReq",
instance.mossResponseHandlerClass
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package me.iacn.biliroaming.hook

import me.iacn.biliroaming.BiliBiliPackage.Companion.instance
import me.iacn.biliroaming.Constant
import me.iacn.biliroaming.utils.hookAfterMethod
import me.iacn.biliroaming.utils.packageName

class KillDelayBootHook(classLoader: ClassLoader) : BaseHook(classLoader) {
override fun startHook() {
instance.gripperBootExpClass?.hookAfterMethod("getDelayMillis") { param ->
instance.gripperBootExpClass?.hookAfterMethod(
if (packageName == Constant.PLAY_PACKAGE_NAME) "b" else "getDelayMillis"
) { param ->
param.result = -1L
}
}
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/java/me/iacn/biliroaming/hook/PlayArcConfHook.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class PlayArcConfHook(classLoader: ClassLoader) : BaseHook(classLoader) {
if (!sPrefs.getBoolean("play_arc_conf", false)) return

instance.playURLMossClass?.hookAfterMethod(
"playView", instance.playViewReqClass
if (instance.useNewMossFunc) "executePlayView" else "playView", instance.playViewReqClass
) { param ->
param.result?.callMethod("getPlayArc")?.run {
arrayOf(
Expand All @@ -41,7 +41,8 @@ class PlayArcConfHook(classLoader: ClassLoader) : BaseHook(classLoader) {
}

instance.playerMossClass?.hookAfterMethod(
"playViewUnite", instance.playViewUniteReqClass
if (instance.useNewMossFunc) "executePlayViewUnite" else "playViewUnite",
instance.playViewUniteReqClass
) { param ->
param.result?.callMethod("mergePlayArcConf", arcConfs)
}
Expand Down Expand Up @@ -81,7 +82,7 @@ class PlayArcConfHook(classLoader: ClassLoader) : BaseHook(classLoader) {
hooker = playlistHook
)
hookAfterMethod(
"playURL",
if (instance.useNewMossFunc) "executePlayURL" else "playURL",
"com.bapis.bilibili.app.listener.v1.PlayURLReq"
) { param ->
if (instance.networkExceptionClass?.isInstance(param.throwable) == true)
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/me/iacn/biliroaming/hook/SubtitleHook.kt
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,8 @@ class SubtitleHook(classLoader: ClassLoader) : BaseHook(classLoader) {

private fun hookSubtitleList() {
instance.dmMossClass?.hookAfterMethod(
"dmView", instance.dmViewReqClass,
if (instance.useNewMossFunc) "executeDmView" else "dmView",
instance.dmViewReqClass,
) { param ->
param.result.hookSubtitleList(param.args[0])?.let { param.result = it }
}
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,10 @@
<string name="block_comment_guide_summary">封鎖影片詳情頁及評論頁的評論引導提示</string>
<string name="disable_auto_refresh_title">禁止首頁自動重新整理</string>
<string name="disable_auto_refresh_summary">禁止首頁內容在退至後台、切換其他頁面一段時間後返回或熱重啟時自動重新整理</string>
<!--
<string name="disable_auto_select_title">禁止自動轉到動態</string>
<string name="disable_auto_select_summary">禁止評論帶圖時自動勾選轉到動態</string>
-->
<string name="apply_to_relate_title">同時套用於影片下方推薦</string>
<string name="disable_vip_dm_colorful_title">篩選漸層顏色弹幕</string>
<string name="disable_vip_dm_colorful_summary">漸層顏色(非一般彩色)彈幕顯示為白色</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,10 @@
<string name="block_comment_guide_summary">屏蔽视频详情页及评论页的评论引导提示</string>
<string name="disable_auto_refresh_title">禁止首页自动刷新</string>
<string name="disable_auto_refresh_summary">禁止首页内容在退至后台、切换其他页面一段时间后返回或热重启时自动刷新</string>
<!--
<string name="disable_auto_select_title">禁止自动转到动态</string>
<string name="disable_auto_select_summary">禁止评论带图时自动勾选转到动态</string>
-->
<string name="apply_to_relate_title">同时应用于视频下方推荐</string>
<string name="disable_vip_dm_colorful_title">过滤渐变色弹幕</string>
<string name="disable_vip_dm_colorful_summary">渐变色(非普通彩色)弹幕显示为白色</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/xml/prefs_setting.xml
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,12 @@
android:summary="@string/disable_auto_refresh_summary"
android:title="@string/disable_auto_refresh_title" />

<!--
<SwitchPreference
android:key="disable_auto_select"
android:summary="@string/disable_auto_select_summary"
android:title="@string/disable_auto_select_title" />
-->

<SwitchPreference
android:key="disable_vip_dm_colorful"
Expand Down

0 comments on commit 2879601

Please sign in to comment.