Skip to content

Commit

Permalink
šŸ› Fix(update): Remove "-dev" suffix from version name before comparinā€¦
Browse files Browse the repository at this point in the history
ā€¦g for updates.
  • Loading branch information
maxrave-dev committed Jan 10, 2025
1 parent f68b696 commit 5b50286
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/src/main/java/com/maxrave/simpmusic/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,8 @@ class MainActivity : AppCompatActivity() {
viewModel.checkForUpdate()
viewModel.githubResponse.observe(this) { response ->
if (response != null && !this.isInPictureInPictureMode && !viewModel.showedUpdateDialog) {
Log.w("MainActivity", "Check for update")
Log.w("MainActivity", "Current version: ${getString(R.string.version_format, VersionManager.getVersionName())}")
if (response.tagName != getString(R.string.version_format, VersionManager.getVersionName())) {
viewModel.showedUpdateDialog = true
val inputFormat =
Expand Down
10 changes: 9 additions & 1 deletion app/src/main/java/com/maxrave/simpmusic/utils/VersionManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ object VersionManager {


fun getVersionName(): String {
return versionName ?: String()
return removeDevSuffix(versionName ?: String())
}

private fun removeDevSuffix(versionName: String): String {
return if (versionName.endsWith("-dev")) {
versionName.replace("-dev", "")
} else {
versionName
}
}
}

0 comments on commit 5b50286

Please sign in to comment.