* modifying setting option * navigates to email screen * UI construction [in progress] * hooking up withObservables * email settings - need to save now * adding a bit of paddings * setting initial value * Update notification_email.tsx * UI Polish - main setting screen * UI Polish - Mention * UI Polish - Notification main screen * code clean up * code clean up * UI Polish Notification * UI Polish * code clean up * UI Polish - OOO * fix observable for email interval * fix ooo * fix ooo * added setting_row_label component * further clean up * UI Polish - Display - [ IN PROGRESS ] * UI Polish - Display - [ IN PROGRESS ] * UI Polish - Timezone Select [ IN PROGRESS ] * Update index.test.tsx.snap * Update app/screens/settings/notification_email/notification_email.tsx Co-authored-by: Daniel Espino García <larkox@gmail.com> * refactor after review * update option_item so that action can accept type React.Dispatch<React.SetStateAction Co-authored-by: Daniel Espino García <larkox@gmail.com>
34 lines
1.7 KiB
TypeScript
34 lines
1.7 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {withDatabase} from '@nozbe/watermelondb/DatabaseProvider';
|
|
import withObservables from '@nozbe/with-observables';
|
|
import {of as of$} from 'rxjs';
|
|
import {switchMap} from 'rxjs/operators';
|
|
|
|
import {Preferences} from '@constants';
|
|
import {getPreferenceValue} from '@helpers/api/preference';
|
|
import {queryPreferencesByCategoryAndName} from '@queries/servers/preference';
|
|
import {observeConfigBooleanValue} from '@queries/servers/system';
|
|
import {observeIsCRTEnabled} from '@queries/servers/thread';
|
|
import {observeCurrentUser} from '@queries/servers/user';
|
|
|
|
import NotificationSettings from './notifications';
|
|
|
|
import type {WithDatabaseArgs} from '@typings/database/database';
|
|
|
|
const enhanced = withObservables([], ({database}: WithDatabaseArgs) => {
|
|
return {
|
|
currentUser: observeCurrentUser(database),
|
|
isCRTEnabled: observeIsCRTEnabled(database),
|
|
enableAutoResponder: observeConfigBooleanValue(database, 'ExperimentalEnableAutomaticReplies'),
|
|
enableEmailBatching: observeConfigBooleanValue(database, 'EnableEmailBatching'),
|
|
emailInterval: queryPreferencesByCategoryAndName(database, Preferences.CATEGORY_NOTIFICATIONS).
|
|
observeWithColumns(['value']).pipe(
|
|
switchMap((preferences) => of$(getPreferenceValue(preferences, Preferences.CATEGORY_NOTIFICATIONS, Preferences.EMAIL_INTERVAL, Preferences.INTERVAL_NOT_SET))),
|
|
),
|
|
sendEmailNotifications: observeConfigBooleanValue(database, 'SendEmailNotifications'),
|
|
};
|
|
});
|
|
|
|
export default withDatabase(enhanced(NotificationSettings));
|