Catch the onCancelled event, and treat as "close" button tap. Also
disable cancel via taps outside the alert, which I think is less
confusing than leaving the unplayable game up without the alert or
closing it without explanation.
BoardDelegate can have a one-to-one relationship to this thing, and
occasional leakage was preventing opening a new alert, so some fix was
needed. This one's simple.
Because I'm doing a singleton thing, if I miss the alert going away I
won't up another up. This tries to always catch dismissal. Might still
be screwed if it's not actually put up for some reason. Needs testing.
Try using both secure and insecure sockets. The latter appears to cause
fewer problems on OS/device combos with crappy BT. It's only possible if
I know the addr of the device I want to, so hack around that being
secret by passing it on request.
If inviting known players to a more-than-two-player game, can select all
at once. Required using checkboxes instead of radiobuttons for the case
where nMissing > 1.
Create new class that owns the alert. Let it decide whether to post,
remove, etc. Seems to work, but I've removed some of the "reinvite"
options I'm not sure were helpful anyway. To be considered...
When thumbnail was required but couldn't be produced list item showed up
tiny as height followed thumbnail's. Instead, when there's no thumbnail
behave as if it's disabled, a layout that looks ok.
There are ways I can't record a close, e.g. user swiping app to kill
it. To avoid that leading to a corrupt-game warning, or to failure to
open in background, drop the count to 0 rather then merely decrementing
it when it closes correctly. Assumption is that if it closes ok once
it's ok.
Invitations over MQTT were handled by different code that always opened
the new game on top of any other open one. Use instead existing code
that puts up a notification instead where appropriate.
I'm fixing android client not showing stats for or allowing to disable
mqtt after it's added automatically to a game that connects
otherwise. Problem was that only the channel got the mqtt address
flag. So now add the flag for any type that's added.
Don't wait for user to tap one of the buttons. Instead notice when
scrolling becomes possible, and offer once per launch until user says
"hide" or clicks the don't-ask-again box.
This won't impact shipping code, but if during development I add then
remove a new INVITEMEANS I can crash with AIOOB trying to load by
ordinal. So check first.
It's simpler this way, and I'm tired of stuff not happening because the
OS chooses not to schedule e.g. an invitation send for minutes. Goal's
to be running BluetoothServerSocket.accept() as much as possible when
there are active BT games in play OR when the game's in the foreground.
If that's happening, sent invitations and moves will be received when
users expect. When there's no traffic and app isn't being brought to
foreground, backoff will ensure I don't try to run accept() too often.
FWIW, BTLE seems to offer a better way to do this (to have an app be
responsive to incoming invitations when it hasn't run in the foreground
in a while), but it requires users to accept FINE_LOCATION
permission. I'm hoping I can make this work to avoid asking for that
permission.
Add a single method to provide candidate devices; don't bother passing
bogus BT MAC addrs; let instance belonging to background-user start
communicating again when user becomes foreground.
I was comparing the wrong strings and so broke deleting known BT
devices. And wanted to see how often since I'd seen them updated, though
every 10 seconds is still 10 seconds.
Some devices unpair themselves and needed to stop being listed so user'd
know to fix. And my Nexus 5x is neither a PHONE nor a COMPUTER per BT,
so accept a larger range of BT classes when scanning.
Working around a bug in Android 11 that broke invitation http urls
getting passed to CrossWords. They always launch the backstop script on
eehouse.org. So modify that script to include a link that will pass the
invitation params to CrossWords via a proprietary scheme it already
registers for. No change to app required!
The last change meant the test whether to show the words under the
pen-down cell would pass when it shouldn't because a drag to an occupied
location didn't register as movement. Change so movement counts to stop
the timer even if it wouldn't change the drag-target's location.
Rather than have a tile revert to its original location if it's dropped
where it can't be (on an occupied tile or outside the board), put it in
the last place it could have been. Do that by only updating cur when
it's to a legal location, and then relocating to cur when drag ends.
If you've bypassed the quick-start game it's probably because you want
to play somebody not yet in the Known Players list. So don't start out
with that list as how you'll invite.
Not at all tested, but now the game's timestamp is kept and passed in to
where it can be used to determine, e.g., which of two Bluetooth device
names to keep for a given opponent.
Got as far as having gtk client display list of previously harvested
known players to be invited. Their addresses, or at least mqtt ids are
saved. Next is to actually invite one.
I have a case where app crashed on launch due to the assert that resend_all()
wasn't being called on a standalone game. That happened because somehow
the game's android-side db entry showed pending packets to send, though the
game type was correct. Fix is to check for game type also, but also to add
a test so comms won't get invoked with a null ptr on release builds.
At least one device was mysteriously losing games. They were winding up
with a group ID for a non-existant group. Now on startup I look for such
games and assign them to a new "recovered games" group. We'll see how
common this is before deciding whether it's a good enough
solution. Another perhaps better solution would be to display all games,
ordered by groups, rather than displaying all known groups and their
games.
On a small-screen (?) emulator (Nexus 5 1080x1920) the icons in the
new-game alerts are huge. Setting their size to 32x32 instead of 120x120
seems to fix this. Haven't tested on more than two devices, on one of
which they were ok before and still are.
Doing away with letting user build a local phone list (left over from
the NBS case where it made sense.) Just launch the default SMS app with
the message and let 'em choose a recipient. Hard to test, but works on
two of two phones so far.
It's coming up too often, sometimes several times in a row so that all
must be dismissed. Until I can detect which result from explicit user
action (tapping a URL) rather than duplicated delivery over MQTT and
bluetooth, this is better.
I'm using model names to detect duplicates, but there are enough that
may not suffice. So add a new random per-device ID to be used only until
the dupes are resolved.
Thanks to my use of unseeded() rand() early on to generate mqtt device
IDs, a handful of devices are using the same devIDs. The server notices
this and passes a new response which triggers generating a new id that
should be unique (rand() being seeded earlier now.) Testing says the
games that are left behind with the old devid will limp along thanks to
their relay connection while newer games will be better.
Not sure this even belongs here, but that decision will wait until BYOD
is online and I have to figure out how people will distribute custom
wordlists.
I'm fixing android client not showing stats for or allowing to disable
mqtt after it's added automatically to a game that connects
otherwise. Problem was that only the channel got the mqtt address
flag. So now add the flag for any type that's added.
Don't wait for user to tap one of the buttons. Instead notice when
scrolling becomes possible, and offer once per launch until user says
"hide" or clicks the don't-ask-again box.
Invitations will now only allow opening the game (Dbg or not) that
created them. Should prevent bogus warnings that games have been
deleted. Impacts only developers and friends running CrossDbg and
CrossWords on the same device. Can still get games going between the two
using room names or invite-by-devid.
Noticed the same emulator would always generate the same MQTT id, even
after a factory reset. That's because I was seeding rand() in that
jni *game* init code, not the (called-earlier) init of the whole jni
world. MQTT id generation happens on app launch before any game can be
opened so was using an unseeded rand().
Supid bug generating keys from __FILE__ meant each release
build (usually done in /tmp/$$, or on a travis server) had a new key and
generated a new MQTT devID (and other stuff less frequently used.)
Replace the keys with something that won't change, and as a temporary
fix so the upgrade including this fix doesn't generate new keys use the
most recent stored key matching the suffix the old keys will have had in
common.
If you're using a monster font and have the keyboard up you might not be
able to touch the "apply filter" button without dismissing the
keyboard. (Hi Deb :.) So make it possible to scroll it into view. Won't
ever become scrollable for most people, and seems to play well with the
scrolling wordlist regardless.
Do away with debug setting to accept duplicate invitations. Change
definition of duplicate to mean specifying a channel and gameID that
already exist. So now send-to-self works without a debug
preference. Accidentally clicking on the same emailed invite twice will
still be blocked. There will be problems if a game's been deleted but
those have probably always been here.
There was a way to get to the sender before its handler had been
initialized. That can only happen on UI thread, so just drop the send
rather than figure out a better way (for now).
As happened with expander arrows on the right when I turned on fast
scrolling, the on-left-side scrollbar was preventing selecting rows when
there were enough list elements for fast scrolling to be enabled. So use
a listener to turn it on only after the user starts to scroll. And move the
bar back to the right side since that's where people expect it.
If a configured-as-host game joined an existing game the relay would
make it a guest. The android util_ callback for that change was only
implemented in BoardDelegate and so the change was dropped unless the
game was open/visible. Because comms recorded the change, though, the
callback would never be called again and so the game never learned to
behave as a guest and never registered: permanent failure to join game!
Implemented with a new server state so initClientConnection can be
called from server_do() instead of inside comms while processing an
incoming packet.