diff --git a/project.task.yaml b/project.task.yaml
index 5a8b1cce..d111576c 100644
--- a/project.task.yaml
+++ b/project.task.yaml
@@ -19,6 +19,7 @@ tasks :
- .2 don't show a warning on a totally new project when the authorized agent is set
- .2 anchor hash into BTC
- .2 list the "show more" contacts alphabetically
+- .5 add back the explicit wait for browser subscription timing problems?
- .5 make Time Safari a share_target for images
diff --git a/src/components/FeedFilters.vue b/src/components/FeedFilters.vue
index 390205b1..669e9531 100644
--- a/src/components/FeedFilters.vue
+++ b/src/components/FeedFilters.vue
@@ -6,7 +6,10 @@
-
+
From my contacts
@@ -14,7 +17,7 @@
@@ -27,11 +30,18 @@
-
+
Nearby
-
+
+
+ Select Location
+
+
-
- Apply
-
-
+
+ Set All
+
+
Clear All
- Cancel
+ Done
@@ -81,6 +97,9 @@ import {
LTileLayer,
} from "@vue-leaflet/vue-leaflet";
+import { MASTER_SETTINGS_KEY } from "@/db/tables/settings";
+import { db } from "@/db/index";
+
@Component({
components: {
LRectangle,
@@ -90,20 +109,80 @@ import {
},
})
export default class FeedFilters extends Vue {
- visible = false;
- isFromMyContacts = false;
+ callOnCloseIfChanged = () => {};
+ hasSearchBox = false;
+ isInMyContacts = false;
isNearby = false;
+ settingChanged = false;
+ visible = false;
+
+ async open(callOnCloseIfChanged: () => void) {
+ this.callOnCloseIfChanged = callOnCloseIfChanged;
+
+ await db.open();
+ const settings = await db.settings.get(MASTER_SETTINGS_KEY);
+ this.isInMyContacts = !!settings?.filterFeedContacts;
+ this.isNearby = !!settings?.filterFeedNearby;
+ if (settings?.searchBoxes && settings.searchBoxes.length > 0) {
+ this.hasSearchBox = true;
+ }
- async open() {
+ this.settingChanged = false;
this.visible = true;
}
+ toggleContacts() {
+ this.settingChanged = true;
+ this.isInMyContacts = !this.isInMyContacts;
+ db.settings.update(MASTER_SETTINGS_KEY, {
+ filterFeedContacts: this.isInMyContacts,
+ });
+ }
+
+ toggleNearby() {
+ this.settingChanged = true;
+ this.isNearby = !this.isNearby;
+ db.settings.update(MASTER_SETTINGS_KEY, {
+ filterFeedNearby: this.isNearby,
+ });
+ }
+
+ async clearAll() {
+ if (this.isInMyContacts || this.isNearby) {
+ this.settingChanged = true;
+ }
+
+ db.settings.update(MASTER_SETTINGS_KEY, {
+ filterFeedNearby: false,
+ filterFeedContacts: false,
+ });
+
+ this.isInMyContacts = false;
+ this.isNearby = false;
+ }
+
+ async setAll() {
+ if (!this.isInMyContacts || !this.isNearby) {
+ this.settingChanged = true;
+ }
+
+ db.settings.update(MASTER_SETTINGS_KEY, {
+ filterFeedNearby: true,
+ filterFeedContacts: true,
+ });
+
+ this.isInMyContacts = true;
+ this.isNearby = true;
+ }
+
close() {
- // close the dialog but don't change values (just in case some actions are added later)
+ if (this.settingChanged) {
+ this.callOnCloseIfChanged();
+ }
this.visible = false;
}
- cancel() {
+ done() {
this.close();
}
}
diff --git a/src/db/tables/settings.ts b/src/db/tables/settings.ts
index f95b3839..479ee637 100644
--- a/src/db/tables/settings.ts
+++ b/src/db/tables/settings.ts
@@ -16,6 +16,10 @@ export type Settings = {
activeDid?: string; // Active Decentralized ID
apiServer?: string; // API server URL
+
+ filterFeedNearby?: string; // filter by nearby
+ filterFeedContacts?: string; // filter by user contacts
+
firstName?: string; // User's first name
isRegistered?: boolean;
lastName?: string; // deprecated - put all names in firstName
diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue
index e6172ce4..41941517 100644
--- a/src/views/HomeView.vue
+++ b/src/views/HomeView.vue
@@ -180,9 +180,9 @@
Latest Activity
- Filter…
+ {{ resultsAreFiltered() ? "Filtered" : "Unfiltered" }}