pull/1770/head
Brice-W 4 years ago
parent f1e4cbaabf
commit 5252dd40e3

@ -297,10 +297,6 @@
window.addEventListener('focus', () => Whisper.Notifications.clear());
window.addEventListener('unload', () => Whisper.Notifications.fastClear());
window.showResetSessionIdDialog = () => {
appView.showResetSessionIdDialog();
};
// Set user's launch count.
const prevLaunchCount = window.getSettingValue('launch-count');
const launchCount = !prevLaunchCount ? 1 : prevLaunchCount + 1;

@ -94,16 +94,5 @@
window.focus(); // FIXME
return Promise.resolve();
},
showResetSessionIdDialog() {
const theme = this.getThemeObject();
const resetSessionIDDialog = new Whisper.SessionIDResetDialog({ theme });
this.el.prepend(resetSessionIDDialog.el);
},
getThemeObject() {
const themeSettings = storage.get('theme-setting') || 'light';
const theme = themeSettings === 'light' ? window.lightTheme : window.darkTheme;
return theme;
},
});
})();

@ -28,8 +28,7 @@ import {
} from '../state/ducks/conversations';
import { SessionIcon, SessionIconSize, SessionIconType } from './session/icon';
import { useDispatch, useSelector } from 'react-redux';
import { SectionType } from './session/ActionsPanel';
import { getTheme } from '../state/selectors/theme';
import { SectionType } from '../state/ducks/section';
import { getFocusedSection } from '../state/selectors/section';
export interface ConversationListItemProps extends ConversationType {

@ -1,6 +1,6 @@
import React, { useState } from 'react';
import { ActionsPanel, SectionType } from './session/ActionsPanel';
import { ActionsPanel } from './session/ActionsPanel';
import { LeftPaneMessageSection } from './session/LeftPaneMessageSection';
import { openConversationExternal } from '../state/ducks/conversations';
@ -13,6 +13,7 @@ import { useDispatch, useSelector } from 'react-redux';
import { getLeftPaneLists } from '../state/selectors/conversations';
import { getQuery, getSearchResults, isSearching } from '../state/selectors/search';
import { clearSearch, search, updateSearchTerm } from '../state/ducks/search';
import { SectionType } from '../state/ducks/section';
import { getTheme } from '../state/selectors/theme';
// from https://github.com/bvaughn/react-virtualized/blob/fb3484ed5dcc41bffae8eab029126c0fb8f7abc0/source/List/types.js#L5

@ -30,7 +30,7 @@ import { applyTheme } from '../../state/ducks/theme';
import { getFocusedSection } from '../../state/selectors/section';
import { useInterval } from '../../hooks/useInterval';
import { clearSearch } from '../../state/ducks/search';
import { showLeftPaneSection } from '../../state/ducks/section';
import { SectionType, showLeftPaneSection } from '../../state/ducks/section';
import { cleanUpOldDecryptedMedias } from '../../session/crypto/DecryptedAttachmentsManager';
import { getOpenGroupManager } from '../../opengroup/opengroupV2/OpenGroupManagerV2';
@ -47,16 +47,6 @@ import { ActionPanelOnionStatusLight } from '../OnionStatusPathDialog';
// tslint:disable-next-line: no-import-side-effect no-submodule-imports
export enum SectionType {
Profile,
Message,
Contact,
Channel,
Settings,
Moon,
PathIndicator,
}
const Section = (props: { type: SectionType; avatarPath?: string }) => {
const ourNumber = useSelector(getOurNumber);
const unreadMessageCount = useSelector(getUnreadMessageCount);
@ -143,15 +133,6 @@ const Section = (props: { type: SectionType; avatarPath?: string }) => {
);
};
const showResetSessionIDDialogIfNeeded = async () => {
const userED25519KeyPairHex = await UserUtils.getUserED25519KeyPair();
if (userED25519KeyPairHex) {
return;
}
window.showResetSessionIdDialog();
};
const cleanUpMediasInterval = DURATION.MINUTES * 30;
const setupTheme = () => {
@ -230,7 +211,6 @@ const doAppStartUp = () => {
void setupTheme();
// keep that one to make sure our users upgrade to new sessionIDS
void showResetSessionIDDialogIfNeeded();
void removeAllV1OpenGroups();
// this generates the key to encrypt attachments locally

@ -31,10 +31,10 @@ import { getConversationController } from '../../../session/conversations';
import { ConversationType } from '../../../state/ducks/conversations';
import { SessionMemberListItem } from '../SessionMemberListItem';
import autoBind from 'auto-bind';
import { SectionType } from '../ActionsPanel';
import { SessionSettingCategory } from '../settings/SessionSettings';
import { getMentionsInput } from '../../../state/selectors/mentionsInput';
import { updateConfirmModal } from '../../../state/ducks/modalDialog';
import { SectionType } from '../../../state/ducks/section';
import { SessionButtonColor } from '../SessionButton';
import { SessionConfirmDialogProps } from '../SessionConfirm';

@ -7,6 +7,7 @@ import { Item, Submenu } from 'react-contexify';
import { ConversationNotificationSettingType } from '../../../models/conversation';
import { useDispatch, useSelector } from 'react-redux';
import { changeNickNameModal, updateConfirmModal } from '../../../state/ducks/modalDialog';
import { SectionType } from '../../../state/ducks/section';
import { getConversationController } from '../../../session/conversations';
import {
blockConvoById,
@ -24,7 +25,6 @@ import {
unblockConvoById,
} from '../../../interactions/conversationInteractions';
import { SessionButtonColor } from '../SessionButton';
import { SectionType } from '../ActionsPanel';
import { ToastUtils } from '../../../session/utils';
const maxNumberOfPinnedConversations = 5;
@ -132,9 +132,7 @@ export interface PinConversationMenuItemProps {
conversationId: string;
}
export const getPinConversationMenuItem = (
conversationId: string
): JSX.Element | null => {
export const getPinConversationMenuItem = (conversationId: string): JSX.Element | null => {
const isMessagesSection = useSelector(getFocusedSection) === SectionType.Message;
if (isMessagesSection && window.lokiFeatureFlags.enablePinConversations) {
const conversation = getConversationController().get(conversationId);

@ -163,6 +163,3 @@ export const inversedTheme = (theme: DefaultTheme): DefaultTheme => {
export const SessionTheme = ({ children, theme }: { children: any; theme: DefaultTheme }) => (
<ThemeProvider theme={theme}>{children}</ThemeProvider>
);
window.lightTheme = lightTheme;
window.darkTheme = darkTheme;

@ -1,9 +1,18 @@
import { SectionType } from '../../components/session/ActionsPanel';
import { SessionSettingCategory } from '../../components/session/settings/SessionSettings';
export const FOCUS_SECTION = 'FOCUS_SECTION';
export const FOCUS_SETTINGS_SECTION = 'FOCUS_SETTINGS_SECTION';
export enum SectionType {
Profile,
Message,
Contact,
Channel,
Settings,
Moon,
PathIndicator,
}
type FocusSectionActionType = {
type: 'FOCUS_SECTION';
payload: SectionType;

@ -1,9 +1,9 @@
import { createSelector } from 'reselect';
import { StateType } from '../reducer';
import { SectionType } from '../../components/session/ActionsPanel';
import { OnionState } from '../ducks/onion';
import { Snode } from '../../data/data';
import { SectionType } from '../../state/ducks/section';
export const getOnionPaths = (state: StateType): OnionState => state.onionPaths;

@ -1,8 +1,7 @@
import { createSelector } from 'reselect';
import { StateType } from '../reducer';
import { SectionStateType } from '../ducks/section';
import { SectionType } from '../../components/session/ActionsPanel';
import { SectionStateType, SectionType } from '../ducks/section';
import { SessionSettingCategory } from '../../components/session/settings/SessionSettings';
export const getSection = (state: StateType): SectionStateType => state.section;

3
ts/window.d.ts vendored

@ -57,7 +57,6 @@ declare global {
getSeedNodeList: () => Array<any> | undefined;
setPassword: any;
setSettingValue: any;
showResetSessionIdDialog: any;
storage: any;
textsecure: LibTextsecure;
toggleLinkPreview: any;
@ -80,8 +79,6 @@ declare global {
expired: (boolean) => void;
expiredStatus: () => boolean;
};
lightTheme: DefaultTheme;
darkTheme: DefaultTheme;
LokiPushNotificationServer: any;
globalOnlineStatus: boolean;
confirmationDialog: any;

Loading…
Cancel
Save