add additional warning about failure to connect when user's on WiFi,

since paranoid WiFi settings are probably a leading cause of my not
being able to connect.
This commit is contained in:
Eric House 2015-06-08 07:36:47 -07:00
parent 7eb6c17623
commit f296ab4dc3
6 changed files with 37 additions and 9 deletions

View file

@ -1927,7 +1927,7 @@ public final class R {
substituted.
*/
public static final int no_name_found_fmt=0x7f0500b8;
public static final int no_relay_conn=0x7f0502fb;
public static final int no_relay_conn=0x7f0502fc;
/** This is not currently shown
<string name="not_again_dicts">Crosswords wordlists, which are
just compressed lists of words plus tile information, determine
@ -2339,6 +2339,7 @@ public final class R {
/** title for popup of public rooms found on server
*/
public static final int room_public_prompt=0x7f0500b6;
public static final int seeking_relay=0x7f0502fb;
public static final int sel_games_fmt=0x7f050251;
public static final int sel_groups_fmt=0x7f050252;
public static final int sel_items_fmt=0x7f05026d;
@ -2702,6 +2703,7 @@ public final class R {
/**
*/
public static final int warn_unlimited=0x7f050201;
public static final int wifi_warning=0x7f0502fd;
/**
*/
public static final int word_search_hint=0x7f0501cc;

View file

@ -2463,9 +2463,15 @@
<string name="checking_for_fmt">Checking for wordlists in %1$s…</string>
<string name="db_store_done">SD card write complete.</string>
<string name="seeking_relay">Connecting to relay…</string>
<string name="no_relay_conn">This game is configured to use the
relay 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.</string>
because the relay is not running.\n\nPlease try opening the game
again later after conditions have changed.</string>
<string name="wifi_warning">\u0020For example, you may need to be on
a different WiFi network.</string>
</resources>

View file

@ -2132,9 +2132,12 @@
<string name="checking_title">Gnikcehc</string>
<string name="checking_for_fmt">Gnikcehc rof stsildrow ni %1$s…</string>
<string name="db_store_done">DS drac etirw etelpmoc.</string>
<string name="seeking_relay">Gnitcennoc ot yaler…</string>
<string name="no_relay_conn">Siht emag si derugifnoc ot esu eht
yaler 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.</string>
esuaceb eht yaler si ton gninnur.\n\nEsaelp yrt gninepo eht emag
niaga retal retfa snoitidnoc evah degnahc.</string>
<string name="wifi_warning">\u0020Rof ,elpmaxe uoy yam deen ot eb no
a tnereffid IfIw krowten.</string>
</resources>

View file

@ -2132,9 +2132,12 @@
<string name="checking_title">CHECKING</string>
<string name="checking_for_fmt">CHECKING FOR WORDLISTS IN %1$s…</string>
<string name="db_store_done">SD CARD WRITE COMPLETE.</string>
<string name="seeking_relay">CONNECTING TO RELAY…</string>
<string name="no_relay_conn">THIS GAME IS CONFIGURED TO USE THE
RELAY 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.</string>
BECAUSE THE RELAY IS NOT RUNNING.\n\nPLEASE TRY OPENING THE GAME
AGAIN LATER AFTER CONDITIONS HAVE CHANGED.</string>
<string name="wifi_warning">\u0020FOR EXAMPLE, YOU MAY NEED TO BE ON
A DIFFERENT WIFI NETWORK.</string>
</resources>

View file

@ -479,17 +479,24 @@ public class BoardDelegate extends DelegateBase
case DLG_NOINVITE:
AlertDialog ad = (AlertDialog)dialog;
String message;
int titleID = R.string.info_title;;
int titleID;
boolean nukeButton = false;
if ( m_summary.hasRematchInfo() ) {
titleID = R.string.info_title;;
message = getString( R.string.rematch_msg );
nukeButton = true;
} else if ( DlgID.DLG_NOINVITE == dlgID ) {
titleID = R.string.seeking_relay;
message = getString( R.string.no_relay_conn );
if ( NetStateCache.netAvail( m_activity )
&& NetStateCache.onWifi() ) {
message += getString( R.string.wifi_warning );
}
nukeButton = true;
} else {
titleID = R.string.waiting_title;
message = getQuantityString( R.plurals.invite_msg_fmt, m_nMissing, m_nMissing );
message = getQuantityString( R.plurals.invite_msg_fmt,
m_nMissing, m_nMissing );
String ps = null;
if ( m_nMissing > 1 ) {

View file

@ -46,6 +46,7 @@ public class NetStateCache {
private static AtomicBoolean s_haveReceiver = new AtomicBoolean( false );
private static HashSet<StateChangedIf> s_ifs;
private static boolean s_netAvail = false;
private static boolean s_isWifi;
private static PvtBroadcastReceiver s_receiver;
private static final boolean s_onSim = Build.PRODUCT.contains("sdk");
@ -71,6 +72,11 @@ public class NetStateCache {
return s_netAvail || s_onSim;
}
public static boolean onWifi()
{
return s_isWifi;
}
public static void reset( Context context )
{
synchronized( s_haveReceiver ) {
@ -140,6 +146,7 @@ public class NetStateCache {
switch ( state ) {
case CONNECTED:
netAvail = true;
s_isWifi = ConnectivityManager.TYPE_WIFI == ni.getType();
break;
case DISCONNECTED:
netAvail = false;