强制退出
This commit is contained in:
parent
97276904ff
commit
8a2f418831
|
|
@ -185,6 +185,7 @@
|
||||||
<button class="btn ptt-btn ptt-action-btn" style="background: #8b5cf6;" onclick="pttGetMembers()" disabled>获取成员</button>
|
<button class="btn ptt-btn ptt-action-btn" style="background: #8b5cf6;" onclick="pttGetMembers()" disabled>获取成员</button>
|
||||||
<button class="btn ptt-btn ptt-action-btn" style="background: #3b82f6;" onclick="pttJumpGroup()" disabled>切换群组</button>
|
<button class="btn ptt-btn ptt-action-btn" style="background: #3b82f6;" onclick="pttJumpGroup()" disabled>切换群组</button>
|
||||||
<button class="btn ptt-btn ptt-action-btn btn-orange" onclick="pttForceRelease()" disabled>强制释放</button>
|
<button class="btn ptt-btn ptt-action-btn btn-orange" onclick="pttForceRelease()" disabled>强制释放</button>
|
||||||
|
<button class="btn ptt-btn ptt-action-btn" style="background: #000; color: #fca5a5;" onclick="pttSimulateConflict()" disabled>模拟冲突</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="ptt-result" class="log-container" style="background: #0f172a; margin-top: 10px; height: 120px;">
|
<div id="ptt-result" class="log-container" style="background: #0f172a; margin-top: 10px; height: 120px;">
|
||||||
|
|
@ -759,6 +760,13 @@
|
||||||
showPttResult("执行强制释放");
|
showPttResult("执行强制释放");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function pttSimulateConflict() {
|
||||||
|
if (window.android && window.android.simulatePttConflict) {
|
||||||
|
window.android.simulatePttConflict();
|
||||||
|
showPttResult("已触发模拟账号冲突");
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,16 @@ class AndroidInterface(private val activity: MainActivity) {
|
||||||
SendAtUtil.getGroupMemberInfo(gid)
|
SendAtUtil.getGroupMemberInfo(gid)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模拟 PTT 账号冲突 (测试用)
|
||||||
|
*/
|
||||||
|
@JavascriptInterface
|
||||||
|
fun simulatePttConflict() {
|
||||||
|
Handler(Looper.getMainLooper()).post {
|
||||||
|
MainActivity.showPttConflictDialog()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PTT 切换群组
|
* PTT 切换群组
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.stand.standapp
|
package com.stand.standapp
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.KeyEvent
|
import android.view.KeyEvent
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
|
@ -58,6 +59,25 @@ class MainActivity : AppCompatActivity() {
|
||||||
executeJs("onHardwarePttUp")
|
executeJs("onHardwarePttUp")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun showPttConflictDialog() {
|
||||||
|
instance?.runOnUiThread {
|
||||||
|
val ctx = instance ?: return@runOnUiThread
|
||||||
|
androidx.appcompat.app.AlertDialog.Builder(ctx)
|
||||||
|
.setTitle("账号冲突")
|
||||||
|
.setMessage("您的 PTT 账号已在其他设备登录,当前设备已被迫下线。\n请点击确认退出并重新登录。")
|
||||||
|
.setCancelable(false)
|
||||||
|
.setPositiveButton("确认") { _, _ ->
|
||||||
|
val pm = ctx.packageManager
|
||||||
|
val intent = pm.getLaunchIntentForPackage(ctx.packageName)
|
||||||
|
intent?.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||||
|
ctx.startActivity(intent)
|
||||||
|
android.os.Process.killProcess(android.os.Process.myPid())
|
||||||
|
}
|
||||||
|
.show()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private var mAgentWeb: AgentWeb? = null
|
private var mAgentWeb: AgentWeb? = null
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue