缓存上次加入的群组

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