Skip to content

armgit / andee

Public Imported from GitHub
0

Andee lives on your phone or Mac and uses any app like you do—no integrations, no root, any model; memory and passwords never leave your device | Andee 住进你的手机或 Mac,像你一样操作任何 App——无需集成、无需 Root、支持任意模型,记忆和密码绝不离开设备。

fix(ui): closing a page puts the assistant back full size

booboosuib5ccaf8f6c82
diff --git a/app/src/main/java/net/kuafuai/andee/net/CommandDispatcher.kt b/app/src/main/java/net/kuafuai/andee/net/CommandDispatcher.kt
index 5f29995..8496582 100644
--- a/app/src/main/java/net/kuafuai/andee/net/CommandDispatcher.kt
+++ b/app/src/main/java/net/kuafuai/andee/net/CommandDispatcher.kt
@@ -1338,13 +1338,34 @@ class CommandDispatcher(
* The user dismissed a page. Runs on the main thread, from
* `HtmlActivity.onDestroy`.
*
- * Two jobs, and the second one is why the page can be non-blocking at all:
- * put the ball back (it was hung off the ledge for as long as the page was
- * up) and tell whoever the brain is, since the model is no longer sitting
- * in a tool call waiting to find out.
+ * Three jobs. Put the ball back (it was hung off the ledge for as long as
+ * the page was up), unfold the card — unconditionally, see below — and tell
+ * whoever the brain is, the last of which is why the page can be
+ * non-blocking at all: the model is no longer sitting in a tool call waiting
+ * to find out.
*/
private fun pageClosed(title: String, openedAt: Long) {
window.setPagePerched(false)
+ // And give the card back, full size — whatever shape it was in before
+ // the page went up.
+ //
+ // Deliberately not "only if we folded it", which is what
+ // `BodyCoreService.openPageFrom` does with a local `wasFullscreen`, and
+ // what this did first. A page is something the user asked to read, and
+ // closing it means they are done reading; the assistant coming back is
+ // the plainest reading of that, and a ball in the corner of an app they
+ // do not remember opening is not. Asked for directly, and asked for the
+ // same way once before: closing the self-check card had exactly this
+ // complaint, and the answer there was unconditional too — see
+ // `SelfCheckActivity.onStageLeaving`.
+ //
+ // The cost is real and accepted: a card folded by a `screen.*` call
+ // mid-job is meant to stay folded (see `BodyCoreService.typingFinished`
+ // for that rule) and unfolding here overrides it. What makes it
+ // affordable is that a page is not supposed to go up mid-job at all —
+ // `LocalPrompt` tells the model to wait until the job is done, and the
+ // model is the only thing that can open one.
+ expand()
val seconds = ((android.os.SystemClock.elapsedRealtime() - openedAt) / 1000L).toInt()
runCatching { onPageClosed(title, seconds) }
.onFailure { android.util.Log.w("Body", "page-closed notify failed", it) }