Commit 2f7f9310 authored by Mygod's avatar Mygod

Fix NetworkOnMainThreadException

parent 06df4227
...@@ -58,7 +58,10 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro ...@@ -58,7 +58,10 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro
mdg.update(Core.packageInfo.signaturesCompat.first().toByteArray()) mdg.update(Core.packageInfo.signaturesCompat.first().toByteArray())
val (config, success) = RemoteConfig.fetch() val (config, success) = RemoteConfig.fetch()
scheduleConfigUpdate = !success scheduleConfigUpdate = !success
val conn = service.openConnection(URL(config.getString("proxy_url"))) as HttpURLConnection val conn = withContext(Dispatchers.IO) {
// Network.openConnection might use networking, see https://issuetracker.google.com/issues/135242093
service.openConnection(URL(config.getString("proxy_url"))) as HttpURLConnection
}
conn.requestMethod = "POST" conn.requestMethod = "POST"
conn.doOutput = true conn.doOutput = true
......
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