add code to deal with Amazon, which I falsely identified as having

broken custom schemes.  I'm leaving it in, unreachable, to have a record.
This commit is contained in:
Eric House 2012-11-25 12:30:25 -08:00
parent d7bb869a5b
commit f82e5bd0e9

View file

@ -1,6 +1,31 @@
<!-- -*- mode: sgml; -*- --> <!-- -*- mode: sgml; -*- -->
<?php <?php
function langToString( $code ) {
switch ( $code ) {
case 1: return "English";
case 2: return "French";
case 3: return "German";
case 4: return "Turkish";
case 5: return "Arabic";
case 6: return "Spanish";
case 7: return "Swedish";
case 8: return "Polish";
case 9: return "Danish";
case 0xA: return "Italian";
case 0xB: return "Dutch";
case 0xC: return "Catalan";
case 0xD: return "Portuguese";
case 0XF: return "Russian";
case 0x11: return "Czech";
case 0x12: return "Greek";
case 0x13: return "Slovak";
default:
return "<unknown>";
}
}
$g_androidStrings = array( "android", ); $g_androidStrings = array( "android", );
$scheme = "newxwgame"; $scheme = "newxwgame";
@ -17,6 +42,7 @@ for ( $ii = 0; $ii < count($g_androidStrings) && !$onAndroid; ++$ii ) {
$needle = $g_androidStrings[$ii]; $needle = $g_androidStrings[$ii];
$onAndroid = 0 != stripos( $agent, $needle ); $onAndroid = 0 != stripos( $agent, $needle );
} }
$onFire = 0 != stripos( $agent, 'silk' );
$localurl = "$scheme://$host?room=$room&lang=$lang&np=$np"; $localurl = "$scheme://$host?room=$room&lang=$lang&np=$np";
if ( $id != "" ) { if ( $id != "" ) {
@ -26,7 +52,7 @@ if ( $wl != "" ) {
$localurl .= "&wl=$wl"; $localurl .= "&wl=$wl";
} }
if ( $onAndroid ) { if ( $onAndroid || $onFire ) {
print <<<EOF print <<<EOF
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
@ -38,7 +64,7 @@ print <<<EOF
<body> <body>
<div align="center"> <div align="center">
<img src="./icon48x48.png"> <img src="./icon48x48.png"/>
<h1><a href="$localurl">Tap this link to launch Crosswords with <h1><a href="$localurl">Tap this link to launch Crosswords with
your new game.</a> your new game.</a>
@ -47,7 +73,7 @@ print <<<EOF
version of Crosswords installed. version of Crosswords installed.
</p> </p>
<img src="./icon48x48.png"> <img src="./icon48x48.png"/>
</div> </div>
</body> </body>
@ -55,6 +81,45 @@ print <<<EOF
EOF; EOF;
} else if ( $onFire ) {
$langString = langToString($lang);
$langText = "Make sure the language chosen is $langString";
if ( '' != $wl ) {
$langText .= " and the wordlist is $wl.";
}
$langText .= " If you don't have a[n] $langString wordlist installed you'll need to do that first.";
print <<<EOF
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Crosswords Invite redirect</title>
</head>
<body>
<p>It appears you&apos;re running on a Kindle Fire, whose non-standard (from
an Android perspective) OS doesn't support the custom schemes on which
Crosswords invitations depend. If you want to accept this invitation
you'll need to do it the manual way:
<ol>
<li>Open Crosswords, and navigate to the main Games List screen</li>
<li>Choose &quot;Add game&quot;, either from the menu or the button at the bottom.</li>
<li>Under &quot;New Networked game&quot;, choose &quot;Configure first&quot;.</li>
<li>$langText</li>
<li>As the room name, enter &quot;$room&quot;.</li>
<li>Make sure the total number of players shown is $np and that only one of them is not an &quot;Off-device player&quot;.</li>
<li>Now tap the &quot;Play game&quot; button at the bottom (above the keyboard). Your new game should open and connect.</li>
</ol></p>
<p>I&apos;m sorry this is so complicated. I&apos;m trying to find a
workaround for this limitation in the Kindle Fire's operating system
but for now this is all I can offer.</p>
<p>(Just in case Amazon&apos;s fixed the
problem, <a href="$localurl">here is the link</a> that should open
your new game.)</p>
</body>
</html>
EOF;
} else { } else {
$subject = "Android device not identified"; $subject = "Android device not identified";
@ -70,11 +135,11 @@ print <<<EOF
</head> </head>
<body> <body>
<div align="center"> <div align="center">
<img src="./icon48x48.png"> <img src="./icon48x48.png"/>
</div> </div>
<p>This page is meant to be viewed on a browser on your Android <p>This page is meant to be viewed on a browser on your Android
device. Please open the email that sent you here on that device to device. Please open the email that sent you here on that device and
complete the invitation process. revisit this link to complete the invitation process.
</p> </p>
<p>(If you <em>are</em> viewing this on an Android device, you've <p>(If you <em>are</em> viewing this on an Android device, you've