Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
GangJust committed Jun 18, 2024
1 parent 37f1502 commit 2499805
Show file tree
Hide file tree
Showing 24 changed files with 114 additions and 91 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ android {
applicationId "io.github.fplus"
minSdk 24
targetSdk 33
versionCode 126
versionName "1.3.0"
versionCode 128
versionName "1.3.1"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/assets/update.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
v1.3.1
增加横屏播放单独的状态栏沉浸逻辑
增加根据内容自动匹配下载文件的格式 (表情包无法发送微信问题)
调整不再需要手动勾选崩溃容错处理 (默认给你们开了)
调整改回下载链接取为取第一项 (格式不统一问题)
修复部分情况下复制链接为前一个视频问题
修复新版本下清爽模式偶尔不隐藏顶、底部控件问题
修复其它已知问题

v1.3.0
增加官方自动连播默认开启选项
修复定时、空闲退出计时冲突问题
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/assets/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.0-126
1.3.1-128
9 changes: 4 additions & 5 deletions app/src/main/java/io/github/fplus/activity/HomeActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import androidx.compose.foundation.clickable
import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
Expand Down Expand Up @@ -419,7 +418,7 @@ class HomeActivity : ComponentActivity() {
text = buildAnnotatedString {
append("该操作将清空")
withStyle(SpanStyle(Color.Red)) {
append("数据目录")
append("下载目录")
}
append("包括下载的")
withStyle(SpanStyle(Color.Red)) {
Expand Down Expand Up @@ -454,17 +453,17 @@ class HomeActivity : ComponentActivity() {
Icon(
modifier = Modifier.size(24.dp),
painter = painterResource(id = R.drawable.ic_find_file),
contentDescription = "数据目录",
contentDescription = "下载目录",
tint = Themes.nowColors.icon,
)
Spacer(modifier = Modifier.padding(horizontal = 8.dp))
Column {
Text(
text = "数据目录: `外置存储器/Download/Freedom`",
text = "下载目录: `外置存储器/Download/Freedom`",
style = Themes.nowTypography.body1,
)
Text(
text = "长按清空数据目录",
text = "长按清空下载目录",
style = Themes.nowTypography.overline,
)
}
Expand Down
25 changes: 18 additions & 7 deletions core/src/main/java/io/github/fplus/core/helper/DexkitBuilder.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package io.github.fplus.core.helper

import android.app.Application
import com.freegang.extension.appLastUpdateTime
import com.freegang.extension.appVersionCode
import com.freegang.extension.appVersionName
import com.freegang.extension.getIntOrDefault
import com.freegang.extension.getJSONArrayOrDefault
import com.freegang.extension.getLongOrDefault
import com.freegang.extension.getStringOrDefault
import com.freegang.ktutils.log.KLogCat
import com.freegang.ktutils.text.KTextUtils
Expand Down Expand Up @@ -607,16 +609,13 @@ object DexkitBuilder {
add {
type = "com.ss.android.ugc.aweme.feed.model.VideoItemParams"
}

add {
type = "com.ss.android.ugc.aweme.feed.plato.business.mainarchitecture.tablandguide.TabId"
}
}
methods {
add {
paramTypes = listOf("com.ss.android.ugc.aweme.feed.model.VideoItemParams")
}
}
usingStrings = listOf("TabLandGuidePresenter", "tabLandingActionBtn")
}
}
tabLandingClazz = tabLanding.instance("tabLanding")
Expand Down Expand Up @@ -661,9 +660,19 @@ object DexkitBuilder {

// version
val version = cache.getIntOrDefault("version")
val appVersion = cache.getStringOrDefault("appVersion")
val appVersionName = cache.getStringOrDefault("appVersionName")
val appVersionCode = cache.getLongOrDefault("appVersionCode", 0)
val appLastUpdateTime = cache.getLongOrDefault("appLastUpdateTime")

if (appVersionName != app!!.appVersionName) {
return false
}

if (appVersionCode != app!!.appVersionCode) {
return false
}

if (appVersion.compareTo("${app!!.appVersionName}_${app!!.appVersionCode}") != 0) {
if (appLastUpdateTime != app!!.appLastUpdateTime) {
return false
}

Expand Down Expand Up @@ -727,7 +736,9 @@ object DexkitBuilder {
private fun saveCache() {
// version
cacheJson.put("version", "$cacheVersion")
cacheJson.put("appVersion", "${app!!.appVersionName}_${app!!.appVersionCode}")
cacheJson.put("appVersionName", app!!.appVersionName)
cacheJson.put("appVersionCode", app!!.appVersionCode)
cacheJson.put("appLastUpdateTime", app!!.appLastUpdateTime)

// cache
cacheJson.put("class", classCacheJson)
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/io/github/fplus/core/hook/DouYinMain.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class DouYinMain(private val app: Application) {
// search and hook
DexkitBuilder.running(
app = app,
version = 23,
version = 24,
searchBefore = {
HActivity()
HMainActivity()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.LinearLayout
import androidx.core.view.children
import androidx.core.view.isVisible
import androidx.core.view.updatePadding
import com.freegang.extension.asOrNull
import com.freegang.extension.dip2px
import com.freegang.extension.firstOrNull
import com.freegang.extension.firstParentOrNull
Expand Down Expand Up @@ -43,14 +43,16 @@ class HAbstractFeedAdapter : BaseHook() {
i: Int,
) {
hookBlockRunning(params) {
if (!config.isImmersive) return
if (!config.isImmersive)
return

// KLogCat.d("view: $view")
if (view is FrameLayout && view !is VideoViewHolderRootView) {

// 垫高
view.forEachChild { if (it.background is GradientDrawable) it.background = null }
val bottomPadding = view.context.dip2px(58f) // BottomTabBarHeight
val viewGroup = view.children.lastOrNull()?.asOrNull<ViewGroup>() ?: return
val viewGroup = view.children.lastOrNull { it is ViewGroup && it.isVisible } ?: return
viewGroup.updatePadding(bottom = bottomPadding)

singleLaunchMain {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class HCrashTolerance : BaseHook() {
}

override fun onInit() {
if (!config.isCrashTolerance)
return
// if (!config.isCrashTolerance)
// return

HPoiFeed()
HLivePhoto()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,8 @@ class HDetailActivity : BaseHook() {
return

val method = activity.method(returnType = Aweme::class.java)
val aweme = method?.invoke(activity)?.asOrNull<Aweme>()
?: HVideoViewHolder.aweme

clipboardLogic.addClipboardListener(activity) { _, _ ->
val aweme = method?.invoke(activity)?.asOrNull<Aweme>()

DownloadLogic(
this@HDetailActivity,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class HEmojiDetailDialogNew : BaseHook() {
override fun onInit() {

lpparam.hookClass(EmojiDetailDialogNew::class.java)
.constructorsAll {
.constructorAll {
onBefore {
if (argsOrEmpty.isEmpty())
return@onBefore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,9 @@ class HEmojiPopupWindow : BaseHook() {
if (!config.isEmojiDownload)
return

popUrlList = popUrlList.ifEmpty {
emoji?.detailEmoji?.animateUrl?.urlList
?: emoji?.detailEmoji?.staticUrl?.urlList
?: emptyList()
}
popUrlList = emoji?.detailEmoji?.animateUrl?.urlList
?: emoji?.detailEmoji?.staticUrl?.urlList
?: emptyList()
}.onFailure {
XplerLog.e(it)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.ss.android.ugc.aweme.longervideo.landscape.home.activity.LandscapeFee
import de.robv.android.xposed.XC_MethodHook
import io.github.fplus.core.base.BaseHook
import io.github.fplus.core.config.ConfigV1
import io.github.fplus.core.helper.ImmersiveHelper
import io.github.fplus.core.hook.logic.ClipboardLogic
import io.github.fplus.core.hook.logic.DownloadLogic
import io.github.xpler.core.entity.OnAfter
Expand All @@ -33,6 +34,11 @@ class HLandscapeFeedActivity : BaseHook() {
fun onResumeAfter(params: XC_MethodHook.MethodHookParam) {
hookBlockRunning(params) {
addClipboardListener(thisActivity)
ImmersiveHelper.immersive(
thisActivity,
hideStatusBar = true,
hideNavigationBars = true,
)
}.onFailure {
XplerLog.e(it)
}
Expand All @@ -47,6 +53,20 @@ class HLandscapeFeedActivity : BaseHook() {
}
}

@OnBefore("onWindowFocusChanged")
@OnAfter("onWindowFocusChanged")
fun onWindowFocusChangedAfter(params: XC_MethodHook.MethodHookParam, boolean: Boolean) {
hookBlockRunning(params) {
ImmersiveHelper.immersive(
thisActivity,
hideStatusBar = true,
hideNavigationBars = true,
)
}.onFailure {
XplerLog.e(it)
}
}

private fun addClipboardListener(activity: Activity) {
if (!config.isDownload)
return
Expand Down
10 changes: 0 additions & 10 deletions core/src/main/java/io/github/fplus/core/hook/HMainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,6 @@ class HMainActivity : BaseHook() {
XplerLog.d("version: ${KtXposedHelpers.moduleVersionName(activity)} - ${activity.appVersionName}(${activity.appVersionCode})")
DouYinMain.timerExitHelper?.restart()

// test
/* runCatching {
val helper = findClass("X.0Suh").newInstance().methodInvoke("LIZ", args = arrayOf(activity))
KLogCat.d("helper: $helper")
helper?.method("LIZ", paramTypes = arrayOf(helper::class.java, String::class.java, Int::class.java, Any::class.java))
?.invoke(helper, helper, null, 1, null)
}.onFailure {
KLogCat.d("调用失败: $it")
} */

openAutoPlay(activity)
}.onFailure {
XplerLog.e(it)
Expand Down
49 changes: 23 additions & 26 deletions core/src/main/java/io/github/fplus/core/hook/HPlayerController.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.github.fplus.core.hook

import android.view.View
import androidx.core.view.isVisible
import com.freegang.extension.asOrNull
import com.freegang.extension.fields
Expand All @@ -10,6 +9,7 @@ import com.ss.android.ugc.aweme.feed.ui.PenetrateTouchRelativeLayout
import de.robv.android.xposed.XC_MethodHook
import io.github.fplus.core.base.BaseHook
import io.github.fplus.core.config.ConfigV1
import io.github.xpler.core.entity.OnAfter
import io.github.xpler.core.entity.OnBefore
import io.github.xpler.core.hookBlockRunning
import io.github.xpler.core.log.XplerLog
Expand Down Expand Up @@ -46,6 +46,7 @@ class HPlayerController : BaseHook() {
@OnBefore("onResumePlay")
fun onResumePlayBefore(params: XC_MethodHook.MethodHookParam, aid: String?) {
hookBlockRunning(params) {
// XplerLog.d("onResumePlay: $aid")
playingAid = aid
isPlaying = true
callOpenCleanMode(params, true)
Expand All @@ -55,40 +56,52 @@ class HPlayerController : BaseHook() {
}

@OnBefore("onPausePlay")
fun onPausePlayAfter(params: XC_MethodHook.MethodHookParam, aid: String?) {
fun onPausePlayBefore(params: XC_MethodHook.MethodHookParam, aid: String?) {
hookBlockRunning(params) {
// XplerLog.d("onPausePlay: $aid")
if (playingAid == aid) {
isPlaying = false
callOpenCleanMode(params, false)
}
callOpenCleanMode(params, false)
}.onFailure {
XplerLog.e(it)
}
}

// @OnBefore("onPlayStop")
fun onPlayStopBefore(params: XC_MethodHook.MethodHookParam, aid: String?) {
hookBlockRunning(params) {
// XplerLog.d("onPlayStop: $aid")
if (playingAid == aid) {
isPlaying = false
callOpenCleanMode(params, false)
}
}.onFailure {
XplerLog.tagE(TAG, it)
}
}

// @OnBefore("onPlayCompleted")
fun onPlayCompletedAfter(params: XC_MethodHook.MethodHookParam, aid: String?) {
hookBlockRunning(params) {
// isPlaying = false
// callOpenCleanMode(params, false)
// XplerLog.d("onPlayCompleted: $aid")
isPlaying = false
}.onFailure {
XplerLog.e(it)
}
}

@OnBefore("onPlayCompletedFirstTime")
// @OnAfter("onPlayCompletedFirstTime")
fun onPlayCompletedFirstTimeAfter(params: XC_MethodHook.MethodHookParam, aid: String?) {
hookBlockRunning(params) {
// isPlaying = false
// callOpenCleanMode(params, false)
// onSwipeUp(params)
// XplerLog.d("onPlayCompletedFirstTime: $aid")
isPlaying = false
}.onFailure {
XplerLog.e(it)
}
}

@OnBefore("onPlayProgressChange")
@OnAfter("onPlayProgressChange")
fun onPlayProgressChangeBefore(
params: XC_MethodHook.MethodHookParam, aid: String?,
current: Long,
Expand All @@ -97,7 +110,6 @@ class HPlayerController : BaseHook() {
hookBlockRunning(params) {
playingAid = aid
isPlaying = true
// callOpenCleanMode(params, false)
}.onFailure {
XplerLog.e(it)
}
Expand Down Expand Up @@ -126,19 +138,4 @@ class HPlayerController : BaseHook() {
view?.isVisible = !bool
HMainActivity.toggleView(!bool)
}

private fun onSwipeUp(params: XC_MethodHook.MethodHookParam) {
val method = params.thisObject
.methods(returnType = VideoViewHolder::class.java)
.firstOrNull { it.parameterTypes.isEmpty() }
val videoViewHolder = method?.invoke(params.thisObject)

val fields = videoViewHolder
?.fields(type = View::class.java)

fields?.map { "\nfield: ${it}\nvalue: ${it.get(videoViewHolder)}" }
?.let {
XplerLog.d(*it.toTypedArray())
}
}
}
Loading

0 comments on commit 2499805

Please sign in to comment.