feat: fix potential null groupName and implement pocGid fallback callbacks

This commit is contained in:
fengge 2026-07-06 13:28:02 +08:00
parent e807974315
commit f41557db0e
1 changed files with 22 additions and 12 deletions

View File

@ -101,10 +101,15 @@ class TempCallActivity : AppCompatActivity() {
instance = this
isMinimized = false
val groupName = intent.getStringExtra("group_name") ?: "临时会话"
val rawGroupName = intent.getStringExtra("group_name")
val groupName = if (rawGroupName.isNullOrEmpty() || rawGroupName == "null") "临时会话" else rawGroupName
val gid = intent.getStringExtra("gid") ?: ""
currentGroupName = groupName
currentTempGroupId = com.example.kingway.ptt.SendAtUtil.str2HexStr(gid)
currentTempGroupId = if (gid.isNotEmpty()) {
com.example.kingway.ptt.SendAtUtil.str2HexStr(gid)
} else {
com.example.kingway.ptt.SendAtUtil.str2HexStr(groupName)
}
MainActivity.executeJs("if(window.startPullGroupLock){ window.startPullGroupLock('$currentTempGroupId'); }")
findViewById<TextView>(R.id.tv_group_name).text = groupName
@ -373,17 +378,22 @@ class TempCallActivity : AppCompatActivity() {
val dataArray = json.optJSONArray("data")
if (dataArray != null && dataArray.length() > 0) {
val record = dataArray.optJSONObject(0) ?: return
val pullTitle = record.optString("pullTitle", "")
val pullTime = record.optString("pullTime", "")
val sourceUnitName = record.optString("sourceUnitName", "")
val pullTitle = record.optString("pullTitle", "")
val pullTime = record.optString("pullTime", "")
val sourceUnitName = record.optString("sourceUnitName", "")
val pocGid = record.optString("pocGid", "")
if (pocGid.isNotEmpty()) {
currentTempGroupId = pocGid
MainActivity.executeJs("if(window.startPullGroupLock){ window.startPullGroupLock('$currentTempGroupId'); }")
}
runOnUiThread {
findViewById<View>(R.id.ll_pull_info)?.visibility = View.VISIBLE
findViewById<TextView>(R.id.tv_pull_title)?.text = "标题:$pullTitle"
findViewById<TextView>(R.id.tv_pull_source_unit)?.text = "发送单位:$sourceUnitName"
findViewById<TextView>(R.id.tv_pull_time)?.text = "拉动时间:$pullTime"
findViewById<TextView>(R.id.tv_pull_content)?.text = "内容:请注意!正在对你单位进行视频拉动。"
}
runOnUiThread {
findViewById<View>(R.id.ll_pull_info)?.visibility = View.VISIBLE
findViewById<TextView>(R.id.tv_pull_title)?.text = "标题:$pullTitle"
findViewById<TextView>(R.id.tv_pull_source_unit)?.text = "发送单位:$sourceUnitName"
findViewById<TextView>(R.id.tv_pull_time)?.text = "拉动时间:$pullTime"
findViewById<TextView>(R.id.tv_pull_content)?.text = "内容:请注意!正在对你单位进行视频拉动。"
}
}
}
} catch (e: Exception) {