/** * 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 = { id: number; // Only one entry, keyed with MASTER_SETTINGS_KEY activeDid?: string; // Active Decentralized ID apiServer?: string; // API server URL filterFeedByNearby?: boolean; // filter by nearby filterFeedByVisible?: boolean; // filter by visible users ie. anyone not hidden firstName?: string; // User's first name isRegistered?: boolean; lastName?: string; // deprecated - put all names in firstName lastNotifiedClaimId?: string; // Last notified claim ID lastViewedClaimId?: string; // Last viewed claim ID 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 showShortcutBvc?: boolean; // Show shortcut for BVC 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", }; /** * Constants. */ export const MASTER_SETTINGS_KEY = 1;