patcon / polis-like-nfc

Home Page:https://expo.dev/accounts/patcon/projects/snack-81f04247-61d9-4cc9-b0e4-67c1a4f261e0/builds/90005652-095d-4570-af57-77391737e5e9

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Polis IRL NFC voting app

Development

# You'll need two devices. We'll assume one actual device and one emulated.
# This should list your actual device
adb devices

# start any emulators you need
emulator -avd <existing emulator ID>

# this should now list real and emulated, with device IDs
adb devices

# Set up reverse port forwarding from device to workstation.
# This allows devices to access you local websocket dev server.
adb -s <real device id> reverse tcp:1999 tcp:1999
adb -s <emu device id> reverse tcp:1999 tcp:1999

# Open the webserver in one terminal.
npm run start-server

# In another terminal, start the react-native expo dev server.
npm start
# The hit "a" to build android (for both devices)
# You should see each device load the app it has installed

# Each app should say that the websocket connection status is "Open" above to logs.
# Updating the Statement ID should propagate between devices.

# Add an API key of format `pkey_*`.
# Add a convo ID that starts with a digit, then any characters.

# Start listening for NFC scans.

# Flash any NFC-enabled tag (some credit cards word, or door fobs) to test.

Production Build

npm run android:prod

Roadmap

See [TODO.md][/TODO.md] for task list of past/upcoming features.

Usage

  1. Gather NFC tags (key fobs or some credit cards work fine) and 3 phones.
  2. Create a Polis conversation. Note the conversation ID in URL.
    • Click for screenshot

  3. Add at minimum one statement and vote on that statement. (this allows access to report)
    • click for screenshot

  4. Create a report (you'll use this later to see complete list of statements).
    • click for screenshot

  5. Install preview app on 3 phones
  6. Enter the conversation ID in each of the 3 apps.
    • Click for screenshot

  7. Set each phone a different vote type, and initiate NFC scanning.
    • Click for screenshot

  8. Leave "Agree" and "Disagree" phones face down.
  9. Open the report, and scroll to the bottom to see the full list of statements, including each numeric "statement ID".
    • Click for screenshot

  10. On the "Unsure" device, set the active Statement ID (it will sync to the other devices).
    • Click for screenshot

  11. Read out each statement, enter the statement ID in the app (from the report), and ask people to scan their NFC tag at the appropriate device.
    • Click for screenshot

  12. If there Polis conversation page is up on a screen, it will update in real-time.