This Repository Has Moved Here
This tutorial assumes you have a basic understanding of Git, Typescript, and that you are using Visual Studio Code as your IDE.
- Install programs: Visual Studio Code, Node.JS (Current), JDK (x64), Android Studio. If you would like to develop for iOS, you also must install Xcode and Xcode Command Line Tools (You must own a Mac to develop for iOS).
- (OSX Only) Set up npm globally: https://github.com/glenpike/npm-g_nosudo/blob/master/npm-g-nosudo.sh
- Install JS dependencies: In an administrator command window, run
npm i -g cordova typescript typedoc. - (OSX Only) Install more JS dependencies: In an administrator command window, run
npm i -g --unsafe-perm=true ios-simulator ios-deploy. - Setup Android: Follow this tutorial to the end of "Installing the Requirements". As of writing the targeted Android version is 4.4 (API level 19).
- Clone this repository and open
HereWeGo/Wilson App.code-workspaceusing VSCode. Install all recommended extensions for the workspace (can be found in the extensions window by searching "@recommended" and looking under "Workspace Recommendations" if the workspace is open). - Using the terminal in VSCode, run
npm update,cordova platform add android, andcordova platform add ios.
- To start the Typescript build, press
Ctrl+Shift+B(Command+Shift+Bon OSX). - In the VSCode debug menu, select "Simulate iOS in browser" and hit run.
- In the browser, you will need to install a CORS disabler extension. I use this one for Chrome. Install an extension and ensure it is enabled.
- Refresh the page, and open the developer tools (
Ctrl+Shift+Ifor Chrome on windows). Enable the Mobile Screen size tool (Ctrl+Shift+Mfor Chrome on Windows), and resize to a desired device (I use Samsung Galaxy S5). - You can now make changes to any files in the project, and the webpage will automatically update to reflect those changes. Note: Changes made to files located in
HereWeGo/www/scriptswill not persist, as these are automatically overwritten by Typescript. Any script editing should be done in the.tsor.jsfiles inHereWeGo/scripts.
- Use
Ctrl+Shift+B(Command+Shift+Bon OSX) to start the Typescript build if you haven't already. - Connect an Android phone to your computer and enable USB debugging if you haven't already.
- In the VSCode debug menu, select "Run Android on device" and hit run.
- Check out this tutorial for debugging web apps on Android.
- Unlike the browser simulation, you will need to reinstall the app every time you change a file to see the changes reflected on the device.
- Use
Ctrl+Shift+B(Command+Shift+Bon OSX) to start the Typescript build if you haven't already. - Run
./build-and-run-ios.shin the integrated terminal (You may need tosudo chmod +x ./build-and-run-ios.shfor the first run). This script can be configured to build to different versions and devices, by defualt it is set to an IPhone 7 running IOS 10. - Check out this tutorial for debugging a web app in IOS simulator using Safari.
- Unlike the browser simulation, you will need to reinstall the app every time you change a file to see the changes reflected on the device. To reinstall, simply run
./build-and-run-ios.sh, and the app will automatically be replaced on the already launched simulator.
- Connect an Apple ID to XCode (XCode->Preferences->Accounts). It can be either your personal account or the WilsonCS account.
- In VSCode, use
Ctrl+Shift+B(Command+Shift+Bon OSX) to start the Typescript build if you haven't already. - Run
cordova build iosin the integrated terminal. - Double click on
./HereWeGo/HereWeGo/platforms/ios/Wilson App.xcodeprojto open the IOS project in XCode. - If this is your first build: In Project Editor->General->Signing section, select a personal team in the "Team" drop down menu.
- Connect your IOS device, and use the device list menu (top left) to select your device. Press the play button to build the app.
- If the above step throws a "Could not launch error": In your IOS device, navigate to Settings->General->Device Management, tap the email associated with the Apple ID you attached to XCode, and tap "Trust <your email here>". Click the play button in XCode one more time to try again.
- Debugging an IOS device is messy. You can attempt following the tutorial for Safari debugging an IOS Simulator replacing the simulator with the device (I have had mixed results using this method). Or you use a proxy and the Chrome developer tools, as detailed here.
Typedoc is used to generate web documentation from code comments. You can view the documentation generated here. To update the documentation, simply run typedoc --target ES6 --mode file --out ./docs, and the documentation will be regenerated.
- You will need to be granted access to the
build.jsonandWilsonCS.keystorefiles, and the WilsonCS Google Play Developer dashboard. Please speak with Mr. Bartlo or the student managing this project for access to these resources. - Place the
build.jsonandWilsonCS.keystorefile at./HereWeGo/HereWeGo/ - Ensure the version in
config.xmlhas been increased appropriately to reflect the new release. You may also need to clear the old cached data by modifying DBManage. - Run
cordova build android --releasein the integrated terminal. - In the developer console, navigate to Release Management->App releases, click "MANAGE" next to the "Production" header, then click "CREATE RELEASE".
- Upload the built APK file in
./HereWeGo/HereWeGo/platforms/android/app/build/outputs/apk/release/app-release.apkusing the "BROWSE FILES" button. The Release name will be filled in automatically when the upload is finished. Write some descriptive and relevant release notes while you wait. - Click "REVIEW" and then "START ROLLOUT". The updated version will be released to the play store and installed on devices usually by the next day.
These steps only work on a OSX machine. Warning: Apple makes everything harder than it should be, expect troubleshooting.
- You will need to be granted access to the
ios_distribution.ceran instance of XCode which is connected to the WilsonCS Apple ID. Please speak with Mr. Bartlo or the student managing this project for access to these resources. - Ensure the version in
config.xmlhas been increased appropriately to reflect the new release. You may also need to clear the old cached data by modifying DBManage. - If this is your first time building: Double click on
ios_distribution.cerand add it to your keychain. In XCode under Project Editor->General->Signing section, select "Christopher Bartlo" in the "Team" drop down menu. - In the XCode top menus click Product->Archive.
- Once the archiving is finished, click "Upload to App Store". Keep the default options. This step will take awhile.
- Head over to the App Store Management Page, and log in with the WilsonCS AppleID.
- Click on the "+ VERSION OR PLATFORM" below the versions, then click "iOS".
- Click the plus button next to "Build", and select the version you uploaded using XCode. Change the version below "General App Information" to reflect the build version, and fill in change notes under "Version Information".
- Click "Save" and then "Submit for Review".
- The app will now be reviewed by Apple for app store eligibility. The status of this process will display next to the version in the dashboard. This process generally takes 1-2 days, and expect to be rejected once or twice during development.
The Wilson App includes a server platform developed on Google Apps Script which handles the cataloguing and serving of data sources, including the calendar and background images. This server platform is developed in the form of a public API, which can be executed here. To edit this platform, first request access from the computer science student in charge of this project, or alternately Mr. Bartlo. Once you are granted access, the source code can be edited here. More information on web apps in Google Apps Script.
Changes made to the Google Apps Script project will not affect Wilson App users until they are published. Changes may, however, be tested in the IDE.
To test a function, navigate to the file with the function, select the function in the drop down menu labeled "Select function", then press the button with a bug on it. Google Apps Script will run the function, breaking on an exception with a debug memory dump.
Since Google Apps Script does not show the output of the script during debugging, logs must be written using Logger.log(string), and viewed after execution under View->Logs. You can also view a more verbose output of the scripts execution under View->Execution Transcript.
After extensive modification, you may also wish to test the entire project before publishing it for students. To do this, visit the developer endpoint here. This link will execute the API with all your changes, but will only work in a browser that is allowed to edit the Google Apps Script project. As such, you cannot test this link in the Wilson App itself.
Note: As of writing, the Wilson App Backend uses the Script Property Store for data storage. One consequence of this is that code being executed for testing purposes uses the same database as code being used for production. This means that testing should be done carefully, as there is a risk of breaking the Wilson App for everyone should the test corrupt the database. This issue is a byproduct of poor design.
To deploy your changes to production, click Publish->Deploy as web app... In the window, open the project version drop-down, select "New", and enter a few words describing your changes and your name. Click "Update" to deploy the changes. Once "Update" has been clicked, the API immediately will begin using your changes, and as such it is prudent to check with students if there app still works afterwards.