@@ -13,6 +13,7 @@ import android.os.Build
1313import android.util.Log
1414import android.widget.Toast
1515import androidx.appcompat.app.AlertDialog
16+ import com.github.jing332.tts_server_android.App
1617import com.github.jing332.tts_server_android.R
1718import com.github.jing332.tts_server_android.bean.GithubReleaseApiBean
1819import kotlinx.coroutines.DelicateCoroutinesApi
@@ -26,7 +27,7 @@ import java.math.BigDecimal
2627
2728object MyTools {
2829 const val TAG = " MyTools"
29- private val json = Json { ignoreUnknownKeys = true }
30+ private val json by lazy { App .jsonBuilder }
3031
3132 /* 从Github检查更新*/
3233 @OptIn(DelicateCoroutinesApi ::class )
@@ -90,8 +91,8 @@ object MyTools {
9091 Log .d(TAG , " appVersionName: $appVersion , versionName: $removeVersion " )
9192 if (removeVersion > appVersion) {/* 需要更新 */
9293 runOnUI { downLoadAndInstall(ctx, body, downloadUrl, tag) }
93- } else
94- ctx.toast(R .string.current_is_last_version)
94+ }
95+ // ctx.toast(R.string.current_is_last_version)
9596 }
9697
9798 private fun downLoadAndInstall (
@@ -100,27 +101,26 @@ object MyTools {
100101 downloadUrl : String ,
101102 tag : String
102103 ) {
103-
104104 AlertDialog .Builder (ctx)
105105 .setTitle(" 有新版本" )
106106 .setMessage(" 版本号: $tag \n\n $body " )
107107 .setPositiveButton(
108108 " Github下载"
109- ) { _: DialogInterface ? , _: Int ->
109+ ) { _, _ ->
110110 val intent = Intent (Intent .ACTION_VIEW )
111111 intent.data = Uri .parse(downloadUrl)
112112 intent.flags = Intent .FLAG_ACTIVITY_NEW_TASK
113113 ctx.startActivity(intent)
114114 }
115115 .setNegativeButton(
116116 " Github加速"
117- ) { _: DialogInterface ? , _: Int ->
117+ ) { _, _ ->
118118 val intent = Intent (Intent .ACTION_VIEW )
119119 intent.data = Uri .parse(" https://ghproxy.com/$downloadUrl " )
120120 intent.flags = Intent .FLAG_ACTIVITY_NEW_TASK
121121 ctx.startActivity(intent)
122122 }
123- .create ().show()
123+ .setFadeAnim ().show()
124124 }
125125
126126 /* 添加快捷方式 */
0 commit comments