fix(bugcollect): LogQueue 动态获取 bugCollectApiUrl,修复上传 URL 为空问题

- LogQueue.logApiUrl 改为动态 getter,每次上传取最新 URL
- flush() 在 URL 为空时跳过,等下次定时 flush
- LogUploader.resolveUrl 自动补全相对路径
这个提交包含在:
XuqmGroup 2026-06-18 19:16:02 +08:00
父节点 d742317c4d
当前提交 ceaaeca1fe
共有 2 个文件被更改,包括 4 次插入2 次删除

查看文件

@ -180,7 +180,6 @@ object BugCollect {
private fun queue(): LogQueue {
return queue ?: synchronized(this) {
queue ?: LogQueue(
logApiUrl = XuqmSDK.bugCollectApiUrl ?: "",
appKey = XuqmSDK.appKey,
appContext = XuqmSDK.appContext,
).also { queue = it }

查看文件

@ -18,10 +18,11 @@ private fun JSONObject.optNullableString(key: String): String? =
if (has(key) && !isNull(key)) optString(key) else null
internal class LogQueue(
private val logApiUrl: String,
private val appKey: String,
private val appContext: Context,
) {
/** 每次上传时取最新的 URL平台配置可能在队列创建后才下发。 */
private val logApiUrl: String get() = com.xuqm.sdk.XuqmSDK.bugCollectApiUrl ?: ""
companion object {
private const val TAG = "BugCollect"
@ -109,6 +110,8 @@ internal class LogQueue(
}
private fun flush() {
// URL 未就绪时跳过,等下次定时 flush
if (logApiUrl.isBlank()) return
val issues: List<IssueEvent>
val events: List<LogEvent>
synchronized(lock) {