get rid of boolean meant to prevent duplicate invite alerts

It was preventing even one and seems no longer to be necessary.
This commit is contained in:
Eric House 2020-11-15 14:17:00 -08:00
parent d2e2135791
commit a58048e9eb
5 changed files with 40 additions and 39 deletions

View file

@ -125,7 +125,6 @@ public class BoardDelegate extends DelegateBase
private JNIThread.GameStateInfo m_gsi;
private int m_nGuestDevs = -1;
private boolean m_haveInvited = false;
private boolean m_showedReInvite;
private boolean m_overNotShown;
private boolean m_dropRelayOnDismiss;
@ -637,7 +636,6 @@ public class BoardDelegate extends DelegateBase
Bundle args = getArguments();
m_rowid = args.getLong( GameUtils.INTENT_KEY_ROWID, -1 );
Log.i( TAG, "opening rowid %d", m_rowid );
m_haveInvited = args.getBoolean( GameUtils.INVITED, false );
m_overNotShown = true;
} // init
@ -849,11 +847,20 @@ public class BoardDelegate extends DelegateBase
@Override
protected void setTitle()
{
String title = GameUtils.getName( m_activity, m_rowid );
if ( null != m_gi && m_gi.inDuplicateMode ) {
title = LocUtils.getString( m_activity, R.string.dupe_title_fmt, title );
}
setTitle( title );
runOnUiThread( new Runnable() {
@Override
public void run() {
String title = GameUtils.getName( m_activity, m_rowid );
if ( 0 < m_mySIS.nMissing ) {
title = LocUtils.getString( m_activity, R.string.title_missing_fmt,
title, m_mySIS.nMissing );
}
if ( null != m_gi && m_gi.inDuplicateMode ) {
title = LocUtils.getString( m_activity, R.string.dupe_title_fmt, title );
}
setTitle( title );
}
} );
}
private void initToolbar()
@ -1727,7 +1734,7 @@ public class BoardDelegate extends DelegateBase
finish();
GameUtils.launchGame( getDelegator(), m_rowid, m_haveInvited );
GameUtils.launchGame( getDelegator(), m_rowid );
}
private void setGotGameDict( String getDict )
@ -1737,7 +1744,7 @@ public class BoardDelegate extends DelegateBase
String msg = getString( R.string.reload_new_dict_fmt, getDict );
showToast( msg );
finish();
GameUtils.launchGame( getDelegator(), m_rowid, false );
GameUtils.launchGame( getDelegator(), m_rowid );
}
private XwJNI.XP_Key keyCodeToXPKey( int keyCode )
@ -1794,11 +1801,9 @@ public class BoardDelegate extends DelegateBase
skipDismiss = !tryRematchInvites( false );
} else if ( m_summary.hasInviteInfo() ) {
skipDismiss = !tryOtherInvites();
} else if ( !m_haveInvited ) {
m_haveInvited = true;
showInviteAlertIf();
invalidateOptionsMenuIf();
} else if ( showInviteAlertIf() ) {
skipDismiss = true;
invalidateOptionsMenuIf();
} else {
toastStr = getQuantityString( R.plurals.msg_relay_waiting_fmt, nMissing,
devOrder, room, nMissing );
@ -1828,6 +1833,7 @@ public class BoardDelegate extends DelegateBase
}
invalidateOptionsMenuIf();
setTitle();
} // handleConndMessage
private class BoardUtilCtxt extends UtilCtxtImpl {
@ -2023,6 +2029,7 @@ public class BoardDelegate extends DelegateBase
post( new Runnable() {
@Override
public void run() {
setTitle();
makeNotAgainBuilder( R.string.not_again_turnchanged,
R.string.key_notagain_turnchanged )
.show();
@ -2165,10 +2172,11 @@ public class BoardDelegate extends DelegateBase
m_nGuestDevs = nDevs;
m_mySIS.nMissing = nMissing; // will be 0 unless isServer is true
setTitle();
if ( null != connTypes && 0 == connTypes.size() ) {
askNoAddrsDelete();
} else if ( 0 < nMissing && isServer && !m_haveInvited ) {
} else if ( 0 < nMissing && isServer ) {
doDismiss = false;
post( new Runnable() {
@Override
@ -2679,8 +2687,9 @@ public class BoardDelegate extends DelegateBase
// This is failing sometimes, and so the null == m_inviteAlert test means
// we never post it. BUT on a lot of devices without the test we wind up
// trying over and over to put the thing up.
private void showInviteAlertIf()
private boolean showInviteAlertIf()
{
boolean success = false;
DbgUtils.assertOnUIThread();
if ( alertOrderAt( StartAlertOrder.INVITE ) ) {
if ( ! m_haveStartedShowing && null == m_inviteAlert
@ -2694,10 +2703,12 @@ public class BoardDelegate extends DelegateBase
ias.nMissing = m_mySIS.nMissing;
showDialogFragment( DlgID.DLG_INVITE, ias );
m_haveStartedShowing = true;
success = true;
} else {
alertOrderIncrIfAt( StartAlertOrder.INVITE );
}
}
return success;
}
private boolean doZoom( int zoomBy )

View file

@ -63,7 +63,6 @@ import java.util.Map;
public class GameUtils {
private static final String TAG = GameUtils.class.getSimpleName();
public static final String INVITED = "invited";
public static final String INTENT_KEY_ROWID = "rowid";
interface ResendDoneProc {
@ -943,26 +942,22 @@ public class GameUtils {
return file.endsWith( XWConstants.GAME_EXTN );
}
private static Bundle makeLaunchExtras( long rowid, boolean invited )
private static Bundle makeLaunchExtras( long rowid )
{
Bundle bundle = new Bundle();
bundle.putLong( INTENT_KEY_ROWID, rowid );
if ( invited ) {
bundle.putBoolean( INVITED, true );
}
return bundle;
}
public static void launchGame( Delegator delegator, long rowid,
boolean invited )
public static void launchGame( Delegator delegator, long rowid )
{
launchGame( delegator, rowid, invited, null );
launchGame( delegator, rowid, null );
}
public static void launchGame( Delegator delegator, long rowid,
boolean invited, Bundle moreExtras )
Bundle moreExtras )
{
Bundle extras = makeLaunchExtras( rowid, invited );
Bundle extras = makeLaunchExtras( rowid );
if ( null != moreExtras ) {
extras.putAll( moreExtras );
}
@ -977,11 +972,6 @@ public class GameUtils {
}
}
public static void launchGame( Delegator delegator, long rowid )
{
launchGame( delegator, rowid, false );
}
private static class FeedUtilsImpl extends UtilCtxtImpl {
private Context m_context;
private long m_rowid;

View file

@ -2797,7 +2797,7 @@ public class GamesListDelegate extends ListDelegateBase
return madeGame;
}
private void launchGame( long rowid, boolean invited, Bundle extras )
private void launchGame( long rowid, Bundle extras )
{
if ( DBUtils.ROWID_NOTFOUND == rowid ) {
Log.d( TAG, "launchGame(): dropping bad rowid" );
@ -2806,25 +2806,20 @@ public class GamesListDelegate extends ListDelegateBase
if ( m_adapter.inExpandedGroup( rowid ) ) {
setSelGame( rowid );
}
GameUtils.launchGame( getDelegator(), rowid, invited, extras );
GameUtils.launchGame( getDelegator(), rowid, extras );
}
}
private void launchGame( long rowid )
{
launchGame( rowid, false, null );
}
private void launchGame( long rowid, Bundle extras )
{
launchGame( rowid, false, extras );
launchGame( rowid, null );
}
private void makeNewNetGame( NetLaunchInfo nli )
{
long rowid = DBUtils.ROWID_NOTFOUND;
rowid = GameUtils.makeNewMultiGame( m_activity, nli );
launchGame( rowid, true, null );
launchGame( rowid, null );
}
private void tryStartsFromIntent( Intent intent )

View file

@ -51,6 +51,8 @@ public class Quarantine {
if ( !result ) {
Log.d( TAG, "safeToOpen(%d) => %b (count=%d)", rowid, result, count );
if ( BuildConfig.NON_RELEASE ) {
Log.d( TAG, "printing calling stack:" );
DbgUtils.printStack( TAG );
List<StackTraceElement[]> list = get().listFor( rowid );
for ( int ii = 0; ii < list.size(); ++ii ) {
StackTraceElement[] trace = list.get( ii );

View file

@ -2674,4 +2674,7 @@
<!-- Title of the game name field in quick-invite new game dialog -->
<string name="choose_opponent">Choose your opponent</string>
<!-- Board window title when host has not yet had all remote
players connect -->
<string name="title_missing_fmt">%1$s (missing %2$d)</string>
</resources>