Instead of running the entire toArray of the chatboxes object, we
only render the information we need (id, title, last message text)
which will (hopefully) make for a less resource-hungry function
This is primarily so that we can read the entire chat message that
comes in, not just the beginning part that fits on the screen. The
implementation is still a bit jumpy and needs some work, but at
least you can now use it to have a functional conversation.
Addresses #3 but maybe needs more work.
The original kaios-native-ui was using a fancy mask-image property,
which was unfortunately a bit *too* fancy for KaiOS to handle.
Instead, we've fallen back to good ol' conditions and a number of
new SVGs for the selected version of the checkbox. The drawback is,
of course, that selected checkboxes will perforce be white (which
can be easily overridden to black if so desired, but not so easily
to any other colour: Inkscape is your friend though).
This gives us something prettier than a blank page while the app
is loading (although, of course, it could also prove a bit more
cryptic to debug if something goes wrong).
Closes#5
Earlier, we were using the centre softkey but this is a bit too
easy to trigger by mistake. Now, we use the centre softkey for
the more mundane but arguably equally important "Enter"...which
doesn't actually work because we're using a single-line input and
not a multi-line textarea, but we'll get to that sometime. Or,
maybe the centre key can become something more funky such as...
an emoji selector?
Fixes#4
They were in the main dependencies, which is not really necessary.
Come to think of it, *no* dependencies should be necessary once
the thing is compiled, but the template which this project is
based on kept `sirv` as a main dependency, so I'm keeping it there.
I guess you could argue that sirv is necessary for runtime if
you're going to be running this application on a desktop for some
reason and need someway to serve the app to you.
These helpers are there in the main ConverseJS utils but not in
the headless one; unfortunately they are used in some cases
(while parsing inline emoji) so not having them causes an error.
Ideally we'd patch ConverseJS to include this in the headless
version too, but for now as a quick-fix we're just defining
everything directly in our converse.js itself.
This is the mechanism to automatically scroll to the bottom of
the page when a new message comes in. This is now done by
listening for a change on the "mesages" element and acting upon
that. It's still a bit hacky like the earlier one, but at least
the hack is all in one place.
This is instead of using the stanza directly. To get this to work,
we had to import a couple of other util libraries just so that
they assign their respective utils to Converse's `u` object. This
is probably supposed to happen by itself when the respective
plugins are loaded, but for whatever reason it wasn't happening so
here we are.
We already defined window._converse earlier in the file. (In any
case, both these are temporary globals for debugging; once done
we ideally won't have a floating public _converse like that. Come
to think of it, we won't have a floating converse without the
underscore either!)
We forgot to break the switch-case after the middle softkey's
callback, which meant the middle key was calling the right
softkey's action too, causing all sorts of confusion. (Maybe a
sign not to use switch-case? 😛)
They're needed to navigate through the text you're editing, so
having them jump out to the next input field (or whatever it is)
instead is very annoying
The two main stumbling blocks were a tiny line in rollup's config
and the need to import the emoji utils to make the isOnlyEmojis
function available to parseMessage. Both with tiny code changes,
but it took a days' worth of hunting and debugging to get here!
For want of a nail...