This commit is contained in:
parent
776eb9daae
commit
850550c392
|
|
@ -115,9 +115,9 @@ class UpdateManager(private val context: Context) {
|
||||||
if (newVersionCode > currentVersionCode) {
|
if (newVersionCode > currentVersionCode) {
|
||||||
val versionName = data.optString("versionName", "New")
|
val versionName = data.optString("versionName", "New")
|
||||||
val content = data.optString("updateContent", "优化系统体验")
|
val content = data.optString("updateContent", "优化系统体验")
|
||||||
val id = data.optLong("id", -1)
|
val id = data.optString("id", "")
|
||||||
|
|
||||||
if (id != -1L) {
|
if (id != "") {
|
||||||
(context as? AppCompatActivity)?.runOnUiThread {
|
(context as? AppCompatActivity)?.runOnUiThread {
|
||||||
try {
|
try {
|
||||||
showUpdateDialog(versionName, content, id)
|
showUpdateDialog(versionName, content, id)
|
||||||
|
|
@ -144,7 +144,7 @@ class UpdateManager(private val context: Context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showUpdateDialog(versionName: String, content: String, id: Long) {
|
private fun showUpdateDialog(versionName: String, content: String, id: String) {
|
||||||
val view = (context as AppCompatActivity).layoutInflater.inflate(R.layout.dialog_update, null)
|
val view = (context as AppCompatActivity).layoutInflater.inflate(R.layout.dialog_update, null)
|
||||||
val tvTitle = view.findViewById<android.widget.TextView>(R.id.tv_update_title)
|
val tvTitle = view.findViewById<android.widget.TextView>(R.id.tv_update_title)
|
||||||
val tvContent = view.findViewById<android.widget.TextView>(R.id.tv_update_content)
|
val tvContent = view.findViewById<android.widget.TextView>(R.id.tv_update_content)
|
||||||
|
|
@ -162,7 +162,7 @@ class UpdateManager(private val context: Context) {
|
||||||
.setCancelable(false)
|
.setCancelable(false)
|
||||||
.setPositiveButton("立即升级") { _, _ ->
|
.setPositiveButton("立即升级") { _, _ ->
|
||||||
val serverUrl = AppConfig.getServerUrl(context)
|
val serverUrl = AppConfig.getServerUrl(context)
|
||||||
val downloadUrl = "$serverUrl/app-version/download/$id"
|
val downloadUrl = "$serverUrl/api/app-version/download/$id"
|
||||||
startManualDownload(downloadUrl)
|
startManualDownload(downloadUrl)
|
||||||
}
|
}
|
||||||
.setNegativeButton("稍后再说", null)
|
.setNegativeButton("稍后再说", null)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue