feat: fix potential null groupName and implement pocGid fallback callbacks
This commit is contained in:
parent
e807974315
commit
f41557db0e
|
|
@ -101,10 +101,15 @@ class TempCallActivity : AppCompatActivity() {
|
||||||
instance = this
|
instance = this
|
||||||
isMinimized = false
|
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") ?: ""
|
val gid = intent.getStringExtra("gid") ?: ""
|
||||||
currentGroupName = groupName
|
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'); }")
|
MainActivity.executeJs("if(window.startPullGroupLock){ window.startPullGroupLock('$currentTempGroupId'); }")
|
||||||
findViewById<TextView>(R.id.tv_group_name).text = groupName
|
findViewById<TextView>(R.id.tv_group_name).text = groupName
|
||||||
|
|
||||||
|
|
@ -373,17 +378,22 @@ class TempCallActivity : AppCompatActivity() {
|
||||||
val dataArray = json.optJSONArray("data")
|
val dataArray = json.optJSONArray("data")
|
||||||
if (dataArray != null && dataArray.length() > 0) {
|
if (dataArray != null && dataArray.length() > 0) {
|
||||||
val record = dataArray.optJSONObject(0) ?: return
|
val record = dataArray.optJSONObject(0) ?: return
|
||||||
val pullTitle = record.optString("pullTitle", "")
|
val pullTitle = record.optString("pullTitle", "")
|
||||||
val pullTime = record.optString("pullTime", "")
|
val pullTime = record.optString("pullTime", "")
|
||||||
val sourceUnitName = record.optString("sourceUnitName", "")
|
val sourceUnitName = record.optString("sourceUnitName", "")
|
||||||
|
val pocGid = record.optString("pocGid", "")
|
||||||
|
if (pocGid.isNotEmpty()) {
|
||||||
|
currentTempGroupId = pocGid
|
||||||
|
MainActivity.executeJs("if(window.startPullGroupLock){ window.startPullGroupLock('$currentTempGroupId'); }")
|
||||||
|
}
|
||||||
|
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
findViewById<View>(R.id.ll_pull_info)?.visibility = View.VISIBLE
|
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_title)?.text = "标题:$pullTitle"
|
||||||
findViewById<TextView>(R.id.tv_pull_source_unit)?.text = "发送单位:$sourceUnitName"
|
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_time)?.text = "拉动时间:$pullTime"
|
||||||
findViewById<TextView>(R.id.tv_pull_content)?.text = "内容:请注意!正在对你单位进行视频拉动。"
|
findViewById<TextView>(R.id.tv_pull_content)?.text = "内容:请注意!正在对你单位进行视频拉动。"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue