Skip to content

Commit

Permalink
Update checking function
Browse files Browse the repository at this point in the history
  • Loading branch information
Corewala committed Mar 7, 2022
1 parent 4cd0e19 commit 48c7339
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions app/src/main/java/corewala/buran/io/update/BuranUpdates.kt
Original file line number Diff line number Diff line change
@@ -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
}
}

0 comments on commit 48c7339

Please sign in to comment.