Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad92e93660 |
2 changed files with 17 additions and 2 deletions
|
|
@ -22,8 +22,8 @@ android {
|
||||||
applicationId = "dev.n1ko.nikogpt"
|
applicationId = "dev.n1ko.nikogpt"
|
||||||
minSdk = 29 // Android 10
|
minSdk = 29 // Android 10
|
||||||
targetSdk = 35
|
targetSdk = 35
|
||||||
versionCode = 7
|
versionCode = 8
|
||||||
versionName = "1.2.1"
|
versionName = "1.2.2"
|
||||||
}
|
}
|
||||||
|
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,10 @@ class MainActivity : AppCompatActivity() {
|
||||||
|
|
||||||
// Shared text ("Share to NikoGPT") waiting for the page to load.
|
// Shared text ("Share to NikoGPT") waiting for the page to load.
|
||||||
private var pendingShare: String? = null
|
private var pendingShare: String? = null
|
||||||
|
// Whether the chat's inner scroll container is at the top; pull-to-refresh
|
||||||
|
// only fires there (the WebView itself never scrolls).
|
||||||
|
@Volatile
|
||||||
|
private var webAtTop = true
|
||||||
// Where the camera writes the picture before it reaches the web app.
|
// Where the camera writes the picture before it reaches the web app.
|
||||||
private var pendingCameraUri: Uri? = null
|
private var pendingCameraUri: Uri? = null
|
||||||
|
|
||||||
|
|
@ -276,6 +280,10 @@ class MainActivity : AppCompatActivity() {
|
||||||
})
|
})
|
||||||
|
|
||||||
refresh.setOnRefreshListener { webView.reload() }
|
refresh.setOnRefreshListener { webView.reload() }
|
||||||
|
// Pull-to-refresh only when the chat list is really at the top; a
|
||||||
|
// bigger trigger distance keeps normal scrolling from reloading.
|
||||||
|
refresh.setOnChildScrollUpCallback { _, _ -> !webAtTop }
|
||||||
|
refresh.setDistanceToTriggerSync((80 * resources.displayMetrics.density).toInt())
|
||||||
|
|
||||||
onBackPressedDispatcher.addCallback(this, object : OnBackPressedCallback(true) {
|
onBackPressedDispatcher.addCallback(this, object : OnBackPressedCallback(true) {
|
||||||
override fun handleOnBackPressed() {
|
override fun handleOnBackPressed() {
|
||||||
|
|
@ -352,6 +360,13 @@ class MainActivity : AppCompatActivity() {
|
||||||
fun linkGoogle(clientId: String) {
|
fun linkGoogle(clientId: String) {
|
||||||
runOnUiThread { openGooglePicker(clientId, link = true) }
|
runOnUiThread { openGooglePicker(clientId, link = true) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The web app reports the message list's scroll position, so pulling
|
||||||
|
// down only refreshes when the list really is at the top.
|
||||||
|
@JavascriptInterface
|
||||||
|
fun setAtTop(atTop: Boolean) {
|
||||||
|
webAtTop = atTop
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// openGooglePicker tries the native pickers in order: Credential Manager
|
// openGooglePicker tries the native pickers in order: Credential Manager
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue