use rowid for invitation notifications so they'll be replaced by

subsequent notifications for the same game and removed when the game's
opened.
This commit is contained in:
Eric House 2015-07-16 06:57:30 -07:00
parent c9e8655eea
commit ac34250bf3
4 changed files with 10 additions and 8 deletions

View file

@ -1089,7 +1089,8 @@ public class BTService extends XWService {
R.string.new_bt_body_fmt,
sender );
GameUtils.postInvitedNotification( this, nli.gameID(), body );
GameUtils.postInvitedNotification( this, nli.gameID(), body,
rowid );
sendResult( MultiEvent.BT_GAME_CREATED, rowid );
}

View file

@ -1066,11 +1066,11 @@ public class GameUtils {
}
public static void postInvitedNotification( Context context, int gameID,
String body )
String body, long rowid )
{
Intent intent = GamesListDelegate.makeGameIDIntent( context, gameID );
Utils.postNotification( context, intent, R.string.invite_notice_title,
body, gameID );
body, (int)rowid );
}
private static void tellDied( Context context, GameLock lock,

View file

@ -260,7 +260,8 @@ public class RelayService extends XWService
}
String body = LocUtils.getString( this,
R.string.new_relay_body );
GameUtils.postInvitedNotification( this, nli.gameID(), body );
GameUtils.postInvitedNotification( this, nli.gameID(), body,
rowid );
}
}
}

View file

@ -619,19 +619,19 @@ public class SMSService extends XWService {
}
}
private void postNotification( String phone, int gameID )
private void postNotification( String phone, int gameID, long rowid )
{
String owner = Utils.phoneToContact( this, phone, true );
String body = LocUtils.getString( this, R.string.new_name_body_fmt,
owner );
GameUtils.postInvitedNotification( this, gameID, body );
GameUtils.postInvitedNotification( this, gameID, body, rowid );
}
private void makeForInvite( String phone, NetLaunchInfo nli )
{
SMSMsgSink sink = new SMSMsgSink( this );
long rowid = GameUtils.makeNewMultiGame( this, nli, sink, null );
postNotification( phone, nli.gameID() );
postNotification( phone, nli.gameID(), rowid );
ackInvite( phone, nli.gameID() );
}
@ -643,7 +643,7 @@ public class SMSService extends XWService {
GameUtils.makeNewGame( this, gameID, new CommsAddrRec( phone ),
lang, dict, nPlayersT, nPlayersH,
forceChannel, gameName );
postNotification( phone, gameID );
postNotification( phone, gameID, rowid );
ackInvite( phone, gameID );
}