This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| unit_test: | |
| stage: test | |
| only: | |
| - develop | |
| - master | |
| before_script: | |
| - export ANDROID_HOME=$PWD/.android | |
| - export PATH=$PATH:$PWD/.android/platform-tools/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .build_template: &build_template_def | |
| stage: build | |
| artifacts: | |
| expire_in: 4 hours | |
| paths: | |
| - app/build/outputs/ | |
| - .android/ | |
| before_script: | |
| # Extract the SDK version that we're building against |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async function sendPingPongScore(pingId: string) { | |
| const payload = {attachments: []}; | |
| const ping = (await admin.database().ref("ping").child(pingId).once("value")).val(); | |
| const snap = await admin.database().ref("pong").orderByChild("ping").equalTo(pingId).limitToFirst(3).once("value"); | |
| const medalColors = ["#C98910", "#A8A8A8", "#965A38"]; | |
| let counter = 0; | |
| snap.forEach((childSnap) => { | |
| const pong = childSnap.val() as Pong; | |
| const color = medalColors[counter]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const on_actions = functions.database.ref("actions/{id}").onWrite(async (event) => { | |
| if (!event.data.exists()) { | |
| return "Nothing to do for deletion of processed commands."; | |
| } | |
| // Start by deleting the action request itself from the queue | |
| await event.data.ref.remove(); | |
| const action = event.data.val(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const message_action = functions.https.onRequest(async (request, response) => { | |
| if (request.method !== "POST") { | |
| console.error(`Got unsupported ${request.method} request. Expected POST.`); | |
| return response.send(405, "Only POST requests are accepted"); | |
| } | |
| if (!request.body && request.body.payload) { | |
| return response.send(405, "Expected a message action payload."); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const on_command_ping = functions.database.ref("commands/ping/{id}").onWrite(async (event) => { | |
| if (!event.data.exists()) { | |
| return "Nothing to do for deletion of processed commands."; | |
| } | |
| // Start by deleting the command itself from the queue | |
| await event.data.ref.remove(); | |
| const command = event.data.val(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const oauth_redirect = functions.https.onRequest(async (request, response) => { | |
| if (request.method !== "GET") { | |
| console.error(`Got unsupported ${request.method} request. Expected GET.`); | |
| return response.send(405, "Only GET requests are accepted"); | |
| } | |
| if (!request.query && !request.query.code) { | |
| return response.status(401).send("Missing query attribute 'code'"); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "ok": true, | |
| "access_token": "xoxp-111111111111-222222222222-333333333333-abcdef0123456789", | |
| "scope": "identify,commands,incoming-webhook", | |
| "user_id": "U11MAYA11", | |
| "team_name": "oddbit", | |
| "team_id": "T22SARA22", | |
| "incoming_webhook": { | |
| "channel": "#random", | |
| "channel_id": "C03ALUND3", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| runtime: python27 | |
| api_version: 1 | |
| threadsafe: true | |
| handlers: | |
| - url: /cron | |
| script: main.app | |
| login: admin | |
| env_variables: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as functions from "firebase-functions"; | |
| import * as admin from "firebase-admin"; | |
| admin.initializeApp(functions.config().firebase); | |
| export const onCreated = functions.database.ref("timings/{id}/created").onWrite(event => { | |
| return event.data.ref.parent.child("handled").set(admin.database.ServerValue.TIMESTAMP); | |
| }); | |
| export const onHandled = functions.database.ref("timings/{id}").onWrite(async event => { |