mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-05 20:45:49 +01:00
alert on receiving phone when SMS sender is using older/incompatible protocol.
This commit is contained in:
parent
159a1a8dd2
commit
3dd16b5883
8 changed files with 250 additions and 227 deletions
File diff suppressed because it is too large
Load diff
|
@ -1829,6 +1829,11 @@
|
|||
<string name="bt_bad_proto_fmt">The version of Crosswords on
|
||||
\"%1$s\" is incompatible with this one for play using
|
||||
Bluetooth. One of you may need to upgrade before you can
|
||||
continue.</string>
|
||||
|
||||
<string name="sms_bad_proto_fmt">The version of Crosswords on the
|
||||
phone with number \"%1$s\" is incompatible with this one for play
|
||||
using SMS. One of you may need to upgrade before you can
|
||||
continue.</string>
|
||||
|
||||
<!-- -->
|
||||
|
|
|
@ -1568,6 +1568,10 @@
|
|||
\"%1$s\" si elbitapmocni htiw siht eno rof yalp gnisu
|
||||
Htooteulb. Eno fo uoy yam deen ot edargpu erofeb uoy nac
|
||||
eunitnoc.</string>
|
||||
<string name="sms_bad_proto_fmt">Eht noisrev fo Sdrowssorc no eht
|
||||
enohp htiw rebmun \"%1$s\" si elbitapmocni htiw siht eno rof yalp
|
||||
gnisu SMS. Eno fo uoy yam deen ot edargpu erofeb uoy nac
|
||||
eunitnoc.</string>
|
||||
<!-- -->
|
||||
<string name="new_btmove_title">Noitativni aiv Htooteulb</string>
|
||||
<!-- -->
|
||||
|
|
|
@ -1568,6 +1568,10 @@
|
|||
\"%1$s\" IS INCOMPATIBLE WITH THIS ONE FOR PLAY USING
|
||||
BLUETOOTH. ONE OF YOU MAY NEED TO UPGRADE BEFORE YOU CAN
|
||||
CONTINUE.</string>
|
||||
<string name="sms_bad_proto_fmt">THE VERSION OF CROSSWORDS ON THE
|
||||
PHONE WITH NUMBER \"%1$s\" IS INCOMPATIBLE WITH THIS ONE FOR PLAY
|
||||
USING SMS. ONE OF YOU MAY NEED TO UPGRADE BEFORE YOU CAN
|
||||
CONTINUE.</string>
|
||||
<!-- -->
|
||||
<string name="new_btmove_title">INVITATION VIA BLUETOOTH</string>
|
||||
<!-- -->
|
||||
|
|
|
@ -1137,7 +1137,7 @@ public class BTService extends XWService {
|
|||
|
||||
private void sendBadProto( BluetoothSocket socket )
|
||||
{
|
||||
sendResult( MultiEvent.BAD_PROTO, socket.getRemoteDevice().getName() );
|
||||
sendResult( MultiEvent.BAD_PROTO_BT, socket.getRemoteDevice().getName() );
|
||||
}
|
||||
|
||||
private void postNotification( int gameID, int title, String body,
|
||||
|
|
|
@ -482,26 +482,33 @@ public class DelegateBase implements DlgClickNotify,
|
|||
//////////////////////////////////////////////////
|
||||
public void eventOccurred( MultiEvent event, final Object ... args )
|
||||
{
|
||||
int fmtId = 0;
|
||||
switch( event ) {
|
||||
case BT_ERR_COUNT:
|
||||
int count = (Integer)args[0];
|
||||
DbgUtils.logf( "Bluetooth error count: %d", count );
|
||||
break;
|
||||
case BAD_PROTO:
|
||||
case BAD_PROTO_BT:
|
||||
fmtId = R.string.bt_bad_proto_fmt;
|
||||
break;
|
||||
case BAD_PROTO_SMS:
|
||||
fmtId = R.string.sms_bad_proto_fmt;
|
||||
break;
|
||||
case APP_NOT_FOUND:
|
||||
final String msg = MultiEvent.BAD_PROTO == event
|
||||
? getString( R.string.bt_bad_proto_fmt, (String)args[0] )
|
||||
: getString( R.string.app_not_found_fmt, (String)args[0] );
|
||||
fmtId = R.string.app_not_found_fmt;
|
||||
break;
|
||||
default:
|
||||
DbgUtils.logf( "DelegateBase.eventOccurred(event=%s) (DROPPED)", event.toString() );
|
||||
}
|
||||
|
||||
if ( 0 != fmtId ) {
|
||||
final String msg = getString( fmtId, (String)args[0] );
|
||||
runOnUiThread( new Runnable() {
|
||||
public void run() {
|
||||
showOKOnlyDialog( msg );
|
||||
}
|
||||
});
|
||||
break;
|
||||
default:
|
||||
DbgUtils.logf( "DelegateBase.eventOccurred(event=%s) (DROPPED)", event.toString() );
|
||||
}
|
||||
// Assert.fail();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -57,7 +57,8 @@ public class MultiService {
|
|||
|
||||
// these do not currently pass between devices so they can change.
|
||||
public enum MultiEvent { _INVALID,
|
||||
BAD_PROTO,
|
||||
BAD_PROTO_BT,
|
||||
BAD_PROTO_SMS,
|
||||
APP_NOT_FOUND,
|
||||
BT_ENABLED,
|
||||
BT_DISABLED,
|
||||
|
|
|
@ -470,7 +470,7 @@ public class SMSService extends XWService {
|
|||
}
|
||||
end += len;
|
||||
byte[] part = new byte[4 + len];
|
||||
part[0] = (byte)0; // proto
|
||||
part[0] = (byte)SMS_PROTO_VERSION;
|
||||
part[1] = (byte)msgID;
|
||||
part[2] = (byte)ii;
|
||||
part[3] = (byte)count;
|
||||
|
@ -585,8 +585,9 @@ public class SMSService extends XWService {
|
|||
try {
|
||||
byte proto = dis.readByte();
|
||||
if ( SMS_PROTO_VERSION != proto ) {
|
||||
DbgUtils.logf( "SMSService.disAssemble: bad proto %d; dropping",
|
||||
proto );
|
||||
DbgUtils.logf( "SMSService.disAssemble: bad proto %d from %s;"
|
||||
+ " dropping", proto, senderPhone );
|
||||
sendResult( MultiEvent.BAD_PROTO_SMS, senderPhone );
|
||||
} else {
|
||||
SMS_CMD cmd = SMS_CMD.values()[dis.readByte()];
|
||||
byte[] rest = new byte[dis.available()];
|
||||
|
|
Loading…
Add table
Reference in a new issue