.
This commit is contained in:
parent
f2c3caa061
commit
d78817be05
1 changed files with 22 additions and 26 deletions
|
|
@ -123,33 +123,29 @@ class PoTokenWebViewLoginActivity : BaseActivity() {
|
|||
setResult(RESULT_OK, intent)
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!noAuth) {
|
||||
//update cookies
|
||||
withContext(Dispatchers.IO) {
|
||||
val cookieURL = "Po Token Generated Cookies"
|
||||
cookiesViewModel.getCookiesFromDB(cookieURL).getOrNull()?.let {
|
||||
kotlin.runCatching {
|
||||
cookiesViewModel.insert(
|
||||
CookieItem(
|
||||
0,
|
||||
cookieURL,
|
||||
it,
|
||||
"",
|
||||
true
|
||||
)
|
||||
//update cookies
|
||||
withContext(Dispatchers.IO) {
|
||||
val cookieURL = "Po Token Generated Cookies"
|
||||
cookiesViewModel.getCookiesFromDB(cookieURL).getOrNull()?.let {
|
||||
kotlin.runCatching {
|
||||
cookiesViewModel.insert(
|
||||
CookieItem(
|
||||
0,
|
||||
cookieURL,
|
||||
it,
|
||||
"",
|
||||
true
|
||||
)
|
||||
cookiesViewModel.updateCookiesFile()
|
||||
preferences.edit().putBoolean("use_cookies", true).apply()
|
||||
}.onFailure {
|
||||
withContext(Dispatchers.Main) {
|
||||
Toast.makeText(
|
||||
this@PoTokenWebViewLoginActivity,
|
||||
"Tokens were generated but cookies were not updated",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
)
|
||||
cookiesViewModel.updateCookiesFile()
|
||||
preferences.edit().putBoolean("use_cookies", true).apply()
|
||||
}.onFailure {
|
||||
withContext(Dispatchers.Main) {
|
||||
Toast.makeText(
|
||||
this@PoTokenWebViewLoginActivity,
|
||||
"Tokens were generated but cookies were not updated",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue