.
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)
|
setResult(RESULT_OK, intent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//update cookies
|
||||||
|
withContext(Dispatchers.IO) {
|
||||||
if (!noAuth) {
|
val cookieURL = "Po Token Generated Cookies"
|
||||||
//update cookies
|
cookiesViewModel.getCookiesFromDB(cookieURL).getOrNull()?.let {
|
||||||
withContext(Dispatchers.IO) {
|
kotlin.runCatching {
|
||||||
val cookieURL = "Po Token Generated Cookies"
|
cookiesViewModel.insert(
|
||||||
cookiesViewModel.getCookiesFromDB(cookieURL).getOrNull()?.let {
|
CookieItem(
|
||||||
kotlin.runCatching {
|
0,
|
||||||
cookiesViewModel.insert(
|
cookieURL,
|
||||||
CookieItem(
|
it,
|
||||||
0,
|
"",
|
||||||
cookieURL,
|
true
|
||||||
it,
|
|
||||||
"",
|
|
||||||
true
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
cookiesViewModel.updateCookiesFile()
|
)
|
||||||
preferences.edit().putBoolean("use_cookies", true).apply()
|
cookiesViewModel.updateCookiesFile()
|
||||||
}.onFailure {
|
preferences.edit().putBoolean("use_cookies", true).apply()
|
||||||
withContext(Dispatchers.Main) {
|
}.onFailure {
|
||||||
Toast.makeText(
|
withContext(Dispatchers.Main) {
|
||||||
this@PoTokenWebViewLoginActivity,
|
Toast.makeText(
|
||||||
"Tokens were generated but cookies were not updated",
|
this@PoTokenWebViewLoginActivity,
|
||||||
Toast.LENGTH_SHORT
|
"Tokens were generated but cookies were not updated",
|
||||||
).show()
|
Toast.LENGTH_SHORT
|
||||||
}
|
).show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue