diff --git a/xwords4/android/XWords4/archive/R.java b/xwords4/android/XWords4/archive/R.java
index 19f6c21bf..de6ad0ff3 100644
--- a/xwords4/android/XWords4/archive/R.java
+++ b/xwords4/android/XWords4/archive/R.java
@@ -861,6 +861,9 @@ public final class R {
of the language is substituted for %1$s.
*/
public static final int confirm_deleteonly_dicts_fmt=0x7f0500a0;
+ public static final int confirm_drop_relay=0x7f050300;
+ public static final int confirm_drop_relay_bt=0x7f050301;
+ public static final int confirm_drop_relay_sms=0x7f050302;
public static final int confirm_get_locdict_fmt=0x7f0502c9;
/** Text of confirmation dialog for above
*/
@@ -1070,6 +1073,7 @@ public final class R {
public static final int download_failed=0x7f05023a;
public static final int download_path_title=0x7f05023d;
public static final int downloading_dict_fmt=0x7f050185;
+ public static final int drop_relay_warning_fmt=0x7f0502ff;
/** Display snapshots of games
*/
public static final int dropped_dupe=0x7f050256;
@@ -1826,13 +1830,13 @@ public final class R {
this and you'll get taken to the "Game configure" screen
*/
public static final int newgame_configure_first=0x7f050160;
+ public static final int newgame_drop_relay=0x7f050164;
/** Text of first of two buttons for new networked games. Tap
this and a game will be created, but you probably won't see
it immediately because an email or messaging app will be
launched to send your invitation.
*/
public static final int newgame_invite=0x7f050163;
- public static final int newgame_invite_anyway=0x7f050164;
/** Text of first of two buttons for new standalone games. Tap
this and a new game will be created and opened. If the first
player is a robot it will immediately take its turn.
@@ -2377,7 +2381,6 @@ public final class R {
/** explanation of the above
*/
public static final int skip_confirm_turn_summary=0x7f050147;
- public static final int skip_relay_warning=0x7f0502ff;
public static final int slmenu_clear_sel=0x7f050264;
public static final int slmenu_copy_sel=0x7f050263;
public static final int slmenu_deselect_all=0x7f05026d;
diff --git a/xwords4/android/XWords4/res/values/strings.xml b/xwords4/android/XWords4/res/values/strings.xml
index db8a59248..41e9f15b7 100644
--- a/xwords4/android/XWords4/res/values/strings.xml
+++ b/xwords4/android/XWords4/res/values/strings.xml
@@ -1170,7 +1170,7 @@
it immediately because an email or messaging app will be
launched to send your invitation. -->
Invite now
- Invite anyway
+ Drop Relay
@@ -2467,16 +2467,23 @@
Connecting to relay…
This game is configured to use the
- relay (server) for communication but has been unable to connect,
- either because of problems with your device\'s internet connection
- or because the relay is not running.\n\nPlease try opening the game
- again later after conditions have changed.
+ relay (internet) for communication but has been unable to
+ connect.\n\nPlease try opening the game again later after
+ conditions have changed.
\u0020For example, you may need to be on
a different WiFi network.
- (Because this game has other ways
- of communicating, you can invite even without a relay connection,
- but then you\'ll have to play the game without it.)
+ (This game can also connect
+ via %1$s, so if you\'d like to play the game without a relay
+ connection you can.)
+
+
+ Are you sure you want to drop this
+ game\'s ability to communicate via the relay?
+ Bluetooth only works for nearby
+ devices.
+ Not all carriers support play
+ via SMS.
diff --git a/xwords4/android/XWords4/res_src/values-ba_CK/strings.xml b/xwords4/android/XWords4/res_src/values-ba_CK/strings.xml
index 24aa6259c..efad02670 100644
--- a/xwords4/android/XWords4/res_src/values-ba_CK/strings.xml
+++ b/xwords4/android/XWords4/res_src/values-ba_CK/strings.xml
@@ -1008,7 +1008,7 @@
it immediately because an email or messaging app will be
launched to send your invitation. -->
Etivni won
- Etivni yawyna
+ Pord Yaler
Wen Htooteulb emag
@@ -2135,13 +2135,19 @@
DS drac etirw etelpmoc.
Gnitcennoc ot yaler…
Siht emag si derugifnoc ot esu eht
- yaler )revres( rof noitacinummoc tub sah neeb elbanu ot ,tcennoc
- rehtie esuaceb fo smelborp htiw ruoy ecived\'s tenretni noitcennoc
- ro esuaceb eht yaler si ton gninnur.\n\nEsaelp yrt gninepo eht emag
- niaga retal retfa snoitidnoc evah degnahc.
+ yaler )tenretni( rof noitacinummoc tub sah neeb elbanu ot
+ tcennoc.\n\nEsaelp yrt gninepo eht emag niaga retal retfa
+ snoitidnoc evah degnahc.
\u0020Rof ,elpmaxe uoy yam deen ot eb no
a tnereffid IfIw krowten.
- eSuaceb( siht emag sah rehto syaw
- fo ,gnitacinummoc uoy nac etivni neve tuohtiw a yaler ,noitcennoc
- tub neht uoy\'ll evah ot yalp eht emag tuohtiw ti.)
+ sIht( emag nac osla tcennoc
+ aiv %1$s, os fi uoy\'d ekil ot yalp eht emag tuohtiw a yaler
+ noitcennoc uoy nac.)
+
+ Era uoy erus uoy tnaw ot pord siht
+ emag\'s ytiliba ot etacinummoc aiv eht ?yaler
+ Htooteulb ylno skrow rof ybraen
+ secived.
+ Ton lla sreirrac troppus yalp
+ aiv SMS.
diff --git a/xwords4/android/XWords4/res_src/values-ca_PS/strings.xml b/xwords4/android/XWords4/res_src/values-ca_PS/strings.xml
index 7996ca1cb..6498f2bfe 100644
--- a/xwords4/android/XWords4/res_src/values-ca_PS/strings.xml
+++ b/xwords4/android/XWords4/res_src/values-ca_PS/strings.xml
@@ -1008,7 +1008,7 @@
it immediately because an email or messaging app will be
launched to send your invitation. -->
INVITE NOW
- INVITE ANYWAY
+ DROP RELAY
NEW BLUETOOTH GAME
@@ -2135,13 +2135,19 @@
SD CARD WRITE COMPLETE.
CONNECTING TO RELAY…
THIS GAME IS CONFIGURED TO USE THE
- RELAY (SERVER) FOR COMMUNICATION BUT HAS BEEN UNABLE TO CONNECT,
- EITHER BECAUSE OF PROBLEMS WITH YOUR DEVICE\'S INTERNET CONNECTION
- OR BECAUSE THE RELAY IS NOT RUNNING.\n\nPLEASE TRY OPENING THE GAME
- AGAIN LATER AFTER CONDITIONS HAVE CHANGED.
+ RELAY (INTERNET) FOR COMMUNICATION BUT HAS BEEN UNABLE TO
+ CONNECT.\n\nPLEASE TRY OPENING THE GAME AGAIN LATER AFTER
+ CONDITIONS HAVE CHANGED.
\u0020FOR EXAMPLE, YOU MAY NEED TO BE ON
A DIFFERENT WIFI NETWORK.
- (BECAUSE THIS GAME HAS OTHER WAYS
- OF COMMUNICATING, YOU CAN INVITE EVEN WITHOUT A RELAY CONNECTION,
- BUT THEN YOU\'LL HAVE TO PLAY THE GAME WITHOUT IT.)
+ (THIS GAME CAN ALSO CONNECT
+ VIA %1$s, SO IF YOU\'D LIKE TO PLAY THE GAME WITHOUT A RELAY
+ CONNECTION YOU CAN.)
+
+ ARE YOU SURE YOU WANT TO DROP THIS
+ GAME\'S ABILITY TO COMMUNICATE VIA THE RELAY?
+ BLUETOOTH ONLY WORKS FOR NEARBY
+ DEVICES.
+ NOT ALL CARRIERS SUPPORT PLAY
+ VIA SMS.
diff --git a/xwords4/android/XWords4/res_src/values-fr/strings.xml b/xwords4/android/XWords4/res_src/values-fr/strings.xml
index 3fc5756ef..799a82274 100644
--- a/xwords4/android/XWords4/res_src/values-fr/strings.xml
+++ b/xwords4/android/XWords4/res_src/values-fr/strings.xml
@@ -1405,7 +1405,6 @@ réseau. (Vous pourrez envoyer des invitations plus tard.)
launched to send your invitation. -->
Inviter maintenant
- Inviter malgré tout
@@ -3457,9 +3456,5 @@ pour la langue
\u0020Vous pourriez, par exemple,
avoir besoin d\'être sur un réseau Wi-Fi différent.
- (Étant donné que cette partie a
- d\'autres moyens de communiquer, vous pouvez inviter même sans une
- connexion à un relai, mais ensuite vous devrez jouer sans elle.)
-
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java
index 433ddff02..248725c5c 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java
@@ -436,7 +436,12 @@ public class BoardDelegate extends DelegateBase
lstnr = new OnClickListener() {
public void onClick( DialogInterface dialog,
int item ) {
- showInviteChoicesThen( Action.LAUNCH_INVITE_ACTION );
+ if ( m_relayConnected ||
+ ! m_connTypes.contains(CommsConnType.COMMS_CONN_RELAY) ) {
+ showInviteChoicesThen( Action.LAUNCH_INVITE_ACTION );
+ } else {
+ askDropRelay();
+ }
}
};
OnClickListener lstnr2 = new OnClickListener() {
@@ -495,8 +500,13 @@ public class BoardDelegate extends DelegateBase
message += getString( R.string.wifi_warning );
}
if ( !relayOnly ) {
- message += "\n\n" + getString( R.string.skip_relay_warning );
- buttonTxt = R.string.newgame_invite_anyway;
+ CommsConnTypeSet without = (CommsConnTypeSet)
+ m_connTypes.clone();
+ without.remove( CommsConnType.COMMS_CONN_RELAY );
+ message += "\n\n"
+ + getString( R.string.drop_relay_warning_fmt,
+ without.toString( m_activity ) );
+ buttonTxt = R.string.newgame_drop_relay;
}
} else {
titleID = R.string.waiting_title;
@@ -1003,6 +1013,9 @@ public class BoardDelegate extends DelegateBase
case NFC_TO_SELF:
GamesListDelegate.sendNFCToSelf( m_activity, makeNFCMessage() );
break;
+ case DROP_RELAY_ACTION:
+ dropRelayAndRestart();
+ break;
default:
handled = false;
}
@@ -1296,6 +1309,29 @@ public class BoardDelegate extends DelegateBase
return m_handler;
}
+ private void askDropRelay()
+ {
+ String msg = getString( R.string.confirm_drop_relay );
+ if ( m_connTypes.contains(CommsConnType.COMMS_CONN_BT) ) {
+ msg += " " + getString( R.string.confirm_drop_relay_bt );
+ }
+ if ( m_connTypes.contains(CommsConnType.COMMS_CONN_SMS) ) {
+ msg += " " + getString( R.string.confirm_drop_relay_sms );
+ }
+ showConfirmThen( msg, Action.DROP_RELAY_ACTION );
+ }
+
+ private void dropRelayAndRestart() {
+ CommsAddrRec addr = new CommsAddrRec();
+ XwJNI.comms_getAddr( m_jniGamePtr, addr );
+ addr.remove( CommsConnType.COMMS_CONN_RELAY );
+ XwJNI.comms_setAddr( m_jniGamePtr, addr );
+
+ finish();
+
+ GameUtils.launchGame( m_activity, m_rowid, m_haveInvited );
+ }
+
private void setGotGameDict( String getDict )
{
m_jniThread.setSaveDict( getDict );
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgDelegate.java
index 2524c0603..f805c0aac 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgDelegate.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgDelegate.java
@@ -83,6 +83,7 @@ public class DlgDelegate {
SMS_CONFIG_ACTION,
BUTTON_BROWSEALL_ACTION,
NFC_TO_SELF,
+ DROP_RELAY_ACTION,
// Dict Browser
FINISH_ACTION,
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CommsAddrRec.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CommsAddrRec.java
index 5ba7104d8..bf86dc73f 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CommsAddrRec.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CommsAddrRec.java
@@ -270,6 +270,11 @@ public class CommsAddrRec {
}
}
+ public void remove( CommsConnType typ )
+ {
+ conTypes.remove( typ );
+ }
+
public boolean changesMatter( final CommsAddrRec other )
{
boolean matter = ! conTypes.equals( other.conTypes );