Robot-Scouter icon indicating copy to clipboard operation
Robot-Scouter copied to clipboard

Auto Scout – Phase 1

Open SUPERCILEX opened this issue 5 years ago • 0 comments

This phase adds core backend infrastructure to support Auto Scout.

Requirements

  • Device identification
  • Device naming
  • Remote wake-up triggers
  • Master vs. slave differentiation

Identification

FirebaseInstanceId.getInstance().id

Wake-up

Setup FCM to log incoming messages and errors.

Create Cloud Function to add device to group. Check for notification key. If null, create the device group, else add the device. notification_key_name == ${uid}.

In an auth listener, if isFullUser, trigger the cloud function if the cache/db/device-id.json file doesn't exist.

Database

{
    "users": {
        "uid": { // Document
            // …
            "groupId": "notification_key",
            "devices": { // Collection
                "instanceId1": { // Document
                    "name": "...",
                    "token": "registration_id"
                },
                // ...
            },
            "prefs": {
                // …
                "master": { // Document
                    "value": "instanceId1"
                }
            }
        }
    }
}

SUPERCILEX avatar Jul 28 '18 22:07 SUPERCILEX