Verified Commit 170d285e authored by Daniel Sonck's avatar Daniel Sonck
Browse files

Fix always saying beta tester

parent 0e63b652
......@@ -30,7 +30,7 @@ deploy:
- build
stage: deploy
script:
- cp $KEYS_JSON app/keys.json
- ln $KEYS_JSON app/keys.json
- ./gradlew publishReleaseBundle --track internal
after_script:
- rm -rf app/keys.json
......
......@@ -53,7 +53,6 @@ import androidx.navigation.fragment.NavHostFragment
import androidx.navigation.ui.*
import ch.derlin.changelog.Changelog
import com.android.volley.RequestQueue
import com.android.volley.Response
import com.android.volley.toolbox.JsonObjectRequest
import com.android.volley.toolbox.Volley
import com.google.android.material.navigation.NavigationView
......@@ -97,7 +96,7 @@ class MainActivity : AppCompatActivity() {
val lastKnownVersion = prefs.getInt("LatestReleaseVersion", 0)
val jsonRequest = JsonObjectRequest("https://www.touhou.fm/app-release.json", null,
Response.Listener { response: JSONObject ->
{ response: JSONObject ->
val supported: Boolean
when {
appVersion < response.getInt("supported") -> {
......@@ -140,6 +139,9 @@ class MainActivity : AppCompatActivity() {
.show()
}
}
appVersion < response.getInt("beta") -> {
supported = true
}
appVersion < response.getInt("alpha") -> {
supported = true
Toast.makeText(this, "Thanks for being a beta tester", LENGTH_LONG).show()
......@@ -153,7 +155,7 @@ class MainActivity : AppCompatActivity() {
prefs.edit().putInt("LatestVersion", appVersion).apply()
Changelog.createDialog(this, versionCode = lastVersion).show()
}
}, Response.ErrorListener {
}, {
Toast.makeText(this, "Failed to check latest version", LENGTH_LONG).show()
})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment