From 0b591264b2174ade27417dc7c77d1eb00763555f Mon Sep 17 00:00:00 2001 From: Harshil Sharma Date: Fri, 16 Jun 2023 16:02:53 +0530 Subject: [PATCH] WIP --- app/queries/servers/post.ts | 2 +- app/screens/post_priority_picker/index.ts | 5 +++++ .../post_priority_picker/post_priority_picker.tsx | 9 ++++++++- app/screens/post_priority_picker/utils.ts | 4 ++-- assets/base/i18n/en.json | 4 ++-- package-lock.json | 2 +- types/api/config.d.ts | 1 + 7 files changed, 20 insertions(+), 7 deletions(-) diff --git a/app/queries/servers/post.ts b/app/queries/servers/post.ts index 38e52b2b7..d504bd079 100644 --- a/app/queries/servers/post.ts +++ b/app/queries/servers/post.ts @@ -9,7 +9,7 @@ import {MM_TABLES} from '@constants/database'; import {queryGroupsByNames} from './group'; import {querySavedPostsPreferences} from './preference'; -import {getConfigValue, observeConfigBooleanValue} from './system'; +import {getConfigValue, observeConfigBooleanValue, observeConfigIntValue, observeConfigValue} from './system'; import {queryUsersByUsername, observeUser, observeCurrentUser} from './user'; import type PostModel from '@typings/database/models/servers/post'; diff --git a/app/screens/post_priority_picker/index.ts b/app/screens/post_priority_picker/index.ts index 810b2e061..3fe86ba5b 100644 --- a/app/screens/post_priority_picker/index.ts +++ b/app/screens/post_priority_picker/index.ts @@ -6,14 +6,19 @@ import withObservables from '@nozbe/with-observables'; import {observeIsPostAcknowledgementsEnabled, observePersistentNotificationsEnabled} from '@queries/servers/post'; +import {observeConfigIntValue} from '../../queries/servers/system'; + import PostPriorityPicker from './post_priority_picker'; import type {Database} from '@nozbe/watermelondb'; const enhanced = withObservables([], ({database}: {database: Database}) => { + const persistentNotificationInterval = observeConfigIntValue(database, 'PersistentNotificationIntervalMinutes'); + return { isPostAcknowledgementEnabled: observeIsPostAcknowledgementsEnabled(database), isPersistenNotificationsEnabled: observePersistentNotificationsEnabled(database), + persistentNotificationInterval, }; }); diff --git a/app/screens/post_priority_picker/post_priority_picker.tsx b/app/screens/post_priority_picker/post_priority_picker.tsx index 01a8d065f..65e197938 100644 --- a/app/screens/post_priority_picker/post_priority_picker.tsx +++ b/app/screens/post_priority_picker/post_priority_picker.tsx @@ -35,6 +35,7 @@ type Props = { postPriority: PostPriority; updatePostPriority: (data: PostPriority) => void; closeButtonId: string; + persistentNotificationInterval: number; }; const TITLE_HEIGHT = 30; // typography 600 line height @@ -83,6 +84,7 @@ const PostPriorityPicker = ({ componentId, isPostAcknowledgementEnabled, isPersistenNotificationsEnabled, + persistentNotificationInterval, postPriority, updatePostPriority, closeButtonId, @@ -201,7 +203,12 @@ const PostPriorityPicker = ({