Browse Source
Reviewed-on: https://gitea.anomalistdesign.com/trent_larson/crowd-funder-for-time-pwa/pulls/67pull/79/head
anomalist
1 year ago
7 changed files with 254 additions and 52 deletions
@ -0,0 +1,30 @@ |
|||||
|
|
||||
|
|
||||
|
self.addEventListener("push", function (event) { |
||||
|
let payload; |
||||
|
if (event.data) { |
||||
|
payload = JSON.parse(event.data.text()); |
||||
|
} |
||||
|
|
||||
|
const title = payload ? payload.title : "Custom Title"; |
||||
|
const options = { |
||||
|
body: payload ? payload.body : "Custom body text", |
||||
|
icon: payload ? payload.icon : "icon.png", |
||||
|
badge: payload ? payload.badge : "badge.png", |
||||
|
}; |
||||
|
|
||||
|
event.waitUntil(self.registration.showNotification(title, options)); |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
self.addEventListener('message', function(event) { |
||||
|
const data = event.data; |
||||
|
|
||||
|
switch (data.command) { |
||||
|
case 'account': |
||||
|
break; |
||||
|
|
||||
|
default: |
||||
|
console.log('Unknown command:', data.command); |
||||
|
} |
||||
|
}); |
@ -1,29 +1,46 @@ |
|||||
|
/** |
||||
|
* BoundingBox type describes the geographical bounding box coordinates. |
||||
|
*/ |
||||
export type BoundingBox = { |
export type BoundingBox = { |
||||
eastLong: number; |
eastLong: number; // Eastern longitude
|
||||
maxLat: number; |
maxLat: number; // Maximum (Northernmost) latitude
|
||||
minLat: number; |
minLat: number; // Minimum (Southernmost) latitude
|
||||
westLong: number; |
westLong: number; // Western longitude
|
||||
}; |
}; |
||||
|
|
||||
// a singleton
|
/** |
||||
|
* Settings type encompasses user-specific configuration details. |
||||
|
*/ |
||||
export type Settings = { |
export type Settings = { |
||||
id: number; // there's only one entry: MASTER_SETTINGS_KEY
|
id: number; // Only one entry using MASTER_SETTINGS_KEY
|
||||
|
activeDid?: string; // Active Decentralized ID
|
||||
|
apiServer?: string; // API server URL
|
||||
|
firstName?: string; // User's first name
|
||||
|
lastName?: string; // User's last name
|
||||
|
lastViewedClaimId?: string; // Last viewed claim ID
|
||||
|
lastNotifiedClaimId?: string; // Last notified claim ID
|
||||
|
|
||||
activeDid?: string; |
// Array of named search boxes defined by bounding boxes
|
||||
apiServer?: string; |
|
||||
firstName?: string; |
|
||||
isRegistered?: boolean; |
|
||||
lastName?: string; // deprecated, pre v 0.1.3
|
|
||||
lastViewedClaimId?: string; |
|
||||
searchBoxes?: Array<{ |
searchBoxes?: Array<{ |
||||
name: string; |
name: string; |
||||
bbox: BoundingBox; |
bbox: BoundingBox; |
||||
}>; |
}>; |
||||
showContactGivesInline?: boolean; |
|
||||
|
showContactGivesInline?: boolean; // Display contact inline or not
|
||||
|
vapid?: string; // VAPID (Voluntary Application Server Identification) field for web push
|
||||
|
reminderTime?: number; // Time in milliseconds since UNIX epoch for reminders
|
||||
|
reminderOn?: boolean; // Toggle to enable or disable reminders
|
||||
}; |
}; |
||||
|
|
||||
|
/** |
||||
|
* Schema for the Settings table in the database. |
||||
|
*/ |
||||
export const SettingsSchema = { |
export const SettingsSchema = { |
||||
settings: "id", |
settings: "id", |
||||
}; |
}; |
||||
|
|
||||
|
/** |
||||
|
* Constants. |
||||
|
*/ |
||||
export const MASTER_SETTINGS_KEY = 1; |
export const MASTER_SETTINGS_KEY = 1; |
||||
|
Loading…
Reference in new issue