Fix session loss on restart; English-only resources
Some checks failed
build / apk (push) Has been cancelled
Some checks failed
build / apk (push) Has been cancelled
- flush the WebView cookie store in onStop/onPageFinished: Chromium batches cookie writes, so the session could be lost when Android killed the process - English default strings + values-ru translations - bump to 1.0.1
This commit is contained in:
parent
8a2a075894
commit
ed08921a78
4 changed files with 26 additions and 7 deletions
|
|
@ -11,8 +11,8 @@ android {
|
|||
applicationId = "dev.n1ko.nikogpt"
|
||||
minSdk = 29 // Android 10
|
||||
targetSdk = 35
|
||||
versionCode = 1
|
||||
versionName = "1.0.0"
|
||||
versionCode = 2
|
||||
versionName = "1.0.1"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
|
|
|
|||
|
|
@ -133,6 +133,8 @@ class MainActivity : AppCompatActivity() {
|
|||
override fun onPageFinished(view: WebView, url: String) {
|
||||
refresh.isRefreshing = false
|
||||
progress.visibility = View.GONE
|
||||
// Persist cookies (the session) right after the page settles.
|
||||
CookieManager.getInstance().flush()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -205,6 +207,14 @@ class MainActivity : AppCompatActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
super.onStop()
|
||||
// Chromium writes cookies in batches: without an explicit flush the
|
||||
// session cookie can be lost when Android kills the process, so the
|
||||
// user would have to log in again after every restart.
|
||||
CookieManager.getInstance().flush()
|
||||
}
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
super.onSaveInstanceState(outState)
|
||||
webView.saveState(outState)
|
||||
|
|
|
|||
9
app/src/main/res/values-ru/strings.xml
Normal file
9
app/src/main/res/values-ru/strings.xml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">NikoGPT</string>
|
||||
<string name="retry">Повторить</string>
|
||||
<string name="load_error">Не удалось загрузить chat.n1ko.dev\n\n%1$s</string>
|
||||
<string name="no_app">Нет приложения, которое может открыть эту ссылку</string>
|
||||
<string name="download_started">Загрузка началась</string>
|
||||
<string name="download_failed">Не удалось начать загрузку</string>
|
||||
</resources>
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">NikoGPT</string>
|
||||
<string name="retry">Повторить</string>
|
||||
<string name="load_error">Не удалось загрузить chat.n1ko.dev\n\n%1$s</string>
|
||||
<string name="no_app">Нет приложения, которое может открыть эту ссылку</string>
|
||||
<string name="download_started">Загрузка началась</string>
|
||||
<string name="download_failed">Не удалось начать загрузку</string>
|
||||
<string name="retry">Retry</string>
|
||||
<string name="load_error">Could not load chat.n1ko.dev\n\n%1$s</string>
|
||||
<string name="no_app">No app can open this link</string>
|
||||
<string name="download_started">Download started</string>
|
||||
<string name="download_failed">Could not start the download</string>
|
||||
</resources>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue