Skip to content

Commit

Permalink
fix: 7.28.0+ compatibility (#1277)
Browse files Browse the repository at this point in the history
fix: 
- Fix #1272 CI版本的净化分享在Play版本上坏掉了
- Fix #1271 7.48.0自定义主题色失效
- Fix #1275 开启“应用 UPOS 服务器到所有视频”后离线缓存不能播放
- [x] MusicNotification 移除
- [x] (7.29.0+) `过滤设置同时作用于视频分区`, `移除最常访问(视频)` 失效
  • Loading branch information
cxw620 authored Sep 29, 2023
1 parent 8a19697 commit 978bb1b
Show file tree
Hide file tree
Showing 14 changed files with 102 additions and 795 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ An Xposed module that unblocks bangumi area limit of BILIBILI, and miscellaneous
- 不以小程序形式分享
- 自动点赞视频
- 把我的页面移到侧边栏
- 替换音乐状态栏为原生样式
- ~替换音乐状态栏为原生样式~
- 提取视频、直播封面
- 自定义屏启动图

Expand All @@ -49,7 +49,7 @@ An Xposed module that unblocks bangumi area limit of BILIBILI, and miscellaneous
- Share without mini programs
- Like videos automatically
- Move 'Mine page' to sidebar drawer
- Change music notification style to Primitive
- ~Change music notification style to Primitive~
- Extra covers from videos and live rooms
- Customized splash images

Expand Down
264 changes: 4 additions & 260 deletions app/src/main/java/me/iacn/biliroaming/BiliBiliPackage.kt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class DynamicFilterDialog(activity: Activity, prefs: SharedPreferences) :
val rmAdLinkSwitch = switchPrefsItem(
string(R.string.customize_dynamic_rm_ad_link_title)
).let { root.addView(it.first); it.second }
rmBlockedSwitch.isChecked = prefs.getBoolean("customize_dynamic_rm_ad_link", false)
rmAdLinkSwitch.isChecked = prefs.getBoolean("customize_dynamic_rm_ad_link", false)

val byTypeTitle = categoryTitle(string(R.string.customize_dynamic_by_type))
root.addView(byTypeTitle)
Expand Down
10 changes: 1 addition & 9 deletions app/src/main/java/me/iacn/biliroaming/SettingDialog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ class SettingDialog(context: Context) : AlertDialog.Builder(context) {

private fun checkCompatibleVersion() {
val versionCode = getVersionCode(packageName)
var supportMusicNotificationHook = true
var supportCustomizeTab = true
val supportFullSplash = try {
instance.splashInfoClass?.getMethod("getMode") != null
Expand All @@ -262,8 +261,6 @@ class SettingDialog(context: Context) : AlertDialog.Builder(context) {
supportAddTag = false
}
}
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O)
supportMusicNotificationHook = false
val supportSplashHook = instance.brandSplashClass != null
val supportTeenagersMode = instance.teenagersModeDialogActivityClass != null
val supportStoryVideo = instance.storyVideoActivityClass != null
Expand All @@ -278,12 +275,6 @@ class SettingDialog(context: Context) : AlertDialog.Builder(context) {
if (!supportFullSplash) {
disablePreference("full_splash")
}
if (!supportMusicNotificationHook) {
disablePreference(
"music_notification",
context.getString(R.string.os_not_support)
)
}
if (!supportMain) {
disablePreference("main_func", "Android O以下系统不支持64位Xpatch版,请使用32位版")
}
Expand All @@ -303,6 +294,7 @@ class SettingDialog(context: Context) : AlertDialog.Builder(context) {
}
if (!supportPurifyShare) {
disablePreference("purify_share")
disablePreference("mini_program")
}
if (!supportDownloadThread) {
disablePreference("custom_download_thread")
Expand Down
1 change: 0 additions & 1 deletion app/src/main/java/me/iacn/biliroaming/XposedInit.kt
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ class XposedInit : IXposedHookLoadPackage, IXposedHookZygoteInit {
startHook(SplashHook(lpparam.classLoader))
startHook(EnvHook(lpparam.classLoader))
startHook(DownloadThreadHook(lpparam.classLoader))
startHook(MusicNotificationHook(lpparam.classLoader))
startHook(DrawerHook(lpparam.classLoader))
startHook(CoverHook(lpparam.classLoader))
startHook(SubtitleHook(lpparam.classLoader))
Expand Down
30 changes: 30 additions & 0 deletions app/src/main/java/me/iacn/biliroaming/hook/DynamicHook.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,22 @@ class DynamicHook(classLoader: ClassLoader) : BaseHook(classLoader) {
filterDynamic(it)
}
}
dynamicMossV2?.hookBeforeMethod(
"dynAll",
"com.bapis.bilibili.app.dynamic.v2.DynAllReq",
instance.mossResponseHandlerClass
) {
it.args[1] = it.args[1].mossResponseHandlerProxy { result ->
result?.let {
if (removeTopicOfAll)
it.callMethod("clearTopicList")
if (removeUpOfAll)
it.callMethod("clearUpList")
if (needFilterDynamic)
filterDynamic(it)
}
}
}
}
if (hidden && ((filterApplyToVideo && needFilterDynamic) || removeUpOfVideo)) {
dynamicMossV2?.hookAfterMethod(
Expand All @@ -64,6 +80,20 @@ class DynamicHook(classLoader: ClassLoader) : BaseHook(classLoader) {
filterDynamic(it)
}
}
dynamicMossV2?.hookBeforeMethod(
"dynVideo",
"com.bapis.bilibili.app.dynamic.v2.DynVideoReq",
instance.mossResponseHandlerClass
) {
it.args[1] = it.args[1].mossResponseHandlerProxy { result ->
result?.let {
if (removeUpOfVideo)
it.callMethod("clearVideoUpList")
if (filterApplyToVideo && needFilterDynamic)
filterDynamic(it)
}
}
}
}
if (hidden && preferVideoTab) {
dynamicMossV1?.hookAfterMethod(
Expand Down
31 changes: 9 additions & 22 deletions app/src/main/java/me/iacn/biliroaming/hook/JsonHook.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class JsonHook(classLoader: ClassLoader) : BaseHook(classLoader) {
)
val accountMineClass =
"tv.danmaku.bili.ui.main2.api.AccountMine".findClassOrNull(mClassLoader)
val garbEntranceClass =
"tv.danmaku.bili.ui.main2.api.AccountMine\$GarbEntrance".from(mClassLoader)
val splashClass = "tv.danmaku.bili.ui.splash.SplashData".findClassOrNull(mClassLoader)
?: "tv.danmaku.bili.ui.splash.ad.model.SplashData".findClassOrNull(mClassLoader)
val splashShowClass = "tv.danmaku.bili.ui.splash.ad.model.SplashShowData".findClassOrNull(mClassLoader)
Expand Down Expand Up @@ -243,7 +245,13 @@ class JsonHook(classLoader: ClassLoader) : BaseHook(classLoader) {
}
accountMineClass.findFieldOrNull("vipSectionRight")?.set(result, null)
if (sPrefs.getBoolean("custom_theme", false)) {
result.setObjectField("garbEntrance", null)
if (instance.clientVersionCode >= 7480200) {
garbEntranceClass?.new()?.apply {
setObjectField("uri", "activity://navigation/theme/")
}?.let { result.setObjectField("garbEntrance", it) }
} else {
result.setObjectField("garbEntrance", null)
}
}
}
splashClass, splashShowClass -> if (sPrefs.getBoolean("purify_splash", false) &&
Expand Down Expand Up @@ -382,27 +390,6 @@ class JsonHook(classLoader: ClassLoader) : BaseHook(classLoader) {
) {
result?.clear()
}
categoryClass ->
if (sPrefs.getBoolean("music_notification", false)) {
val hasMusic = result?.any {
it.getObjectFieldAs<String?>("mUri")
?.startsWith("bilibili://music") ?: false
} ?: false
if (!hasMusic) {
result?.add(
categoryClass.new()
.setObjectField("mTypeName", "音頻")
.setObjectField(
"mCoverUrl",
"http://i0.hdslb.com/bfs/archive/85d6dddbdc9746fed91c65c2c3eb3a0a453eadaf.png"
)
.setObjectField("mUri", "bilibili://music/home?from=category")
.setIntField("mType", 1)
.setIntField("mParentTid", 0)
.setIntField("mTid", 65543)
)
}
}
}
}

Expand Down
Loading

0 comments on commit 978bb1b

Please sign in to comment.