From ac34250bf3cee7210f67b843c55e796fdc23974b Mon Sep 17 00:00:00 2001 From: Eric House Date: Thu, 16 Jul 2015 06:57:30 -0700 Subject: [PATCH] use rowid for invitation notifications so they'll be replaced by subsequent notifications for the same game and removed when the game's opened. --- .../XWords4/src/org/eehouse/android/xw4/BTService.java | 3 ++- .../XWords4/src/org/eehouse/android/xw4/GameUtils.java | 4 ++-- .../XWords4/src/org/eehouse/android/xw4/RelayService.java | 3 ++- .../XWords4/src/org/eehouse/android/xw4/SMSService.java | 8 ++++---- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTService.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTService.java index 20cb90980..f713f724a 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTService.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTService.java @@ -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 ); } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java index 171a6486a..648730c68 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java @@ -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, diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayService.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayService.java index ccbfb481d..99baacf58 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayService.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayService.java @@ -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 ); } } } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSService.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSService.java index fd8435fc1..43ef149a6 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSService.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSService.java @@ -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 ); }