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

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

@ -94,16 +94,5 @@
window.focus(); // FIXME window.focus(); // FIXME
return Promise.resolve(); 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'; } from '../state/ducks/conversations';
import { SessionIcon, SessionIconSize, SessionIconType } from './session/icon'; import { SessionIcon, SessionIconSize, SessionIconType } from './session/icon';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { SectionType } from './session/ActionsPanel'; import { SectionType } from '../state/ducks/section';
import { getTheme } from '../state/selectors/theme';
import { getFocusedSection } from '../state/selectors/section'; import { getFocusedSection } from '../state/selectors/section';
export interface ConversationListItemProps extends ConversationType { export interface ConversationListItemProps extends ConversationType {

@ -1,6 +1,6 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import { ActionsPanel, SectionType } from './session/ActionsPanel'; import { ActionsPanel } from './session/ActionsPanel';
import { LeftPaneMessageSection } from './session/LeftPaneMessageSection'; import { LeftPaneMessageSection } from './session/LeftPaneMessageSection';
import { openConversationExternal } from '../state/ducks/conversations'; import { openConversationExternal } from '../state/ducks/conversations';
@ -13,6 +13,7 @@ import { useDispatch, useSelector } from 'react-redux';
import { getLeftPaneLists } from '../state/selectors/conversations'; import { getLeftPaneLists } from '../state/selectors/conversations';
import { getQuery, getSearchResults, isSearching } from '../state/selectors/search'; import { getQuery, getSearchResults, isSearching } from '../state/selectors/search';
import { clearSearch, search, updateSearchTerm } from '../state/ducks/search'; import { clearSearch, search, updateSearchTerm } from '../state/ducks/search';
import { SectionType } from '../state/ducks/section';
import { getTheme } from '../state/selectors/theme'; import { getTheme } from '../state/selectors/theme';
// from https://github.com/bvaughn/react-virtualized/blob/fb3484ed5dcc41bffae8eab029126c0fb8f7abc0/source/List/types.js#L5 // 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 { getFocusedSection } from '../../state/selectors/section';
import { useInterval } from '../../hooks/useInterval'; import { useInterval } from '../../hooks/useInterval';
import { clearSearch } from '../../state/ducks/search'; 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 { cleanUpOldDecryptedMedias } from '../../session/crypto/DecryptedAttachmentsManager';
import { getOpenGroupManager } from '../../opengroup/opengroupV2/OpenGroupManagerV2'; 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 // 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 Section = (props: { type: SectionType; avatarPath?: string }) => {
const ourNumber = useSelector(getOurNumber); const ourNumber = useSelector(getOurNumber);
const unreadMessageCount = useSelector(getUnreadMessageCount); 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 cleanUpMediasInterval = DURATION.MINUTES * 30;
const setupTheme = () => { const setupTheme = () => {
@ -230,7 +211,6 @@ const doAppStartUp = () => {
void setupTheme(); void setupTheme();
// keep that one to make sure our users upgrade to new sessionIDS // keep that one to make sure our users upgrade to new sessionIDS
void showResetSessionIDDialogIfNeeded();
void removeAllV1OpenGroups(); void removeAllV1OpenGroups();
// this generates the key to encrypt attachments locally // this generates the key to encrypt attachments locally

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

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

@ -163,6 +163,3 @@ export const inversedTheme = (theme: DefaultTheme): DefaultTheme => {
export const SessionTheme = ({ children, theme }: { children: any; theme: DefaultTheme }) => ( export const SessionTheme = ({ children, theme }: { children: any; theme: DefaultTheme }) => (
<ThemeProvider theme={theme}>{children}</ThemeProvider> <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'; import { SessionSettingCategory } from '../../components/session/settings/SessionSettings';
export const FOCUS_SECTION = 'FOCUS_SECTION'; export const FOCUS_SECTION = 'FOCUS_SECTION';
export const FOCUS_SETTINGS_SECTION = 'FOCUS_SETTINGS_SECTION'; export const FOCUS_SETTINGS_SECTION = 'FOCUS_SETTINGS_SECTION';
export enum SectionType {
Profile,
Message,
Contact,
Channel,
Settings,
Moon,
PathIndicator,
}
type FocusSectionActionType = { type FocusSectionActionType = {
type: 'FOCUS_SECTION'; type: 'FOCUS_SECTION';
payload: SectionType; payload: SectionType;

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

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

3
ts/window.d.ts vendored

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

Loading…
Cancel
Save