mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-15 15:41:24 +01:00
remove the offer to reinvite from rematched games
Now that rematching creates all the invitations and an expectation of how the invitees will be ordered it'll confuse things if unexpected players show up. So don't allow players to send additional invitations.
This commit is contained in:
parent
1181e908dc
commit
3e6edd3ec4
5 changed files with 49 additions and 31 deletions
|
@ -1580,15 +1580,15 @@ public class BoardDelegate extends DelegateBase
|
|||
callInviteChoices();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInfoClicked( SentInvitesInfo sentInfo )
|
||||
{
|
||||
String msg = sentInfo.getAsText( m_activity );
|
||||
makeOkOnlyBuilder( msg )
|
||||
.setTitle( R.string.title_invite_history )
|
||||
.setAction( Action.INVITE_INFO )
|
||||
.show();
|
||||
}
|
||||
// @Override
|
||||
// public void onInfoClicked( SentInvitesInfo sentInfo )
|
||||
// {
|
||||
// String msg = sentInfo.getAsText( m_activity );
|
||||
// makeOkOnlyBuilder( msg )
|
||||
// .setTitle( R.string.title_invite_history )
|
||||
// .setAction( Action.INVITE_INFO )
|
||||
// .show();
|
||||
// }
|
||||
|
||||
@Override
|
||||
public long getRowID()
|
||||
|
@ -2583,8 +2583,9 @@ public class BoardDelegate extends DelegateBase
|
|||
|
||||
private void showOrHide( InvitesNeededAlert.Wrapper wrapper )
|
||||
{
|
||||
boolean fromRematch = XwJNI.server_isFromRematch( m_jniGamePtr );
|
||||
wrapper.showOrHide( m_mySIS.hostAddr, m_mySIS.nMissing,
|
||||
m_mySIS.nInvited, false );
|
||||
m_mySIS.nInvited, fromRematch );
|
||||
}
|
||||
|
||||
private InvitesNeededAlert.Wrapper mINAWrapper;
|
||||
|
|
|
@ -128,7 +128,7 @@ class InvitesNeededAlert {
|
|||
long getRowID();
|
||||
void onCloseClicked();
|
||||
void onInviteClicked();
|
||||
void onInfoClicked( SentInvitesInfo sentInfo );
|
||||
// void onInfoClicked( SentInvitesInfo sentInfo );
|
||||
}
|
||||
|
||||
private boolean close()
|
||||
|
@ -236,7 +236,7 @@ class InvitesNeededAlert {
|
|||
SentInvitesInfo sentInfo = DBUtils.getInvitesFor( context, rowid );
|
||||
|
||||
int nSent = state.mNInvited + sentInfo.getMinPlayerCount();
|
||||
boolean invitesNeeded = nPlayersMissing > nSent;
|
||||
boolean invitesNeeded = nPlayersMissing > nSent && !state.mIsRematch;
|
||||
|
||||
String title;
|
||||
boolean isRematch = state.mIsRematch;
|
||||
|
@ -250,7 +250,7 @@ class InvitesNeededAlert {
|
|||
ab.setTitle( title );
|
||||
|
||||
String message;
|
||||
int inviteButtonTxt;
|
||||
int inviteButtonTxt = 0;
|
||||
if ( invitesNeeded ) {
|
||||
Assert.assertTrueNR( !isRematch );
|
||||
message = LocUtils.getString( context, R.string.invites_unsent );
|
||||
|
@ -262,8 +262,11 @@ class InvitesNeededAlert {
|
|||
if ( isRematch ) {
|
||||
message += "\n\n"
|
||||
+ LocUtils.getString( context, R.string.invite_msg_extra_rematch );
|
||||
} else {
|
||||
inviteButtonTxt = R.string.newgame_reinvite; // here
|
||||
message += "\n\n"
|
||||
+ LocUtils.getString( context, R.string.invite_msg_extra_norematch );
|
||||
}
|
||||
inviteButtonTxt = R.string.newgame_reinvite;
|
||||
}
|
||||
ab.setMessage( message );
|
||||
|
||||
|
@ -278,19 +281,19 @@ class InvitesNeededAlert {
|
|||
|
||||
if ( invitesNeeded ) {
|
||||
alert.setNoDismissListenerPos( ab, inviteButtonTxt, onInvite );
|
||||
} else {
|
||||
} else if ( 0 != inviteButtonTxt ) {
|
||||
alert.setNoDismissListenerNeg( ab, inviteButtonTxt, onInvite );
|
||||
closeLoc[0] = DialogInterface.BUTTON_POSITIVE;
|
||||
}
|
||||
|
||||
if ( BuildConfig.NON_RELEASE && 0 < nSent ) {
|
||||
alert.setNoDismissListenerNeut( ab, R.string.button_invite_history,
|
||||
new OnClickListener() {
|
||||
@Override
|
||||
public void onClick( DialogInterface dlg, int item ) {
|
||||
callbacks.onInfoClicked( sentInfo );
|
||||
}
|
||||
} );
|
||||
}
|
||||
// if ( BuildConfig.NON_RELEASE && 0 < nSent ) {
|
||||
// alert.setNoDismissListenerNeut( ab, R.string.button_invite_history,
|
||||
// new OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick( DialogInterface dlg, int item ) {
|
||||
// callbacks.onInfoClicked( sentInfo );
|
||||
// }
|
||||
// } );
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -551,6 +551,7 @@ public class XwJNI {
|
|||
public static native String server_writeFinalScores( GamePtr gamePtr );
|
||||
public static native boolean server_initClientConnection( GamePtr gamePtr );
|
||||
public static native boolean server_canOfferRematch( GamePtr gamePtr );
|
||||
public static native boolean server_isFromRematch( GamePtr gamePtr );
|
||||
public static native void server_endGame( GamePtr gamePtr );
|
||||
|
||||
// hybrid to save work
|
||||
|
|
|
@ -455,20 +455,22 @@
|
|||
player to receive and respond to an invitation.
|
||||
|
||||
\n\nYou will see this message until the invited player has
|
||||
responded. If you suspect the invitation you sent was lost,
|
||||
there’s no harm in sending another.</item>
|
||||
responded.</item>
|
||||
|
||||
<item quantity="other">This game is waiting for %1$d remote
|
||||
players to repond to invitations.
|
||||
|
||||
\n\nYou will see this message until all expected players have
|
||||
responded. If you suspect any invitations you sent were lost,
|
||||
there’s no harm in sending more.</item>
|
||||
responded.</item>
|
||||
</plurals>
|
||||
|
||||
<string name="invite_msg_extra_norematch">
|
||||
If you suspect an invitation you sent was lost, there’s no harm
|
||||
in sending another.</string>
|
||||
|
||||
<string name="invite_msg_extra_rematch">With rematches, all
|
||||
necessary invitations will have been sent automatically. But you
|
||||
can always send new ones if an invitee is not responding.</string>
|
||||
necessary invitations will have been created automatically and
|
||||
will be resent until they are accepted.</string>
|
||||
<!-- Appended to message above if local device has NFC
|
||||
available. But not used right now -->
|
||||
<!--string name="invite_if_nfc">Or just Tap to Invite - if the other
|
||||
|
|
|
@ -2202,6 +2202,17 @@ Java_org_eehouse_android_xw4_jni_XwJNI_server_1initClientConnection
|
|||
return result;
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_org_eehouse_android_xw4_jni_XwJNI_server_1isFromRematch
|
||||
( JNIEnv* env, jclass C, GamePtrType gamePtr )
|
||||
{
|
||||
jboolean result;
|
||||
XWJNI_START_GLOBALS(gamePtr);
|
||||
result = server_isFromRematch( state->game.server );
|
||||
XWJNI_END();
|
||||
return result;
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_org_eehouse_android_xw4_jni_XwJNI_server_1canOfferRematch
|
||||
( JNIEnv* env, jclass C, GamePtrType gamePtr )
|
||||
|
@ -2209,7 +2220,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_server_1canOfferRematch
|
|||
jboolean result;
|
||||
XWJNI_START_GLOBALS(gamePtr);
|
||||
XP_Bool canOffer;
|
||||
XP_Bool canRematch= server_canRematch( state->game.server, &canOffer );
|
||||
XP_Bool canRematch = server_canRematch( state->game.server, &canOffer );
|
||||
result = canRematch && canOffer;
|
||||
XWJNI_END();
|
||||
return result;
|
||||
|
|
Loading…
Reference in a new issue