Merge remote-tracking branch 'upstream/unstable' into closed-group-chunk3

pull/3281/head
Audric Ackermann 12 months ago
commit 9ad66047ea
No known key found for this signature in database

@ -25,7 +25,7 @@ concurrency:
env:
# we want to publish on "push to master" only. When we don't want to publish, we want to upload artefacts
SHOULD_PUBLISH: ${{ github.event_name == 'push' && github.ref == 'master' }}
SHOULD_PUBLISH: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
jobs:
build_linux:
@ -77,7 +77,7 @@ jobs:
# we want this to run only when on "push" to "master"
if: ${{ env.SHOULD_PUBLISH == 'true' }}
run: |
sed -i 's/\"target\": \\[\"deb\"\\]/\"target\": \"${{ matrix.pkg_to_build }}\"/g' package.json; yarn build-release-publish
sed -i 's/"target": \["deb"\]/"target": "${{ matrix.pkg_to_build }}"/g' package.json && yarn build-release-publish
build_windows:
runs-on: windows-2022

@ -2,7 +2,7 @@
"name": "session-desktop",
"productName": "Session",
"description": "Private messaging from your desktop",
"version": "1.14.0",
"version": "1.14.2",
"license": "GPL-3.0",
"author": {
"name": "Oxen Labs",

@ -61,7 +61,6 @@ export function OpenUrlModal(props: OpenUrlModalState) {
/>
<SessionButton
text={window.i18n('urlCopy')}
buttonColor={SessionButtonColor.White}
buttonType={SessionButtonType.Simple}
onClick={onClickCopy}
dataTestId="session-confirm-cancel-button"

@ -1,9 +1,11 @@
import { ipcRenderer } from 'electron';
import { debounce } from 'lodash';
import { useEffect, useRef, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import useInterval from 'react-use/lib/useInterval';
import useTimeoutFn from 'react-use/lib/useTimeoutFn';
import useThrottleFn from 'react-use/lib/useThrottleFn';
import { Data } from '../../data/data';
import { ConvoHub } from '../../session/conversations';
@ -11,8 +13,8 @@ import { ConvoHub } from '../../session/conversations';
import { clearSearch } from '../../state/ducks/search';
import { resetLeftOverlayMode, SectionType, showLeftPaneSection } from '../../state/ducks/section';
import {
getGlobalUnreadMessageCount,
getOurPrimaryConversation,
useGlobalUnreadMessageCount,
} from '../../state/selectors/conversations';
import { getFocusedSection } from '../../state/selectors/section';
import { getOurNumber } from '../../state/selectors/user';
@ -38,11 +40,11 @@ import { SnodePool } from '../../session/apis/snode_api/snodePool';
import { UserSync } from '../../session/utils/job_runners/jobs/UserSyncJob';
import { forceSyncConfigurationNowIfNeeded } from '../../session/utils/sync/syncUtils';
import { useFetchLatestReleaseFromFileServer } from '../../hooks/useFetchLatestReleaseFromFileServer';
import { useHotkey } from '../../hooks/useHotkey';
import { useIsDarkTheme } from '../../state/selectors/theme';
import { switchThemeTo } from '../../themes/switchTheme';
import { getOppositeTheme } from '../../util/theme';
import { SessionNotificationCount } from '../icon/SessionNotificationCount';
import { useHotkey } from '../../hooks/useHotkey';
import { getIsModalVisible } from '../../state/selectors/modal';
import { ReleasedFeatures } from '../../util/releaseFeature';
@ -50,7 +52,7 @@ import { MessageQueue } from '../../session/sending';
const Section = (props: { type: SectionType }) => {
const ourNumber = useSelector(getOurNumber);
const globalUnreadMessageCount = useSelector(getGlobalUnreadMessageCount);
const globalUnreadMessageCount = useGlobalUnreadMessageCount();
const dispatch = useDispatch();
const { type } = props;
@ -216,6 +218,21 @@ const doAppStartUp = async () => {
}, 20000);
};
function useUpdateBadgeCount() {
const globalUnreadMessageCount = useGlobalUnreadMessageCount();
// Reuse the unreadToShow from the global state to update the badge count
useThrottleFn(
(unreadCount: number) => {
if (globalUnreadMessageCount !== undefined) {
ipcRenderer.send('update-badge-count', unreadCount);
}
},
2000,
[globalUnreadMessageCount]
);
}
/**
* ActionsPanel is the far left banner (not the left pane).
* The panel with buttons to switch between the message/contact/settings/theme views
@ -238,6 +255,8 @@ export const ActionsPanel = () => {
return () => clearTimeout(timeout);
}, []);
useUpdateBadgeCount();
useInterval(
DecryptedAttachmentsManager.cleanUpOldDecryptedMedias,
startCleanUpMedia ? cleanUpMediasInterval : null

@ -58,12 +58,11 @@ export const convertIconToImageURL = async (
/>
);
// wait for it to render
await sleepFor(100);
await sleepFor(200);
const svg = root?.querySelector(`#icon-to-image-url svg`);
svg?.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
const svgString = svg?.outerHTML;
reactRoot?.unmount();
root?.removeChild(divElement);

@ -10,6 +10,7 @@ import {
dialog,
protocol as electronProtocol,
ipcMain as ipc,
ipcMain,
IpcMainEvent,
Menu,
nativeTheme,
@ -27,7 +28,7 @@ import { platform as osPlatform } from 'process';
import url from 'url';
import Logger from 'bunyan';
import _, { isEmpty } from 'lodash';
import _, { isEmpty, isNumber, isFinite } from 'lodash';
import { setupGlobalErrorHandler } from '../node/global_errors'; // checked - only node
import { setup as setupSpellChecker } from '../node/spell_check'; // checked - only node
@ -1017,6 +1018,12 @@ ipc.on('get-start-in-tray', event => {
}
});
ipcMain.on('update-badge-count', (_event, count) => {
if (app.isReady()) {
app.setBadgeCount(isNumber(count) && isFinite(count) && count >= 0 ? count : 0);
}
});
ipc.on('get-opengroup-pruning', event => {
try {
const val = userConfig.get('opengroupPruning');

@ -551,10 +551,11 @@ export const getPrivateContactsPubkeys = createSelector(getSortedContacts, state
state.map(m => m.id)
);
export const getGlobalUnreadMessageCount = createSelector(
getSortedConversations,
_getGlobalUnreadCount
);
const getGlobalUnreadMessageCount = createSelector(getSortedConversations, _getGlobalUnreadCount);
export function useGlobalUnreadMessageCount() {
return useSelector(getGlobalUnreadMessageCount);
}
export const getMessageInfoId = (state: StateType) => state.conversations.messageInfoId;

@ -72,16 +72,38 @@ export function getBrowserLocale() {
// supportedLocalesOf will throw if the locales has a '_' instead of a '-' in it.
const userLocaleDashed = browserLocale.replaceAll('_', '-');
const matchingLocales = Intl.DateTimeFormat.supportedLocalesOf(userLocaleDashed);
const mappingTo = matchingLocales?.[0] || 'en';
if (!mappedBrowserLocaleDisplayed) {
mappedBrowserLocaleDisplayed = true;
i18nLog(`userLocaleDashed: '${userLocaleDashed}', mapping to browser locale: ${mappingTo}`);
try {
let matchingLocales: Array<string> = [];
try {
matchingLocales = Intl.DateTimeFormat.supportedLocalesOf(userLocaleDashed);
} catch (innerError) {
// some users have a locale setup with a ':' in it.
// see https://github.com/oxen-io/session-desktop/issues/3221
const semiColonIndex = userLocaleDashed.indexOf(':');
if (semiColonIndex > -1) {
matchingLocales = Intl.DateTimeFormat.supportedLocalesOf(
userLocaleDashed.substring(0, semiColonIndex)
);
}
}
const mappingTo = matchingLocales?.[0] || 'en';
if (!mappedBrowserLocaleDisplayed) {
mappedBrowserLocaleDisplayed = true;
i18nLog(`userLocaleDashed: '${userLocaleDashed}', mapping to browser locale: ${mappingTo}`);
}
return mappingTo;
} catch (e) {
if (!mappedBrowserLocaleDisplayed) {
mappedBrowserLocaleDisplayed = true;
i18nLog(
`userLocaleDashed: '${userLocaleDashed}' was an invalid locale for supportedLocalesOf(). Falling back to 'en'. Error:${e.message} `
);
}
return 'en';
}
return mappingTo;
}
export function setInitialLocale(crowdinLocaleArg: CrowdinLocale, dictionary: LocalizerDictionary) {

Loading…
Cancel
Save