deal with case where invitation includes only conntypes not supported

on device, e.g. sms-only sent to a tablet. Strip the unsupported types
when creating the game, and then on game open suggest to user he
delete (with explanation)
This commit is contained in:
Eric House 2015-06-19 07:51:51 -07:00
parent d27fdbd748
commit 8354f45548
5 changed files with 286 additions and 255 deletions

File diff suppressed because it is too large Load diff

View file

@ -1972,6 +1972,10 @@
<!-- -->
<string name="game_list_tmp">Building game summary…</string>
<string name="connstat_net_noaddr">This networked game has no way
to connect and will never be playable.\n\n(It was probably created
from an invitation that didn\'t specify any way of connecting
that your device supports.)</string>
<!-- -->
<string name="connstat_net_fmt">Network status for game connected via
%1$s:</string>

View file

@ -1708,6 +1708,10 @@
<string name="board_menu_dict">Esworb tsildrow</string>
<!-- -->
<string name="game_list_tmp">Gnidliub emag yrammus…</string>
<string name="connstat_net_noaddr">Siht dekrowten emag sah on yaw
ot tcennoc dna lliw reven eb elbayalp.\n\ntI( saw ylbaborp detaerc
morf na noitativni taht ndid\'t yficeps yna yaw fo gnitcennoc
taht ruoy ecived stroppus.)</string>
<!-- -->
<string name="connstat_net_fmt">Krowten sutats rof emag detcennoc aiv
%1$s:</string>

View file

@ -1708,6 +1708,10 @@
<string name="board_menu_dict">BROWSE WORDLIST</string>
<!-- -->
<string name="game_list_tmp">BUILDING GAME SUMMARY…</string>
<string name="connstat_net_noaddr">THIS NETWORKED GAME HAS NO WAY
TO CONNECT AND WILL NEVER BE PLAYABLE.\n\n(IT WAS PROBABLY CREATED
FROM AN INVITATION THAT DIDN\'T SPECIFY ANY WAY OF CONNECTING
THAT YOUR DEVICE SUPPORTS.)</string>
<!-- -->
<string name="connstat_net_fmt">NETWORK STATUS FOR GAME CONNECTED VIA
%1$s:</string>

View file

@ -291,10 +291,7 @@ public class BoardDelegate extends DelegateBase
lstnr = new OnClickListener() {
public void onClick( DialogInterface dlg,
int whichButton ) {
waitCloseGame( false );
GameUtils.deleteGame( m_activity, m_rowid, false );
finish();
deleteAndClose();
}
};
ab.setNegativeButton( R.string.button_delete, lstnr );
@ -1016,6 +1013,9 @@ public class BoardDelegate extends DelegateBase
case DROP_RELAY_ACTION:
dropRelayAndRestart();
break;
case DELETE_AND_EXIT:
deleteAndClose();
break;
default:
handled = false;
}
@ -1293,15 +1293,17 @@ public class BoardDelegate extends DelegateBase
public void onStatusClicked()
{
final String msg = ConnStatusHandler.getStatusText( m_activity, m_connTypes );
if ( null != msg ) {
post( new Runnable() {
public void run() {
post( new Runnable() {
public void run() {
if ( null == msg ) {
askNoAddrsDelete();
} else {
m_dlgBytes = msg;
m_dlgTitle = R.string.info_title;
showDialog( DlgID.DLG_CONNSTAT );
}
} );
}
}
} );
}
public Handler getHandler()
@ -1309,6 +1311,20 @@ public class BoardDelegate extends DelegateBase
return m_handler;
}
private void deleteAndClose()
{
waitCloseGame( false );
GameUtils.deleteGame( m_activity, m_rowid, false );
finish();
}
private void askNoAddrsDelete()
{
showConfirmThen( R.string.connstat_net_noaddr,
R.string.list_item_delete,
Action.DELETE_AND_EXIT );
}
private void askDropRelay()
{
String msg = getString( R.string.confirm_drop_relay );
@ -1775,7 +1791,9 @@ public class BoardDelegate extends DelegateBase
m_nMissing = nMissing; // will be 0 unless isServer is true
if ( 0 < nMissing && isServer && !m_haveInvited ) {
if ( null != connTypes && 0 == connTypes.size() ) {
askNoAddrsDelete();
} else if ( 0 < nMissing && isServer && !m_haveInvited ) {
post( new Runnable() {
public void run() {
showDialog( DlgID.DLG_INVITE );