This file contains 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
/** | |
* Tells if an user can have access to a project. | |
* @param {object} params - An object containing a project's id and jwt; | |
*/ | |
async function checkAccessControl(params: CheckProjectAccessControlParams) { | |
const {projectId, jwt} = params; | |
try { | |
const projectSnapshot = await firestore | |
.collection("projects") |
This file contains 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
/** | |
* Save a project content | |
* (with accessibility check). | |
*/ | |
export const save = functions | |
.region(cloudRegions.eu) | |
.https | |
.onCall(async (data) => { | |
const projectId: string = data.projectId; | |
const jwt: string = data.jwt; |
This file contains 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
/** | |
* Retrieve a project's content in markdown format | |
* (with accessibility check). | |
*/ | |
export const fetch = functions | |
.region(cloudRegions.eu) | |
.https | |
.onCall(async (data) => { | |
const projectId: string = data.projectId; |
This file contains 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 { ReactElement, useState } from 'react' | |
import classNames from 'classnames' | |
import Image from 'next/image' | |
import ArrowRightIcon from '@/public/images/homepage/arrow-right.svg' | |
type PaginationProps = { | |
/** Number of pages to display in the pagination. */ | |
pagesCount: number |
This file contains 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
// Companion | |
// You'll need to add `fitbit-weather` module in your project | |
import * as weather from '../lib/fitbit-weather/companion'; | |
weather.setup({ provider : weather.Providers.darksky, apiKey : 'apiKey' }); |
This file contains 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
// App | |
import * as messaging from "messaging"; | |
// Received message containing settings data | |
messaging.peerSocket.addEventListener("message", function(evt) { | |
settings[evt.data.key] = evt.data.value; | |
// Update Immediately weather value when unit changed | |
if (evt.data.key === 'weatherRefreshTime') { | |
// do something |
This file contains 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
// Companion | |
import * as messaging from "messaging"; | |
sendValue('weatherRefreshTime', time); | |
function sendValue(key, val) { | |
if (val) { | |
sendSettingData({ | |
key: key, | |
value: JSON.parse(val) |
This file contains 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
// Companion | |
import { settingsStorage } from "settings"; | |
const time = settingsStorage.getItem('weatherRefreshTime'); |
This file contains 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
// App | |
import { me } from "appbit"; | |
/** | |
* Return the next allowed activity's number | |
*/ | |
export function getNextAllowedActivity(activityNumber) { | |
const { granted } = me.permissions; | |
const grantedActivity = granted('access_activity'); |
This file contains 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
// App | |
/** | |
* Return horizontal icon position. | |
*/ | |
export function getIconX() { | |
const hPos = { | |
Ionic: 290, | |
Versa: 250, | |
}; |
NewerOlder