Skip to content

Prototype: several characters at once (Android designs A/B/C, iOS design A) - #49

Draft
Kannamoris wants to merge 5 commits into
developmentfrom
feat/multi-character-prototypes
Draft

Kannamoris wants to merge 5 commits into
developmentfrom
feat/multi-character-prototypes

Conversation

@Kannamoris

Copy link
Copy Markdown
Collaborator

Prototype of running up to three characters at once, one WebView per character, the way desktop gives every tab its own page. Draft: not meant to merge as is.

Android: three switcher designs, picked at build time with SWITCHER_DESIGN and -Pswitcher (tabs, drawer or sheet), each installing beside the normal app as Solstice A, B or C. Without the flag the app builds as before. Also draws the app behind the system bars.

iOS: design A (tab strip above the chat). One WKWebView per character (ChatPage), each with its own bridges, stacked with the active one in front. bridge.js serves the synchronous NativeSessions getters from a copy the host keeps current. Notification taps bring the right character to the front, the badge counts every character, and the audio keep-alive stops only when the last character disconnects. ios.yml builds the bundle with SWITCHER_DESIGN=tabs, so the IPA from this PR is the multi-character app under the normal bundle id.

To check on device:

  • characters in the background keep receiving messages (tab badges update) while the app is open
  • background survival with two or three characters signed in (each is its own web process)
  • notification taps land on the right character
  • logging a character out from its tab

Runs up to three characters at once on Android, one WebView each, the way desktop gives every tab its own page. MainActivity hosts the WebViews with their own bridge instances, so per-character native state such as the log index never mixes, and a NativeSessions bridge relays each page's state (character, status, unread PMs and mentions) to the others and holds what they must share: the account credentials and the API ticket, since F-List cancels older tickets whenever it issues a new one. The background service now stays up until the last character disconnects. A character added from another page logs in with the shared account and leaves the characters already signed in out of its list; a hidden page behaves like a blurred window so its messages count as unread.

The switcher UI is chosen at build time with SWITCHER_DESIGN and -Pswitcher (tabs, drawer or sheet), each installing beside the normal app as Solstice A, B or C: A is a tab strip above the chat like the desktop window, B is a switch-to strip under your character in the left drawer with a dot on the menu button, and C turns the avatar in the chat box into a talking-as sheet. Without the flag the app builds as before. Prototype only: Android, notification taps go to the visible character, and each page keeps its own copy of the app settings.
The app used the Holo theme's black system bars, so a black band sat above the page and another under it, most visible on light themes. MainActivity now draws behind both bars, reports their sizes to each page as --sys-top/right/bottom/left (the bottom drops to 0 while the keyboard is up, since the bar sits under it), and switches the bar icons dark or light through a small NativeView bridge that the page drives from its theme's background. The page pads itself and its modals by those sizes or the iOS safe areas, whichever is larger, and the open drawers and the prototype tab strip stretch under the bars. The keyboard resize now ends the WebView at the keyboard's top edge, since the views start at the screen top.
The chat sits 6px below the tab strip and the open drawer started at the chat's top, so the dimmed backdrop showed through as a dark band between the strip and the drawer. The drawer now reaches up over that gap.
Runs up to three characters at once on iOS, one WKWebView each, like the Android prototype. Each character's page (the new ChatPage) gets its own bridges, so the log index and the native socket with its background buffer never mix. WebViewController stacks the pages and brings the active one to the front instead of hiding the others, so WebKit keeps the background characters' JavaScript running while the app is open.

mobile/sessions.ts reads NativeSessions synchronously, which WKWebView cannot do, so bridge.js answers the getters from a copy that the host seeds in a boot script and updates on every change. The host also holds the shared credentials and API ticket.

Notifications carry the character's page: a tap brings that character to the front before opening the conversation, pages after the first tag their notification ids so two characters can both have a PM open with the same person, and the app badge counts every character. The audio keep-alive is shared and only stops when the last character disconnects. Logging a character out from its tab closes its native socket.

The iOS workflow builds the web bundle with SWITCHER_DESIGN=tabs, so the IPA is the multi-character app under the normal bundle id.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant