Commit 0af6994e authored by Jeffrey I. Schiller's avatar Jeffrey I. Schiller

Updated Companion App.

Update Version Number of Companion to 2.06 (versionCode 206). Make
instruction text smaller so the connect buttons don't scroll off the
screen on some devices. Update version Skew to handle compatibility
between master and release v133.

Change-Id: Ic67cfeb64970ebf72171e04b762c678bc677c491
parent d6eb9043
#|
$JSON
{"YaVersion":"69","Source":"Form","Properties":{"$Name":"Screen1","$Type":"Form","$Version":"10","Uuid":"0","ScreenOrientation":"portrait","Scrollable":"False","Title":"MIT AICompanion","VersionCode":"205","VersionName":"2.05","$Components":[{"$Name":"HorizontalArrangement2","$Type":"HorizontalArrangement","$Version":"2","Uuid":"-1890222609","Width":"-2","$Components":[{"$Name":"Label1","$Type":"Label","$Version":"2","Uuid":"-333340163","Text":"Your IP Address: "},{"$Name":"iplabel","$Type":"Label","$Version":"2","Uuid":"1435778230","Text":"IP ADDRESS","Width":"-2"}]},{"$Name":"Label5","$Type":"Label","$Version":"2","Uuid":"1468302777","Text":" ","Width":"-2"},{"$Name":"Label2","$Type":"Label","$Version":"2","Uuid":"-28249960","Text":"Directions: \\n1) On the Blocks Editor, press \"Connect to Device\" and select WiFi.\\n2) Type the 6-letter code or scan the QR code displayed on the Blocks Editor.\\n3) Click the 'Connect to App Inventor' button below.\\n4) If not connected in 30 seconds, click reset and repeat steps 1-4.","Width":"-2"},{"$Name":"Label6","$Type":"Label","$Version":"2","Uuid":"1263643189","Text":" ","Width":"-2"},{"$Name":"ScanButton","$Type":"Button","$Version":"4","Uuid":"-928166843","Text":"Scan the QR Code","Width":"-2"},{"$Name":"HorizontalArrangement1","$Type":"HorizontalArrangement","$Version":"2","Uuid":"-1363356191","Width":"-2","$Components":[{"$Name":"code","$Type":"TextBox","$Version":"4","Uuid":"2091318480","Hint":"Or type the 6-letter code here.","Width":"-2"}]},{"$Name":"Button1","$Type":"Button","$Version":"4","Uuid":"933636264","Text":"Connect to App Inventor","Width":"-2"},{"$Name":"Label8","$Type":"Label","$Version":"2","Uuid":"-1656721742","TextColor":"&HFFFF0000","Visible":"False"},{"$Name":"HorizontalArrangement5","$Type":"HorizontalArrangement","$Version":"2","Uuid":"1374735927","Visible":"False","$Components":[{"$Name":"Label7","$Type":"Label","$Version":"2","Uuid":"677206225","Text":"You did not enter 6 characters, please try again.","TextColor":"&HFFFF0000"}]},{"$Name":"RetryButton","$Type":"Button","$Version":"4","Uuid":"796723612","Text":"Reset","Visible":"False","Width":"-2"},{"$Name":"HorizontalArrangement3","$Type":"HorizontalArrangement","$Version":"2","Uuid":"-1743769894","Visible":"False","$Components":[{"$Name":"Label3","$Type":"Label","$Version":"2","Uuid":"-1412894374","Text":"Or you Can Scan a Bar Code","Visible":"False"}]},{"$Name":"HorizontalArrangement4","$Type":"HorizontalArrangement","$Version":"2","Uuid":"1722789622","Visible":"False","$Components":[{"$Name":"Label4","$Type":"Label","$Version":"2","Uuid":"-1681239855","Text":"If the Blocks Editor is already running"},{"$Name":"RestartButton","$Type":"Button","$Version":"4","Uuid":"1759990306","Text":"Restart"}]},{"$Name":"ConnectFailLabel","$Type":"Label","$Version":"2","Uuid":"1331553180","Text":"Your phone does not appear to be connected to a Wireless (WiFi) network.","TextColor":"&HFFFF0000","Visible":"False"},{"$Name":"Expireblock","$Type":"VerticalArrangement","$Version":"2","Uuid":"-1616116264","AlignHorizontal":"3","Visible":"False","$Components":[{"$Name":"expirewarning","$Type":"Label","$Version":"2","Uuid":"-243410660","Text":"This version of the App Inventor Companion is not compatible with your blocks editor. You can download a new version from the Play Store","TextColor":"&HFFFF0000"},{"$Name":"MarketButton","$Type":"Button","$Version":"4","Uuid":"566867955","Text":"Go to the Play Store"}]},{"$Name":"Web1","$Type":"Web","$Version":"2","Uuid":"-1902677450","Url":"http:\/\/osiris.mit.edu\/rendezvous\/"},{"$Name":"Clock1","$Type":"Clock","$Version":"1","Uuid":"1668438698"},{"$Name":"BarcodeScanner1","$Type":"BarcodeScanner","$Version":"1","Uuid":"240579661"},{"$Name":"TinyDB1","$Type":"TinyDB","$Version":"1","Uuid":"-587391114"},{"$Name":"ActivityStarter1","$Type":"ActivityStarter","$Version":"4","Uuid":"506337611","Action":"android.intent.action.VIEW","DataUri":"market:\/\/details?id=edu.mit.appinventor.aicompanion2"},{"$Name":"PhoneStatus1","$Type":"PhoneStatus","$Version":"1","Uuid":"-315198317"}]}}
{"YaVersion":"75","Source":"Form","Properties":{"$Name":"Screen1","$Type":"Form","$Version":"10","Uuid":"0","ScreenOrientation":"portrait","Scrollable":"False","Title":"MIT AICompanion","VersionCode":"206","VersionName":"2.06","$Components":[{"$Name":"HorizontalArrangement2","$Type":"HorizontalArrangement","$Version":"2","Uuid":"-1890222609","Width":"-2","$Components":[{"$Name":"Label1","$Type":"Label","$Version":"2","Uuid":"-333340163","FontSize":"12.0","Text":"Your IP Address: "},{"$Name":"iplabel","$Type":"Label","$Version":"2","Uuid":"1435778230","Text":"IP ADDRESS","Width":"-2"}]},{"$Name":"Label2","$Type":"Label","$Version":"2","Uuid":"-28249960","FontSize":"12.0","Text":"Directions: \\n1) On the Blocks Editor, press \"Connect to Device\" and select WiFi.\\n2) Type the 6-letter code or scan the QR code displayed on the Blocks Editor.\\n3) Click the 'Connect to App Inventor' button below.\\n4) If not connected in 30 seconds, click reset and repeat steps 1-4.","Width":"-2"},{"$Name":"Label6","$Type":"Label","$Version":"2","Uuid":"1263643189","Text":" ","Width":"-2"},{"$Name":"ScanButton","$Type":"Button","$Version":"5","Uuid":"-928166843","Text":"Scan the QR Code","Width":"-2"},{"$Name":"HorizontalArrangement1","$Type":"HorizontalArrangement","$Version":"2","Uuid":"-1363356191","Width":"-2","$Components":[{"$Name":"code","$Type":"TextBox","$Version":"4","Uuid":"2091318480","Hint":"Or type the 6-letter code here.","Width":"-2"}]},{"$Name":"Button1","$Type":"Button","$Version":"5","Uuid":"933636264","Text":"Connect to App Inventor","Width":"-2"},{"$Name":"Label8","$Type":"Label","$Version":"2","Uuid":"-1656721742","TextColor":"&HFFFF0000","Visible":"False"},{"$Name":"HorizontalArrangement5","$Type":"HorizontalArrangement","$Version":"2","Uuid":"1374735927","Visible":"False","$Components":[{"$Name":"Label7","$Type":"Label","$Version":"2","Uuid":"677206225","Text":"You did not enter 6 characters, please try again.","TextColor":"&HFFFF0000"}]},{"$Name":"RetryButton","$Type":"Button","$Version":"5","Uuid":"796723612","Text":"Reset","Visible":"False","Width":"-2"},{"$Name":"HorizontalArrangement3","$Type":"HorizontalArrangement","$Version":"2","Uuid":"-1743769894","Visible":"False","$Components":[{"$Name":"Label3","$Type":"Label","$Version":"2","Uuid":"-1412894374","Text":"Or you Can Scan a Bar Code","Visible":"False"}]},{"$Name":"HorizontalArrangement4","$Type":"HorizontalArrangement","$Version":"2","Uuid":"1722789622","Visible":"False","$Components":[{"$Name":"Label4","$Type":"Label","$Version":"2","Uuid":"-1681239855","Text":"If the Blocks Editor is already running"},{"$Name":"RestartButton","$Type":"Button","$Version":"5","Uuid":"1759990306","Text":"Restart"}]},{"$Name":"ConnectFailLabel","$Type":"Label","$Version":"2","Uuid":"1331553180","Text":"Your phone does not appear to be connected to a Wireless (WiFi) network.","TextColor":"&HFFFF0000","Visible":"False"},{"$Name":"Expireblock","$Type":"VerticalArrangement","$Version":"2","Uuid":"-1616116264","AlignHorizontal":"3","Visible":"False","$Components":[{"$Name":"expirewarning","$Type":"Label","$Version":"2","Uuid":"-243410660","Text":"This version of the App Inventor Companion is not compatible with your blocks editor. You can download a new version from the Play Store","TextColor":"&HFFFF0000"},{"$Name":"MarketButton","$Type":"Button","$Version":"5","Uuid":"566867955","Text":"Go to the Play Store"}]},{"$Name":"Web1","$Type":"Web","$Version":"3","Uuid":"-1902677450","Url":"http:\/\/osiris.mit.edu\/rendezvous\/"},{"$Name":"Clock1","$Type":"Clock","$Version":"1","Uuid":"1668438698"},{"$Name":"BarcodeScanner1","$Type":"BarcodeScanner","$Version":"1","Uuid":"240579661"},{"$Name":"TinyDB1","$Type":"TinyDB","$Version":"1","Uuid":"-587391114"},{"$Name":"ActivityStarter1","$Type":"ActivityStarter","$Version":"4","Uuid":"506337611","Action":"android.intent.action.VIEW","DataUri":"market:\/\/details?id=edu.mit.appinventor.aicompanion2"},{"$Name":"PhoneStatus1","$Type":"PhoneStatus","$Version":"1","Uuid":"-315198317"}]}}
|#
\ No newline at end of file
......@@ -4,15 +4,35 @@ $Source $Yail
(define-repl-form edu.mit.appinventor.aicompanion2.Screen1 Screen1)
(require <com.google.youngandroid.runtime>)
(def (badversion)
(set-var! expired #t)
(def (Setup)
(set-var! ipaddress (call-component-method 'PhoneStatus1 'GetWifiIpAddress (*list-for-runtime*)
'())
)
(set-and-coerce-property! 'Expireblock 'Visible #t 'boolean)
(set-and-coerce-property! 'iplabel 'Text (get-var ipaddress)
'text)
(set-and-coerce-property! 'Button1 'Enabled #t 'boolean)
(set-and-coerce-property! 'ScanButton 'Enabled #t 'boolean)
(set-and-coerce-property! 'RetryButton 'Visible #f 'boolean)
(if (call-yail-primitive yail-not (*list-for-runtime* (call-component-method 'PhoneStatus1 'isConnected (*list-for-runtime*)
'())
)
'( boolean)
"not")
(begin (set-and-coerce-property! 'ConnectFailLabel 'Visible #t 'boolean)
)
(begin (set-and-coerce-property! 'ConnectFailLabel 'Visible #f 'boolean)
)
)
)
(def ipaddress "IPADDRESS")
(def expired #f)
(def (PostData)
(set-and-coerce-property! 'Web1 'Url (call-yail-primitive string-append (*list-for-runtime* "http://" (call-yail-primitive string-append (*list-for-runtime* "rendezvous.appinventor.mit.edu" "/rendezvous/")
......@@ -23,7 +43,7 @@ $Source $Yail
"join")
'text)
(call-component-method 'Web1 'PostText (*list-for-runtime* (call-component-method 'Web1 'BuildPostData (*list-for-runtime* (call-yail-primitive make-yail-list (*list-for-runtime* (call-yail-primitive make-yail-list (*list-for-runtime* "key" (get-property 'code 'Text)
(call-component-method 'Web1 'PostText (*list-for-runtime* (call-component-method 'Web1 'BuildRequestData (*list-for-runtime* (call-yail-primitive make-yail-list (*list-for-runtime* (call-yail-primitive make-yail-list (*list-for-runtime* "key" (get-property 'code 'Text)
)
'( any any)
"make a list")
......@@ -48,42 +68,27 @@ $Source $Yail
'())
)
(def expired #f)
(def (Setup)
(set-var! ipaddress (call-component-method 'PhoneStatus1 'GetWifiIpAddress (*list-for-runtime*)
'())
)
(set-and-coerce-property! 'iplabel 'Text (get-var ipaddress)
'text)
(def ipaddress "IPADDRESS")
(set-and-coerce-property! 'Button1 'Enabled #t 'boolean)
(def (badversion)
(set-var! expired #t)
(set-and-coerce-property! 'ScanButton 'Enabled #t 'boolean)
(set-and-coerce-property! 'Expireblock 'Visible #t 'boolean)
(set-and-coerce-property! 'RetryButton 'Visible #f 'boolean)
(if (call-yail-primitive yail-not (*list-for-runtime* (call-component-method 'PhoneStatus1 'isConnected (*list-for-runtime*)
'())
)
'( boolean)
"not")
(begin (set-and-coerce-property! 'ConnectFailLabel 'Visible #t 'boolean)
)
(begin (set-and-coerce-property! 'ConnectFailLabel 'Visible #f 'boolean)
)
)
)
;;; Screen1
(do-after-form-creation (set-and-coerce-property! 'Screen1 'ScreenOrientation "portrait" 'text)
(set-and-coerce-property! 'Screen1 'Scrollable #f 'boolean)
(set-and-coerce-property! 'Screen1 'Title "MIT AICompanion" 'text)
(set-and-coerce-property! 'Screen1 'VersionCode 205 'number)
(set-and-coerce-property! 'Screen1 'VersionName "2.05" 'text)
(set-and-coerce-property! 'Screen1 'VersionCode 206 'number)
(set-and-coerce-property! 'Screen1 'VersionName "2.06" 'text)
)
(define-event Screen1 Initialize()
(set-this-form)
((get-var Setup))
)
(define-event Screen1 ErrorOccurred( component functionName errorNumber message )
(set-this-form)
......@@ -103,28 +108,21 @@ $Source $Yail
((get-var Setup))
)
(define-event Screen1 Initialize()
(set-this-form)
((get-var Setup))
)
;;; HorizontalArrangement2
(add-component Screen1 HorizontalArrangement HorizontalArrangement2 (set-and-coerce-property! 'HorizontalArrangement2 'Width -2 'number)
)
;;; Label1
(add-component HorizontalArrangement2 Label Label1 (set-and-coerce-property! 'Label1 'Text "Your IP Address: " 'text)
(add-component HorizontalArrangement2 Label Label1 (set-and-coerce-property! 'Label1 'FontSize 12.0 'number)
(set-and-coerce-property! 'Label1 'Text "Your IP Address: " 'text)
)
;;; iplabel
(add-component HorizontalArrangement2 Label iplabel (set-and-coerce-property! 'iplabel 'Text "IP ADDRESS" 'text)
(set-and-coerce-property! 'iplabel 'Width -2 'number)
)
;;; Label5
(add-component Screen1 Label Label5 (set-and-coerce-property! 'Label5 'Text " " 'text)
(set-and-coerce-property! 'Label5 'Width -2 'number)
)
;;; Label2
(add-component Screen1 Label Label2 (set-and-coerce-property! 'Label2 'Text "Directions: \n1) On the Blocks Editor, press \"Connect to Device\" and select WiFi.\n2) Type the 6-letter code or scan the QR code displayed on the Blocks Editor.\n3) Click the 'Connect to App Inventor' button below.\n4) If not connected in 30 seconds, click reset and repeat steps 1-4." 'text)
(add-component Screen1 Label Label2 (set-and-coerce-property! 'Label2 'FontSize 12.0 'number)
(set-and-coerce-property! 'Label2 'Text "Directions: \n1) On the Blocks Editor, press \"Connect to Device\" and select WiFi.\n2) Type the 6-letter code or scan the QR code displayed on the Blocks Editor.\n3) Click the 'Connect to App Inventor' button below.\n4) If not connected in 30 seconds, click reset and repeat steps 1-4." 'text)
(set-and-coerce-property! 'Label2 'Width -2 'number)
)
;;; Label6
......
......@@ -4,5 +4,6 @@ assets=../assets
source=../src
build=../build
icon=AICompanion.png
versioncode=205
versionname=2.05
versioncode=206
versionname=2.06
useslocation=False
......@@ -24,7 +24,8 @@ public class AppInvHTTPD extends NanoHTTPD {
private File rootDir;
private Language scheme;
private ReplForm form;
private static final int YAV_SKEW = 1;
private static final int YAV_SKEW_FORWARD = 1;
private static final int YAV_SKEW_BACKWARD = 4;
public AppInvHTTPD( int port, File wwwroot, ReplForm form) throws IOException
{
......@@ -70,8 +71,8 @@ public class AppInvHTTPD extends NanoHTTPD {
try {
String strversion = parms.getProperty("version", "0");
int version = (new Integer(strversion)).intValue();
if ((version > (YaVersion.YOUNG_ANDROID_VERSION + YAV_SKEW)) ||
(version < (YaVersion.YOUNG_ANDROID_VERSION - YAV_SKEW))) {
if ((version > (YaVersion.YOUNG_ANDROID_VERSION + YAV_SKEW_FORWARD)) ||
(version < (YaVersion.YOUNG_ANDROID_VERSION - YAV_SKEW_BACKWARD))) {
scheme.eval("(begin (require com.google.youngandroid.runtime) (process-repl-input ((get-var badversion)) \"foo\"))");
} else {
// If we have a good version, start the repl
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment