Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix retrieve issue #3090

Merged
merged 11 commits into from
May 1, 2024
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,5 @@ stylesheets/dist/
*.LICENSE.txt
ts/webworker/workers/node/**/*.node

.yarn/**/*.mjs
.yarn/**/*.cjs
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,13 @@
"afterSign": "build/notarize.js",
"afterPack": "build/afterPackHook.js",
"artifactName": "${name}-${os}-${arch}-${version}.${ext}",
"extraResources": [{
"from": "./build/launcher-script.sh",
"to": "./launcher-script.sh"
},
"mmdb/GeoLite2-Country.mmdb"],
"extraResources": [
{
"from": "./build/launcher-script.sh",
"to": "./launcher-script.sh"
},
"mmdb/GeoLite2-Country.mmdb"
],
"mac": {
"category": "public.app-category.social-networking",
"icon": "build/icon-mac.icns",
Expand Down
4 changes: 2 additions & 2 deletions ts/components/DebugLogView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';
import styled from 'styled-components';
import { switchThemeTo } from '../themes/switchTheme';
import { SessionTheme } from '../themes/SessionTheme';
import { fetch } from '../util/logging';
import { fetchNodeLog } from '../util/logging';
import { SessionButton, SessionButtonType } from './basic/SessionButton';
import { SessionIconButton } from './icon';

Expand Down Expand Up @@ -78,7 +78,7 @@ const DebugLogViewAndSave = () => {
const commitHashInfo = window.getCommitHash() ? `Commit Hash: ${window.getCommitHash()}` : '';

// eslint-disable-next-line more/no-then
fetch()
fetchNodeLog()
.then((text: any) => {
const debugLogWithSystemInfo = `${operatingSystemInfo} ${commitHashInfo} ${text}`;
setContent(debugLogWithSystemInfo);
Expand Down
13 changes: 12 additions & 1 deletion ts/components/SessionInboxView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,18 @@ function createSessionInboxStore() {
function setupLeftPane(forceUpdateInboxComponent: () => void) {
window.openConversationWithMessages = openConversationWithMessages;
window.inboxStore = createSessionInboxStore();
window.inboxStore.dispatch(updateAllOnStorageReady());

window.inboxStore.dispatch(
updateAllOnStorageReady({
hasBlindedMsgRequestsEnabled: Storage.getBoolOrFalse(
SettingsKey.hasBlindedMsgRequestsEnabled
),
someDeviceOutdatedSyncing: Storage.getBoolOrFalse(SettingsKey.someDeviceOutdatedSyncing),
settingsLinkPreview: Storage.getBoolOrFalse(SettingsKey.settingsLinkPreview),
hasFollowSystemThemeEnabled: Storage.getBoolOrFalse(SettingsKey.hasFollowSystemThemeEnabled),
hasShiftSendEnabled: Storage.getBoolOrFalse(SettingsKey.hasShiftSendEnabled),
})
);
forceUpdateInboxComponent();
}

Expand Down
3 changes: 1 addition & 2 deletions ts/components/basic/SessionInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { useState } from 'react';

import classNames from 'classnames';
import { SessionIconButton } from '../icon';
import { Noop } from '../../types/Util';
import { useHTMLDirection } from '../../util/i18n';

type Props = {
Expand Down Expand Up @@ -46,7 +45,7 @@ const ErrorItem = (props: { error: string | undefined }) => {
);
};

const ShowHideButton = (props: { toggleForceShow: Noop }) => {
const ShowHideButton = (props: { toggleForceShow: () => void }) => {
const htmlDirection = useHTMLDirection();
const position = htmlDirection === 'ltr' ? { right: '0px' } : { left: '0px' };

Expand Down
2 changes: 1 addition & 1 deletion ts/components/calling/IncomingCallDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { useSelector } from 'react-redux';

import styled from 'styled-components';
import { useConversationUsername } from '../../hooks/useParamSelector';
import { ed25519Str } from '../../session/onions/onionPath';
import { CallManager } from '../../session/utils';
import { callTimeoutMs } from '../../session/utils/calling/CallManager';
import { getHasIncomingCall, getHasIncomingCallFrom } from '../../state/selectors/call';
import { Avatar, AvatarSize } from '../avatar/Avatar';
import { SessionButton, SessionButtonColor, SessionButtonType } from '../basic/SessionButton';
import { SessionWrapperModal } from '../SessionWrapperModal';
import { ed25519Str } from '../../session/utils/String';

export const CallWindow = styled.div`
position: absolute;
Expand Down
9 changes: 4 additions & 5 deletions ts/components/conversation/composition/CompositionButtons.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import styled from 'styled-components';
import { Noop } from '../../../types/Util';
import { SessionIconButton } from '../../icon';

const StyledChatButtonContainer = styled.div`
Expand All @@ -15,7 +14,7 @@ const StyledChatButtonContainer = styled.div`
}
`;

export const AddStagedAttachmentButton = (props: { onClick: Noop }) => {
export const AddStagedAttachmentButton = (props: { onClick: () => void }) => {
return (
<StyledChatButtonContainer>
<SessionIconButton
Expand All @@ -32,7 +31,7 @@ export const AddStagedAttachmentButton = (props: { onClick: Noop }) => {
);
};

export const StartRecordingButton = (props: { onClick: Noop }) => {
export const StartRecordingButton = (props: { onClick: () => void }) => {
return (
<StyledChatButtonContainer>
<SessionIconButton
Expand All @@ -50,7 +49,7 @@ export const StartRecordingButton = (props: { onClick: Noop }) => {
};

// eslint-disable-next-line react/display-name
export const ToggleEmojiButton = React.forwardRef<HTMLButtonElement, { onClick: Noop }>(
export const ToggleEmojiButton = React.forwardRef<HTMLButtonElement, { onClick: () => void }>(
(props, ref) => {
return (
<StyledChatButtonContainer>
Expand All @@ -70,7 +69,7 @@ export const ToggleEmojiButton = React.forwardRef<HTMLButtonElement, { onClick:
}
);

export const SendMessageButton = (props: { onClick: Noop }) => {
export const SendMessageButton = (props: { onClick: () => void }) => {
return (
<StyledChatButtonContainer className="send-message-button">
<SessionIconButton
Expand Down
3 changes: 2 additions & 1 deletion ts/components/dialog/DeleteAccountModal.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useCallback, useState } from 'react';
import { useDispatch } from 'react-redux';
import { SnodeAPI } from '../../session/apis/snode_api/SNodeAPI';
import { ed25519Str } from '../../session/onions/onionPath';

import { forceSyncConfigurationNowIfNeeded } from '../../session/utils/sync/syncUtils';
import { updateConfirmModal, updateDeleteAccountModal } from '../../state/ducks/modalDialog';
import { SessionWrapperModal } from '../SessionWrapperModal';
Expand All @@ -14,6 +14,7 @@ import { deleteAllLogs } from '../../node/logs';
import { clearInbox } from '../../session/apis/open_group_api/sogsv3/sogsV3ClearInbox';
import { getAllValidOpenGroupV2ConversationRoomInfos } from '../../session/apis/open_group_api/utils/OpenGroupUtils';
import { SessionRadioGroup } from '../basic/SessionRadioGroup';
import { ed25519Str } from '../../session/utils/String';

const deleteDbLocally = async () => {
window?.log?.info('last message sent successfully. Deleting everything');
Expand Down
7 changes: 1 addition & 6 deletions ts/components/dialog/EditProfilePictureModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { SessionSpinner } from '../basic/SessionSpinner';
import { SpacerLG } from '../basic/Text';
import { SessionIconButton } from '../icon';
import { ProfileAvatar } from './EditProfileDialog';
import type { EditProfilePictureModalProps } from '../../types/ReduxTypes';

const StyledAvatarContainer = styled.div`
cursor: pointer;
Expand Down Expand Up @@ -59,12 +60,6 @@ const uploadProfileAvatar = async (scaledAvatarUrl: string | null) => {
}
};

export type EditProfilePictureModalProps = {
avatarPath: string | null;
profileName: string | undefined;
ourId: string;
};

export const EditProfilePictureModal = (props: EditProfilePictureModalProps) => {
const dispatch = useDispatch();

Expand Down
3 changes: 1 addition & 2 deletions ts/components/dialog/SessionPasswordDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import { SessionButton, SessionButtonColor, SessionButtonType } from '../basic/S
import { SessionWrapperModal } from '../SessionWrapperModal';
import { matchesHash, validatePassword } from '../../util/passwordUtils';
import { assertUnreachable } from '../../types/sqlSharedTypes';

export type PasswordAction = 'set' | 'change' | 'remove' | 'enter';
import type { PasswordAction } from '../../types/ReduxTypes';

interface Props {
passwordAction: PasswordAction;
Expand Down
30 changes: 15 additions & 15 deletions ts/components/leftpane/LeftPaneSettingSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import {
} from '../../state/ducks/section';
import { getFocusedSettingsSection } from '../../state/selectors/section';
import { SessionIcon } from '../icon';
import { SessionSettingCategory } from '../settings/SessionSettings';
import { LeftPaneSectionHeader } from './LeftPaneSectionHeader';
import type { SessionSettingCategory } from '../../types/ReduxTypes';

const StyledSettingsSectionTitle = styled.strong`
font-family: var(--font-accent), var(--font-default);
Expand Down Expand Up @@ -42,42 +42,42 @@ const StyledSettingsListItem = styled.div<{ active: boolean }>`
}
`;

const getCategories = () => {
const getCategories = (): Array<{ id: SessionSettingCategory; title: string }> => {
return [
{
id: SessionSettingCategory.Privacy,
id: 'privacy' as const,
title: window.i18n('privacySettingsTitle'),
},
{
id: SessionSettingCategory.Notifications,
id: 'notifications' as const,
title: window.i18n('notificationsSettingsTitle'),
},
{
id: SessionSettingCategory.Conversations,
id: 'conversations' as const,
title: window.i18n('conversationsSettingsTitle'),
},
{
id: SessionSettingCategory.MessageRequests,
id: 'messageRequests' as const,
title: window.i18n('openMessageRequestInbox'),
},
{
id: SessionSettingCategory.Appearance,
id: 'appearance' as const,
title: window.i18n('appearanceSettingsTitle'),
},
{
id: SessionSettingCategory.Permissions,
id: 'permissions',
title: window.i18n('permissionsSettingsTitle'),
},
{
id: SessionSettingCategory.Help,
id: 'help' as const,
title: window.i18n('helpSettingsTitle'),
},
{
id: SessionSettingCategory.RecoveryPhrase,
id: 'recoveryPhrase' as const,
title: window.i18n('recoveryPhrase'),
},
{
id: SessionSettingCategory.ClearData,
id: 'clearData' as const,
title: window.i18n('clearDataSettingsTitle'),
},
];
Expand All @@ -93,7 +93,7 @@ const LeftPaneSettingsCategoryRow = (props: {

const dataTestId = `${title.toLowerCase().replace(' ', '-')}-settings-menu-item`;

const isClearData = id === SessionSettingCategory.ClearData;
const isClearData = id === 'clearData';

return (
<StyledSettingsListItem
Expand All @@ -103,15 +103,15 @@ const LeftPaneSettingsCategoryRow = (props: {
role="link"
onClick={() => {
switch (id) {
case SessionSettingCategory.MessageRequests:
case 'messageRequests':
dispatch(showLeftPaneSection(SectionType.Message));
dispatch(setLeftOverlayMode('message-requests'));
dispatch(resetConversationExternal());
break;
case SessionSettingCategory.RecoveryPhrase:
case 'recoveryPhrase':
dispatch(recoveryPhraseModal({}));
break;
case SessionSettingCategory.ClearData:
case 'clearData':
dispatch(updateDeleteAccountModal({}));
break;
default:
Expand Down
5 changes: 2 additions & 3 deletions ts/components/registration/SignUpTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { RegistrationContext, RegistrationPhase, signUp } from './RegistrationSt
import { RegistrationUserDetails } from './RegistrationUserDetails';
import { sanitizeDisplayNameOrToast, SignInMode } from './SignInTab';
import { TermsAndConditions } from './TermsAndConditions';
import { Noop } from '../../types/Util';

export enum SignUpMode {
Default,
Expand All @@ -23,7 +22,7 @@ const ContinueSignUpButton = ({ continueSignUp }: { continueSignUp: any }) => {
return <SessionButton onClick={continueSignUp} text={window.i18n('continue')} />;
};

const SignUpDefault = (props: { createSessionID: Noop }) => {
const SignUpDefault = (props: { createSessionID: () => void }) => {
return (
<div className="session-registration__content">
<CreateSessionIdButton createSessionID={props.createSessionID} />
Expand All @@ -47,7 +46,7 @@ export const GoBackMainMenuButton = () => {
);
};

const SignUpSessionIDShown = (props: { continueSignUp: Noop }) => {
const SignUpSessionIDShown = (props: { continueSignUp: () => void }) => {
return (
<div className="session-registration__content">
<Flex flexDirection="row" container={true} alignItems="center">
Expand Down
3 changes: 1 addition & 2 deletions ts/components/settings/SessionSettingListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
import { SessionToggle } from '../basic/SessionToggle';
import { SessionConfirmDialogProps } from '../dialog/SessionConfirm';
import { SessionIconButton } from '../icon';
import { Noop } from '../../types/Util';

type ButtonSettingsProps = {
title?: string;
Expand Down Expand Up @@ -113,7 +112,7 @@ export const SessionSettingsItemWrapper = (props: {
);
};

export const SessionSettingsTitleWithLink = (props: { title: string; onClick: Noop }) => {
export const SessionSettingsTitleWithLink = (props: { title: string; onClick: () => void }) => {
const { onClick, title } = props;
return (
<StyledSettingItemClickable onClick={onClick}>
Expand Down
32 changes: 10 additions & 22 deletions ts/components/settings/SessionSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import { SessionNotificationGroupSettings } from './SessionNotificationGroupSett
import { Data } from '../../data/data';
import { sessionPassword } from '../../state/ducks/modalDialog';
import { SectionType, showLeftPaneSection } from '../../state/ducks/section';
import { PasswordAction } from '../dialog/SessionPasswordDialog';
import { SettingsCategoryAppearance } from './section/CategoryAppearance';
import { CategoryConversations } from './section/CategoryConversations';
import { SettingsCategoryHelp } from './section/CategoryHelp';
import { SettingsCategoryPermissions } from './section/CategoryPermissions';
import { SettingsCategoryPrivacy } from './section/CategoryPrivacy';
import type { SessionSettingCategory, PasswordAction } from '../../types/ReduxTypes';

export function displayPasswordModal(
passwordAction: PasswordAction,
Expand All @@ -42,18 +42,6 @@ export function getCallMediaPermissionsSettings() {
return window.getSettingValue('call-media-permissions');
}

export enum SessionSettingCategory {
Privacy = 'privacy',
Notifications = 'notifications',
Conversations = 'conversations',
MessageRequests = 'messageRequests',
Appearance = 'appearance',
Permissions = 'permissions',
Help = 'help',
RecoveryPhrase = 'recoveryPhrase',
ClearData = 'ClearData',
}

export interface SettingsViewProps {
category: SessionSettingCategory;
}
Expand Down Expand Up @@ -113,25 +101,25 @@ const SettingInCategory = (props: {

switch (category) {
// special case for blocked user
case SessionSettingCategory.Conversations:
case 'conversations':
return <CategoryConversations />;
case SessionSettingCategory.Appearance:
case 'appearance':
return <SettingsCategoryAppearance />;
case SessionSettingCategory.Notifications:
case 'notifications':
return <SessionNotificationGroupSettings />;
case SessionSettingCategory.Privacy:
case 'privacy':
return (
<SettingsCategoryPrivacy onPasswordUpdated={onPasswordUpdated} hasPassword={hasPassword} />
);
case SessionSettingCategory.Help:
case 'help':
return <SettingsCategoryHelp />;
case SessionSettingCategory.Permissions:
case 'permissions':
return <SettingsCategoryPermissions />;

// these three down there have no options, they are just a button
case SessionSettingCategory.ClearData:
case SessionSettingCategory.MessageRequests:
case SessionSettingCategory.RecoveryPhrase:
case 'clearData':
case 'messageRequests':
case 'recoveryPhrase':
default:
return null;
}
Expand Down
Loading
Loading