Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

Commit

Permalink
Merge pull request #63 from thaliproject/story_0
Browse files Browse the repository at this point in the history
Merge Story 0 into master
  • Loading branch information
deadlyfingers committed Oct 30, 2015
2 parents 16f3140 + 7984db2 commit 8eb128e
Show file tree
Hide file tree
Showing 247 changed files with 1,723 additions and 38,962 deletions.
25 changes: 21 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,24 @@ build/Release
# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules

# Intellij
*.iml
.idea/
bower_components

# Intellij and Android
.idea/

# VS Code
.settings/

platforms/
plugins/
shortid
ejs-locals
express
fast-future
gulp
gulp-nodemon
leveldown
thaliDontCheckIn/

# Mac
.DS_Store
11 changes: 11 additions & 0 deletions config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,16 @@
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
<preference name="BackupWebStorage" value="local" />
<preference name="EnableViewportScale" value="false" />
<preference name="KeyboardDisplayRequiresUserAction" value="false" />
<preference name="SuppressesIncrementalRendering" value="true" />
<feature name="StatusBar">
<param name="ios-package" value="CDVStatusBar" onload="true" />
</feature>
<preference name="StatusBarOverlaysWebview" value="true" />
<preference name="StatusBarStyle" value="lightcontent" />
<preference name="StatusBarBackgroundColor" value="#000000" />
</platform>
<preference name="DisallowOverscroll" value="true" />
</widget>
94 changes: 66 additions & 28 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Postcard App Demo with the following features

2. Sync the cards from other devices over http

![alt text](https://cloud.githubusercontent.com/assets/1880480/10515480/95a32aa6-734b-11e5-972e-d934763b93e9.gif "Postcard app demo")

This is intended as a sample project illustrating how to use the [Thali Project](http://www.thaliproject.org) APIs.

# Dependencies
Expand Down Expand Up @@ -52,7 +54,7 @@ set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools
Follow the instructions at [http://jxcore.com/downloads/](http://jxcore.com/downloads/). Their download page is a little confusing so please pay attention to the section at the top that says in a tiny little font 'Installation'. When you're done, check that the installation worked:
```
$ jx -jxv
v 0.3.0.5
v 0.3.0.7
```

## Install Apache Cordova
Expand All @@ -68,45 +70,63 @@ Windows:
```
$ jx install -g cordova
```

## Install Bower

[Bower](http://bower.io/) is required to install web app dependencies.

```
$ npm install -g bower
```

## Hardware

You will need two (it's a peer to peer system) Android devices running at least KitKat. And no, the emulator won't work. We depend on specific radios to work and they aren't in the emulator.

# Building the postcard app
## Building the postcard app

```shell
curl https://codeload.github.com/thaliproject/postcardapp/zip/master > thali.zip
unzip thali.zip
cd postcardapp-master
cordova platform add android
git clone https://github.com/thaliproject/postcardapp.git

cd postcardapp

cordova platform add ios
cordova platform add android

cd www/jxcore
jx npm install --production --autoremove "*.gz"
cordova build android
bower install
find ./bower_components -name "*.gz" -type f -delete

cordova build ios
cordova build android
```

On Windows one needs to use [Git Bash](https://git-scm.com/download/win) or equivalent to run the above commands.

## Running in development environment on localhost
You will also need to copy the Thali_CordovaPlugin 'mockmobile.js' script if you want run in development mode. This allows native methods to be called on the desktop when UX testing the web app.
```
cd www/jxcore
jx npm install --production --autoremove "*.gz"
bower install
find ./bower_components -name "*.gz" -type f -delete
cp -v ../../thaliDontCheckIn/Thali_CordovaPlugin-master/test/www/jxcore/bv_tests/mockmobile.js node_modules/thali/
jx npm run localhost
```

# Fun issues you are probably going to run into

## Getting Discovery Working on Android
First and foremost, service discovery over Wi-Fi Direct is not terribly reliable. It can take anywhere from seconds to
minutes to discover another device. Yes, we are working on this (including looking at moving completely over to BLE).
In the meantime something you can do to improve things is reboot your devices. But otherwise the way to know if
discovery actually occurred is by looking at your logcat output. See below for instructions on using logcat. In the log
you are looking for something like:
## Getting Discovery Working
First and foremost, service discovery over Wi-Fi Direct is not terribly reliable. It can take anywhere from seconds to minutes to discover another device. Yes, we are working on this (including looking at moving completely over to BLE). In the meantime something you can do to improve things is reboot your devices. But otherwise the way to know if discovery actually occured is by looking at your logcat output. See below for instructions on using logcat. In the log you are looking for something like:

```
08-07 11:18:47.444 6037-6037/org.thaliproject.postcardapp I/Service searcher﹕ Added service request
08-07 11:18:48.464 6037-6037/org.thaliproject.postcardapp I/Service searcher﹕ Started service discovery
08-07 11:19:47.444 6037-6037/org.thaliproject.postcardapp I/Service searcher﹕ Cleared service requests
```

You will see this repeat a lot because it turns out that service discovery just kinda stops working after a minute or
two so we have to constantly turn it on and off to get it to work. This is one of the reasons why service discovery
performance is so awful, it takes time to turn the service on and off and while that is happening we can't be
discovered or discover others.
You will see this repeat a lot because it turns out that service discovery just kinda stops working after a minute or two so we have to constantly turn it on and off to get it to work. This is one of the reasons why service discovery performance is so awful, it takes time to turn the service on and off and while that is happening we can't be discovered or discover others.

When the other device is found you will see something in the log like:

Expand All @@ -115,17 +135,35 @@ When the other device is found you will see something in the log like:
08
```

And yes, we are going to make this easier. See [here](https://github.com/thaliproject/Thali_CordovaPlugin/issues/63)
and [here](https://github.com/thaliproject/postcardapp/issues/19).
And yes, we are going to make this easier. See [here](https://github.com/thaliproject/Thali_CordovaPlugin/issues/63) and [here](https://github.com/thaliproject/postcardapp/issues/19).

### Using logcat

The easiest way in my opinion to use logcat, especially given that there are two devices involved, is to use Android
Studio and its logcat viewer. But for masochists out there you can also use logcat via adb. But you have to specify
which device you want to get your logcat output from. So first run `adb devices` to get a list of your attached devices.
Then issue `adb -s [id] logcat` where [id] is the device ID you got from `adb devices`.

## Using the UX

Even when there is synching the data will only actually show up if you hit the refresh button in the upper right part
of the screen. And yes, this will eventually be fixed when we switch to the new UX.
The easiest way in my opinion to use logcat, especially given that there are two devices involved, is to use Android Studio and its logcat viewer. But for masochists out there you can also use logcat via adb. But you have to specify which device you want to get your logcat output from. So first run `adb devices` to get a list of your attached devices. Then issue `adb -s [id] logcat` where [id] is the device ID you got from `adb devices`.

## Support for iOS 9

iOS 8 is the current supported platform. But the plan is to move forward to iOS 9 once we have tested everything.
In the meantime, if you have updated to iOS 9 you will need to add an App Transport entry to your `Info.plist` until we put a fix in.

```xml
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSTemporaryExceptionAllowsInsecureHTTPSLoads</key>
<false/>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>1.0</string>
<key>NSTemporaryExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>
```
Binary file removed www/css/default/images/ajax-loader.gif
Binary file not shown.
Binary file removed www/css/default/images/icons-png/action-black.png
Binary file not shown.
Binary file removed www/css/default/images/icons-png/action-white.png
Binary file not shown.
Binary file removed www/css/default/images/icons-png/alert-black.png
Binary file not shown.
Binary file removed www/css/default/images/icons-png/alert-white.png
Binary file not shown.
Binary file removed www/css/default/images/icons-png/arrow-d-black.png
Binary file not shown.
Binary file removed www/css/default/images/icons-png/arrow-d-l-black.png
Binary file not shown.
Binary file removed www/css/default/images/icons-png/arrow-d-l-white.png
Binary file not shown.
Binary file removed www/css/default/images/icons-png/arrow-d-r-black.png
Binary file not shown.
Binary file removed www/css/default/images/icons-png/arrow-d-r-white.png
Binary file not shown.
Binary file removed www/css/default/images/icons-png/arrow-d-white.png
Binary file not shown.
Binary file removed www/css/default/images/icons-png/arrow-l-black.png
Binary file not shown.
Binary file removed www/css/default/images/icons-png/arrow-l-white.png
Binary file not shown.
Binary file removed www/css/default/images/icons-png/arrow-r-black.png
Binary file not shown.
Binary file removed www/css/default/images/icons-png/arrow-r-white.png
Binary file not shown.
Binary file removed www/css/default/images/icons-png/arrow-u-black.png
Binary file not shown.
Binary file removed www/css/default/images/icons-png/arrow-u-l-black.png
Binary file not shown.
Binary file removed www/css/default/images/icons-png/arrow-u-l-white.png
Binary file not shown.
Binary file removed www/css/default/images/icons-png/arrow-u-r-black.png
Binary file not shown.
Binary file removed www/css/default/images/icons-png/arrow-u-r-white.png
Binary file not shown.
Binary file removed www/css/default/images/icons-png/arrow-u-white.png
Binary file not shown.
Binary file removed www/css/default/images/icons-png/audio-black.png
Binary file not shown.
Binary file removed www/css/default/images/icons-png/audio-white.png
Binary file not shown.
Binary file removed www/css/default/images/icons-png/back-black.png
Binary file not shown.
Binary file removed www/css/default/images/icons-png/back-white.png
Binary file not shown.
Binary file removed www/css/default/images/icons-png/bars-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/bars-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/bullets-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/bullets-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/calendar-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/calendar-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/camera-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/camera-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/carat-d-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/carat-d-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/carat-l-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/carat-l-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/carat-r-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/carat-r-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/carat-u-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/carat-u-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/check-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/check-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/clock-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/clock-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/cloud-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/cloud-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/comment-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/comment-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/delete-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/delete-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/edit-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/edit-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/eye-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/eye-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/forbidden-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/forbidden-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/forward-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/forward-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/gear-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/gear-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/grid-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/grid-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/heart-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/heart-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/home-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/home-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/info-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/info-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/location-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/location-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/lock-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/lock-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/mail-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/mail-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/minus-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/minus-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/navigation-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/navigation-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/phone-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/phone-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/plus-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/plus-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/power-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/power-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/recycle-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/recycle-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/refresh-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/refresh-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/search-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/search-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/shop-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/shop-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/star-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/star-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/tag-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/tag-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/user-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/user-white.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/video-black.png
Diff not rendered.
Binary file removed www/css/default/images/icons-png/video-white.png
Diff not rendered.
7 changes: 0 additions & 7 deletions www/css/default/images/icons-svg/action-black.svg
Diff not rendered.
7 changes: 0 additions & 7 deletions www/css/default/images/icons-svg/action-white.svg
Diff not rendered.
8 changes: 0 additions & 8 deletions www/css/default/images/icons-svg/alert-black.svg
Diff not rendered.
8 changes: 0 additions & 8 deletions www/css/default/images/icons-svg/alert-white.svg
Diff not rendered.
37 changes: 0 additions & 37 deletions www/css/default/images/icons-svg/arrow-d-black.svg
Diff not rendered.
37 changes: 0 additions & 37 deletions www/css/default/images/icons-svg/arrow-d-l-black.svg
Diff not rendered.
37 changes: 0 additions & 37 deletions www/css/default/images/icons-svg/arrow-d-l-white.svg
Diff not rendered.
37 changes: 0 additions & 37 deletions www/css/default/images/icons-svg/arrow-d-r-black.svg
Diff not rendered.
Loading

0 comments on commit 8eb128e

Please sign in to comment.