mirror of
https://github.com/Corewala/Buran
synced 2024-12-22 07:42:43 +00:00
Update checking function
This commit is contained in:
parent
4cd0e1977b
commit
48c7339d57
1 changed files with 28 additions and 0 deletions
28
app/src/main/java/corewala/buran/io/update/BuranUpdates.kt
Normal file
28
app/src/main/java/corewala/buran/io/update/BuranUpdates.kt
Normal file
|
@ -0,0 +1,28 @@
|
|||
package corewala.buran.io.update
|
||||
|
||||
import java.net.URL
|
||||
import java.net.HttpURLConnection
|
||||
|
||||
|
||||
class BuranUpdates {
|
||||
|
||||
fun getLatestVersion(): String {
|
||||
var latestVersion = ""
|
||||
|
||||
val updateCheckThread = Thread {
|
||||
val url = "https://github.com/Corewala/Buran/releases/latest"
|
||||
|
||||
val con = URL(url).openConnection() as HttpURLConnection
|
||||
con.connect()
|
||||
con.getInputStream()
|
||||
|
||||
latestVersion = con.getURL().toString().drop(47)
|
||||
}
|
||||
|
||||
updateCheckThread.start()
|
||||
updateCheckThread.join()
|
||||
println("Latest version: $latestVersion")
|
||||
|
||||
return latestVersion
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue