Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@
"noteToSelf": "Note to Self",
"hideMenuBarTitle": "Hide Menu Bar",
"hideMenuBarDescription": "Toggle system menu bar visibility",
"frequentTimestampsTitle": "Frequent Timestamps",
"frequentTimestampsDescription": "Reduce time between timestamps in conversations",
"startConversation": "Start New Conversation",
"invalidNumberError": "Invalid Session ID or ONS Name",
"failedResolveOns": "Failed to resolve ONS name",
Expand Down
15 changes: 15 additions & 0 deletions js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@
window.setMenuBarVisibility(!value);
},

getFrequentTimestamps: () => storage.get('frequent-timestamps', false),
setFrequentTimestamps: value => {
storage.put('frequent-timestamps', value);
},

getSpellCheck: () => storage.get('spell-check', true),
setSpellCheck: value => {
storage.put('spell-check', value);
Expand Down Expand Up @@ -282,6 +287,16 @@
window.Events.setHideMenuBar(!current);
};

window.toggleFrequentTimestamps = () => {
const current = window.getSettingValue('frequent-timestamps');
if (current === undefined) {
window.Events.setFrequentTimestamps(false);
return;
}

window.Events.setFrequentTimestamps(!current);
};

window.toggleSpellCheck = () => {
const currentValue = window.getSettingValue('spell-check');
// if undefined, it means 'default' so true. but we have to toggle it, so false
Expand Down
16 changes: 16 additions & 0 deletions ts/components/settings/section/CategoryAppearance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ async function toggleStartInTray() {
}

const settingsMenuBar = 'hide-menu-bar';
const settingsFrequentTimestamps = 'frequent-timestamps';
const settingsSpellCheck = 'spell-check';
const settingsLinkPreview = 'link-preview-setting';
const settingsStartInTray = 'start-in-tray-setting';

// tslint:disable: max-func-body-length
export const SettingsCategoryAppearance = (props: { hasPassword: boolean | null }) => {
const dispatch = useDispatch();
const forceUpdate = useUpdate();
Expand All @@ -60,6 +62,11 @@ export const SettingsCategoryAppearance = (props: { hasPassword: boolean | null
? true
: window.getSettingValue(settingsMenuBar);

const isFrequentTimestampsActive =
window.getSettingValue(settingsFrequentTimestamps) === undefined
? true
: window.getSettingValue(settingsFrequentTimestamps);

const isSpellCheckActive =
window.getSettingValue(settingsSpellCheck) === undefined
? true
Expand All @@ -81,6 +88,15 @@ export const SettingsCategoryAppearance = (props: { hasPassword: boolean | null
active={isHideMenuBarActive}
/>
)}
<SessionToggleWithDescription
onClickToggle={() => {
window.toggleFrequentTimestamps();
forceUpdate();
}}
title={window.i18n('frequentTimestampsTitle')}
description={window.i18n('frequentTimestampsDescription')}
active={isFrequentTimestampsActive}
/>
<SessionToggleWithDescription
onClickToggle={() => {
window.toggleSpellCheck();
Expand Down
2 changes: 1 addition & 1 deletion ts/state/selectors/conversations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export const getSortedMessagesTypesOfSelectedConversation = createSelector(
getSortedMessagesOfSelectedConversation,
getFirstUnreadMessageId,
(sortedMessages, firstUnreadId) => {
const maxMessagesBetweenTwoDateBreaks = 5;
const maxMessagesBetweenTwoDateBreaks = window.getSettingValue('frequent-timestamps') ? 0.25 : 5;
// we want to show the date break if there is a large jump in time
// remember that messages are sorted from the most recent to the oldest
return sortedMessages.map((msg, index) => {
Expand Down
2 changes: 2 additions & 0 deletions ts/types/LocalizerKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export type LocalizerKeys =
| 'openGroupURL'
| 'messageRequestsDescription'
| 'hideMenuBarDescription'
| 'frequentTimestampsDescription'
| 'search'
| 'pickClosedGroupMember'
| 'ByUsingThisService...'
Expand Down Expand Up @@ -253,6 +254,7 @@ export type LocalizerKeys =
| 'setPassword'
| 'editMenuDeleteContact'
| 'hideMenuBarTitle'
| 'frequentTimestampsTitle'
| 'imageCaptionIconAlt'
| 'blockAll'
| 'sendRecoveryPhraseTitle'
Expand Down
1 change: 1 addition & 0 deletions ts/window.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ declare global {
getCallMediaPermissions: () => boolean;
updateZoomFactor: () => boolean;
toggleMenuBar: () => void;
toggleFrequentTimestamps: () => void;
toggleSpellCheck: any;
setTheme: (newTheme: string) => any;
isDev?: () => boolean;
Expand Down