缓存上次加入的群组

This commit is contained in:
fengge 2026-07-01 09:43:44 +08:00
parent 923c88c595
commit b3c7e243b5
1 changed files with 20 additions and 20 deletions

View File

@ -76,26 +76,26 @@ class MainActivity : AppCompatActivity() {
@JvmStatic
fun checkAndAutoJumpToLastGroup() {
synchronized(this) {
if (hasFirstGroupEntered && hasPageFinished && !hasAutoJumped) {
hasAutoJumped = true
instance?.let { ctx ->
val lastGroupId = AppConfig.getLastGroupId(ctx)
if (lastGroupId.isNotEmpty()) {
Timber.tag("PTT").d("Both conditions met. Auto-jumping to last joined group: %s after 2s delay", lastGroupId)
ctx.runOnUiThread {
android.os.Handler(android.os.Looper.getMainLooper()).postDelayed({
instance?.pttInterface?.pttJumpGroup(lastGroupId)
}, 1000)
}
} else {
Timber.tag("PTT").d("Both conditions met but lastGroupId is empty, skip auto-jump")
}
}
} else {
Timber.tag("PTT").d("Check auto jump: hasFirstGroupEntered=$hasFirstGroupEntered, hasPageFinished=$hasPageFinished, hasAutoJumped=$hasAutoJumped")
}
}
// synchronized(this) {
// if (hasFirstGroupEntered && hasPageFinished && !hasAutoJumped) {
// hasAutoJumped = true
// instance?.let { ctx ->
// val lastGroupId = AppConfig.getLastGroupId(ctx)
// if (lastGroupId.isNotEmpty()) {
// Timber.tag("PTT").d("Both conditions met. Auto-jumping to last joined group: %s after 2s delay", lastGroupId)
// ctx.runOnUiThread {
// android.os.Handler(android.os.Looper.getMainLooper()).postDelayed({
// instance?.pttInterface?.pttJumpGroup(lastGroupId)
// }, 1000)
// }
// } else {
// Timber.tag("PTT").d("Both conditions met but lastGroupId is empty, skip auto-jump")
// }
// }
// } else {
// Timber.tag("PTT").d("Check auto jump: hasFirstGroupEntered=$hasFirstGroupEntered, hasPageFinished=$hasPageFinished, hasAutoJumped=$hasAutoJumped")
// }
// }
}
@JvmStatic