mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-15 15:41:24 +01:00
to deal with case where somebody invites a friend who doesn't have
Crosswords installed, add a URL to texts that will show up if it makes it to an inbox and takes user to an explanation and download URL.
This commit is contained in:
parent
fff4116d24
commit
51cfbb196e
1 changed files with 12 additions and 3 deletions
|
@ -45,7 +45,9 @@ import org.eehouse.android.xw4.jni.XwJNI;
|
|||
|
||||
public class SMSService extends Service {
|
||||
|
||||
private static final String PUBLIC_HEADER = "_XW4";
|
||||
private static final String PUBLIC_HEADER = "-XW4 ";
|
||||
private static final String INSTALL_URL = "http://eehouse.org/_/aa.htm ";
|
||||
private static final int MAX_SMS_LEN = 140; // ??? differs by network
|
||||
|
||||
private static final int MAX_LEN_TEXT = 100;
|
||||
private static final int HANDLE = 1;
|
||||
|
@ -116,14 +118,21 @@ public class SMSService extends Service {
|
|||
|
||||
public static String toPublicFmt( String msg )
|
||||
{
|
||||
return PUBLIC_HEADER + msg;
|
||||
String result;
|
||||
int msglen = msg.length() + PUBLIC_HEADER.length();
|
||||
int urllen = INSTALL_URL.length();
|
||||
result = String.format( "%s%s%s", PUBLIC_HEADER,
|
||||
msglen + urllen < MAX_SMS_LEN ? INSTALL_URL : "",
|
||||
msg );
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String fromPublicFmt( String msg )
|
||||
{
|
||||
String result = null;
|
||||
if ( msg.startsWith( PUBLIC_HEADER ) ) {
|
||||
result = msg.substring( PUBLIC_HEADER.length() );
|
||||
int index = msg.lastIndexOf( " " );
|
||||
result = msg.substring( index + 1 );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue