This commit is contained in:
parent
24c8289a0d
commit
f840740a1a
|
|
@ -214,7 +214,7 @@ class MainActivity : AppCompatActivity() {
|
|||
setContentView(R.layout.activity_main)
|
||||
|
||||
geckoView = findViewById<GeckoView>(R.id.geckoView)
|
||||
?: return
|
||||
?: return
|
||||
|
||||
findViewById<android.widget.Button>(R.id.btn_retry)?.setOnClickListener {
|
||||
hideErrorPage()
|
||||
|
|
@ -388,7 +388,7 @@ class MainActivity : AppCompatActivity() {
|
|||
val result = handleBridgeCall(payload, prompt.defaultValue ?: "")
|
||||
return GeckoResult.fromValue(prompt.confirm(result))
|
||||
}
|
||||
|
||||
|
||||
// 默认处理(显示对话框)
|
||||
val res = GeckoResult<GeckoSession.PromptDelegate.PromptResponse>()
|
||||
runOnUiThread {
|
||||
|
|
@ -499,19 +499,19 @@ class MainActivity : AppCompatActivity() {
|
|||
fun logout() {
|
||||
runOnUiThread {
|
||||
Timber.tag("MainActivity").i("用户注销,清理程序")
|
||||
|
||||
|
||||
// 1. PTT Logout and cancel login
|
||||
try {
|
||||
com.example.kingway.ptt.SendAtUtil.toCancelLogin()
|
||||
} catch (e: Exception) {
|
||||
Timber.tag("MainActivity").e(e, "PTT cancel failed")
|
||||
}
|
||||
try {
|
||||
com.example.kingway.ptt.SendAtUtil.toLogout()
|
||||
Timber.tag("MainActivity").i("PTT logout sent")
|
||||
} catch (e: Exception) {
|
||||
Timber.tag("MainActivity").e(e, "PTT logout failed")
|
||||
}
|
||||
// try {
|
||||
// com.example.kingway.ptt.SendAtUtil.toCancelLogin()
|
||||
// } catch (e: Exception) {
|
||||
// Timber.tag("MainActivity").e(e, "PTT cancel failed")
|
||||
// }
|
||||
// try {
|
||||
// com.example.kingway.ptt.SendAtUtil.toLogout()
|
||||
// Timber.tag("MainActivity").i("PTT logout sent")
|
||||
// } catch (e: Exception) {
|
||||
// Timber.tag("MainActivity").e(e, "PTT logout failed")
|
||||
// }
|
||||
|
||||
// 2. Stop GPIO listening
|
||||
try {
|
||||
|
|
@ -520,6 +520,20 @@ class MainActivity : AppCompatActivity() {
|
|||
} catch (e: Exception) {
|
||||
Timber.tag("MainActivity").e(e, "GPIO stop failed")
|
||||
}
|
||||
try {
|
||||
resetAutoJumpStates()
|
||||
CallBackResolution.resetPttLoginStatus();
|
||||
}catch (e: Exception) {
|
||||
Timber.tag("MainActivity").e(e, "Failed to clear public value")
|
||||
}
|
||||
|
||||
// 4. Stop and destroy AudioRecord
|
||||
try {
|
||||
com.example.kingway.ptt.AudioRecordManager.destroy()
|
||||
Timber.tag("MainActivity").i("AudioRecordManager destroyed")
|
||||
} catch (e: Exception) {
|
||||
Timber.tag("MainActivity").e(e, "AudioRecordManager destroy failed")
|
||||
}
|
||||
|
||||
// 3. Destroy/release AudioTrack in PTT Native
|
||||
try {
|
||||
|
|
@ -530,14 +544,6 @@ class MainActivity : AppCompatActivity() {
|
|||
Timber.tag("MainActivity").e(e, "PTT native destroy failed")
|
||||
}
|
||||
|
||||
// 4. Stop and destroy AudioRecord
|
||||
try {
|
||||
com.example.kingway.ptt.AudioRecordManager.destroy()
|
||||
Timber.tag("MainActivity").i("AudioRecordManager destroyed")
|
||||
} catch (e: Exception) {
|
||||
Timber.tag("MainActivity").e(e, "AudioRecordManager destroy failed")
|
||||
}
|
||||
|
||||
// 5. Close printer connection and reset
|
||||
try {
|
||||
com.stand.standapp.printer.PrinterManager.destroy()
|
||||
|
|
@ -563,12 +569,6 @@ class MainActivity : AppCompatActivity() {
|
|||
} catch (e: Exception) {
|
||||
Timber.tag("MainActivity").e(e, "Failed to redirect to LoginActivity")
|
||||
}
|
||||
try {
|
||||
resetAutoJumpStates()
|
||||
CallBackResolution.resetPttLoginStatus();
|
||||
}catch (e: Exception) {
|
||||
Timber.tag("MainActivity").e(e, "Failed to clear public value")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue