diff --git a/README.md b/README.md
index 861a86de..0e943d17 100644
--- a/README.md
+++ b/README.md
@@ -22,25 +22,25 @@ npm run lint
If you are deploying in a subdirectory, add it to `publicPath` in vue.config.js, eg: `publicPath: "/app/time-tracker/",`
-* `npx prettier --write ./sw_scripts/`
-
-...to make sure the service worker scripts are in proper form
-
* Update the CHANGELOG.md & the version in package.json, run `npm install`, and commit.
* Tag wth the new version: `git tag 0.1.0`.
-* If production, change src/constants/app.ts DEFAULT_*_SERVER to be PROD.
+* If production, change src/constants/app.ts DEFAULT_*_SERVER to be "PROD" and package.json to remove "_Test".
* `npm run build`
+* `npx prettier --write ./sw_scripts/`
+
+...to make sure the service worker scripts are in proper form. It's only important if you changed something in that directory.
+
* `cp sw_scripts/[ns]* dist/`
... to copy the contents of the `sw_scripts` folder to the `dist` folder - except additional_scripts.js.
* `rsync -azvu -e "ssh -i ~/.ssh/..." dist ubuntu@endorser.ch:time-safari`
-* Revert src/constants/app.ts, increment version, add "-beta", `npm install`, and commit.
+* Revert src/constants/app.ts and/or package.json, edit package.json to increment version & add "-beta", `npm install`, and commit.
@@ -112,10 +112,10 @@ To add an icon, add to main.ts and reference with `fa` element and `icon` attrib
### Clear/Reset data & restart
-* Clear cache for site. (In Chrome, go to `chrome://settings/cookies` and "all site data and permissions"; in Firefox, go to `about:preferences` and search for "cache" then "Manage Data".)
-* Unregister service worker (in Chrome, go to `chrome://serviceworker-internals/`; in Firefox, go to `about:serviceworkers`).
-* Clear notification permission (in Chrome, go to `chrome://settings/content/notifications`; in Firefox, go to `about:preferences` and search for "notifications").
-* Clear Cache Storage (in Chrome, in dev tools under Application; in Firefox, in dev tools under Storage).
+* Clear cache for site. (In Chrome, go to `chrome://settings/cookies` and "all site data and permissions"; in Firefox, go to `about:preferences` and search for "cache" then "Manage Data", and also manually remove the IndexedDB data if the DBs still show.)
+* Clear notification permission. (in Chrome, go to `chrome://settings/content/notifications`; in Firefox, go to `about:preferences` and search for "notifications".)
+* Unregister service worker. (in Chrome, go to `chrome://serviceworker-internals/`; in Firefox, go to `about:serviceworkers`.)
+* Clear Cache Storage. (in Chrome, in dev tools under Application; in Firefox, in dev tools under Storage.)
diff --git a/package.json b/package.json
index a24cb46a..1d35ad2b 100644
--- a/package.json
+++ b/package.json
@@ -1,5 +1,5 @@
{
- "name": "TimeSafari",
+ "name": "TimeSafari_Test",
"version": "0.1.8-beta",
"private": true,
"scripts": {
diff --git a/project.task.yaml b/project.task.yaml
index a80de786..ba36658e 100644
--- a/project.task.yaml
+++ b/project.task.yaml
@@ -2,29 +2,30 @@
tasks:
- 08 notifications :
- - make the app behave correctly when App Notifications are turned off
- - write troubleshooting docs for notifications
- - hide the "App Notifications" toggle when they switch notifications
- - prompt user to install on their home screen https://developer.mozilla.org/en-US/docs/Web/API/Navigator/getInstalledRelatedApps
+ - get the rest of our Android devices to work
+ - insert tooling (exportable logs?) so that we can see problems and troubleshoot as we onboard
+ - get an error registering notifications on Firefox and subscription info is null
+ - if navigator.serviceWorker is null, then tell the user to wait
+ - Android DuckDuckGo asked for my permissions, got error, won't download DB
+ - Android Chrome won't ask permission, will download log but always empty
+ - Firefox works
+ - Local install works after cleared out cache in Chrome
+ - create troubleshooting notification:
+ - server gets signal to send a normal notification back immediately
+ - add windows & mac help at OS & browser level, in HelpNotificationsView.vue (linked from account page)
+ maybe tell them to pause, after first turn-on and after test
+ maybe Google Play permissions
+ - prompt user to install on their home screen https://benborgers.com/posts/pwa-detect-installed
- warn if they're using the web (android only?)
https://developer.mozilla.org/en-US/docs/Web/API/Navigator/getInstalledRelatedApps
https://web.dev/articles/get-installed-related-apps
- - add windows & mac help at OS & browser level
-- back-and-forth on discovery & project pages led to "You need an identity to load your projects." error on product page when I had an identity
-- fix the projects on /discover to show the issuer (currently all "Someone Anonymous")
+- .2 fix the projects on /discover to show the issuer (currently all "Someone Anonymous")
- .3 bug - make or edit a project, choose "Include location", and see the map display shows on top of the bottom icons assignee-group:ui
-- Got error adding on Firefox user #0 as contact for themselves
- .5 If notifications are not enabled, add message to front page with link/button to enable
-- 01 server - show all claim details when issued by the issuer
-- enhance help page instructions for friends to get notifications, for debugging notifications
-- add way to test a push notification
-- help instructions for PWA install problems (secret failed, must reinstall)
-- look at other examples for better UI friend.tech
-
- show VC details... somehow:
- 01 show my VCs - most interesting, or via search
- 01 allow download of each VC (& confirmations, to show that they actually own their data)
@@ -44,9 +45,14 @@ tasks:
- Other features - donation vs give, show offers, show give & outstanding totals, show network view, restrict registration, connect to contacts
blocks: ref:https://raw.githubusercontent.com/trentlarson/lives-of-gifts/master/project.yaml#kickstarter%20for%20time
-- 01 send visibility signal as a VC and store it
-- remove 'rowid' references (that are sqlite-specific)
- make identicons for contacts into more-memorable faces (and maybe change project identicons, too)
+- 04 split out notification logic & tests from web-push-subscription logic & tests
+- 01 server - show all claim details when issued by the issuer
+- bug - got error adding on Firefox user #0 as contact for themselves
+- bug - back-and-forth on discovery & project pages led to "You need an identity to load your projects." error on product page when I had an identity
+- 01 send visibility signal as a VC and store it
+- 04 remove 'rowid' references (that are sqlite-specific); may involve server
+- 04 look at other examples for better UI friend.tech
- 01 make the prod build copy the sw_scripts
- .5 Add start date to project
- .3 check that Android shows "back" buttons on screens without bottom tray
@@ -83,6 +89,7 @@ tasks:
- 24 Move to Vite
- 32 accept images for projects
- 32 accept images for contacts
+- import project interactions from GitHub/GitLab and manage signing
- linking between projects or plans :
- show total time given to & from a project
diff --git a/src/App.vue b/src/App.vue
index 05bbe0a9..85489c8d 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -281,7 +281,7 @@ interface VapidResponse {
};
}
-import { AppString } from "@/constants/app";
+import { DEFAULT_PUSH_SERVER } from "@/constants/app";
import { db } from "@/db/index";
import { MASTER_SETTINGS_KEY } from "@/db/tables/settings";
@@ -302,7 +302,7 @@ export default class App extends Vue {
try {
await db.open();
const settings = await db.settings.get(MASTER_SETTINGS_KEY);
- let pushUrl: string = AppString.DEFAULT_PUSH_SERVER;
+ let pushUrl = DEFAULT_PUSH_SERVER;
if (settings?.webPushServer) {
pushUrl = settings.webPushServer;
}
@@ -373,6 +373,7 @@ export default class App extends Vue {
}
private askPermission(): Promise {
+ console.log("Requesting permission for notifications:", navigator);
if (!("serviceWorker" in navigator && navigator.serviceWorker.controller)) {
return Promise.reject("Service worker not available.");
}
@@ -445,7 +446,18 @@ export default class App extends Vue {
}
})
.then(() => {
- console.log("Subscription data sent to server.");
+ console.log(
+ "Subscription data sent to server and all finished successfully.",
+ );
+ this.$notify(
+ {
+ group: "alert",
+ type: "success",
+ title: "Notifications Turned On",
+ text: "Notifications are on. You should see one on your device; if not, see the 'Troubleshoot' page.",
+ },
+ -1,
+ );
})
.catch((error) => {
console.error(
@@ -462,9 +474,7 @@ export default class App extends Vue {
"An error occurred setting notification permissions:",
error,
);
- alert(
- "Some error occurred setting notification permissions. See logs.",
- );
+ alert("Some error occurred setting notification permissions.");
});
}
@@ -511,11 +521,7 @@ export default class App extends Vue {
resolve();
})
.catch((error) => {
- console.error(
- "Subscription or server communication failed:",
- error,
- options,
- );
+ console.error("Push subscription failed:", error, options);
// Inform the user about the issue
alert(
diff --git a/src/components/GiftedDialog.vue b/src/components/GiftedDialog.vue
index 1dfb153e..e2362463 100644
--- a/src/components/GiftedDialog.vue
+++ b/src/components/GiftedDialog.vue
@@ -123,9 +123,7 @@ export default class GiftedDialog extends Vue {
group: "alert",
type: "danger",
title: "Error",
- text:
- err.message ||
- "There was an error retrieving the latest sweet, sweet action.",
+ text: err.message || "There was an error retrieving your settings.",
},
-1,
);
diff --git a/src/components/OfferDialog.vue b/src/components/OfferDialog.vue
index 0ab37004..b61bde82 100644
--- a/src/components/OfferDialog.vue
+++ b/src/components/OfferDialog.vue
@@ -105,9 +105,7 @@ export default class OfferDialog extends Vue {
group: "alert",
type: "danger",
title: "Error",
- text:
- err.message ||
- "There was an error retrieving the latest sweet, sweet action.",
+ text: err.message || "There was an error retrieving your settings.",
},
-1,
);
diff --git a/src/components/TopMessage.vue b/src/components/TopMessage.vue
index 84337410..bccc2fec 100644
--- a/src/components/TopMessage.vue
+++ b/src/components/TopMessage.vue
@@ -50,7 +50,7 @@ export default class TopMessage extends Vue {
title: "Error Detecting Server",
text: JSON.stringify(err),
},
- 10000,
+ -1,
);
}
}
diff --git a/src/constants/app.ts b/src/constants/app.ts
index c92709bd..16758064 100644
--- a/src/constants/app.ts
+++ b/src/constants/app.ts
@@ -4,22 +4,20 @@
* See also ../libs/veramo/setup.ts
*/
export enum AppString {
- APP_NAME = "Time Safari",
-
PROD_ENDORSER_API_SERVER = "https://api.endorser.ch",
TEST_ENDORSER_API_SERVER = "https://test-api.endorser.ch",
LOCAL_ENDORSER_API_SERVER = "http://localhost:3000",
- DEFAULT_ENDORSER_API_SERVER = TEST_ENDORSER_API_SERVER,
-
- // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
PROD_PUSH_SERVER = "https://timesafari.app",
TEST1_PUSH_SERVER = "https://test.timesafari.app",
TEST2_PUSH_SERVER = "https://timesafari-pwa.anomalistlabs.com",
-
- DEFAULT_PUSH_SERVER = TEST1_PUSH_SERVER,
}
+export const DEFAULT_ENDORSER_API_SERVER = AppString.TEST_ENDORSER_API_SERVER;
+
+export const DEFAULT_PUSH_SERVER =
+ window.location.protocol + "//" + window.location.host;
+
/**
* The possible values for "group" and "type" are in App.vue.
* From the notiwind package
diff --git a/src/db/index.ts b/src/db/index.ts
index 37d6cf51..c15f6c92 100644
--- a/src/db/index.ts
+++ b/src/db/index.ts
@@ -1,18 +1,20 @@
import BaseDexie, { Table } from "dexie";
import { encrypted, Encryption } from "@pvermeer/dexie-encrypted-addon";
import { Account, AccountsSchema } from "./tables/accounts";
-import { Contact, ContactsSchema } from "./tables/contacts";
+import { Contact, ContactSchema } from "./tables/contacts";
+import { Log, LogSchema } from "@/db/tables/logs";
import {
MASTER_SETTINGS_KEY,
Settings,
SettingsSchema,
} from "./tables/settings";
-import { AppString } from "@/constants/app";
+import { DEFAULT_ENDORSER_API_SERVER } from "@/constants/app";
// Define types for tables that hold sensitive and non-sensitive data
type SensitiveTables = { accounts: Table };
type NonsensitiveTables = {
contacts: Table;
+ logs: Table;
settings: Table;
};
@@ -26,7 +28,11 @@ export const accountsDB = new BaseDexie("TimeSafariAccounts") as SensitiveDexie;
const SensitiveSchemas = { ...AccountsSchema };
export const db = new BaseDexie("TimeSafari") as NonsensitiveDexie;
-const NonsensitiveSchemas = { ...ContactsSchema, ...SettingsSchema };
+const NonsensitiveSchemas = {
+ ...ContactSchema,
+ ...LogSchema,
+ ...SettingsSchema,
+};
// Manage the encryption key. If not present in localStorage, create and store it.
const secret =
@@ -38,12 +44,14 @@ encrypted(accountsDB, { secretKey: secret });
// Define the schema for our databases
accountsDB.version(1).stores(SensitiveSchemas);
-db.version(1).stores(NonsensitiveSchemas);
+// v1 was contacts & settings
+// v2 added logs
+db.version(2).stores(NonsensitiveSchemas);
// Event handler to initialize the non-sensitive database with default settings
db.on("populate", () => {
db.settings.add({
id: MASTER_SETTINGS_KEY,
- apiServer: AppString.DEFAULT_ENDORSER_API_SERVER,
+ apiServer: DEFAULT_ENDORSER_API_SERVER,
});
});
diff --git a/src/db/tables/contacts.ts b/src/db/tables/contacts.ts
index b6845057..8ffd2fb8 100644
--- a/src/db/tables/contacts.ts
+++ b/src/db/tables/contacts.ts
@@ -6,6 +6,6 @@ export interface Contact {
registered?: boolean;
}
-export const ContactsSchema = {
+export const ContactSchema = {
contacts: "&did, name, publicKeyBase64, registered, seesMe",
};
diff --git a/src/db/tables/logs.ts b/src/db/tables/logs.ts
new file mode 100644
index 00000000..9207a2fa
--- /dev/null
+++ b/src/db/tables/logs.ts
@@ -0,0 +1,10 @@
+export interface Log {
+ message: string;
+}
+
+export const LogSchema = {
+ // Currently keyed by "date" because A) today's log data is what we need so we append, and
+ // B) we don't want it to grow so we remove everything if this is the first entry today.
+ // See safari-notifications.js logMessage for the associated logic.
+ logs: "date, message",
+};
diff --git a/src/views/AccountViewView.vue b/src/views/AccountViewView.vue
index f459c0ed..1a19d059 100644
--- a/src/views/AccountViewView.vue
+++ b/src/views/AccountViewView.vue
@@ -133,6 +133,9 @@
Notification status may have changed. Revisit this page to see the
latest setting.
+
+ Troubleshoot notifications here.
+
Data
@@ -306,13 +309,6 @@
Switch Identity
-
-
Claim Server
diff --git a/src/views/ContactAmountsView.vue b/src/views/ContactAmountsView.vue
index a3dfc732..52412ae3 100644
--- a/src/views/ContactAmountsView.vue
+++ b/src/views/ContactAmountsView.vue
@@ -178,6 +178,7 @@ export default class ContactAmountssView extends Vue {
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (err: any) {
+ console.log("Error retrieving settings or gives.", err);
this.$notify(
{
group: "alert",
@@ -185,7 +186,7 @@ export default class ContactAmountssView extends Vue {
title: "Error",
text:
err.userMessage ||
- "There was an error retrieving the latest sweet, sweet action.",
+ "There was an error retrieving your settings and/or contacts and/or gives.",
},
-1,
);
diff --git a/src/views/ContactGiftingView.vue b/src/views/ContactGiftingView.vue
index 2d2bcb83..35bec254 100644
--- a/src/views/ContactGiftingView.vue
+++ b/src/views/ContactGiftingView.vue
@@ -145,6 +145,7 @@ export default class ContactGiftingView extends Vue {
this.allContacts = await db.contacts.toArray();
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (err: any) {
+ console.log("Error retrieving settings & contacts:", err);
this.$notify(
{
group: "alert",
@@ -152,7 +153,7 @@ export default class ContactGiftingView extends Vue {
title: "Error",
text:
err.message ||
- "There was an error retrieving the latest sweet, sweet action.",
+ "There was an error retrieving your settings and/or contacts.",
},
-1,
);
diff --git a/src/views/HelpNotificationsView.vue b/src/views/HelpNotificationsView.vue
index c734ba43..77b284b4 100644
--- a/src/views/HelpNotificationsView.vue
+++ b/src/views/HelpNotificationsView.vue
@@ -22,10 +22,16 @@
-
Here are things to try to get notifications working.
+
Here are ways to get notifications working.
Test
Somehow call the service-worker self.showNotification
+
Check OS-level permissions
@@ -54,7 +60,10 @@
Make sure your OS (above) supports it.
Mobile Phone - Android
-
Chrome requires version 50.
+
+ Chrome requires version 50. Hold icon, select "App info", and enable
+ notifications.
+
@@ -66,12 +75,34 @@
Auto-detection
Show results of auto-detection whether they're turned on