Proxy implemented

This commit is contained in:
Pupil
2020-02-16 19:59:51 +09:00
parent 0d93785581
commit ac1ca71299
16 changed files with 68 additions and 31 deletions

View File

@@ -29,6 +29,7 @@ import android.widget.AdapterView
import android.widget.ArrayAdapter
import androidx.preference.PreferenceManager
import kotlinx.android.synthetic.main.dialog_proxy.view.*
import xyz.quaver.proxy
import xyz.quaver.pupil.R
import xyz.quaver.pupil.util.ProxyInfo
import xyz.quaver.pupil.util.getProxyInfo
@@ -114,9 +115,14 @@ class ProxyDialog(context: Context) : Dialog(context) {
return@setOnClickListener
}
PreferenceManager.getDefaultSharedPreferences(context).edit().putString("proxy",
json.stringify(ProxyInfo.serializer(), ProxyInfo(type, addr, port, username, password))
).apply()
ProxyInfo(type, addr, port, username, password).let {
PreferenceManager.getDefaultSharedPreferences(context).edit().putString("proxy",
json.stringify(ProxyInfo.serializer(), it)
).apply()
proxy = it.proxy()
}
dismiss()
}