Skip to content

Commit 1ba27a0

Browse files
authored
Merge pull request #121 from hannesa2/FixLint
Fix lint warning
2 parents 68be588 + 3cc60b1 commit 1ba27a0

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

githubAppUpdate/src/main/java/info/hannes/github/AppUpdateHelper.kt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,18 @@ object AppUpdateHelper {
3333
prefs.edit().putLong(key, System.currentTimeMillis()).apply()
3434

3535
val latestRelease = versionList.body()?.firstOrNull()
36-
latestRelease?.let {
37-
val assetApk = it.assets.find { it.name.endsWith("release.apk") }
36+
latestRelease?.let { release ->
37+
val assetApk = release.assets.find { it.name.endsWith("release.apk") }
3838

39-
Log.d("AppUpdateHelper", it.tagName + " > " + currentVersionName + " " + (it.tagName > currentVersionName))
40-
callback?.invoke(it.tagName)
41-
if (it.tagName > currentVersionName) {
39+
Log.d("AppUpdateHelper", release.tagName + " > " + currentVersionName + " " + (release.tagName > currentVersionName))
40+
callback?.invoke(release.tagName)
41+
if (release.tagName > currentVersionName) {
42+
@Suppress("DEPRECATION")
4243
val dialog = AlertDialog.Builder(activity)
4344
.setTitle("New Version on Github")
4445
.setMessage(
4546
"You use version \n$currentVersionName\n" +
46-
"and there is a new version \n${it.tagName}\n" +
47+
"and there is a new version \n${release.tagName}\n" +
4748
"Do you want to download it ?"
4849
)
4950
.setOnCancelListener { dialog ->
@@ -53,7 +54,7 @@ object AppUpdateHelper {
5354
dialog.dismiss()
5455
}
5556
.setPositiveButton(activity.getString(R.string.showRelease)) { dialog, _ ->
56-
val uriUrl = Uri.parse(it.htmlUrl)
57+
val uriUrl = Uri.parse(release.htmlUrl)
5758
Log.d("open", uriUrl.toString())
5859
activity.startActivity(Intent(Intent.ACTION_VIEW, uriUrl))
5960
dialog.dismiss()
@@ -69,7 +70,7 @@ object AppUpdateHelper {
6970
}
7071
dialog.show()
7172
} else {
72-
callback?.invoke("Nothing to do with ${it.tagName}")
73+
callback?.invoke("Nothing to do with ${release.tagName}")
7374
}
7475
}
7576
} catch (e: Exception) {

0 commit comments

Comments
 (0)