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