You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
2.7 KiB
72 lines
2.7 KiB
/**
|
|
* BoundingBox type describes the geographical bounding box coordinates.
|
|
*/
|
|
export type BoundingBox = {
|
|
eastLong: number; // Eastern longitude
|
|
maxLat: number; // Maximum (Northernmost) latitude
|
|
minLat: number; // Minimum (Southernmost) latitude
|
|
westLong: number; // Western longitude
|
|
};
|
|
|
|
/**
|
|
* Settings type encompasses user-specific configuration details.
|
|
*/
|
|
export type Settings = {
|
|
// default entry is keyed with MASTER_SETTINGS_KEY; other entries are linked to an account with account ID
|
|
id?: number; // this is only blank on input, when the database assigns it
|
|
|
|
// if supplied, this settings record overrides the master record when the user switches to this account
|
|
accountDid?: string; // not used in the MASTER_SETTINGS_KEY entry
|
|
// active Decentralized ID
|
|
activeDid?: string; // only used in the MASTER_SETTINGS_KEY entry
|
|
|
|
apiServer?: string; // API server URL
|
|
|
|
filterFeedByNearby?: boolean; // filter by nearby
|
|
filterFeedByVisible?: boolean; // filter by visible users ie. anyone not hidden
|
|
finishedOnboarding?: boolean; // the user has completed the onboarding process
|
|
|
|
firstName?: string; // user's full name, may be null if unwanted for a particular account
|
|
hideRegisterPromptOnNewContact?: boolean;
|
|
isRegistered?: boolean;
|
|
imageServer?: string;
|
|
lastName?: string; // deprecated - put all names in firstName
|
|
lastNotifiedClaimId?: string;
|
|
lastViewedClaimId?: string;
|
|
passkeyExpirationMinutes?: number; // passkey access token time-to-live in minutes
|
|
profileImageUrl?: string; // may be null if unwanted for a particular account
|
|
reminderTime?: number; // Time in milliseconds since UNIX epoch for reminders
|
|
reminderOn?: boolean; // Toggle to enable or disable reminders
|
|
|
|
// Array of named search boxes defined by bounding boxes
|
|
searchBoxes?: Array<{
|
|
name: string;
|
|
bbox: BoundingBox;
|
|
}>;
|
|
|
|
showContactGivesInline?: boolean; // Display contact inline or not
|
|
showGeneralAdvanced?: boolean; // Show advanced features which don't have their own flag
|
|
showShortcutBvc?: boolean; // Show shortcut for Bountiful Voluntaryist Community actions
|
|
vapid?: string; // VAPID (Voluntary Application Server Identification) field for web push
|
|
warnIfProdServer?: boolean; // Warn if using a production server
|
|
warnIfTestServer?: boolean; // Warn if using a testing server
|
|
webPushServer?: string; // Web Push server URL
|
|
};
|
|
|
|
export function isAnyFeedFilterOn(settings: Settings): boolean {
|
|
return !!(settings?.filterFeedByNearby || settings?.filterFeedByVisible);
|
|
}
|
|
|
|
/**
|
|
* Schema for the Settings table in the database.
|
|
*/
|
|
export const SettingsSchema = {
|
|
settings: "id, &accountDid",
|
|
};
|
|
|
|
/**
|
|
* Constants.
|
|
*/
|
|
export const MASTER_SETTINGS_KEY = 1;
|
|
|
|
export const DEFAULT_PASSKEY_EXPIRATION_MINUTES = 15;
|
|
|