Gift Transfer: Add 2FA set up button (#5876)
This commit is contained in:
parent
dc722a9cc2
commit
842d2432a1
@ -1674,6 +1674,7 @@
|
|||||||
"GiftFilterHidden" = "Hidden";
|
"GiftFilterHidden" = "Hidden";
|
||||||
"GiftSearchEmpty" = "No matching gifts";
|
"GiftSearchEmpty" = "No matching gifts";
|
||||||
"GiftSearchReset" = "View All Gifts";
|
"GiftSearchReset" = "View All Gifts";
|
||||||
|
"SetUp2FA" = "Set up Two-Step Verification";
|
||||||
"CheckPasswordTitle" = "Enter Password";
|
"CheckPasswordTitle" = "Enter Password";
|
||||||
"CheckPasswordPlaceholder" = "Password";
|
"CheckPasswordPlaceholder" = "Password";
|
||||||
"CheckPasswordDescription" = "Please enter your password to continue.";
|
"CheckPasswordDescription" = "Please enter your password to continue.";
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import { getActions } from '../../global';
|
|||||||
|
|
||||||
import type { GlobalState } from '../../global/types';
|
import type { GlobalState } from '../../global/types';
|
||||||
import type { FolderEditDispatch } from '../../hooks/reducers/useFoldersReducer';
|
import type { FolderEditDispatch } from '../../hooks/reducers/useFoldersReducer';
|
||||||
import type { LeftColumnContent, SettingsScreens } from '../../types';
|
|
||||||
|
|
||||||
import { ANIMATION_END_DELAY } from '../../config';
|
import { ANIMATION_END_DELAY } from '../../config';
|
||||||
import buildClassName from '../../util/buildClassName';
|
import buildClassName from '../../util/buildClassName';
|
||||||
@ -35,9 +34,7 @@ export type OwnProps = {
|
|||||||
isStoryRibbonShown?: boolean;
|
isStoryRibbonShown?: boolean;
|
||||||
onReset: () => void;
|
onReset: () => void;
|
||||||
onTopicSearch: NoneToVoidFunction;
|
onTopicSearch: NoneToVoidFunction;
|
||||||
onSettingsScreenSelect: (screen: SettingsScreens) => void;
|
|
||||||
foldersDispatch: FolderEditDispatch;
|
foldersDispatch: FolderEditDispatch;
|
||||||
onLeftColumnContentChange: (content: LeftColumnContent) => void;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const ArchivedChats: FC<OwnProps> = ({
|
const ArchivedChats: FC<OwnProps> = ({
|
||||||
@ -47,8 +44,6 @@ const ArchivedChats: FC<OwnProps> = ({
|
|||||||
isStoryRibbonShown,
|
isStoryRibbonShown,
|
||||||
onReset,
|
onReset,
|
||||||
onTopicSearch,
|
onTopicSearch,
|
||||||
onSettingsScreenSelect,
|
|
||||||
onLeftColumnContentChange,
|
|
||||||
foldersDispatch,
|
foldersDispatch,
|
||||||
}) => {
|
}) => {
|
||||||
const { updateArchiveSettings } = getActions();
|
const { updateArchiveSettings } = getActions();
|
||||||
@ -136,8 +131,7 @@ const ArchivedChats: FC<OwnProps> = ({
|
|||||||
folderType="archived"
|
folderType="archived"
|
||||||
isActive={isActive}
|
isActive={isActive}
|
||||||
isForumPanelOpen={isForumPanelVisible}
|
isForumPanelOpen={isForumPanelVisible}
|
||||||
onSettingsScreenSelect={onSettingsScreenSelect}
|
isMainList
|
||||||
onLeftColumnContentChange={onLeftColumnContentChange}
|
|
||||||
foldersDispatch={foldersDispatch}
|
foldersDispatch={foldersDispatch}
|
||||||
archiveSettings={archiveSettings}
|
archiveSettings={archiveSettings}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -38,13 +38,14 @@ interface OwnProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type StateProps = {
|
type StateProps = {
|
||||||
|
contentKey: LeftColumnContent;
|
||||||
|
settingsScreen: SettingsScreens;
|
||||||
searchQuery?: string;
|
searchQuery?: string;
|
||||||
searchDate?: number;
|
searchDate?: number;
|
||||||
isFirstChatFolderActive: boolean;
|
isFirstChatFolderActive: boolean;
|
||||||
shouldSkipHistoryAnimations?: boolean;
|
shouldSkipHistoryAnimations?: boolean;
|
||||||
currentUserId?: string;
|
currentUserId?: string;
|
||||||
hasPasscode?: boolean;
|
hasPasscode?: boolean;
|
||||||
nextSettingsScreen?: SettingsScreens;
|
|
||||||
nextFoldersAction?: ReducerAction<FoldersActions>;
|
nextFoldersAction?: ReducerAction<FoldersActions>;
|
||||||
isChatOpen: boolean;
|
isChatOpen: boolean;
|
||||||
isAppUpdateAvailable?: boolean;
|
isAppUpdateAvailable?: boolean;
|
||||||
@ -73,13 +74,14 @@ const RESET_TRANSITION_DELAY_MS = 250;
|
|||||||
|
|
||||||
function LeftColumn({
|
function LeftColumn({
|
||||||
ref,
|
ref,
|
||||||
|
contentKey,
|
||||||
|
settingsScreen,
|
||||||
searchQuery,
|
searchQuery,
|
||||||
searchDate,
|
searchDate,
|
||||||
isFirstChatFolderActive,
|
isFirstChatFolderActive,
|
||||||
shouldSkipHistoryAnimations,
|
shouldSkipHistoryAnimations,
|
||||||
currentUserId,
|
currentUserId,
|
||||||
hasPasscode,
|
hasPasscode,
|
||||||
nextSettingsScreen,
|
|
||||||
nextFoldersAction,
|
nextFoldersAction,
|
||||||
isChatOpen,
|
isChatOpen,
|
||||||
isAppUpdateAvailable,
|
isAppUpdateAvailable,
|
||||||
@ -100,11 +102,10 @@ function LeftColumn({
|
|||||||
loadPasswordInfo,
|
loadPasswordInfo,
|
||||||
clearTwoFaError,
|
clearTwoFaError,
|
||||||
openChat,
|
openChat,
|
||||||
requestNextSettingsScreen,
|
openLeftColumnContent,
|
||||||
|
openSettingsScreen,
|
||||||
} = getActions();
|
} = getActions();
|
||||||
|
|
||||||
const [content, setContent] = useState<LeftColumnContent>(LeftColumnContent.ChatList);
|
|
||||||
const [settingsScreen, setSettingsScreen] = useState(SettingsScreens.Main);
|
|
||||||
const [contactsFilter, setContactsFilter] = useState<string>('');
|
const [contactsFilter, setContactsFilter] = useState<string>('');
|
||||||
const [foldersState, foldersDispatch] = useFoldersReducer();
|
const [foldersState, foldersDispatch] = useFoldersReducer();
|
||||||
|
|
||||||
@ -112,7 +113,7 @@ function LeftColumn({
|
|||||||
const [lastResetTime, setLastResetTime] = useState<number>(0);
|
const [lastResetTime, setLastResetTime] = useState<number>(0);
|
||||||
|
|
||||||
let contentType: ContentType = ContentType.Main;
|
let contentType: ContentType = ContentType.Main;
|
||||||
switch (content) {
|
switch (contentKey) {
|
||||||
case LeftColumnContent.Archived:
|
case LeftColumnContent.Archived:
|
||||||
contentType = ContentType.Archived;
|
contentType = ContentType.Archived;
|
||||||
break;
|
break;
|
||||||
@ -131,8 +132,8 @@ function LeftColumn({
|
|||||||
|
|
||||||
const handleReset = useLastCallback((forceReturnToChatList?: true | Event) => {
|
const handleReset = useLastCallback((forceReturnToChatList?: true | Event) => {
|
||||||
function fullReset() {
|
function fullReset() {
|
||||||
setContent(LeftColumnContent.ChatList);
|
openLeftColumnContent({ contentKey: undefined });
|
||||||
setSettingsScreen(SettingsScreens.Main);
|
openSettingsScreen({ screen: undefined });
|
||||||
setContactsFilter('');
|
setContactsFilter('');
|
||||||
setGlobalSearchClosing({ isClosing: true });
|
setGlobalSearchClosing({ isClosing: true });
|
||||||
resetChatCreation();
|
resetChatCreation();
|
||||||
@ -150,24 +151,24 @@ function LeftColumn({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (content === LeftColumnContent.NewGroupStep2) {
|
if (contentKey === LeftColumnContent.NewGroupStep2) {
|
||||||
setContent(LeftColumnContent.NewGroupStep1);
|
openLeftColumnContent({ contentKey: LeftColumnContent.NewGroupStep1 });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (content === LeftColumnContent.NewChannelStep2) {
|
if (contentKey === LeftColumnContent.NewChannelStep2) {
|
||||||
setContent(LeftColumnContent.NewChannelStep1);
|
openLeftColumnContent({ contentKey: LeftColumnContent.NewChannelStep1 });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (content === LeftColumnContent.NewGroupStep1) {
|
if (contentKey === LeftColumnContent.NewGroupStep1) {
|
||||||
const pickerSearchInput = document.getElementById('new-group-picker-search');
|
const pickerSearchInput = document.getElementById('new-group-picker-search');
|
||||||
if (pickerSearchInput) {
|
if (pickerSearchInput) {
|
||||||
pickerSearchInput.blur();
|
pickerSearchInput.blur();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (content === LeftColumnContent.Settings) {
|
if (contentKey === LeftColumnContent.Settings) {
|
||||||
switch (settingsScreen) {
|
switch (settingsScreen) {
|
||||||
case SettingsScreens.EditProfile:
|
case SettingsScreens.EditProfile:
|
||||||
case SettingsScreens.Folders:
|
case SettingsScreens.Folders:
|
||||||
@ -180,14 +181,14 @@ function LeftColumn({
|
|||||||
case SettingsScreens.Language:
|
case SettingsScreens.Language:
|
||||||
case SettingsScreens.Stickers:
|
case SettingsScreens.Stickers:
|
||||||
case SettingsScreens.Experimental:
|
case SettingsScreens.Experimental:
|
||||||
setSettingsScreen(SettingsScreens.Main);
|
openSettingsScreen({ screen: SettingsScreens.Main });
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case SettingsScreens.GeneralChatBackground:
|
case SettingsScreens.GeneralChatBackground:
|
||||||
setSettingsScreen(SettingsScreens.General);
|
openSettingsScreen({ screen: SettingsScreens.General });
|
||||||
return;
|
return;
|
||||||
case SettingsScreens.GeneralChatBackgroundColor:
|
case SettingsScreens.GeneralChatBackgroundColor:
|
||||||
setSettingsScreen(SettingsScreens.GeneralChatBackground);
|
openSettingsScreen({ screen: SettingsScreens.GeneralChatBackground });
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case SettingsScreens.PrivacyPhoneNumber:
|
case SettingsScreens.PrivacyPhoneNumber:
|
||||||
@ -211,141 +212,143 @@ function LeftColumn({
|
|||||||
case SettingsScreens.PasscodeDisabled:
|
case SettingsScreens.PasscodeDisabled:
|
||||||
case SettingsScreens.PasscodeEnabled:
|
case SettingsScreens.PasscodeEnabled:
|
||||||
case SettingsScreens.PasscodeCongratulations:
|
case SettingsScreens.PasscodeCongratulations:
|
||||||
setSettingsScreen(SettingsScreens.Privacy);
|
openSettingsScreen({ screen: SettingsScreens.Privacy });
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case SettingsScreens.PasscodeNewPasscode:
|
case SettingsScreens.PasscodeNewPasscode:
|
||||||
setSettingsScreen(hasPasscode ? SettingsScreens.PasscodeEnabled : SettingsScreens.PasscodeDisabled);
|
openSettingsScreen({
|
||||||
|
screen: hasPasscode ? SettingsScreens.PasscodeEnabled : SettingsScreens.PasscodeDisabled,
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case SettingsScreens.PasscodeChangePasscodeCurrent:
|
case SettingsScreens.PasscodeChangePasscodeCurrent:
|
||||||
case SettingsScreens.PasscodeTurnOff:
|
case SettingsScreens.PasscodeTurnOff:
|
||||||
setSettingsScreen(SettingsScreens.PasscodeEnabled);
|
openSettingsScreen({ screen: SettingsScreens.PasscodeEnabled });
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case SettingsScreens.PasscodeNewPasscodeConfirm:
|
case SettingsScreens.PasscodeNewPasscodeConfirm:
|
||||||
setSettingsScreen(SettingsScreens.PasscodeNewPasscode);
|
openSettingsScreen({ screen: SettingsScreens.PasscodeNewPasscode });
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case SettingsScreens.PasscodeChangePasscodeNew:
|
case SettingsScreens.PasscodeChangePasscodeNew:
|
||||||
setSettingsScreen(SettingsScreens.PasscodeChangePasscodeCurrent);
|
openSettingsScreen({ screen: SettingsScreens.PasscodeChangePasscodeCurrent });
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case SettingsScreens.PasscodeChangePasscodeConfirm:
|
case SettingsScreens.PasscodeChangePasscodeConfirm:
|
||||||
setSettingsScreen(SettingsScreens.PasscodeChangePasscodeNew);
|
openSettingsScreen({ screen: SettingsScreens.PasscodeChangePasscodeNew });
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case SettingsScreens.PrivacyPhoneNumberAllowedContacts:
|
case SettingsScreens.PrivacyPhoneNumberAllowedContacts:
|
||||||
case SettingsScreens.PrivacyPhoneNumberDeniedContacts:
|
case SettingsScreens.PrivacyPhoneNumberDeniedContacts:
|
||||||
setSettingsScreen(SettingsScreens.PrivacyPhoneNumber);
|
openSettingsScreen({ screen: SettingsScreens.PrivacyPhoneNumber });
|
||||||
return;
|
return;
|
||||||
case SettingsScreens.PrivacyLastSeenAllowedContacts:
|
case SettingsScreens.PrivacyLastSeenAllowedContacts:
|
||||||
case SettingsScreens.PrivacyLastSeenDeniedContacts:
|
case SettingsScreens.PrivacyLastSeenDeniedContacts:
|
||||||
setSettingsScreen(SettingsScreens.PrivacyLastSeen);
|
openSettingsScreen({ screen: SettingsScreens.PrivacyLastSeen });
|
||||||
return;
|
return;
|
||||||
case SettingsScreens.PrivacyProfilePhotoAllowedContacts:
|
case SettingsScreens.PrivacyProfilePhotoAllowedContacts:
|
||||||
case SettingsScreens.PrivacyProfilePhotoDeniedContacts:
|
case SettingsScreens.PrivacyProfilePhotoDeniedContacts:
|
||||||
setSettingsScreen(SettingsScreens.PrivacyProfilePhoto);
|
openSettingsScreen({ screen: SettingsScreens.PrivacyProfilePhoto });
|
||||||
return;
|
return;
|
||||||
case SettingsScreens.PrivacyBioAllowedContacts:
|
case SettingsScreens.PrivacyBioAllowedContacts:
|
||||||
case SettingsScreens.PrivacyBioDeniedContacts:
|
case SettingsScreens.PrivacyBioDeniedContacts:
|
||||||
setSettingsScreen(SettingsScreens.PrivacyBio);
|
openSettingsScreen({ screen: SettingsScreens.PrivacyBio });
|
||||||
return;
|
return;
|
||||||
case SettingsScreens.PrivacyBirthdayAllowedContacts:
|
case SettingsScreens.PrivacyBirthdayAllowedContacts:
|
||||||
case SettingsScreens.PrivacyBirthdayDeniedContacts:
|
case SettingsScreens.PrivacyBirthdayDeniedContacts:
|
||||||
setSettingsScreen(SettingsScreens.PrivacyBirthday);
|
openSettingsScreen({ screen: SettingsScreens.PrivacyBirthday });
|
||||||
return;
|
return;
|
||||||
case SettingsScreens.PrivacyGiftsAllowedContacts:
|
case SettingsScreens.PrivacyGiftsAllowedContacts:
|
||||||
case SettingsScreens.PrivacyGiftsDeniedContacts:
|
case SettingsScreens.PrivacyGiftsDeniedContacts:
|
||||||
setSettingsScreen(SettingsScreens.PrivacyGifts);
|
openSettingsScreen({ screen: SettingsScreens.PrivacyGifts });
|
||||||
return;
|
return;
|
||||||
case SettingsScreens.PrivacyPhoneCallAllowedContacts:
|
case SettingsScreens.PrivacyPhoneCallAllowedContacts:
|
||||||
case SettingsScreens.PrivacyPhoneCallDeniedContacts:
|
case SettingsScreens.PrivacyPhoneCallDeniedContacts:
|
||||||
setSettingsScreen(SettingsScreens.PrivacyPhoneCall);
|
openSettingsScreen({ screen: SettingsScreens.PrivacyPhoneCall });
|
||||||
return;
|
return;
|
||||||
case SettingsScreens.PrivacyPhoneP2PAllowedContacts:
|
case SettingsScreens.PrivacyPhoneP2PAllowedContacts:
|
||||||
case SettingsScreens.PrivacyPhoneP2PDeniedContacts:
|
case SettingsScreens.PrivacyPhoneP2PDeniedContacts:
|
||||||
setSettingsScreen(SettingsScreens.PrivacyPhoneP2P);
|
openSettingsScreen({ screen: SettingsScreens.PrivacyPhoneP2P });
|
||||||
return;
|
return;
|
||||||
case SettingsScreens.PrivacyForwardingAllowedContacts:
|
case SettingsScreens.PrivacyForwardingAllowedContacts:
|
||||||
case SettingsScreens.PrivacyForwardingDeniedContacts:
|
case SettingsScreens.PrivacyForwardingDeniedContacts:
|
||||||
setSettingsScreen(SettingsScreens.PrivacyForwarding);
|
openSettingsScreen({ screen: SettingsScreens.PrivacyForwarding });
|
||||||
return;
|
return;
|
||||||
case SettingsScreens.PrivacyVoiceMessagesAllowedContacts:
|
case SettingsScreens.PrivacyVoiceMessagesAllowedContacts:
|
||||||
case SettingsScreens.PrivacyVoiceMessagesDeniedContacts:
|
case SettingsScreens.PrivacyVoiceMessagesDeniedContacts:
|
||||||
setSettingsScreen(SettingsScreens.PrivacyVoiceMessages);
|
openSettingsScreen({ screen: SettingsScreens.PrivacyVoiceMessages });
|
||||||
return;
|
return;
|
||||||
case SettingsScreens.PrivacyGroupChatsAllowedContacts:
|
case SettingsScreens.PrivacyGroupChatsAllowedContacts:
|
||||||
case SettingsScreens.PrivacyGroupChatsDeniedContacts:
|
case SettingsScreens.PrivacyGroupChatsDeniedContacts:
|
||||||
setSettingsScreen(SettingsScreens.PrivacyGroupChats);
|
openSettingsScreen({ screen: SettingsScreens.PrivacyGroupChats });
|
||||||
return;
|
return;
|
||||||
case SettingsScreens.TwoFaNewPassword:
|
case SettingsScreens.TwoFaNewPassword:
|
||||||
setSettingsScreen(SettingsScreens.TwoFaDisabled);
|
openSettingsScreen({ screen: SettingsScreens.TwoFaDisabled });
|
||||||
return;
|
return;
|
||||||
case SettingsScreens.TwoFaNewPasswordConfirm:
|
case SettingsScreens.TwoFaNewPasswordConfirm:
|
||||||
setSettingsScreen(SettingsScreens.TwoFaNewPassword);
|
openSettingsScreen({ screen: SettingsScreens.TwoFaNewPassword });
|
||||||
return;
|
return;
|
||||||
case SettingsScreens.TwoFaNewPasswordHint:
|
case SettingsScreens.TwoFaNewPasswordHint:
|
||||||
setSettingsScreen(SettingsScreens.TwoFaNewPasswordConfirm);
|
openSettingsScreen({ screen: SettingsScreens.TwoFaNewPasswordConfirm });
|
||||||
return;
|
return;
|
||||||
case SettingsScreens.TwoFaNewPasswordEmail:
|
case SettingsScreens.TwoFaNewPasswordEmail:
|
||||||
setSettingsScreen(SettingsScreens.TwoFaNewPasswordHint);
|
openSettingsScreen({ screen: SettingsScreens.TwoFaNewPasswordHint });
|
||||||
return;
|
return;
|
||||||
case SettingsScreens.TwoFaNewPasswordEmailCode:
|
case SettingsScreens.TwoFaNewPasswordEmailCode:
|
||||||
setSettingsScreen(SettingsScreens.TwoFaNewPasswordEmail);
|
openSettingsScreen({ screen: SettingsScreens.TwoFaNewPasswordEmail });
|
||||||
return;
|
return;
|
||||||
case SettingsScreens.TwoFaChangePasswordCurrent:
|
case SettingsScreens.TwoFaChangePasswordCurrent:
|
||||||
case SettingsScreens.TwoFaTurnOff:
|
case SettingsScreens.TwoFaTurnOff:
|
||||||
case SettingsScreens.TwoFaRecoveryEmailCurrentPassword:
|
case SettingsScreens.TwoFaRecoveryEmailCurrentPassword:
|
||||||
setSettingsScreen(SettingsScreens.TwoFaEnabled);
|
openSettingsScreen({ screen: SettingsScreens.TwoFaEnabled });
|
||||||
return;
|
return;
|
||||||
case SettingsScreens.TwoFaChangePasswordNew:
|
case SettingsScreens.TwoFaChangePasswordNew:
|
||||||
setSettingsScreen(SettingsScreens.TwoFaChangePasswordCurrent);
|
openSettingsScreen({ screen: SettingsScreens.TwoFaChangePasswordCurrent });
|
||||||
return;
|
return;
|
||||||
case SettingsScreens.TwoFaChangePasswordConfirm:
|
case SettingsScreens.TwoFaChangePasswordConfirm:
|
||||||
setSettingsScreen(SettingsScreens.TwoFaChangePasswordNew);
|
openSettingsScreen({ screen: SettingsScreens.TwoFaChangePasswordNew });
|
||||||
return;
|
return;
|
||||||
case SettingsScreens.TwoFaChangePasswordHint:
|
case SettingsScreens.TwoFaChangePasswordHint:
|
||||||
setSettingsScreen(SettingsScreens.TwoFaChangePasswordConfirm);
|
openSettingsScreen({ screen: SettingsScreens.TwoFaChangePasswordConfirm });
|
||||||
return;
|
return;
|
||||||
case SettingsScreens.TwoFaRecoveryEmail:
|
case SettingsScreens.TwoFaRecoveryEmail:
|
||||||
setSettingsScreen(SettingsScreens.TwoFaRecoveryEmailCurrentPassword);
|
openSettingsScreen({ screen: SettingsScreens.TwoFaRecoveryEmailCurrentPassword });
|
||||||
return;
|
return;
|
||||||
case SettingsScreens.TwoFaRecoveryEmailCode:
|
case SettingsScreens.TwoFaRecoveryEmailCode:
|
||||||
setSettingsScreen(SettingsScreens.TwoFaRecoveryEmail);
|
openSettingsScreen({ screen: SettingsScreens.TwoFaRecoveryEmail });
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case SettingsScreens.FoldersCreateFolder:
|
case SettingsScreens.FoldersCreateFolder:
|
||||||
case SettingsScreens.FoldersEditFolder:
|
case SettingsScreens.FoldersEditFolder:
|
||||||
setSettingsScreen(SettingsScreens.Folders);
|
openSettingsScreen({ screen: SettingsScreens.Folders });
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case SettingsScreens.FoldersShare:
|
case SettingsScreens.FoldersShare:
|
||||||
setSettingsScreen(SettingsScreens.FoldersEditFolder);
|
openSettingsScreen({ screen: SettingsScreens.FoldersEditFolder });
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case SettingsScreens.FoldersIncludedChatsFromChatList:
|
case SettingsScreens.FoldersIncludedChatsFromChatList:
|
||||||
case SettingsScreens.FoldersExcludedChatsFromChatList:
|
case SettingsScreens.FoldersExcludedChatsFromChatList:
|
||||||
setSettingsScreen(SettingsScreens.FoldersEditFolderFromChatList);
|
openSettingsScreen({ screen: SettingsScreens.FoldersEditFolderFromChatList });
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case SettingsScreens.FoldersEditFolderFromChatList:
|
case SettingsScreens.FoldersEditFolderFromChatList:
|
||||||
case SettingsScreens.FoldersEditFolderInvites:
|
case SettingsScreens.FoldersEditFolderInvites:
|
||||||
setContent(LeftColumnContent.ChatList);
|
openLeftColumnContent({ contentKey: LeftColumnContent.ChatList });
|
||||||
setSettingsScreen(SettingsScreens.Main);
|
openSettingsScreen({ screen: SettingsScreens.Main });
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case SettingsScreens.QuickReaction:
|
case SettingsScreens.QuickReaction:
|
||||||
case SettingsScreens.CustomEmoji:
|
case SettingsScreens.CustomEmoji:
|
||||||
setSettingsScreen(SettingsScreens.Stickers);
|
openSettingsScreen({ screen: SettingsScreens.Stickers });
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case SettingsScreens.DoNotTranslate:
|
case SettingsScreens.DoNotTranslate:
|
||||||
setSettingsScreen(SettingsScreens.Language);
|
openSettingsScreen({ screen: SettingsScreens.Language });
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case SettingsScreens.PrivacyNoPaidMessages:
|
case SettingsScreens.PrivacyNoPaidMessages:
|
||||||
setSettingsScreen(SettingsScreens.PrivacyMessages);
|
openSettingsScreen({ screen: SettingsScreens.PrivacyMessages });
|
||||||
return;
|
return;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -353,8 +356,8 @@ function LeftColumn({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (content === LeftColumnContent.ChatList && isFirstChatFolderActive) {
|
if (contentKey === LeftColumnContent.ChatList && isFirstChatFolderActive) {
|
||||||
setContent(LeftColumnContent.GlobalSearch);
|
openLeftColumnContent({ contentKey: LeftColumnContent.GlobalSearch });
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -363,12 +366,12 @@ function LeftColumn({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const handleSearchQuery = useLastCallback((query: string) => {
|
const handleSearchQuery = useLastCallback((query: string) => {
|
||||||
if (content === LeftColumnContent.Contacts) {
|
if (contentKey === LeftColumnContent.Contacts) {
|
||||||
setContactsFilter(query);
|
setContactsFilter(query);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setContent(LeftColumnContent.GlobalSearch);
|
openLeftColumnContent({ contentKey: LeftColumnContent.GlobalSearch });
|
||||||
|
|
||||||
if (query !== searchQuery) {
|
if (query !== searchQuery) {
|
||||||
setGlobalSearchQuery({ query });
|
setGlobalSearchQuery({ query });
|
||||||
@ -376,15 +379,15 @@ function LeftColumn({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const handleTopicSearch = useLastCallback(() => {
|
const handleTopicSearch = useLastCallback(() => {
|
||||||
setContent(LeftColumnContent.GlobalSearch);
|
openLeftColumnContent({ contentKey: LeftColumnContent.GlobalSearch });
|
||||||
setGlobalSearchQuery({ query: '' });
|
setGlobalSearchQuery({ query: '' });
|
||||||
setGlobalSearchChatId({ id: forumPanelChatId });
|
setGlobalSearchChatId({ id: forumPanelChatId });
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(
|
useEffect(
|
||||||
() => {
|
() => {
|
||||||
const isArchived = content === LeftColumnContent.Archived;
|
const isArchived = contentKey === LeftColumnContent.Archived;
|
||||||
const isChatList = content === LeftColumnContent.ChatList;
|
const isChatList = contentKey === LeftColumnContent.ChatList;
|
||||||
const noChatOrForumOpen = !isChatOpen && !isForumPanelOpen;
|
const noChatOrForumOpen = !isChatOpen && !isForumPanelOpen;
|
||||||
// We listen for escape key only in these cases:
|
// We listen for escape key only in these cases:
|
||||||
// 1. When we are in archived chats and no chat or forum is open.
|
// 1. When we are in archived chats and no chat or forum is open.
|
||||||
@ -399,16 +402,16 @@ function LeftColumn({
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[isFirstChatFolderActive, content, handleReset, isChatOpen, isForumPanelOpen],
|
[isFirstChatFolderActive, contentKey, handleReset, isChatOpen, isForumPanelOpen],
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleHotkeySearch = useLastCallback((e: KeyboardEvent) => {
|
const handleHotkeySearch = useLastCallback((e: KeyboardEvent) => {
|
||||||
if (content === LeftColumnContent.GlobalSearch) {
|
if (contentKey === LeftColumnContent.GlobalSearch) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
setContent(LeftColumnContent.GlobalSearch);
|
openLeftColumnContent({ contentKey: LeftColumnContent.GlobalSearch });
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleHotkeySavedMessages = useLastCallback((e: KeyboardEvent) => {
|
const handleHotkeySavedMessages = useLastCallback((e: KeyboardEvent) => {
|
||||||
@ -418,12 +421,12 @@ function LeftColumn({
|
|||||||
|
|
||||||
const handleArchivedChats = useLastCallback((e: KeyboardEvent) => {
|
const handleArchivedChats = useLastCallback((e: KeyboardEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
setContent(LeftColumnContent.Archived);
|
openLeftColumnContent({ contentKey: LeftColumnContent.Archived });
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleHotkeySettings = useLastCallback((e: KeyboardEvent) => {
|
const handleHotkeySettings = useLastCallback((e: KeyboardEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
setContent(LeftColumnContent.Settings);
|
openLeftColumnContent({ contentKey: LeftColumnContent.Settings });
|
||||||
});
|
});
|
||||||
|
|
||||||
useHotkeys(useMemo(() => ({
|
useHotkeys(useMemo(() => ({
|
||||||
@ -448,21 +451,10 @@ function LeftColumn({
|
|||||||
}, [clearTwoFaError, loadPasswordInfo, settingsScreen]);
|
}, [clearTwoFaError, loadPasswordInfo, settingsScreen]);
|
||||||
|
|
||||||
useSyncEffect(() => {
|
useSyncEffect(() => {
|
||||||
if (nextSettingsScreen !== undefined) {
|
|
||||||
setContent(LeftColumnContent.Settings);
|
|
||||||
setSettingsScreen(nextSettingsScreen);
|
|
||||||
requestNextSettingsScreen({ screen: undefined });
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nextFoldersAction) {
|
if (nextFoldersAction) {
|
||||||
foldersDispatch(nextFoldersAction);
|
foldersDispatch(nextFoldersAction);
|
||||||
}
|
}
|
||||||
}, [foldersDispatch, nextFoldersAction, nextSettingsScreen, requestNextSettingsScreen]);
|
}, [foldersDispatch, nextFoldersAction]);
|
||||||
|
|
||||||
const handleSettingsScreenSelect = useLastCallback((screen: SettingsScreens) => {
|
|
||||||
setContent(LeftColumnContent.Settings);
|
|
||||||
setSettingsScreen(screen);
|
|
||||||
});
|
|
||||||
|
|
||||||
const prevSettingsScreenRef = useStateRef(usePrevious(contentType === ContentType.Settings ? settingsScreen : -1));
|
const prevSettingsScreenRef = useStateRef(usePrevious(contentType === ContentType.Settings ? settingsScreen : -1));
|
||||||
|
|
||||||
@ -476,8 +468,8 @@ function LeftColumn({
|
|||||||
selectorToPreventScroll: '#Settings .custom-scroll',
|
selectorToPreventScroll: '#Settings .custom-scroll',
|
||||||
onSwipeRightStart: handleReset,
|
onSwipeRightStart: handleReset,
|
||||||
onCancel: () => {
|
onCancel: () => {
|
||||||
setContent(LeftColumnContent.Settings);
|
openLeftColumnContent({ contentKey: LeftColumnContent.Settings });
|
||||||
handleSettingsScreenSelect(prevSettingsScreenRef.current!);
|
openSettingsScreen({ screen: prevSettingsScreenRef.current! });
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}, [prevSettingsScreenRef, ref]);
|
}, [prevSettingsScreenRef, ref]);
|
||||||
@ -491,8 +483,6 @@ function LeftColumn({
|
|||||||
onReset={handleReset}
|
onReset={handleReset}
|
||||||
onTopicSearch={handleTopicSearch}
|
onTopicSearch={handleTopicSearch}
|
||||||
foldersDispatch={foldersDispatch}
|
foldersDispatch={foldersDispatch}
|
||||||
onSettingsScreenSelect={handleSettingsScreenSelect}
|
|
||||||
onLeftColumnContentChange={setContent}
|
|
||||||
isForumPanelOpen={isForumPanelOpen}
|
isForumPanelOpen={isForumPanelOpen}
|
||||||
archiveSettings={archiveSettings}
|
archiveSettings={archiveSettings}
|
||||||
isStoryRibbonShown={isArchivedStoryRibbonShown}
|
isStoryRibbonShown={isArchivedStoryRibbonShown}
|
||||||
@ -506,7 +496,6 @@ function LeftColumn({
|
|||||||
foldersState={foldersState}
|
foldersState={foldersState}
|
||||||
foldersDispatch={foldersDispatch}
|
foldersDispatch={foldersDispatch}
|
||||||
shouldSkipTransition={shouldSkipHistoryAnimations}
|
shouldSkipTransition={shouldSkipHistoryAnimations}
|
||||||
onScreenSelect={handleSettingsScreenSelect}
|
|
||||||
onReset={handleReset}
|
onReset={handleReset}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
@ -516,8 +505,7 @@ function LeftColumn({
|
|||||||
key={lastResetTime}
|
key={lastResetTime}
|
||||||
isActive={isActive}
|
isActive={isActive}
|
||||||
isChannel
|
isChannel
|
||||||
content={content}
|
content={contentKey}
|
||||||
onContentChange={setContent}
|
|
||||||
onReset={handleReset}
|
onReset={handleReset}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
@ -526,23 +514,20 @@ function LeftColumn({
|
|||||||
<NewChat
|
<NewChat
|
||||||
key={lastResetTime}
|
key={lastResetTime}
|
||||||
isActive={isActive}
|
isActive={isActive}
|
||||||
content={content}
|
content={contentKey}
|
||||||
onContentChange={setContent}
|
|
||||||
onReset={handleReset}
|
onReset={handleReset}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
default:
|
default:
|
||||||
return (
|
return (
|
||||||
<LeftMain
|
<LeftMain
|
||||||
content={content}
|
content={contentKey}
|
||||||
isClosingSearch={isClosingSearch}
|
isClosingSearch={isClosingSearch}
|
||||||
searchQuery={searchQuery}
|
searchQuery={searchQuery}
|
||||||
searchDate={searchDate}
|
searchDate={searchDate}
|
||||||
contactsFilter={contactsFilter}
|
contactsFilter={contactsFilter}
|
||||||
foldersDispatch={foldersDispatch}
|
foldersDispatch={foldersDispatch}
|
||||||
onContentChange={setContent}
|
|
||||||
onSearchQuery={handleSearchQuery}
|
onSearchQuery={handleSearchQuery}
|
||||||
onSettingsScreenSelect={handleSettingsScreenSelect}
|
|
||||||
onReset={handleReset}
|
onReset={handleReset}
|
||||||
shouldSkipTransition={shouldSkipHistoryAnimations}
|
shouldSkipTransition={shouldSkipHistoryAnimations}
|
||||||
isAppUpdateAvailable={isAppUpdateAvailable}
|
isAppUpdateAvailable={isAppUpdateAvailable}
|
||||||
@ -583,7 +568,7 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
},
|
},
|
||||||
shouldSkipHistoryAnimations,
|
shouldSkipHistoryAnimations,
|
||||||
activeChatFolder,
|
activeChatFolder,
|
||||||
nextSettingsScreen,
|
leftColumn,
|
||||||
nextFoldersAction,
|
nextFoldersAction,
|
||||||
storyViewer: {
|
storyViewer: {
|
||||||
isArchivedRibbonShown,
|
isArchivedRibbonShown,
|
||||||
@ -612,7 +597,6 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
shouldSkipHistoryAnimations,
|
shouldSkipHistoryAnimations,
|
||||||
currentUserId,
|
currentUserId,
|
||||||
hasPasscode,
|
hasPasscode,
|
||||||
nextSettingsScreen,
|
|
||||||
nextFoldersAction,
|
nextFoldersAction,
|
||||||
isChatOpen,
|
isChatOpen,
|
||||||
isAppUpdateAvailable,
|
isAppUpdateAvailable,
|
||||||
@ -623,6 +607,8 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
archiveSettings,
|
archiveSettings,
|
||||||
isArchivedStoryRibbonShown: isArchivedRibbonShown,
|
isArchivedStoryRibbonShown: isArchivedRibbonShown,
|
||||||
isAccountFrozen,
|
isAccountFrozen,
|
||||||
|
contentKey: leftColumn.contentKey,
|
||||||
|
settingsScreen: leftColumn.settingsScreen,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
)(LeftColumn));
|
)(LeftColumn));
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import { getActions, getGlobal, withGlobal } from '../../../global';
|
|||||||
import type { ApiChatFolder, ApiChatlistExportedInvite, ApiSession } from '../../../api/types';
|
import type { ApiChatFolder, ApiChatlistExportedInvite, ApiSession } from '../../../api/types';
|
||||||
import type { GlobalState } from '../../../global/types';
|
import type { GlobalState } from '../../../global/types';
|
||||||
import type { FolderEditDispatch } from '../../../hooks/reducers/useFoldersReducer';
|
import type { FolderEditDispatch } from '../../../hooks/reducers/useFoldersReducer';
|
||||||
import type { LeftColumnContent } from '../../../types';
|
|
||||||
import type { MenuItemContextAction } from '../../ui/ListItem';
|
import type { MenuItemContextAction } from '../../ui/ListItem';
|
||||||
import type { TabWithProperties } from '../../ui/TabList';
|
import type { TabWithProperties } from '../../ui/TabList';
|
||||||
import { SettingsScreens } from '../../../types';
|
import { SettingsScreens } from '../../../types';
|
||||||
@ -38,9 +37,7 @@ import Transition from '../../ui/Transition';
|
|||||||
import ChatList from './ChatList';
|
import ChatList from './ChatList';
|
||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
onSettingsScreenSelect: (screen: SettingsScreens) => void;
|
|
||||||
foldersDispatch: FolderEditDispatch;
|
foldersDispatch: FolderEditDispatch;
|
||||||
onLeftColumnContentChange: (content: LeftColumnContent) => void;
|
|
||||||
shouldHideFolderTabs?: boolean;
|
shouldHideFolderTabs?: boolean;
|
||||||
isForumPanelOpen?: boolean;
|
isForumPanelOpen?: boolean;
|
||||||
};
|
};
|
||||||
@ -68,8 +65,6 @@ const FIRST_FOLDER_INDEX = 0;
|
|||||||
|
|
||||||
const ChatFolders: FC<OwnProps & StateProps> = ({
|
const ChatFolders: FC<OwnProps & StateProps> = ({
|
||||||
foldersDispatch,
|
foldersDispatch,
|
||||||
onSettingsScreenSelect,
|
|
||||||
onLeftColumnContentChange,
|
|
||||||
chatFoldersById,
|
chatFoldersById,
|
||||||
orderedFolderIds,
|
orderedFolderIds,
|
||||||
activeChatFolder,
|
activeChatFolder,
|
||||||
@ -97,6 +92,7 @@ const ChatFolders: FC<OwnProps & StateProps> = ({
|
|||||||
openEditChatFolder,
|
openEditChatFolder,
|
||||||
openLimitReachedModal,
|
openLimitReachedModal,
|
||||||
markChatMessagesRead,
|
markChatMessagesRead,
|
||||||
|
openSettingsScreen,
|
||||||
} = getActions();
|
} = getActions();
|
||||||
|
|
||||||
// eslint-disable-next-line no-null/no-null
|
// eslint-disable-next-line no-null/no-null
|
||||||
@ -207,7 +203,7 @@ const ChatFolders: FC<OwnProps & StateProps> = ({
|
|||||||
title: lang('FilterEditFolders'),
|
title: lang('FilterEditFolders'),
|
||||||
icon: 'edit',
|
icon: 'edit',
|
||||||
handler: () => {
|
handler: () => {
|
||||||
onSettingsScreenSelect(SettingsScreens.Folders);
|
openSettingsScreen({ screen: SettingsScreens.Folders });
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -260,7 +256,7 @@ const ChatFolders: FC<OwnProps & StateProps> = ({
|
|||||||
});
|
});
|
||||||
}, [
|
}, [
|
||||||
displayedFolders, maxFolders, folderCountersById, lang, chatFoldersById, maxChatLists, folderInvitesById,
|
displayedFolders, maxFolders, folderCountersById, lang, chatFoldersById, maxChatLists, folderInvitesById,
|
||||||
maxFolderInvites, folderUnreadChatsCountersById, onSettingsScreenSelect,
|
maxFolderInvites, folderUnreadChatsCountersById, openSettingsScreen,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const handleSwitchTab = useLastCallback((index: number) => {
|
const handleSwitchTab = useLastCallback((index: number) => {
|
||||||
@ -365,8 +361,7 @@ const ChatFolders: FC<OwnProps & StateProps> = ({
|
|||||||
isActive={isActive}
|
isActive={isActive}
|
||||||
isForumPanelOpen={isForumPanelOpen}
|
isForumPanelOpen={isForumPanelOpen}
|
||||||
foldersDispatch={foldersDispatch}
|
foldersDispatch={foldersDispatch}
|
||||||
onSettingsScreenSelect={onSettingsScreenSelect}
|
isMainList
|
||||||
onLeftColumnContentChange={onLeftColumnContentChange}
|
|
||||||
canDisplayArchive={(hasArchivedChats || hasArchivedStories) && !archiveSettings.isHidden}
|
canDisplayArchive={(hasArchivedChats || hasArchivedStories) && !archiveSettings.isHidden}
|
||||||
archiveSettings={archiveSettings}
|
archiveSettings={archiveSettings}
|
||||||
sessions={sessions}
|
sessions={sessions}
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import { getActions } from '../../../global';
|
|||||||
import type { ApiSession } from '../../../api/types';
|
import type { ApiSession } from '../../../api/types';
|
||||||
import type { GlobalState } from '../../../global/types';
|
import type { GlobalState } from '../../../global/types';
|
||||||
import type { FolderEditDispatch } from '../../../hooks/reducers/useFoldersReducer';
|
import type { FolderEditDispatch } from '../../../hooks/reducers/useFoldersReducer';
|
||||||
import type { SettingsScreens } from '../../../types';
|
|
||||||
import { LeftColumnContent } from '../../../types';
|
import { LeftColumnContent } from '../../../types';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -51,10 +50,9 @@ type OwnProps = {
|
|||||||
archiveSettings?: GlobalState['archiveSettings'];
|
archiveSettings?: GlobalState['archiveSettings'];
|
||||||
isForumPanelOpen?: boolean;
|
isForumPanelOpen?: boolean;
|
||||||
sessions?: Record<string, ApiSession>;
|
sessions?: Record<string, ApiSession>;
|
||||||
foldersDispatch?: FolderEditDispatch;
|
|
||||||
onSettingsScreenSelect?: (screen: SettingsScreens) => void;
|
|
||||||
onLeftColumnContentChange?: (content: LeftColumnContent) => void;
|
|
||||||
isAccountFrozen?: boolean;
|
isAccountFrozen?: boolean;
|
||||||
|
isMainList?: boolean;
|
||||||
|
foldersDispatch?: FolderEditDispatch;
|
||||||
};
|
};
|
||||||
|
|
||||||
const INTERSECTION_THROTTLE = 200;
|
const INTERSECTION_THROTTLE = 200;
|
||||||
@ -70,10 +68,9 @@ const ChatList: FC<OwnProps> = ({
|
|||||||
canDisplayArchive,
|
canDisplayArchive,
|
||||||
archiveSettings,
|
archiveSettings,
|
||||||
sessions,
|
sessions,
|
||||||
foldersDispatch,
|
|
||||||
onSettingsScreenSelect,
|
|
||||||
onLeftColumnContentChange,
|
|
||||||
isAccountFrozen,
|
isAccountFrozen,
|
||||||
|
isMainList,
|
||||||
|
foldersDispatch,
|
||||||
}) => {
|
}) => {
|
||||||
const {
|
const {
|
||||||
openChat,
|
openChat,
|
||||||
@ -81,6 +78,7 @@ const ChatList: FC<OwnProps> = ({
|
|||||||
closeForumPanel,
|
closeForumPanel,
|
||||||
toggleStoryRibbon,
|
toggleStoryRibbon,
|
||||||
openFrozenAccountModal,
|
openFrozenAccountModal,
|
||||||
|
openLeftColumnContent,
|
||||||
} = getActions();
|
} = getActions();
|
||||||
// eslint-disable-next-line no-null/no-null
|
// eslint-disable-next-line no-null/no-null
|
||||||
const containerRef = useRef<HTMLDivElement>(null);
|
const containerRef = useRef<HTMLDivElement>(null);
|
||||||
@ -150,7 +148,7 @@ const ChatList: FC<OwnProps> = ({
|
|||||||
const position = Number(digit) + shift - 1;
|
const position = Number(digit) + shift - 1;
|
||||||
|
|
||||||
if (isArchiveInList && position === -1) {
|
if (isArchiveInList && position === -1) {
|
||||||
onLeftColumnContentChange?.(LeftColumnContent.Archived);
|
if (isMainList) openLeftColumnContent({ contentKey: LeftColumnContent.Archived });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,8 +164,7 @@ const ChatList: FC<OwnProps> = ({
|
|||||||
document.removeEventListener('keydown', handleKeyDown);
|
document.removeEventListener('keydown', handleKeyDown);
|
||||||
};
|
};
|
||||||
}, [
|
}, [
|
||||||
archiveSettings, isSaved, isActive, onLeftColumnContentChange, openChat, openNextChat, orderedIds,
|
archiveSettings, isSaved, isActive, openChat, openNextChat, orderedIds, shouldDisplayArchive, isMainList,
|
||||||
shouldDisplayArchive,
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const { observe } = useIntersectionObserver({
|
const { observe } = useIntersectionObserver({
|
||||||
@ -176,7 +173,7 @@ const ChatList: FC<OwnProps> = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const handleArchivedClick = useLastCallback(() => {
|
const handleArchivedClick = useLastCallback(() => {
|
||||||
onLeftColumnContentChange!(LeftColumnContent.Archived);
|
openLeftColumnContent({ contentKey: LeftColumnContent.Archived });
|
||||||
closeForumPanel();
|
closeForumPanel();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -288,7 +285,6 @@ const ChatList: FC<OwnProps> = ({
|
|||||||
folderId={folderId}
|
folderId={folderId}
|
||||||
folderType={folderType}
|
folderType={folderType}
|
||||||
foldersDispatch={foldersDispatch!}
|
foldersDispatch={foldersDispatch!}
|
||||||
onSettingsScreenSelect={onSettingsScreenSelect!}
|
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import type { FC } from '../../../lib/teact/teact';
|
import type { FC } from '../../../lib/teact/teact';
|
||||||
import React, { memo, useCallback } from '../../../lib/teact/teact';
|
import React, { memo, useCallback } from '../../../lib/teact/teact';
|
||||||
import { withGlobal } from '../../../global';
|
import { getActions, withGlobal } from '../../../global';
|
||||||
|
|
||||||
import type { ApiChatFolder, ApiSticker } from '../../../api/types';
|
import type { ApiChatFolder, ApiSticker } from '../../../api/types';
|
||||||
import type { FolderEditDispatch } from '../../../hooks/reducers/useFoldersReducer';
|
import type { FolderEditDispatch } from '../../../hooks/reducers/useFoldersReducer';
|
||||||
@ -21,7 +21,6 @@ type OwnProps = {
|
|||||||
folderId?: number;
|
folderId?: number;
|
||||||
folderType: 'all' | 'archived' | 'saved' | 'folder';
|
folderType: 'all' | 'archived' | 'saved' | 'folder';
|
||||||
foldersDispatch: FolderEditDispatch;
|
foldersDispatch: FolderEditDispatch;
|
||||||
onSettingsScreenSelect: (screen: SettingsScreens) => void;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
type StateProps = {
|
type StateProps = {
|
||||||
@ -32,15 +31,16 @@ type StateProps = {
|
|||||||
const ICON_SIZE = 96;
|
const ICON_SIZE = 96;
|
||||||
|
|
||||||
const EmptyFolder: FC<OwnProps & StateProps> = ({
|
const EmptyFolder: FC<OwnProps & StateProps> = ({
|
||||||
chatFolder, animatedEmoji, foldersDispatch, onSettingsScreenSelect,
|
chatFolder, animatedEmoji, foldersDispatch,
|
||||||
}) => {
|
}) => {
|
||||||
|
const { openSettingsScreen } = getActions();
|
||||||
const lang = useOldLang();
|
const lang = useOldLang();
|
||||||
const { isMobile } = useAppLayout();
|
const { isMobile } = useAppLayout();
|
||||||
|
|
||||||
const handleEditFolder = useCallback(() => {
|
const handleEditFolder = useCallback(() => {
|
||||||
foldersDispatch({ type: 'editFolder', payload: chatFolder });
|
foldersDispatch({ type: 'editFolder', payload: chatFolder });
|
||||||
onSettingsScreenSelect(SettingsScreens.FoldersEditFolderFromChatList);
|
openSettingsScreen({ screen: SettingsScreens.FoldersEditFolderFromChatList });
|
||||||
}, [chatFolder, foldersDispatch, onSettingsScreenSelect]);
|
}, [chatFolder, foldersDispatch]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.root}>
|
<div className={styles.root}>
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import React, {
|
|||||||
import { getActions } from '../../../global';
|
import { getActions } from '../../../global';
|
||||||
|
|
||||||
import type { FolderEditDispatch } from '../../../hooks/reducers/useFoldersReducer';
|
import type { FolderEditDispatch } from '../../../hooks/reducers/useFoldersReducer';
|
||||||
import type { SettingsScreens } from '../../../types';
|
|
||||||
import { LeftColumnContent } from '../../../types';
|
import { LeftColumnContent } from '../../../types';
|
||||||
|
|
||||||
import { PRODUCTION_URL } from '../../../config';
|
import { PRODUCTION_URL } from '../../../config';
|
||||||
@ -40,8 +39,6 @@ type OwnProps = {
|
|||||||
isForumPanelOpen?: boolean;
|
isForumPanelOpen?: boolean;
|
||||||
isClosingSearch?: boolean;
|
isClosingSearch?: boolean;
|
||||||
onSearchQuery: (query: string) => void;
|
onSearchQuery: (query: string) => void;
|
||||||
onContentChange: (content: LeftColumnContent) => void;
|
|
||||||
onSettingsScreenSelect: (screen: SettingsScreens) => void;
|
|
||||||
onTopicSearch: NoneToVoidFunction;
|
onTopicSearch: NoneToVoidFunction;
|
||||||
isAccountFrozen?: boolean;
|
isAccountFrozen?: boolean;
|
||||||
onReset: () => void;
|
onReset: () => void;
|
||||||
@ -64,13 +61,11 @@ const LeftMain: FC<OwnProps> = ({
|
|||||||
isElectronUpdateAvailable,
|
isElectronUpdateAvailable,
|
||||||
isForumPanelOpen,
|
isForumPanelOpen,
|
||||||
onSearchQuery,
|
onSearchQuery,
|
||||||
onContentChange,
|
|
||||||
onSettingsScreenSelect,
|
|
||||||
onReset,
|
onReset,
|
||||||
onTopicSearch,
|
onTopicSearch,
|
||||||
isAccountFrozen,
|
isAccountFrozen,
|
||||||
}) => {
|
}) => {
|
||||||
const { closeForumPanel } = getActions();
|
const { closeForumPanel, openLeftColumnContent } = getActions();
|
||||||
const [isNewChatButtonShown, setIsNewChatButtonShown] = useState(IS_TOUCH_ENV);
|
const [isNewChatButtonShown, setIsNewChatButtonShown] = useState(IS_TOUCH_ENV);
|
||||||
const [isElectronAutoUpdateEnabled, setIsElectronAutoUpdateEnabled] = useState(false);
|
const [isElectronAutoUpdateEnabled, setIsElectronAutoUpdateEnabled] = useState(false);
|
||||||
|
|
||||||
@ -116,15 +111,15 @@ const LeftMain: FC<OwnProps> = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const handleSelectSettings = useLastCallback(() => {
|
const handleSelectSettings = useLastCallback(() => {
|
||||||
onContentChange(LeftColumnContent.Settings);
|
openLeftColumnContent({ contentKey: LeftColumnContent.Settings });
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleSelectContacts = useLastCallback(() => {
|
const handleSelectContacts = useLastCallback(() => {
|
||||||
onContentChange(LeftColumnContent.Contacts);
|
openLeftColumnContent({ contentKey: LeftColumnContent.Contacts });
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleSelectArchived = useLastCallback(() => {
|
const handleSelectArchived = useLastCallback(() => {
|
||||||
onContentChange(LeftColumnContent.Archived);
|
openLeftColumnContent({ contentKey: LeftColumnContent.Archived });
|
||||||
closeForumPanel();
|
closeForumPanel();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -139,11 +134,11 @@ const LeftMain: FC<OwnProps> = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const handleSelectNewChannel = useLastCallback(() => {
|
const handleSelectNewChannel = useLastCallback(() => {
|
||||||
onContentChange(LeftColumnContent.NewChannelStep1);
|
openLeftColumnContent({ contentKey: LeftColumnContent.NewChannelStep1 });
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleSelectNewGroup = useLastCallback(() => {
|
const handleSelectNewGroup = useLastCallback(() => {
|
||||||
onContentChange(LeftColumnContent.NewGroupStep1);
|
openLeftColumnContent({ contentKey: LeftColumnContent.NewGroupStep1 });
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -199,8 +194,6 @@ const LeftMain: FC<OwnProps> = ({
|
|||||||
return (
|
return (
|
||||||
<ChatFolders
|
<ChatFolders
|
||||||
shouldHideFolderTabs={isForumPanelVisible}
|
shouldHideFolderTabs={isForumPanelVisible}
|
||||||
onSettingsScreenSelect={onSettingsScreenSelect}
|
|
||||||
onLeftColumnContentChange={onContentChange}
|
|
||||||
foldersDispatch={foldersDispatch}
|
foldersDispatch={foldersDispatch}
|
||||||
isForumPanelOpen={isForumPanelVisible}
|
isForumPanelOpen={isForumPanelVisible}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -113,7 +113,7 @@ const LeftMainHeader: FC<OwnProps & StateProps> = ({
|
|||||||
setSharedSettingOption,
|
setSharedSettingOption,
|
||||||
setGlobalSearchChatId,
|
setGlobalSearchChatId,
|
||||||
lockScreen,
|
lockScreen,
|
||||||
requestNextSettingsScreen,
|
openSettingsScreen,
|
||||||
} = getActions();
|
} = getActions();
|
||||||
|
|
||||||
const oldLang = useOldLang();
|
const oldLang = useOldLang();
|
||||||
@ -146,7 +146,7 @@ const LeftMainHeader: FC<OwnProps & StateProps> = ({
|
|||||||
if (hasPasscode) {
|
if (hasPasscode) {
|
||||||
lockScreen();
|
lockScreen();
|
||||||
} else {
|
} else {
|
||||||
requestNextSettingsScreen({ screen: SettingsScreens.PasscodeDisabled });
|
openSettingsScreen({ screen: SettingsScreens.PasscodeDisabled });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import type { FC } from '../../../lib/teact/teact';
|
import type { FC } from '../../../lib/teact/teact';
|
||||||
import React, { memo, useCallback, useState } from '../../../lib/teact/teact';
|
import React, { memo, useCallback, useState } from '../../../lib/teact/teact';
|
||||||
|
import { getActions } from '../../../global';
|
||||||
|
|
||||||
import { LeftColumnContent } from '../../../types';
|
import { LeftColumnContent } from '../../../types';
|
||||||
|
|
||||||
@ -15,7 +16,6 @@ export type OwnProps = {
|
|||||||
isActive: boolean;
|
isActive: boolean;
|
||||||
isChannel?: boolean;
|
isChannel?: boolean;
|
||||||
content: LeftColumnContent;
|
content: LeftColumnContent;
|
||||||
onContentChange: (content: LeftColumnContent) => void;
|
|
||||||
onReset: () => void;
|
onReset: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -25,14 +25,16 @@ const NewChat: FC<OwnProps> = ({
|
|||||||
isActive,
|
isActive,
|
||||||
isChannel = false,
|
isChannel = false,
|
||||||
content,
|
content,
|
||||||
onContentChange,
|
|
||||||
onReset,
|
onReset,
|
||||||
}) => {
|
}) => {
|
||||||
|
const { openLeftColumnContent } = getActions();
|
||||||
const [newChatMemberIds, setNewChatMemberIds] = useState<string[]>([]);
|
const [newChatMemberIds, setNewChatMemberIds] = useState<string[]>([]);
|
||||||
|
|
||||||
const handleNextStep = useCallback(() => {
|
const handleNextStep = useCallback(() => {
|
||||||
onContentChange(isChannel ? LeftColumnContent.NewChannelStep2 : LeftColumnContent.NewGroupStep2);
|
openLeftColumnContent({
|
||||||
}, [isChannel, onContentChange]);
|
contentKey: isChannel ? LeftColumnContent.NewChannelStep2 : LeftColumnContent.NewGroupStep2,
|
||||||
|
});
|
||||||
|
}, [isChannel]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Transition
|
<Transition
|
||||||
|
|||||||
@ -29,7 +29,6 @@ import PrivacyLockedOption from './PrivacyLockedOption';
|
|||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
isActive?: boolean;
|
isActive?: boolean;
|
||||||
onReset: VoidFunction;
|
onReset: VoidFunction;
|
||||||
onScreenSelect: (screen: SettingsScreens) => void;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
type StateProps = {
|
type StateProps = {
|
||||||
@ -52,9 +51,8 @@ function PrivacyMessages({
|
|||||||
isCurrentUserPremium,
|
isCurrentUserPremium,
|
||||||
noPaidReactionsForUsersCount,
|
noPaidReactionsForUsersCount,
|
||||||
onReset,
|
onReset,
|
||||||
onScreenSelect,
|
|
||||||
}: OwnProps & StateProps) {
|
}: OwnProps & StateProps) {
|
||||||
const { updateGlobalPrivacySettings } = getActions();
|
const { updateGlobalPrivacySettings, openSettingsScreen } = getActions();
|
||||||
const oldLang = useOldLang();
|
const oldLang = useOldLang();
|
||||||
const lang = useLang();
|
const lang = useLang();
|
||||||
|
|
||||||
@ -133,7 +131,7 @@ function PrivacyMessages({
|
|||||||
icon="delete-user"
|
icon="delete-user"
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
onScreenSelect(SettingsScreens.PrivacyNoPaidMessages);
|
openSettingsScreen({ screen: SettingsScreens.PrivacyNoPaidMessages });
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className="multiline-item full-size">
|
<div className="multiline-item full-size">
|
||||||
|
|||||||
@ -150,7 +150,6 @@ export type OwnProps = {
|
|||||||
currentScreen: SettingsScreens;
|
currentScreen: SettingsScreens;
|
||||||
foldersState: FoldersState;
|
foldersState: FoldersState;
|
||||||
foldersDispatch: FolderEditDispatch;
|
foldersDispatch: FolderEditDispatch;
|
||||||
onScreenSelect: (screen: SettingsScreens) => void;
|
|
||||||
shouldSkipTransition?: boolean;
|
shouldSkipTransition?: boolean;
|
||||||
onReset: (forceReturnToChatList?: true | Event) => void;
|
onReset: (forceReturnToChatList?: true | Event) => void;
|
||||||
};
|
};
|
||||||
@ -160,11 +159,10 @@ const Settings: FC<OwnProps> = ({
|
|||||||
currentScreen,
|
currentScreen,
|
||||||
foldersState,
|
foldersState,
|
||||||
foldersDispatch,
|
foldersDispatch,
|
||||||
onScreenSelect,
|
|
||||||
onReset,
|
onReset,
|
||||||
shouldSkipTransition,
|
shouldSkipTransition,
|
||||||
}) => {
|
}) => {
|
||||||
const { closeShareChatFolderModal } = getActions();
|
const { closeShareChatFolderModal, openSettingsScreen } = getActions();
|
||||||
|
|
||||||
// eslint-disable-next-line no-null/no-null
|
// eslint-disable-next-line no-null/no-null
|
||||||
const containerRef = useRef<HTMLDivElement>(null);
|
const containerRef = useRef<HTMLDivElement>(null);
|
||||||
@ -205,9 +203,9 @@ const Settings: FC<OwnProps> = ({
|
|||||||
|| currentScreen === SettingsScreens.FoldersExcludedChats
|
|| currentScreen === SettingsScreens.FoldersExcludedChats
|
||||||
) {
|
) {
|
||||||
if (foldersState.mode === 'create') {
|
if (foldersState.mode === 'create') {
|
||||||
onScreenSelect(SettingsScreens.FoldersCreateFolder);
|
openSettingsScreen({ screen: SettingsScreens.FoldersCreateFolder });
|
||||||
} else {
|
} else {
|
||||||
onScreenSelect(SettingsScreens.FoldersEditFolder);
|
openSettingsScreen({ screen: SettingsScreens.FoldersEditFolder });
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -243,7 +241,7 @@ const Settings: FC<OwnProps> = ({
|
|||||||
switch (currentScreen) {
|
switch (currentScreen) {
|
||||||
case SettingsScreens.Main:
|
case SettingsScreens.Main:
|
||||||
return (
|
return (
|
||||||
<SettingsMain onScreenSelect={onScreenSelect} isActive={isActive} onReset={handleReset} />
|
<SettingsMain isActive={isActive} onReset={handleReset} />
|
||||||
);
|
);
|
||||||
case SettingsScreens.EditProfile:
|
case SettingsScreens.EditProfile:
|
||||||
return (
|
return (
|
||||||
@ -255,7 +253,6 @@ const Settings: FC<OwnProps> = ({
|
|||||||
case SettingsScreens.General:
|
case SettingsScreens.General:
|
||||||
return (
|
return (
|
||||||
<SettingsGeneral
|
<SettingsGeneral
|
||||||
onScreenSelect={onScreenSelect}
|
|
||||||
isActive={isScreenActive
|
isActive={isScreenActive
|
||||||
|| activeScreen === SettingsScreens.GeneralChatBackgroundColor
|
|| activeScreen === SettingsScreens.GeneralChatBackgroundColor
|
||||||
|| activeScreen === SettingsScreens.GeneralChatBackground
|
|| activeScreen === SettingsScreens.GeneralChatBackground
|
||||||
@ -284,7 +281,6 @@ const Settings: FC<OwnProps> = ({
|
|||||||
case SettingsScreens.Privacy:
|
case SettingsScreens.Privacy:
|
||||||
return (
|
return (
|
||||||
<SettingsPrivacy
|
<SettingsPrivacy
|
||||||
onScreenSelect={onScreenSelect}
|
|
||||||
isActive={isScreenActive || isPrivacyScreen}
|
isActive={isScreenActive || isPrivacyScreen}
|
||||||
onReset={handleReset}
|
onReset={handleReset}
|
||||||
/>
|
/>
|
||||||
@ -294,7 +290,6 @@ const Settings: FC<OwnProps> = ({
|
|||||||
<SettingsLanguage
|
<SettingsLanguage
|
||||||
isActive={isScreenActive || activeScreen === SettingsScreens.DoNotTranslate}
|
isActive={isScreenActive || activeScreen === SettingsScreens.DoNotTranslate}
|
||||||
onReset={handleReset}
|
onReset={handleReset}
|
||||||
onScreenSelect={onScreenSelect}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
case SettingsScreens.DoNotTranslate:
|
case SettingsScreens.DoNotTranslate:
|
||||||
@ -303,7 +298,7 @@ const Settings: FC<OwnProps> = ({
|
|||||||
);
|
);
|
||||||
case SettingsScreens.Stickers:
|
case SettingsScreens.Stickers:
|
||||||
return (
|
return (
|
||||||
<SettingsStickers isActive={isScreenActive} onReset={handleReset} onScreenSelect={onScreenSelect} />
|
<SettingsStickers isActive={isScreenActive} onReset={handleReset} />
|
||||||
);
|
);
|
||||||
case SettingsScreens.Experimental:
|
case SettingsScreens.Experimental:
|
||||||
return (
|
return (
|
||||||
@ -312,7 +307,6 @@ const Settings: FC<OwnProps> = ({
|
|||||||
case SettingsScreens.GeneralChatBackground:
|
case SettingsScreens.GeneralChatBackground:
|
||||||
return (
|
return (
|
||||||
<SettingsGeneralBackground
|
<SettingsGeneralBackground
|
||||||
onScreenSelect={onScreenSelect}
|
|
||||||
isActive={isScreenActive || activeScreen === SettingsScreens.GeneralChatBackgroundColor}
|
isActive={isScreenActive || activeScreen === SettingsScreens.GeneralChatBackgroundColor}
|
||||||
onReset={handleReset}
|
onReset={handleReset}
|
||||||
/>
|
/>
|
||||||
@ -358,7 +352,6 @@ const Settings: FC<OwnProps> = ({
|
|||||||
return (
|
return (
|
||||||
<SettingsPrivacyVisibility
|
<SettingsPrivacyVisibility
|
||||||
screen={currentScreen}
|
screen={currentScreen}
|
||||||
onScreenSelect={onScreenSelect}
|
|
||||||
isActive={isScreenActive || privacyAllowScreens[currentScreen]}
|
isActive={isScreenActive || privacyAllowScreens[currentScreen]}
|
||||||
onReset={handleReset}
|
onReset={handleReset}
|
||||||
/>
|
/>
|
||||||
@ -412,7 +405,6 @@ const Settings: FC<OwnProps> = ({
|
|||||||
<PrivacyMessages
|
<PrivacyMessages
|
||||||
isActive={isScreenActive}
|
isActive={isScreenActive}
|
||||||
onReset={handleReset}
|
onReset={handleReset}
|
||||||
onScreenSelect={onScreenSelect}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -433,7 +425,6 @@ const Settings: FC<OwnProps> = ({
|
|||||||
state={foldersState}
|
state={foldersState}
|
||||||
dispatch={foldersDispatch}
|
dispatch={foldersDispatch}
|
||||||
isActive={isScreenActive}
|
isActive={isScreenActive}
|
||||||
onScreenSelect={onScreenSelect}
|
|
||||||
onReset={handleReset}
|
onReset={handleReset}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
@ -461,7 +452,6 @@ const Settings: FC<OwnProps> = ({
|
|||||||
dispatch={twoFaDispatch}
|
dispatch={twoFaDispatch}
|
||||||
shownScreen={activeScreen}
|
shownScreen={activeScreen}
|
||||||
isActive={isScreenActive}
|
isActive={isScreenActive}
|
||||||
onScreenSelect={onScreenSelect}
|
|
||||||
onReset={handleReset}
|
onReset={handleReset}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
@ -482,7 +472,6 @@ const Settings: FC<OwnProps> = ({
|
|||||||
onSetPasscode={setPrivacyPasscode}
|
onSetPasscode={setPrivacyPasscode}
|
||||||
shownScreen={activeScreen}
|
shownScreen={activeScreen}
|
||||||
isActive={isScreenActive}
|
isActive={isScreenActive}
|
||||||
onScreenSelect={onScreenSelect}
|
|
||||||
onReset={handleReset}
|
onReset={handleReset}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
@ -511,7 +500,6 @@ const Settings: FC<OwnProps> = ({
|
|||||||
<SettingsHeader
|
<SettingsHeader
|
||||||
currentScreen={currentScreen}
|
currentScreen={currentScreen}
|
||||||
onReset={handleReset}
|
onReset={handleReset}
|
||||||
onScreenSelect={onScreenSelect}
|
|
||||||
editedFolderId={foldersState.folderId}
|
editedFolderId={foldersState.folderId}
|
||||||
/>
|
/>
|
||||||
{renderCurrentSectionContent(isScreenActive, activeKey)}
|
{renderCurrentSectionContent(isScreenActive, activeKey)}
|
||||||
|
|||||||
@ -26,7 +26,6 @@ import RangeSlider from '../../ui/RangeSlider';
|
|||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
isActive?: boolean;
|
isActive?: boolean;
|
||||||
onScreenSelect: (screen: SettingsScreens) => void;
|
|
||||||
onReset: () => void;
|
onReset: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -46,11 +45,10 @@ const SettingsGeneral: FC<OwnProps & StateProps> = ({
|
|||||||
timeFormat,
|
timeFormat,
|
||||||
theme,
|
theme,
|
||||||
shouldUseSystemTheme,
|
shouldUseSystemTheme,
|
||||||
onScreenSelect,
|
|
||||||
onReset,
|
onReset,
|
||||||
}) => {
|
}) => {
|
||||||
const {
|
const {
|
||||||
setSharedSettingOption,
|
setSharedSettingOption, openSettingsScreen,
|
||||||
} = getActions();
|
} = getActions();
|
||||||
|
|
||||||
const lang = useLang();
|
const lang = useLang();
|
||||||
@ -146,7 +144,7 @@ const SettingsGeneral: FC<OwnProps & StateProps> = ({
|
|||||||
icon="photo"
|
icon="photo"
|
||||||
narrow
|
narrow
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => onScreenSelect(SettingsScreens.GeneralChatBackground)}
|
onClick={() => openSettingsScreen({ screen: SettingsScreens.GeneralChatBackground })}
|
||||||
>
|
>
|
||||||
{lang('ChatBackground')}
|
{lang('ChatBackground')}
|
||||||
</ListItem>
|
</ListItem>
|
||||||
|
|||||||
@ -27,7 +27,6 @@ import './SettingsGeneralBackground.scss';
|
|||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
isActive?: boolean;
|
isActive?: boolean;
|
||||||
onScreenSelect: (screen: SettingsScreens) => void;
|
|
||||||
onReset: () => void;
|
onReset: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -44,7 +43,6 @@ const runThrottled = throttle((cb) => cb(), 60000, true);
|
|||||||
|
|
||||||
const SettingsGeneralBackground: FC<OwnProps & StateProps> = ({
|
const SettingsGeneralBackground: FC<OwnProps & StateProps> = ({
|
||||||
isActive,
|
isActive,
|
||||||
onScreenSelect,
|
|
||||||
onReset,
|
onReset,
|
||||||
background,
|
background,
|
||||||
isBlurred,
|
isBlurred,
|
||||||
@ -55,6 +53,7 @@ const SettingsGeneralBackground: FC<OwnProps & StateProps> = ({
|
|||||||
loadWallpapers,
|
loadWallpapers,
|
||||||
uploadWallpaper,
|
uploadWallpaper,
|
||||||
setThemeSettings,
|
setThemeSettings,
|
||||||
|
openSettingsScreen,
|
||||||
} = getActions();
|
} = getActions();
|
||||||
|
|
||||||
const themeRef = useRef<ThemeKey>();
|
const themeRef = useRef<ThemeKey>();
|
||||||
@ -81,8 +80,8 @@ const SettingsGeneralBackground: FC<OwnProps & StateProps> = ({
|
|||||||
}, [handleFileSelect]);
|
}, [handleFileSelect]);
|
||||||
|
|
||||||
const handleSetColor = useCallback(() => {
|
const handleSetColor = useCallback(() => {
|
||||||
onScreenSelect(SettingsScreens.GeneralChatBackgroundColor);
|
openSettingsScreen({ screen: SettingsScreens.GeneralChatBackgroundColor });
|
||||||
}, [onScreenSelect]);
|
}, []);
|
||||||
|
|
||||||
const handleResetToDefault = useCallback(() => {
|
const handleResetToDefault = useCallback(() => {
|
||||||
setThemeSettings({
|
setThemeSettings({
|
||||||
|
|||||||
@ -21,25 +21,24 @@ type OwnProps = {
|
|||||||
currentScreen: SettingsScreens;
|
currentScreen: SettingsScreens;
|
||||||
editedFolderId?: number;
|
editedFolderId?: number;
|
||||||
onReset: () => void;
|
onReset: () => void;
|
||||||
onScreenSelect: (screen: SettingsScreens) => void;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const SettingsHeader: FC<OwnProps> = ({
|
const SettingsHeader: FC<OwnProps> = ({
|
||||||
currentScreen,
|
currentScreen,
|
||||||
editedFolderId,
|
editedFolderId,
|
||||||
onReset,
|
onReset,
|
||||||
onScreenSelect,
|
|
||||||
}) => {
|
}) => {
|
||||||
const {
|
const {
|
||||||
signOut,
|
signOut,
|
||||||
openDeleteChatFolderModal,
|
openDeleteChatFolderModal,
|
||||||
|
openSettingsScreen,
|
||||||
} = getActions();
|
} = getActions();
|
||||||
|
|
||||||
const { isMobile } = useAppLayout();
|
const { isMobile } = useAppLayout();
|
||||||
const [isSignOutDialogOpen, setIsSignOutDialogOpen] = useState(false);
|
const [isSignOutDialogOpen, setIsSignOutDialogOpen] = useState(false);
|
||||||
|
|
||||||
const handleMultiClick = useMultiClick(5, () => {
|
const handleMultiClick = useMultiClick(5, () => {
|
||||||
onScreenSelect(SettingsScreens.Experimental);
|
openSettingsScreen({ screen: SettingsScreens.Experimental });
|
||||||
});
|
});
|
||||||
|
|
||||||
const openSignOutConfirmation = useCallback(() => {
|
const openSignOutConfirmation = useCallback(() => {
|
||||||
@ -270,7 +269,7 @@ const SettingsHeader: FC<OwnProps> = ({
|
|||||||
size="smaller"
|
size="smaller"
|
||||||
color="translucent"
|
color="translucent"
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => onScreenSelect(SettingsScreens.EditProfile)}
|
onClick={() => openSettingsScreen({ screen: SettingsScreens.EditProfile })}
|
||||||
ariaLabel={oldLang('lng_settings_information')}
|
ariaLabel={oldLang('lng_settings_information')}
|
||||||
>
|
>
|
||||||
<Icon name="edit" />
|
<Icon name="edit" />
|
||||||
|
|||||||
@ -25,7 +25,6 @@ import Loading from '../../ui/Loading';
|
|||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
isActive?: boolean;
|
isActive?: boolean;
|
||||||
onReset: () => void;
|
onReset: () => void;
|
||||||
onScreenSelect: (screen: SettingsScreens) => void;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
type StateProps = {
|
type StateProps = {
|
||||||
@ -41,7 +40,6 @@ const SettingsLanguage: FC<OwnProps & StateProps> = ({
|
|||||||
canTranslate,
|
canTranslate,
|
||||||
canTranslateChats,
|
canTranslateChats,
|
||||||
doNotTranslate,
|
doNotTranslate,
|
||||||
onScreenSelect,
|
|
||||||
onReset,
|
onReset,
|
||||||
}) => {
|
}) => {
|
||||||
const {
|
const {
|
||||||
@ -49,6 +47,7 @@ const SettingsLanguage: FC<OwnProps & StateProps> = ({
|
|||||||
setSettingOption,
|
setSettingOption,
|
||||||
setSharedSettingOption,
|
setSharedSettingOption,
|
||||||
openPremiumModal,
|
openPremiumModal,
|
||||||
|
openSettingsScreen,
|
||||||
} = getActions();
|
} = getActions();
|
||||||
|
|
||||||
const [selectedLanguage, setSelectedLanguage] = useState<string>(language);
|
const [selectedLanguage, setSelectedLanguage] = useState<string>(language);
|
||||||
@ -120,7 +119,7 @@ const SettingsLanguage: FC<OwnProps & StateProps> = ({
|
|||||||
}, [doNotTranslate, lang, language]);
|
}, [doNotTranslate, lang, language]);
|
||||||
|
|
||||||
const handleDoNotSelectOpen = useLastCallback(() => {
|
const handleDoNotSelectOpen = useLastCallback(() => {
|
||||||
onScreenSelect(SettingsScreens.DoNotTranslate);
|
openSettingsScreen({ screen: SettingsScreens.DoNotTranslate });
|
||||||
});
|
});
|
||||||
|
|
||||||
useHistoryBack({
|
useHistoryBack({
|
||||||
|
|||||||
@ -25,7 +25,6 @@ import ListItem from '../../ui/ListItem';
|
|||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
isActive?: boolean;
|
isActive?: boolean;
|
||||||
onScreenSelect: (screen: SettingsScreens) => void;
|
|
||||||
onReset: () => void;
|
onReset: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -44,7 +43,6 @@ const SettingsMain: FC<OwnProps & StateProps> = ({
|
|||||||
canBuyPremium,
|
canBuyPremium,
|
||||||
isGiveawayAvailable,
|
isGiveawayAvailable,
|
||||||
starsBalance,
|
starsBalance,
|
||||||
onScreenSelect,
|
|
||||||
onReset,
|
onReset,
|
||||||
}) => {
|
}) => {
|
||||||
const {
|
const {
|
||||||
@ -54,6 +52,7 @@ const SettingsMain: FC<OwnProps & StateProps> = ({
|
|||||||
openUrl,
|
openUrl,
|
||||||
openGiftRecipientPicker,
|
openGiftRecipientPicker,
|
||||||
openStarsBalanceModal,
|
openStarsBalanceModal,
|
||||||
|
openSettingsScreen,
|
||||||
} = getActions();
|
} = getActions();
|
||||||
|
|
||||||
const [isSupportDialogOpen, openSupportDialog, closeSupportDialog] = useFlag(false);
|
const [isSupportDialogOpen, openSupportDialog, closeSupportDialog] = useFlag(false);
|
||||||
@ -98,7 +97,7 @@ const SettingsMain: FC<OwnProps & StateProps> = ({
|
|||||||
icon="settings"
|
icon="settings"
|
||||||
narrow
|
narrow
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => onScreenSelect(SettingsScreens.General)}
|
onClick={() => openSettingsScreen({ screen: SettingsScreens.General })}
|
||||||
>
|
>
|
||||||
{lang('TelegramGeneralSettingsViewController')}
|
{lang('TelegramGeneralSettingsViewController')}
|
||||||
</ListItem>
|
</ListItem>
|
||||||
@ -106,7 +105,7 @@ const SettingsMain: FC<OwnProps & StateProps> = ({
|
|||||||
icon="animations"
|
icon="animations"
|
||||||
narrow
|
narrow
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => onScreenSelect(SettingsScreens.Performance)}
|
onClick={() => openSettingsScreen({ screen: SettingsScreens.Performance })}
|
||||||
>
|
>
|
||||||
{lang('MenuAnimations')}
|
{lang('MenuAnimations')}
|
||||||
</ListItem>
|
</ListItem>
|
||||||
@ -114,7 +113,7 @@ const SettingsMain: FC<OwnProps & StateProps> = ({
|
|||||||
icon="unmute"
|
icon="unmute"
|
||||||
narrow
|
narrow
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => onScreenSelect(SettingsScreens.Notifications)}
|
onClick={() => openSettingsScreen({ screen: SettingsScreens.Notifications })}
|
||||||
>
|
>
|
||||||
{lang('Notifications')}
|
{lang('Notifications')}
|
||||||
</ListItem>
|
</ListItem>
|
||||||
@ -122,7 +121,7 @@ const SettingsMain: FC<OwnProps & StateProps> = ({
|
|||||||
icon="data"
|
icon="data"
|
||||||
narrow
|
narrow
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => onScreenSelect(SettingsScreens.DataStorage)}
|
onClick={() => openSettingsScreen({ screen: SettingsScreens.DataStorage })}
|
||||||
>
|
>
|
||||||
{lang('DataSettings')}
|
{lang('DataSettings')}
|
||||||
</ListItem>
|
</ListItem>
|
||||||
@ -130,7 +129,7 @@ const SettingsMain: FC<OwnProps & StateProps> = ({
|
|||||||
icon="lock"
|
icon="lock"
|
||||||
narrow
|
narrow
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => onScreenSelect(SettingsScreens.Privacy)}
|
onClick={() => openSettingsScreen({ screen: SettingsScreens.Privacy })}
|
||||||
>
|
>
|
||||||
{lang('PrivacySettings')}
|
{lang('PrivacySettings')}
|
||||||
</ListItem>
|
</ListItem>
|
||||||
@ -138,7 +137,7 @@ const SettingsMain: FC<OwnProps & StateProps> = ({
|
|||||||
icon="folder"
|
icon="folder"
|
||||||
narrow
|
narrow
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => onScreenSelect(SettingsScreens.Folders)}
|
onClick={() => openSettingsScreen({ screen: SettingsScreens.Folders })}
|
||||||
>
|
>
|
||||||
{lang('Filters')}
|
{lang('Filters')}
|
||||||
</ListItem>
|
</ListItem>
|
||||||
@ -146,7 +145,7 @@ const SettingsMain: FC<OwnProps & StateProps> = ({
|
|||||||
icon="active-sessions"
|
icon="active-sessions"
|
||||||
narrow
|
narrow
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => onScreenSelect(SettingsScreens.ActiveSessions)}
|
onClick={() => openSettingsScreen({ screen: SettingsScreens.ActiveSessions })}
|
||||||
>
|
>
|
||||||
{lang('SessionsTitle')}
|
{lang('SessionsTitle')}
|
||||||
{sessionCount > 0 && (<span className="settings-item__current-value">{sessionCount}</span>)}
|
{sessionCount > 0 && (<span className="settings-item__current-value">{sessionCount}</span>)}
|
||||||
@ -155,7 +154,7 @@ const SettingsMain: FC<OwnProps & StateProps> = ({
|
|||||||
icon="language"
|
icon="language"
|
||||||
narrow
|
narrow
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => onScreenSelect(SettingsScreens.Language)}
|
onClick={() => openSettingsScreen({ screen: SettingsScreens.Language })}
|
||||||
>
|
>
|
||||||
{lang('Language')}
|
{lang('Language')}
|
||||||
<span className="settings-item__current-value">{lang.languageInfo.nativeName}</span>
|
<span className="settings-item__current-value">{lang.languageInfo.nativeName}</span>
|
||||||
@ -164,7 +163,7 @@ const SettingsMain: FC<OwnProps & StateProps> = ({
|
|||||||
icon="stickers"
|
icon="stickers"
|
||||||
narrow
|
narrow
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => onScreenSelect(SettingsScreens.Stickers)}
|
onClick={() => openSettingsScreen({ screen: SettingsScreens.Stickers })}
|
||||||
>
|
>
|
||||||
{lang('MenuStickers')}
|
{lang('MenuStickers')}
|
||||||
</ListItem>
|
</ListItem>
|
||||||
|
|||||||
@ -22,7 +22,6 @@ import ListItem from '../../ui/ListItem';
|
|||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
isActive?: boolean;
|
isActive?: boolean;
|
||||||
onScreenSelect: (screen: SettingsScreens) => void;
|
|
||||||
onReset: () => void;
|
onReset: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -60,7 +59,6 @@ const SettingsPrivacy: FC<OwnProps & StateProps> = ({
|
|||||||
canDisplayChatInTitle,
|
canDisplayChatInTitle,
|
||||||
canSetPasscode,
|
canSetPasscode,
|
||||||
privacy,
|
privacy,
|
||||||
onScreenSelect,
|
|
||||||
onReset,
|
onReset,
|
||||||
isCurrentUserFrozen,
|
isCurrentUserFrozen,
|
||||||
}) => {
|
}) => {
|
||||||
@ -73,6 +71,7 @@ const SettingsPrivacy: FC<OwnProps & StateProps> = ({
|
|||||||
updateGlobalPrivacySettings,
|
updateGlobalPrivacySettings,
|
||||||
loadWebAuthorizations,
|
loadWebAuthorizations,
|
||||||
setSharedSettingOption,
|
setSharedSettingOption,
|
||||||
|
openSettingsScreen,
|
||||||
} = getActions();
|
} = getActions();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -160,7 +159,7 @@ const SettingsPrivacy: FC<OwnProps & StateProps> = ({
|
|||||||
icon="delete-user"
|
icon="delete-user"
|
||||||
narrow
|
narrow
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => onScreenSelect(SettingsScreens.PrivacyBlockedUsers)}
|
onClick={() => openSettingsScreen({ screen: SettingsScreens.PrivacyBlockedUsers })}
|
||||||
>
|
>
|
||||||
{oldLang('BlockedUsers')}
|
{oldLang('BlockedUsers')}
|
||||||
<span className="settings-item__current-value">{blockedCount || ''}</span>
|
<span className="settings-item__current-value">{blockedCount || ''}</span>
|
||||||
@ -170,9 +169,9 @@ const SettingsPrivacy: FC<OwnProps & StateProps> = ({
|
|||||||
icon="key"
|
icon="key"
|
||||||
narrow
|
narrow
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => onScreenSelect(
|
onClick={() => openSettingsScreen({
|
||||||
hasPasscode ? SettingsScreens.PasscodeEnabled : SettingsScreens.PasscodeDisabled,
|
screen: hasPasscode ? SettingsScreens.PasscodeEnabled : SettingsScreens.PasscodeDisabled,
|
||||||
)}
|
})}
|
||||||
>
|
>
|
||||||
<div className="multiline-item">
|
<div className="multiline-item">
|
||||||
<span className="title">{oldLang('Passcode')}</span>
|
<span className="title">{oldLang('Passcode')}</span>
|
||||||
@ -186,9 +185,9 @@ const SettingsPrivacy: FC<OwnProps & StateProps> = ({
|
|||||||
icon="lock"
|
icon="lock"
|
||||||
narrow
|
narrow
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => onScreenSelect(
|
onClick={() => openSettingsScreen({
|
||||||
hasPassword ? SettingsScreens.TwoFaEnabled : SettingsScreens.TwoFaDisabled,
|
screen: hasPassword ? SettingsScreens.TwoFaEnabled : SettingsScreens.TwoFaDisabled,
|
||||||
)}
|
})}
|
||||||
>
|
>
|
||||||
<div className="multiline-item">
|
<div className="multiline-item">
|
||||||
<span className="title">{oldLang('TwoStepVerification')}</span>
|
<span className="title">{oldLang('TwoStepVerification')}</span>
|
||||||
@ -202,7 +201,7 @@ const SettingsPrivacy: FC<OwnProps & StateProps> = ({
|
|||||||
icon="web"
|
icon="web"
|
||||||
narrow
|
narrow
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => onScreenSelect(SettingsScreens.ActiveWebsites)}
|
onClick={() => openSettingsScreen({ screen: SettingsScreens.ActiveWebsites })}
|
||||||
>
|
>
|
||||||
{oldLang('PrivacySettings.WebSessions')}
|
{oldLang('PrivacySettings.WebSessions')}
|
||||||
<span className="settings-item__current-value">{webAuthCount}</span>
|
<span className="settings-item__current-value">{webAuthCount}</span>
|
||||||
@ -217,7 +216,7 @@ const SettingsPrivacy: FC<OwnProps & StateProps> = ({
|
|||||||
narrow
|
narrow
|
||||||
className="no-icon"
|
className="no-icon"
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => onScreenSelect(SettingsScreens.PrivacyPhoneNumber)}
|
onClick={() => openSettingsScreen({ screen: SettingsScreens.PrivacyPhoneNumber })}
|
||||||
>
|
>
|
||||||
<div className="multiline-item">
|
<div className="multiline-item">
|
||||||
<span className="title">{oldLang('PrivacyPhoneTitle')}</span>
|
<span className="title">{oldLang('PrivacyPhoneTitle')}</span>
|
||||||
@ -230,7 +229,7 @@ const SettingsPrivacy: FC<OwnProps & StateProps> = ({
|
|||||||
narrow
|
narrow
|
||||||
className="no-icon"
|
className="no-icon"
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => onScreenSelect(SettingsScreens.PrivacyLastSeen)}
|
onClick={() => openSettingsScreen({ screen: SettingsScreens.PrivacyLastSeen })}
|
||||||
>
|
>
|
||||||
<div className="multiline-item">
|
<div className="multiline-item">
|
||||||
<span className="title">{oldLang('LastSeenTitle')}</span>
|
<span className="title">{oldLang('LastSeenTitle')}</span>
|
||||||
@ -243,7 +242,7 @@ const SettingsPrivacy: FC<OwnProps & StateProps> = ({
|
|||||||
narrow
|
narrow
|
||||||
className="no-icon"
|
className="no-icon"
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => onScreenSelect(SettingsScreens.PrivacyProfilePhoto)}
|
onClick={() => openSettingsScreen({ screen: SettingsScreens.PrivacyProfilePhoto })}
|
||||||
>
|
>
|
||||||
<div className="multiline-item">
|
<div className="multiline-item">
|
||||||
<span className="title">{oldLang('PrivacyProfilePhotoTitle')}</span>
|
<span className="title">{oldLang('PrivacyProfilePhotoTitle')}</span>
|
||||||
@ -256,7 +255,7 @@ const SettingsPrivacy: FC<OwnProps & StateProps> = ({
|
|||||||
narrow
|
narrow
|
||||||
className="no-icon"
|
className="no-icon"
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => onScreenSelect(SettingsScreens.PrivacyBio)}
|
onClick={() => openSettingsScreen({ screen: SettingsScreens.PrivacyBio })}
|
||||||
>
|
>
|
||||||
<div className="multiline-item">
|
<div className="multiline-item">
|
||||||
<span className="title">{oldLang('PrivacyBio')}</span>
|
<span className="title">{oldLang('PrivacyBio')}</span>
|
||||||
@ -269,7 +268,7 @@ const SettingsPrivacy: FC<OwnProps & StateProps> = ({
|
|||||||
narrow
|
narrow
|
||||||
className="no-icon"
|
className="no-icon"
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => onScreenSelect(SettingsScreens.PrivacyBirthday)}
|
onClick={() => openSettingsScreen({ screen: SettingsScreens.PrivacyBirthday })}
|
||||||
>
|
>
|
||||||
<div className="multiline-item">
|
<div className="multiline-item">
|
||||||
<span className="title">{oldLang('PrivacyBirthday')}</span>
|
<span className="title">{oldLang('PrivacyBirthday')}</span>
|
||||||
@ -282,7 +281,7 @@ const SettingsPrivacy: FC<OwnProps & StateProps> = ({
|
|||||||
narrow
|
narrow
|
||||||
className="no-icon"
|
className="no-icon"
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => onScreenSelect(SettingsScreens.PrivacyGifts)}
|
onClick={() => openSettingsScreen({ screen: SettingsScreens.PrivacyGifts })}
|
||||||
>
|
>
|
||||||
<div className="multiline-item">
|
<div className="multiline-item">
|
||||||
<span className="title">{lang('PrivacyGifts')}</span>
|
<span className="title">{lang('PrivacyGifts')}</span>
|
||||||
@ -295,7 +294,7 @@ const SettingsPrivacy: FC<OwnProps & StateProps> = ({
|
|||||||
narrow
|
narrow
|
||||||
className="no-icon"
|
className="no-icon"
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => onScreenSelect(SettingsScreens.PrivacyForwarding)}
|
onClick={() => openSettingsScreen({ screen: SettingsScreens.PrivacyForwarding })}
|
||||||
>
|
>
|
||||||
<div className="multiline-item">
|
<div className="multiline-item">
|
||||||
<span className="title">{oldLang('PrivacyForwardsTitle')}</span>
|
<span className="title">{oldLang('PrivacyForwardsTitle')}</span>
|
||||||
@ -308,7 +307,7 @@ const SettingsPrivacy: FC<OwnProps & StateProps> = ({
|
|||||||
narrow
|
narrow
|
||||||
className="no-icon"
|
className="no-icon"
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => onScreenSelect(SettingsScreens.PrivacyPhoneCall)}
|
onClick={() => openSettingsScreen({ screen: SettingsScreens.PrivacyPhoneCall })}
|
||||||
>
|
>
|
||||||
<div className="multiline-item">
|
<div className="multiline-item">
|
||||||
<span className="title">{oldLang('WhoCanCallMe')}</span>
|
<span className="title">{oldLang('WhoCanCallMe')}</span>
|
||||||
@ -323,7 +322,7 @@ const SettingsPrivacy: FC<OwnProps & StateProps> = ({
|
|||||||
rightElement={isCurrentUserPremium && <StarIcon size="big" type="premium" />}
|
rightElement={isCurrentUserPremium && <StarIcon size="big" type="premium" />}
|
||||||
className="no-icon"
|
className="no-icon"
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => onScreenSelect(SettingsScreens.PrivacyVoiceMessages)}
|
onClick={() => openSettingsScreen({ screen: SettingsScreens.PrivacyVoiceMessages })}
|
||||||
>
|
>
|
||||||
<div className="multiline-item">
|
<div className="multiline-item">
|
||||||
<span className="title">{oldLang('PrivacyVoiceMessagesTitle')}</span>
|
<span className="title">{oldLang('PrivacyVoiceMessagesTitle')}</span>
|
||||||
@ -337,7 +336,7 @@ const SettingsPrivacy: FC<OwnProps & StateProps> = ({
|
|||||||
rightElement={isCurrentUserPremium && <StarIcon size="big" type="premium" />}
|
rightElement={isCurrentUserPremium && <StarIcon size="big" type="premium" />}
|
||||||
className="no-icon"
|
className="no-icon"
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => onScreenSelect(SettingsScreens.PrivacyMessages)}
|
onClick={() => openSettingsScreen({ screen: SettingsScreens.PrivacyMessages })}
|
||||||
>
|
>
|
||||||
<div className="multiline-item">
|
<div className="multiline-item">
|
||||||
<span className="title">{oldLang('PrivacyMessagesTitle')}</span>
|
<span className="title">{oldLang('PrivacyMessagesTitle')}</span>
|
||||||
@ -353,7 +352,7 @@ const SettingsPrivacy: FC<OwnProps & StateProps> = ({
|
|||||||
narrow
|
narrow
|
||||||
className="no-icon"
|
className="no-icon"
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => onScreenSelect(SettingsScreens.PrivacyGroupChats)}
|
onClick={() => openSettingsScreen({ screen: SettingsScreens.PrivacyGroupChats })}
|
||||||
>
|
>
|
||||||
<div className="multiline-item">
|
<div className="multiline-item">
|
||||||
<span className="title">{oldLang('WhoCanAddMe')}</span>
|
<span className="title">{oldLang('WhoCanAddMe')}</span>
|
||||||
|
|||||||
@ -26,7 +26,6 @@ import SettingsPrivacyPublicProfilePhoto from './SettingsPrivacyPublicProfilePho
|
|||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
screen: SettingsScreens;
|
screen: SettingsScreens;
|
||||||
isActive?: boolean;
|
isActive?: boolean;
|
||||||
onScreenSelect: (screen: SettingsScreens) => void;
|
|
||||||
onReset: () => void;
|
onReset: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -50,15 +49,14 @@ const SettingsPrivacyVisibility: FC<OwnProps & StateProps> = ({
|
|||||||
hasCurrentUserFullInfo,
|
hasCurrentUserFullInfo,
|
||||||
currentUserFallbackPhoto,
|
currentUserFallbackPhoto,
|
||||||
isPremiumRequired,
|
isPremiumRequired,
|
||||||
onScreenSelect,
|
|
||||||
onReset,
|
onReset,
|
||||||
shouldDisplayGiftsButton,
|
shouldDisplayGiftsButton,
|
||||||
isCurrentUserPremium,
|
isCurrentUserPremium,
|
||||||
}) => {
|
}) => {
|
||||||
const lang = useLang();
|
|
||||||
|
|
||||||
const { updateGlobalPrivacySettings, showNotification } = getActions();
|
const { updateGlobalPrivacySettings, showNotification } = getActions();
|
||||||
|
|
||||||
|
const lang = useLang();
|
||||||
|
|
||||||
useHistoryBack({
|
useHistoryBack({
|
||||||
isActive,
|
isActive,
|
||||||
onBack: onReset,
|
onBack: onReset,
|
||||||
@ -120,7 +118,6 @@ const SettingsPrivacyVisibility: FC<OwnProps & StateProps> = ({
|
|||||||
<PrivacySubsection
|
<PrivacySubsection
|
||||||
screen={screen}
|
screen={screen}
|
||||||
privacy={primaryPrivacy}
|
privacy={primaryPrivacy}
|
||||||
onScreenSelect={onScreenSelect}
|
|
||||||
isPremiumRequired={isPremiumRequired}
|
isPremiumRequired={isPremiumRequired}
|
||||||
/>
|
/>
|
||||||
{screen === SettingsScreens.PrivacyProfilePhoto && primaryPrivacy?.visibility !== 'everybody' && (
|
{screen === SettingsScreens.PrivacyProfilePhoto && primaryPrivacy?.visibility !== 'everybody' && (
|
||||||
@ -140,7 +137,6 @@ const SettingsPrivacyVisibility: FC<OwnProps & StateProps> = ({
|
|||||||
<PrivacySubsection
|
<PrivacySubsection
|
||||||
screen={secondaryScreen}
|
screen={secondaryScreen}
|
||||||
privacy={secondaryPrivacy}
|
privacy={secondaryPrivacy}
|
||||||
onScreenSelect={onScreenSelect}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@ -150,15 +146,13 @@ const SettingsPrivacyVisibility: FC<OwnProps & StateProps> = ({
|
|||||||
function PrivacySubsection({
|
function PrivacySubsection({
|
||||||
screen,
|
screen,
|
||||||
privacy,
|
privacy,
|
||||||
onScreenSelect,
|
|
||||||
isPremiumRequired,
|
isPremiumRequired,
|
||||||
}: {
|
}: {
|
||||||
screen: SettingsScreens;
|
screen: SettingsScreens;
|
||||||
privacy?: ApiPrivacySettings;
|
privacy?: ApiPrivacySettings;
|
||||||
isPremiumRequired?: boolean;
|
isPremiumRequired?: boolean;
|
||||||
onScreenSelect: (screen: SettingsScreens) => void;
|
|
||||||
}) {
|
}) {
|
||||||
const { setPrivacyVisibility } = getActions();
|
const { setPrivacyVisibility, openSettingsScreen } = getActions();
|
||||||
const oldLang = useOldLang();
|
const oldLang = useOldLang();
|
||||||
const lang = useLang();
|
const lang = useLang();
|
||||||
|
|
||||||
@ -376,7 +370,7 @@ function PrivacySubsection({
|
|||||||
icon="add-user"
|
icon="add-user"
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
onScreenSelect(allowedContactsScreen);
|
openSettingsScreen({ screen: allowedContactsScreen });
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className="multiline-item full-size">
|
<div className="multiline-item full-size">
|
||||||
@ -391,7 +385,7 @@ function PrivacySubsection({
|
|||||||
icon="delete-user"
|
icon="delete-user"
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
onScreenSelect(deniedContactsScreen);
|
openSettingsScreen({ screen: deniedContactsScreen });
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className="multiline-item full-size">
|
<div className="multiline-item full-size">
|
||||||
|
|||||||
@ -31,7 +31,6 @@ const DEFAULT_REACTION_SIZE = 1.5 * REM;
|
|||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
isActive?: boolean;
|
isActive?: boolean;
|
||||||
onScreenSelect: (screen: SettingsScreens) => void;
|
|
||||||
onReset: () => void;
|
onReset: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -58,11 +57,11 @@ const SettingsStickers: FC<OwnProps & StateProps> = ({
|
|||||||
availableReactions,
|
availableReactions,
|
||||||
canPlayAnimatedEmojis,
|
canPlayAnimatedEmojis,
|
||||||
onReset,
|
onReset,
|
||||||
onScreenSelect,
|
|
||||||
}) => {
|
}) => {
|
||||||
const {
|
const {
|
||||||
setSettingOption,
|
setSettingOption,
|
||||||
openStickerSet,
|
openStickerSet,
|
||||||
|
openSettingsScreen,
|
||||||
} = getActions();
|
} = getActions();
|
||||||
const lang = useOldLang();
|
const lang = useOldLang();
|
||||||
|
|
||||||
@ -104,7 +103,7 @@ const SettingsStickers: FC<OwnProps & StateProps> = ({
|
|||||||
<ListItem
|
<ListItem
|
||||||
narrow
|
narrow
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => onScreenSelect(SettingsScreens.CustomEmoji)}
|
onClick={() => openSettingsScreen({ screen: SettingsScreens.CustomEmoji })}
|
||||||
icon="smile"
|
icon="smile"
|
||||||
>
|
>
|
||||||
{lang('StickersList.EmojiItem')}
|
{lang('StickersList.EmojiItem')}
|
||||||
@ -115,7 +114,7 @@ const SettingsStickers: FC<OwnProps & StateProps> = ({
|
|||||||
className="SettingsDefaultReaction"
|
className="SettingsDefaultReaction"
|
||||||
narrow
|
narrow
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => onScreenSelect(SettingsScreens.QuickReaction)}
|
onClick={() => openSettingsScreen({ screen: SettingsScreens.QuickReaction })}
|
||||||
>
|
>
|
||||||
<ReactionStaticEmoji
|
<ReactionStaticEmoji
|
||||||
reaction={defaultReaction}
|
reaction={defaultReaction}
|
||||||
|
|||||||
@ -23,7 +23,6 @@ export type OwnProps = {
|
|||||||
state: FoldersState;
|
state: FoldersState;
|
||||||
dispatch: FolderEditDispatch;
|
dispatch: FolderEditDispatch;
|
||||||
isActive?: boolean;
|
isActive?: boolean;
|
||||||
onScreenSelect: (screen: SettingsScreens) => void;
|
|
||||||
onReset: () => void;
|
onReset: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -33,13 +32,13 @@ const SettingsFolders: FC<OwnProps> = ({
|
|||||||
state,
|
state,
|
||||||
dispatch,
|
dispatch,
|
||||||
isActive,
|
isActive,
|
||||||
onScreenSelect,
|
|
||||||
onReset,
|
onReset,
|
||||||
}) => {
|
}) => {
|
||||||
const {
|
const {
|
||||||
openShareChatFolderModal,
|
openShareChatFolderModal,
|
||||||
editChatFolder,
|
editChatFolder,
|
||||||
addChatFolder,
|
addChatFolder,
|
||||||
|
openSettingsScreen,
|
||||||
} = getActions();
|
} = getActions();
|
||||||
|
|
||||||
const handleReset = useCallback(() => {
|
const handleReset = useCallback(() => {
|
||||||
@ -59,18 +58,15 @@ const SettingsFolders: FC<OwnProps> = ({
|
|||||||
|| currentScreen === SettingsScreens.FoldersExcludedChats
|
|| currentScreen === SettingsScreens.FoldersExcludedChats
|
||||||
) {
|
) {
|
||||||
if (state.mode === 'create') {
|
if (state.mode === 'create') {
|
||||||
onScreenSelect(SettingsScreens.FoldersCreateFolder);
|
openSettingsScreen({ screen: SettingsScreens.FoldersCreateFolder });
|
||||||
} else {
|
} else {
|
||||||
onScreenSelect(SettingsScreens.FoldersEditFolder);
|
openSettingsScreen({ screen: SettingsScreens.FoldersEditFolder });
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
onReset();
|
onReset();
|
||||||
}, [
|
}, [state.mode, dispatch, currentScreen, onReset]);
|
||||||
state.mode, dispatch,
|
|
||||||
currentScreen, onReset, onScreenSelect,
|
|
||||||
]);
|
|
||||||
|
|
||||||
const isCreating = state.mode === 'create';
|
const isCreating = state.mode === 'create';
|
||||||
|
|
||||||
@ -119,38 +115,42 @@ const SettingsFolders: FC<OwnProps> = ({
|
|||||||
|
|
||||||
const handleCreateFolder = useCallback(() => {
|
const handleCreateFolder = useCallback(() => {
|
||||||
dispatch({ type: 'reset' });
|
dispatch({ type: 'reset' });
|
||||||
onScreenSelect(SettingsScreens.FoldersCreateFolder);
|
openSettingsScreen({ screen: SettingsScreens.FoldersCreateFolder });
|
||||||
}, [onScreenSelect, dispatch]);
|
}, [dispatch]);
|
||||||
|
|
||||||
const handleEditFolder = useCallback((folder: ApiChatFolder) => {
|
const handleEditFolder = useCallback((folder: ApiChatFolder) => {
|
||||||
dispatch({ type: 'editFolder', payload: folder });
|
dispatch({ type: 'editFolder', payload: folder });
|
||||||
onScreenSelect(SettingsScreens.FoldersEditFolder);
|
openSettingsScreen({ screen: SettingsScreens.FoldersEditFolder });
|
||||||
}, [dispatch, onScreenSelect]);
|
}, [dispatch]);
|
||||||
|
|
||||||
const handleAddIncludedChats = useCallback(() => {
|
const handleAddIncludedChats = useCallback(() => {
|
||||||
dispatch({ type: 'editIncludeFilters' });
|
dispatch({ type: 'editIncludeFilters' });
|
||||||
onScreenSelect(currentScreen === SettingsScreens.FoldersEditFolderFromChatList
|
openSettingsScreen({
|
||||||
? SettingsScreens.FoldersIncludedChatsFromChatList
|
screen: currentScreen === SettingsScreens.FoldersEditFolderFromChatList
|
||||||
: SettingsScreens.FoldersIncludedChats);
|
? SettingsScreens.FoldersIncludedChatsFromChatList
|
||||||
}, [currentScreen, dispatch, onScreenSelect]);
|
: SettingsScreens.FoldersIncludedChats,
|
||||||
|
});
|
||||||
|
}, [currentScreen, dispatch]);
|
||||||
|
|
||||||
const handleAddExcludedChats = useCallback(() => {
|
const handleAddExcludedChats = useCallback(() => {
|
||||||
dispatch({ type: 'editExcludeFilters' });
|
dispatch({ type: 'editExcludeFilters' });
|
||||||
onScreenSelect(currentScreen === SettingsScreens.FoldersEditFolderFromChatList
|
openSettingsScreen({
|
||||||
? SettingsScreens.FoldersExcludedChatsFromChatList
|
screen: currentScreen === SettingsScreens.FoldersEditFolderFromChatList
|
||||||
: SettingsScreens.FoldersExcludedChats);
|
? SettingsScreens.FoldersExcludedChatsFromChatList
|
||||||
}, [currentScreen, dispatch, onScreenSelect]);
|
: SettingsScreens.FoldersExcludedChats,
|
||||||
|
});
|
||||||
|
}, [currentScreen, dispatch]);
|
||||||
|
|
||||||
const handleShareFolder = useCallback(() => {
|
const handleShareFolder = useCallback(() => {
|
||||||
openShareChatFolderModal({ folderId: state.folderId!, noRequestNextScreen: true });
|
openShareChatFolderModal({ folderId: state.folderId!, noRequestNextScreen: true });
|
||||||
dispatch({ type: 'setIsChatlist', payload: true });
|
dispatch({ type: 'setIsChatlist', payload: true });
|
||||||
onScreenSelect(SettingsScreens.FoldersShare);
|
openSettingsScreen({ screen: SettingsScreens.FoldersShare });
|
||||||
}, [dispatch, onScreenSelect, state.folderId]);
|
}, [dispatch, state.folderId]);
|
||||||
|
|
||||||
const handleOpenInvite = useCallback((url: string) => {
|
const handleOpenInvite = useCallback((url: string) => {
|
||||||
openShareChatFolderModal({ folderId: state.folderId!, url, noRequestNextScreen: true });
|
openShareChatFolderModal({ folderId: state.folderId!, url, noRequestNextScreen: true });
|
||||||
onScreenSelect(SettingsScreens.FoldersShare);
|
openSettingsScreen({ screen: SettingsScreens.FoldersShare });
|
||||||
}, [onScreenSelect, state.folderId]);
|
}, [state.folderId]);
|
||||||
|
|
||||||
switch (currentScreen) {
|
switch (currentScreen) {
|
||||||
case SettingsScreens.Folders:
|
case SettingsScreens.Folders:
|
||||||
|
|||||||
@ -20,7 +20,6 @@ export type OwnProps = {
|
|||||||
shownScreen: SettingsScreens;
|
shownScreen: SettingsScreens;
|
||||||
isActive?: boolean;
|
isActive?: boolean;
|
||||||
onSetPasscode: (passcode: string) => void;
|
onSetPasscode: (passcode: string) => void;
|
||||||
onScreenSelect: (screen: SettingsScreens) => void;
|
|
||||||
onReset: () => void;
|
onReset: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -33,7 +32,6 @@ const SettingsPasscode: FC<OwnProps & StateProps> = ({
|
|||||||
error,
|
error,
|
||||||
isActive,
|
isActive,
|
||||||
isLoading,
|
isLoading,
|
||||||
onScreenSelect,
|
|
||||||
onSetPasscode,
|
onSetPasscode,
|
||||||
onReset,
|
onReset,
|
||||||
}) => {
|
}) => {
|
||||||
@ -42,52 +40,53 @@ const SettingsPasscode: FC<OwnProps & StateProps> = ({
|
|||||||
clearPasscode,
|
clearPasscode,
|
||||||
setPasscodeError,
|
setPasscodeError,
|
||||||
clearPasscodeError,
|
clearPasscodeError,
|
||||||
|
openSettingsScreen,
|
||||||
} = getActions();
|
} = getActions();
|
||||||
|
|
||||||
const lang = useOldLang();
|
const lang = useOldLang();
|
||||||
|
|
||||||
const handleStartWizard = useCallback(() => {
|
const handleStartWizard = useCallback(() => {
|
||||||
onSetPasscode('');
|
onSetPasscode('');
|
||||||
onScreenSelect(SettingsScreens.PasscodeNewPasscode);
|
openSettingsScreen({ screen: SettingsScreens.PasscodeNewPasscode });
|
||||||
}, [onScreenSelect, onSetPasscode]);
|
}, [onSetPasscode]);
|
||||||
|
|
||||||
const handleNewPassword = useCallback((value: string) => {
|
const handleNewPassword = useCallback((value: string) => {
|
||||||
onSetPasscode(value);
|
onSetPasscode(value);
|
||||||
onScreenSelect(SettingsScreens.PasscodeNewPasscodeConfirm);
|
openSettingsScreen({ screen: SettingsScreens.PasscodeNewPasscodeConfirm });
|
||||||
}, [onScreenSelect, onSetPasscode]);
|
}, [onSetPasscode]);
|
||||||
|
|
||||||
const handleNewPasswordConfirm = useCallback(() => {
|
const handleNewPasswordConfirm = useCallback(() => {
|
||||||
setPasscode({ passcode });
|
setPasscode({ passcode });
|
||||||
onSetPasscode('');
|
onSetPasscode('');
|
||||||
onScreenSelect(SettingsScreens.PasscodeCongratulations);
|
openSettingsScreen({ screen: SettingsScreens.PasscodeCongratulations });
|
||||||
}, [onScreenSelect, onSetPasscode, passcode, setPasscode]);
|
}, [onSetPasscode, passcode]);
|
||||||
|
|
||||||
const handleChangePasswordCurrent = useCallback((currentPasscode: string) => {
|
const handleChangePasswordCurrent = useCallback((currentPasscode: string) => {
|
||||||
onSetPasscode('');
|
onSetPasscode('');
|
||||||
decryptSession(currentPasscode).then(() => {
|
decryptSession(currentPasscode).then(() => {
|
||||||
onScreenSelect(SettingsScreens.PasscodeChangePasscodeNew);
|
openSettingsScreen({ screen: SettingsScreens.PasscodeChangePasscodeNew });
|
||||||
}, () => {
|
}, () => {
|
||||||
setPasscodeError({
|
setPasscodeError({
|
||||||
error: lang('PasscodeController.Error.Current'),
|
error: lang('PasscodeController.Error.Current'),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}, [lang, onScreenSelect, onSetPasscode, setPasscodeError]);
|
}, [lang, onSetPasscode]);
|
||||||
|
|
||||||
const handleChangePasswordNew = useCallback((value: string) => {
|
const handleChangePasswordNew = useCallback((value: string) => {
|
||||||
onSetPasscode(value);
|
onSetPasscode(value);
|
||||||
onScreenSelect(SettingsScreens.PasscodeChangePasscodeConfirm);
|
openSettingsScreen({ screen: SettingsScreens.PasscodeChangePasscodeConfirm });
|
||||||
}, [onScreenSelect, onSetPasscode]);
|
}, [onSetPasscode]);
|
||||||
|
|
||||||
const handleTurnOff = useCallback((currentPasscode: string) => {
|
const handleTurnOff = useCallback((currentPasscode: string) => {
|
||||||
decryptSession(currentPasscode).then(() => {
|
decryptSession(currentPasscode).then(() => {
|
||||||
clearPasscode();
|
clearPasscode();
|
||||||
onScreenSelect(SettingsScreens.Privacy);
|
openSettingsScreen({ screen: SettingsScreens.Privacy });
|
||||||
}, () => {
|
}, () => {
|
||||||
setPasscodeError({
|
setPasscodeError({
|
||||||
error: lang('PasscodeController.Error.Current'),
|
error: lang('PasscodeController.Error.Current'),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}, [clearPasscode, lang, onScreenSelect, setPasscodeError]);
|
}, [lang]);
|
||||||
|
|
||||||
switch (currentScreen) {
|
switch (currentScreen) {
|
||||||
case SettingsScreens.PasscodeDisabled:
|
case SettingsScreens.PasscodeDisabled:
|
||||||
@ -145,7 +144,6 @@ const SettingsPasscode: FC<OwnProps & StateProps> = ({
|
|||||||
case SettingsScreens.PasscodeEnabled:
|
case SettingsScreens.PasscodeEnabled:
|
||||||
return (
|
return (
|
||||||
<SettingsPasscodeEnabled
|
<SettingsPasscodeEnabled
|
||||||
onScreenSelect={onScreenSelect}
|
|
||||||
isActive={isActive || [
|
isActive={isActive || [
|
||||||
SettingsScreens.PasscodeChangePasscodeCurrent,
|
SettingsScreens.PasscodeChangePasscodeCurrent,
|
||||||
SettingsScreens.PasscodeChangePasscodeNew,
|
SettingsScreens.PasscodeChangePasscodeNew,
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import type { FC } from '../../../../lib/teact/teact';
|
import type { FC } from '../../../../lib/teact/teact';
|
||||||
import React, { memo } from '../../../../lib/teact/teact';
|
import React, { memo } from '../../../../lib/teact/teact';
|
||||||
|
import { getActions } from '../../../../global';
|
||||||
|
|
||||||
import { SettingsScreens } from '../../../../types';
|
import { SettingsScreens } from '../../../../types';
|
||||||
|
|
||||||
@ -15,13 +16,13 @@ import lockPreviewUrl from '../../../../assets/lock.png';
|
|||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
isActive?: boolean;
|
isActive?: boolean;
|
||||||
onScreenSelect: (screen: SettingsScreens) => void;
|
|
||||||
onReset: () => void;
|
onReset: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
const SettingsPasscodeEnabled: FC<OwnProps> = ({
|
const SettingsPasscodeEnabled: FC<OwnProps> = ({
|
||||||
isActive, onReset, onScreenSelect,
|
isActive, onReset,
|
||||||
}) => {
|
}) => {
|
||||||
|
const { openSettingsScreen } = getActions();
|
||||||
const lang = useOldLang();
|
const lang = useOldLang();
|
||||||
|
|
||||||
useHistoryBack({ isActive, onBack: onReset });
|
useHistoryBack({ isActive, onBack: onReset });
|
||||||
@ -45,14 +46,14 @@ const SettingsPasscodeEnabled: FC<OwnProps> = ({
|
|||||||
<ListItem
|
<ListItem
|
||||||
icon="edit"
|
icon="edit"
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => onScreenSelect(SettingsScreens.PasscodeChangePasscodeCurrent)}
|
onClick={() => openSettingsScreen({ screen: SettingsScreens.PasscodeChangePasscodeCurrent })}
|
||||||
>
|
>
|
||||||
{lang('Passcode.Change')}
|
{lang('Passcode.Change')}
|
||||||
</ListItem>
|
</ListItem>
|
||||||
<ListItem
|
<ListItem
|
||||||
icon="password-off"
|
icon="password-off"
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => onScreenSelect(SettingsScreens.PasscodeTurnOff)}
|
onClick={() => openSettingsScreen({ screen: SettingsScreens.PasscodeTurnOff })}
|
||||||
>
|
>
|
||||||
{lang('Passcode.TurnOff')}
|
{lang('Passcode.TurnOff')}
|
||||||
</ListItem>
|
</ListItem>
|
||||||
|
|||||||
@ -22,7 +22,6 @@ export type OwnProps = {
|
|||||||
shownScreen: SettingsScreens;
|
shownScreen: SettingsScreens;
|
||||||
dispatch: TwoFaDispatch;
|
dispatch: TwoFaDispatch;
|
||||||
isActive?: boolean;
|
isActive?: boolean;
|
||||||
onScreenSelect: (screen: SettingsScreens) => void;
|
|
||||||
onReset: () => void;
|
onReset: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -38,7 +37,6 @@ const SettingsTwoFa: FC<OwnProps & StateProps> = ({
|
|||||||
waitingEmailCodeLength,
|
waitingEmailCodeLength,
|
||||||
dispatch,
|
dispatch,
|
||||||
isActive,
|
isActive,
|
||||||
onScreenSelect,
|
|
||||||
onReset,
|
onReset,
|
||||||
}) => {
|
}) => {
|
||||||
const {
|
const {
|
||||||
@ -48,6 +46,7 @@ const SettingsTwoFa: FC<OwnProps & StateProps> = ({
|
|||||||
updateRecoveryEmail,
|
updateRecoveryEmail,
|
||||||
provideTwoFaEmailCode,
|
provideTwoFaEmailCode,
|
||||||
clearPassword,
|
clearPassword,
|
||||||
|
openSettingsScreen,
|
||||||
} = getActions();
|
} = getActions();
|
||||||
|
|
||||||
const lang = useLang();
|
const lang = useLang();
|
||||||
@ -56,31 +55,31 @@ const SettingsTwoFa: FC<OwnProps & StateProps> = ({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (waitingEmailCodeLength) {
|
if (waitingEmailCodeLength) {
|
||||||
if (currentScreen === SettingsScreens.TwoFaNewPasswordEmail) {
|
if (currentScreen === SettingsScreens.TwoFaNewPasswordEmail) {
|
||||||
onScreenSelect(SettingsScreens.TwoFaNewPasswordEmailCode);
|
openSettingsScreen({ screen: SettingsScreens.TwoFaNewPasswordEmailCode });
|
||||||
} else if (currentScreen === SettingsScreens.TwoFaRecoveryEmail) {
|
} else if (currentScreen === SettingsScreens.TwoFaRecoveryEmail) {
|
||||||
onScreenSelect(SettingsScreens.TwoFaRecoveryEmailCode);
|
openSettingsScreen({ screen: SettingsScreens.TwoFaRecoveryEmailCode });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [currentScreen, onScreenSelect, waitingEmailCodeLength]);
|
}, [currentScreen, waitingEmailCodeLength, openSettingsScreen]);
|
||||||
|
|
||||||
const handleStartWizard = useCallback(() => {
|
const handleStartWizard = useCallback(() => {
|
||||||
dispatch({ type: 'reset' });
|
dispatch({ type: 'reset' });
|
||||||
onScreenSelect(SettingsScreens.TwoFaNewPassword);
|
openSettingsScreen({ screen: SettingsScreens.TwoFaNewPassword });
|
||||||
}, [dispatch, onScreenSelect]);
|
}, [dispatch, openSettingsScreen]);
|
||||||
|
|
||||||
const handleNewPassword = useCallback((value: string) => {
|
const handleNewPassword = useCallback((value: string) => {
|
||||||
dispatch({ type: 'setPassword', payload: value });
|
dispatch({ type: 'setPassword', payload: value });
|
||||||
onScreenSelect(SettingsScreens.TwoFaNewPasswordConfirm);
|
openSettingsScreen({ screen: SettingsScreens.TwoFaNewPasswordConfirm });
|
||||||
}, [dispatch, onScreenSelect]);
|
}, [dispatch, openSettingsScreen]);
|
||||||
|
|
||||||
const handleNewPasswordConfirm = useCallback(() => {
|
const handleNewPasswordConfirm = useCallback(() => {
|
||||||
onScreenSelect(SettingsScreens.TwoFaNewPasswordHint);
|
openSettingsScreen({ screen: SettingsScreens.TwoFaNewPasswordHint });
|
||||||
}, [onScreenSelect]);
|
}, [openSettingsScreen]);
|
||||||
|
|
||||||
const handleNewPasswordHint = useCallback((value?: string) => {
|
const handleNewPasswordHint = useCallback((value?: string) => {
|
||||||
dispatch({ type: 'setHint', payload: value });
|
dispatch({ type: 'setHint', payload: value });
|
||||||
onScreenSelect(SettingsScreens.TwoFaNewPasswordEmail);
|
openSettingsScreen({ screen: SettingsScreens.TwoFaNewPasswordEmail });
|
||||||
}, [dispatch, onScreenSelect]);
|
}, [dispatch, openSettingsScreen]);
|
||||||
|
|
||||||
const handleNewPasswordEmail = useCallback((value?: string) => {
|
const handleNewPasswordEmail = useCallback((value?: string) => {
|
||||||
dispatch({ type: 'setEmail', payload: value });
|
dispatch({ type: 'setEmail', payload: value });
|
||||||
@ -88,29 +87,29 @@ const SettingsTwoFa: FC<OwnProps & StateProps> = ({
|
|||||||
...state,
|
...state,
|
||||||
email: value,
|
email: value,
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
onScreenSelect(SettingsScreens.TwoFaCongratulations);
|
openSettingsScreen({ screen: SettingsScreens.TwoFaCongratulations });
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}, [dispatch, onScreenSelect, state, updatePassword]);
|
}, [dispatch, state, updatePassword, openSettingsScreen]);
|
||||||
|
|
||||||
const handleChangePasswordCurrent = useCallback((value: string) => {
|
const handleChangePasswordCurrent = useCallback((value: string) => {
|
||||||
dispatch({ type: 'setCurrentPassword', payload: value });
|
dispatch({ type: 'setCurrentPassword', payload: value });
|
||||||
checkPassword({
|
checkPassword({
|
||||||
currentPassword: value,
|
currentPassword: value,
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
onScreenSelect(SettingsScreens.TwoFaChangePasswordNew);
|
openSettingsScreen({ screen: SettingsScreens.TwoFaChangePasswordNew });
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}, [checkPassword, dispatch, onScreenSelect]);
|
}, [checkPassword, dispatch, openSettingsScreen]);
|
||||||
|
|
||||||
const handleChangePasswordNew = useCallback((value: string) => {
|
const handleChangePasswordNew = useCallback((value: string) => {
|
||||||
dispatch({ type: 'setPassword', payload: value });
|
dispatch({ type: 'setPassword', payload: value });
|
||||||
onScreenSelect(SettingsScreens.TwoFaChangePasswordConfirm);
|
openSettingsScreen({ screen: SettingsScreens.TwoFaChangePasswordConfirm });
|
||||||
}, [dispatch, onScreenSelect]);
|
}, [dispatch, openSettingsScreen]);
|
||||||
|
|
||||||
const handleChangePasswordConfirm = useCallback(() => {
|
const handleChangePasswordConfirm = useCallback(() => {
|
||||||
onScreenSelect(SettingsScreens.TwoFaChangePasswordHint);
|
openSettingsScreen({ screen: SettingsScreens.TwoFaChangePasswordHint });
|
||||||
}, [onScreenSelect]);
|
}, [openSettingsScreen]);
|
||||||
|
|
||||||
const handleChangePasswordHint = useCallback((value?: string) => {
|
const handleChangePasswordHint = useCallback((value?: string) => {
|
||||||
dispatch({ type: 'setHint', payload: value });
|
dispatch({ type: 'setHint', payload: value });
|
||||||
@ -118,29 +117,29 @@ const SettingsTwoFa: FC<OwnProps & StateProps> = ({
|
|||||||
...state,
|
...state,
|
||||||
hint: value,
|
hint: value,
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
onScreenSelect(SettingsScreens.TwoFaCongratulations);
|
openSettingsScreen({ screen: SettingsScreens.TwoFaCongratulations });
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}, [dispatch, onScreenSelect, state, updatePassword]);
|
}, [dispatch, state, updatePassword, openSettingsScreen]);
|
||||||
|
|
||||||
const handleTurnOff = useCallback((value: string) => {
|
const handleTurnOff = useCallback((value: string) => {
|
||||||
clearPassword({
|
clearPassword({
|
||||||
currentPassword: value,
|
currentPassword: value,
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
onScreenSelect(SettingsScreens.Privacy);
|
openSettingsScreen({ screen: SettingsScreens.Privacy });
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}, [clearPassword, onScreenSelect]);
|
}, [clearPassword, openSettingsScreen]);
|
||||||
|
|
||||||
const handleRecoveryEmailCurrentPassword = useCallback((value: string) => {
|
const handleRecoveryEmailCurrentPassword = useCallback((value: string) => {
|
||||||
dispatch({ type: 'setCurrentPassword', payload: value });
|
dispatch({ type: 'setCurrentPassword', payload: value });
|
||||||
checkPassword({
|
checkPassword({
|
||||||
currentPassword: value,
|
currentPassword: value,
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
onScreenSelect(SettingsScreens.TwoFaRecoveryEmail);
|
openSettingsScreen({ screen: SettingsScreens.TwoFaRecoveryEmail });
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}, [checkPassword, dispatch, onScreenSelect]);
|
}, [checkPassword, dispatch, openSettingsScreen]);
|
||||||
|
|
||||||
const handleRecoveryEmail = useCallback((value?: string) => {
|
const handleRecoveryEmail = useCallback((value?: string) => {
|
||||||
dispatch({ type: 'setEmail', payload: value });
|
dispatch({ type: 'setEmail', payload: value });
|
||||||
@ -148,10 +147,10 @@ const SettingsTwoFa: FC<OwnProps & StateProps> = ({
|
|||||||
...state,
|
...state,
|
||||||
email: value!,
|
email: value!,
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
onScreenSelect(SettingsScreens.TwoFaCongratulations);
|
openSettingsScreen({ screen: SettingsScreens.TwoFaCongratulations });
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}, [dispatch, onScreenSelect, state, updateRecoveryEmail]);
|
}, [dispatch, state, updateRecoveryEmail, openSettingsScreen]);
|
||||||
|
|
||||||
const handleEmailCode = useCallback((code: string) => {
|
const handleEmailCode = useCallback((code: string) => {
|
||||||
provideTwoFaEmailCode({ code });
|
provideTwoFaEmailCode({ code });
|
||||||
@ -257,7 +256,6 @@ const SettingsTwoFa: FC<OwnProps & StateProps> = ({
|
|||||||
case SettingsScreens.TwoFaCongratulations:
|
case SettingsScreens.TwoFaCongratulations:
|
||||||
return (
|
return (
|
||||||
<SettingsTwoFaCongratulations
|
<SettingsTwoFaCongratulations
|
||||||
onScreenSelect={onScreenSelect}
|
|
||||||
isActive={isActive}
|
isActive={isActive}
|
||||||
onReset={onReset}
|
onReset={onReset}
|
||||||
/>
|
/>
|
||||||
@ -266,7 +264,6 @@ const SettingsTwoFa: FC<OwnProps & StateProps> = ({
|
|||||||
case SettingsScreens.TwoFaEnabled:
|
case SettingsScreens.TwoFaEnabled:
|
||||||
return (
|
return (
|
||||||
<SettingsTwoFaEnabled
|
<SettingsTwoFaEnabled
|
||||||
onScreenSelect={onScreenSelect}
|
|
||||||
isActive={isActive || [
|
isActive={isActive || [
|
||||||
SettingsScreens.TwoFaChangePasswordCurrent,
|
SettingsScreens.TwoFaChangePasswordCurrent,
|
||||||
SettingsScreens.TwoFaChangePasswordNew,
|
SettingsScreens.TwoFaChangePasswordNew,
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import type { FC } from '../../../../lib/teact/teact';
|
import type { FC } from '../../../../lib/teact/teact';
|
||||||
import React, { memo, useCallback } from '../../../../lib/teact/teact';
|
import React, { memo } from '../../../../lib/teact/teact';
|
||||||
|
import { getActions } from '../../../../global';
|
||||||
|
|
||||||
import { SettingsScreens } from '../../../../types';
|
import { SettingsScreens } from '../../../../types';
|
||||||
|
|
||||||
@ -7,6 +8,7 @@ import { STICKER_SIZE_TWO_FA } from '../../../../config';
|
|||||||
import { LOCAL_TGS_URLS } from '../../../common/helpers/animatedAssets';
|
import { LOCAL_TGS_URLS } from '../../../common/helpers/animatedAssets';
|
||||||
|
|
||||||
import useHistoryBack from '../../../../hooks/useHistoryBack';
|
import useHistoryBack from '../../../../hooks/useHistoryBack';
|
||||||
|
import useLastCallback from '../../../../hooks/useLastCallback';
|
||||||
import useOldLang from '../../../../hooks/useOldLang';
|
import useOldLang from '../../../../hooks/useOldLang';
|
||||||
|
|
||||||
import AnimatedIcon from '../../../common/AnimatedIcon';
|
import AnimatedIcon from '../../../common/AnimatedIcon';
|
||||||
@ -14,18 +16,18 @@ import Button from '../../../ui/Button';
|
|||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
isActive?: boolean;
|
isActive?: boolean;
|
||||||
onScreenSelect: (screen: SettingsScreens) => void;
|
|
||||||
onReset: () => void;
|
onReset: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
const SettingsTwoFaCongratulations: FC<OwnProps> = ({
|
const SettingsTwoFaCongratulations: FC<OwnProps> = ({
|
||||||
isActive, onReset, onScreenSelect,
|
isActive, onReset,
|
||||||
}) => {
|
}) => {
|
||||||
|
const { openSettingsScreen } = getActions();
|
||||||
const lang = useOldLang();
|
const lang = useOldLang();
|
||||||
|
|
||||||
const handleClick = useCallback(() => {
|
const handleClick = useLastCallback(() => {
|
||||||
onScreenSelect(SettingsScreens.Privacy);
|
openSettingsScreen({ screen: SettingsScreens.Privacy });
|
||||||
}, [onScreenSelect]);
|
});
|
||||||
|
|
||||||
useHistoryBack({
|
useHistoryBack({
|
||||||
isActive,
|
isActive,
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import type { FC } from '../../../../lib/teact/teact';
|
import type { FC } from '../../../../lib/teact/teact';
|
||||||
import React, { memo } from '../../../../lib/teact/teact';
|
import React, { memo } from '../../../../lib/teact/teact';
|
||||||
|
import { getActions } from '../../../../global';
|
||||||
|
|
||||||
import { SettingsScreens } from '../../../../types';
|
import { SettingsScreens } from '../../../../types';
|
||||||
|
|
||||||
@ -16,13 +17,13 @@ import lockPreviewUrl from '../../../../assets/lock.png';
|
|||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
isActive?: boolean;
|
isActive?: boolean;
|
||||||
onScreenSelect: (screen: SettingsScreens) => void;
|
|
||||||
onReset: () => void;
|
onReset: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
const SettingsTwoFaEnabled: FC<OwnProps> = ({
|
const SettingsTwoFaEnabled: FC<OwnProps> = ({
|
||||||
isActive, onReset, onScreenSelect,
|
isActive, onReset,
|
||||||
}) => {
|
}) => {
|
||||||
|
const { openSettingsScreen } = getActions();
|
||||||
const lang = useOldLang();
|
const lang = useOldLang();
|
||||||
|
|
||||||
useHistoryBack({
|
useHistoryBack({
|
||||||
@ -49,21 +50,21 @@ const SettingsTwoFaEnabled: FC<OwnProps> = ({
|
|||||||
<ListItem
|
<ListItem
|
||||||
icon="edit"
|
icon="edit"
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => onScreenSelect(SettingsScreens.TwoFaChangePasswordCurrent)}
|
onClick={() => openSettingsScreen({ screen: SettingsScreens.TwoFaChangePasswordCurrent })}
|
||||||
>
|
>
|
||||||
{lang('ChangePassword')}
|
{lang('ChangePassword')}
|
||||||
</ListItem>
|
</ListItem>
|
||||||
<ListItem
|
<ListItem
|
||||||
icon="password-off"
|
icon="password-off"
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => onScreenSelect(SettingsScreens.TwoFaTurnOff)}
|
onClick={() => openSettingsScreen({ screen: SettingsScreens.TwoFaTurnOff })}
|
||||||
>
|
>
|
||||||
{lang('TurnPasswordOff')}
|
{lang('TurnPasswordOff')}
|
||||||
</ListItem>
|
</ListItem>
|
||||||
<ListItem
|
<ListItem
|
||||||
icon="email"
|
icon="email"
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => onScreenSelect(SettingsScreens.TwoFaRecoveryEmailCurrentPassword)}
|
onClick={() => openSettingsScreen({ screen: SettingsScreens.TwoFaRecoveryEmailCurrentPassword })}
|
||||||
>
|
>
|
||||||
{lang('SetRecoveryEmail')}
|
{lang('SetRecoveryEmail')}
|
||||||
</ListItem>
|
</ListItem>
|
||||||
|
|||||||
@ -67,7 +67,7 @@ const SuggestedPhotoAction = ({
|
|||||||
title: lang('ActionSuggestedPhotoUpdatedTitle'),
|
title: lang('ActionSuggestedPhotoUpdatedTitle'),
|
||||||
message: lang('ActionSuggestedPhotoUpdatedDescription'),
|
message: lang('ActionSuggestedPhotoUpdatedDescription'),
|
||||||
action: {
|
action: {
|
||||||
action: 'requestNextSettingsScreen',
|
action: 'openSettingsScreen',
|
||||||
payload: {
|
payload: {
|
||||||
screen: SettingsScreens.Main,
|
screen: SettingsScreens.Main,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import { getActions, withGlobal } from '../../../../global';
|
|||||||
|
|
||||||
import type { ApiStarGiftUnique } from '../../../../api/types';
|
import type { ApiStarGiftUnique } from '../../../../api/types';
|
||||||
import type { TabState } from '../../../../global/types';
|
import type { TabState } from '../../../../global/types';
|
||||||
import type { CustomPeer } from '../../../../types';
|
import { type CustomPeer, SettingsScreens } from '../../../../types';
|
||||||
|
|
||||||
import { getDays } from '../../../../util/dates/units';
|
import { getDays } from '../../../../util/dates/units';
|
||||||
import { getServerTime } from '../../../../util/serverTime';
|
import { getServerTime } from '../../../../util/serverTime';
|
||||||
@ -22,6 +22,7 @@ import Avatar from '../../../common/Avatar';
|
|||||||
import Icon from '../../../common/icons/Icon';
|
import Icon from '../../../common/icons/Icon';
|
||||||
import PasswordForm from '../../../common/PasswordForm';
|
import PasswordForm from '../../../common/PasswordForm';
|
||||||
import RadialPatternBackground from '../../../common/profile/RadialPatternBackground';
|
import RadialPatternBackground from '../../../common/profile/RadialPatternBackground';
|
||||||
|
import Button from '../../../ui/Button';
|
||||||
import Modal from '../../../ui/Modal';
|
import Modal from '../../../ui/Modal';
|
||||||
|
|
||||||
import styles from './GiftWithdrawModal.module.scss';
|
import styles from './GiftWithdrawModal.module.scss';
|
||||||
@ -44,7 +45,13 @@ const FRAGMENT_PEER: CustomPeer = {
|
|||||||
const GIFT_STICKER_SIZE = 4.5 * REM;
|
const GIFT_STICKER_SIZE = 4.5 * REM;
|
||||||
|
|
||||||
const GiftWithdrawModal = ({ modal, hasPassword, passwordHint }: OwnProps & StateProps) => {
|
const GiftWithdrawModal = ({ modal, hasPassword, passwordHint }: OwnProps & StateProps) => {
|
||||||
const { closeGiftWithdrawModal, clearGiftWithdrawError, processStarGiftWithdrawal } = getActions();
|
const {
|
||||||
|
closeGiftWithdrawModal,
|
||||||
|
clearGiftWithdrawError,
|
||||||
|
closeGiftInfoModal,
|
||||||
|
processStarGiftWithdrawal,
|
||||||
|
openSettingsScreen,
|
||||||
|
} = getActions();
|
||||||
const isOpen = Boolean(modal);
|
const isOpen = Boolean(modal);
|
||||||
|
|
||||||
const [shouldShowPassword, setShouldShowPassword] = useState(false);
|
const [shouldShowPassword, setShouldShowPassword] = useState(false);
|
||||||
@ -68,6 +75,14 @@ const GiftWithdrawModal = ({ modal, hasPassword, passwordHint }: OwnProps & Stat
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const handleSetUpPassword = useLastCallback(() => {
|
||||||
|
openSettingsScreen({
|
||||||
|
screen: SettingsScreens.TwoFaDisabled,
|
||||||
|
});
|
||||||
|
closeGiftWithdrawModal();
|
||||||
|
closeGiftInfoModal();
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
isOpen={isOpen}
|
isOpen={isOpen}
|
||||||
@ -115,7 +130,12 @@ const GiftWithdrawModal = ({ modal, hasPassword, passwordHint }: OwnProps & Stat
|
|||||||
{lang('GiftWithdrawWait', { days: getDays(exportDelay) }, { pluralValue: getDays(exportDelay) })}
|
{lang('GiftWithdrawWait', { days: getDays(exportDelay) }, { pluralValue: getDays(exportDelay) })}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
{!hasPassword && <span className={styles.noPassword}>{lang('ErrorPasswordMissing')}</span>}
|
{!hasPassword && (
|
||||||
|
<>
|
||||||
|
<span className={styles.noPassword}>{lang('ErrorPasswordMissing')}</span>
|
||||||
|
<Button size="smaller" onClick={handleSetUpPassword}>{lang('SetUp2FA')}</Button>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
{hasPassword && !exportDelay && (
|
{hasPassword && !exportDelay && (
|
||||||
<PasswordForm
|
<PasswordForm
|
||||||
shouldShowSubmit
|
shouldShowSubmit
|
||||||
|
|||||||
@ -1140,7 +1140,7 @@ addActionHandler('addChatFolder', async (global, actions, payload): Promise<void
|
|||||||
folder: folderUpdate,
|
folder: folderUpdate,
|
||||||
});
|
});
|
||||||
|
|
||||||
actions.requestNextSettingsScreen({
|
actions.requestNextFoldersAction({
|
||||||
foldersAction: {
|
foldersAction: {
|
||||||
type: 'setFolderId',
|
type: 'setFolderId',
|
||||||
payload: maxId + 1,
|
payload: maxId + 1,
|
||||||
@ -2629,7 +2629,7 @@ addActionHandler('createChatlistInvite', async (global, actions, payload): Promi
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (CHATLIST_LIMIT_ERROR_LIST.has((error as ApiError).message)) {
|
if (CHATLIST_LIMIT_ERROR_LIST.has((error as ApiError).message)) {
|
||||||
actions.openLimitReachedModal({ limit: 'chatlistInvites', tabId });
|
actions.openLimitReachedModal({ limit: 'chatlistInvites', tabId });
|
||||||
actions.requestNextSettingsScreen({ screen: SettingsScreens.Folders, tabId });
|
actions.openSettingsScreen({ screen: SettingsScreens.Folders, tabId });
|
||||||
} else {
|
} else {
|
||||||
actions.showDialog({ data: { ...(error as ApiError), hasErrorKey: true }, tabId });
|
actions.showDialog({ data: { ...(error as ApiError), hasErrorKey: true }, tabId });
|
||||||
}
|
}
|
||||||
|
|||||||
@ -66,7 +66,7 @@ addActionHandler('setPasscode', async (global, actions, payload): Promise<void>
|
|||||||
message: 'Failed to set passcode',
|
message: 'Failed to set passcode',
|
||||||
tabId,
|
tabId,
|
||||||
});
|
});
|
||||||
actions.requestNextSettingsScreen({ screen: SettingsScreens.PasscodeDisabled, tabId });
|
actions.openSettingsScreen({ screen: SettingsScreens.PasscodeDisabled, tabId });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { addCallback } from '../../../lib/teact/teactn';
|
import { addCallback } from '../../../lib/teact/teactn';
|
||||||
|
|
||||||
import type { ActionReturnType, GlobalState } from '../../types';
|
import type { ActionReturnType, GlobalState } from '../../types';
|
||||||
import { type LangCode, SettingsScreens } from '../../../types';
|
import { type LangCode, LeftColumnContent, SettingsScreens } from '../../../types';
|
||||||
|
|
||||||
import { requestMutation } from '../../../lib/fasterdom/fasterdom';
|
import { requestMutation } from '../../../lib/fasterdom/fasterdom';
|
||||||
import { IS_IOS } from '../../../util/browser/windowEnvironment';
|
import { IS_IOS } from '../../../util/browser/windowEnvironment';
|
||||||
@ -17,7 +17,7 @@ import {
|
|||||||
} from '../../index';
|
} from '../../index';
|
||||||
import { replaceSettings, updateSharedSettings, updateThemeSettings } from '../../reducers';
|
import { replaceSettings, updateSharedSettings, updateThemeSettings } from '../../reducers';
|
||||||
import { updateTabState } from '../../reducers/tabs';
|
import { updateTabState } from '../../reducers/tabs';
|
||||||
import { selectCanAnimateInterface, selectChatFolder } from '../../selectors';
|
import { selectCanAnimateInterface, selectChatFolder, selectTabState } from '../../selectors';
|
||||||
import { selectSharedSettings } from '../../selectors/sharedState';
|
import { selectSharedSettings } from '../../selectors/sharedState';
|
||||||
|
|
||||||
let prevGlobal: GlobalState | undefined;
|
let prevGlobal: GlobalState | undefined;
|
||||||
@ -142,22 +142,48 @@ addActionHandler('setThemeSettings', (global, actions, payload): ActionReturnTyp
|
|||||||
return updateThemeSettings(global, theme, settings);
|
return updateThemeSettings(global, theme, settings);
|
||||||
});
|
});
|
||||||
|
|
||||||
addActionHandler('requestNextSettingsScreen', (global, actions, payload): ActionReturnType => {
|
addActionHandler('requestNextFoldersAction', (global, actions, payload): ActionReturnType => {
|
||||||
const { screen, foldersAction, tabId = getCurrentTabId() } = payload;
|
const { foldersAction, tabId = getCurrentTabId() } = payload;
|
||||||
return updateTabState(global, {
|
return updateTabState(global, {
|
||||||
nextSettingsScreen: screen,
|
|
||||||
nextFoldersAction: foldersAction,
|
nextFoldersAction: foldersAction,
|
||||||
}, tabId);
|
}, tabId);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
addActionHandler('openLeftColumnContent', (global, actions, payload): ActionReturnType => {
|
||||||
|
const { contentKey = LeftColumnContent.ChatList, tabId = getCurrentTabId() } = payload;
|
||||||
|
const tabState = selectTabState(global, tabId);
|
||||||
|
return updateTabState(global, {
|
||||||
|
leftColumn: {
|
||||||
|
...tabState.leftColumn,
|
||||||
|
contentKey,
|
||||||
|
},
|
||||||
|
}, tabId);
|
||||||
|
});
|
||||||
|
|
||||||
|
addActionHandler('openSettingsScreen', (global, actions, payload): ActionReturnType => {
|
||||||
|
const { screen = SettingsScreens.Main, tabId = getCurrentTabId() } = payload;
|
||||||
|
const tabState = selectTabState(global, tabId);
|
||||||
|
// Force settings only if new screen is passed, do not on resets
|
||||||
|
if (payload.screen) actions.openLeftColumnContent({ contentKey: LeftColumnContent.Settings, tabId });
|
||||||
|
return updateTabState(global, {
|
||||||
|
leftColumn: {
|
||||||
|
...tabState.leftColumn,
|
||||||
|
settingsScreen: screen,
|
||||||
|
},
|
||||||
|
}, tabId);
|
||||||
|
});
|
||||||
|
|
||||||
addActionHandler('openEditChatFolder', (global, actions, payload): ActionReturnType => {
|
addActionHandler('openEditChatFolder', (global, actions, payload): ActionReturnType => {
|
||||||
const { folderId, isOnlyInvites, tabId = getCurrentTabId() } = payload;
|
const { folderId, isOnlyInvites, tabId = getCurrentTabId() } = payload;
|
||||||
|
|
||||||
const chatFolder = selectChatFolder(global, folderId);
|
const chatFolder = selectChatFolder(global, folderId);
|
||||||
if (!chatFolder) return;
|
if (!chatFolder) return;
|
||||||
|
|
||||||
actions.requestNextSettingsScreen({
|
actions.openSettingsScreen({
|
||||||
screen: isOnlyInvites ? SettingsScreens.FoldersEditFolderInvites : SettingsScreens.FoldersEditFolderFromChatList,
|
screen: isOnlyInvites ? SettingsScreens.FoldersEditFolderInvites : SettingsScreens.FoldersEditFolderFromChatList,
|
||||||
|
tabId,
|
||||||
|
});
|
||||||
|
actions.requestNextFoldersAction({
|
||||||
foldersAction: {
|
foldersAction: {
|
||||||
type: 'editFolder',
|
type: 'editFolder',
|
||||||
payload: chatFolder,
|
payload: chatFolder,
|
||||||
@ -178,7 +204,7 @@ addActionHandler('openShareChatFolderModal', (global, actions, payload): ActionR
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!noRequestNextScreen) actions.requestNextSettingsScreen({ screen: SettingsScreens.FoldersShare, tabId });
|
if (!noRequestNextScreen) actions.openSettingsScreen({ screen: SettingsScreens.FoldersShare, tabId });
|
||||||
|
|
||||||
return updateTabState(global, {
|
return updateTabState(global, {
|
||||||
shareFolderScreen: {
|
shareFolderScreen: {
|
||||||
@ -192,7 +218,7 @@ addActionHandler('openShareChatFolderModal', (global, actions, payload): ActionR
|
|||||||
addActionHandler('closeShareChatFolderModal', (global, actions, payload): ActionReturnType => {
|
addActionHandler('closeShareChatFolderModal', (global, actions, payload): ActionReturnType => {
|
||||||
const { tabId = getCurrentTabId() } = payload || {};
|
const { tabId = getCurrentTabId() } = payload || {};
|
||||||
|
|
||||||
actions.requestNextSettingsScreen({ screen: undefined, tabId });
|
actions.openSettingsScreen({ screen: undefined, tabId });
|
||||||
|
|
||||||
return updateTabState(global, {
|
return updateTabState(global, {
|
||||||
shareFolderScreen: undefined,
|
shareFolderScreen: undefined,
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import type { PerformanceType } from '../types';
|
import type { PerformanceType } from '../types';
|
||||||
import type { GlobalState, SharedState, TabState } from './types';
|
import type { GlobalState, SharedState, TabState } from './types';
|
||||||
import { NewChatMembersProgress } from '../types';
|
import { LeftColumnContent, NewChatMembersProgress, SettingsScreens } from '../types';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ANIMATION_LEVEL_DEFAULT,
|
ANIMATION_LEVEL_DEFAULT,
|
||||||
@ -361,6 +361,11 @@ export const INITIAL_TAB_STATE: TabState = {
|
|||||||
|
|
||||||
userSearch: {},
|
userSearch: {},
|
||||||
|
|
||||||
|
leftColumn: {
|
||||||
|
contentKey: LeftColumnContent.ChatList,
|
||||||
|
settingsScreen: SettingsScreens.Main,
|
||||||
|
},
|
||||||
|
|
||||||
middleSearch: {
|
middleSearch: {
|
||||||
byChatThreadKey: {},
|
byChatThreadKey: {},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -168,3 +168,15 @@ export function selectActiveWebApp<T extends GlobalState>(
|
|||||||
|
|
||||||
return selectWebApp(global, activeWebAppKey, tabId);
|
return selectWebApp(global, activeWebAppKey, tabId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function selectLeftColumnContentKey<T extends GlobalState>(
|
||||||
|
global: T, ...[tabId = getCurrentTabId()]: TabArgs<T>
|
||||||
|
) {
|
||||||
|
return selectTabState(global, tabId).leftColumn.contentKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function selectSettingsScreen<T extends GlobalState>(
|
||||||
|
global: T, ...[tabId = getCurrentTabId()]: TabArgs<T>
|
||||||
|
) {
|
||||||
|
return selectTabState(global, tabId).leftColumn.settingsScreen;
|
||||||
|
}
|
||||||
|
|||||||
@ -67,6 +67,7 @@ import type {
|
|||||||
GlobalSearchContent,
|
GlobalSearchContent,
|
||||||
IAnchorPosition,
|
IAnchorPosition,
|
||||||
IThemeSettings,
|
IThemeSettings,
|
||||||
|
LeftColumnContent,
|
||||||
LoadMoreDirection,
|
LoadMoreDirection,
|
||||||
ManagementScreens,
|
ManagementScreens,
|
||||||
MediaViewerMedia,
|
MediaViewerMedia,
|
||||||
@ -2308,8 +2309,13 @@ export interface ActionPayloads {
|
|||||||
} | undefined;
|
} | undefined;
|
||||||
loadPeerColors: undefined;
|
loadPeerColors: undefined;
|
||||||
loadTimezones: undefined;
|
loadTimezones: undefined;
|
||||||
requestNextSettingsScreen: {
|
openLeftColumnContent: {
|
||||||
|
contentKey?: LeftColumnContent;
|
||||||
|
} & WithTabId;
|
||||||
|
openSettingsScreen: {
|
||||||
screen?: SettingsScreens;
|
screen?: SettingsScreens;
|
||||||
|
} & WithTabId;
|
||||||
|
requestNextFoldersAction: {
|
||||||
foldersAction?: ReducerAction<FoldersActions>;
|
foldersAction?: ReducerAction<FoldersActions>;
|
||||||
} & WithTabId;
|
} & WithTabId;
|
||||||
sortChatFolders: { folderIds: number[] };
|
sortChatFolders: { folderIds: number[] };
|
||||||
|
|||||||
@ -65,6 +65,7 @@ import type {
|
|||||||
GlobalSearchContent,
|
GlobalSearchContent,
|
||||||
IAnchorPosition,
|
IAnchorPosition,
|
||||||
InlineBotSettings,
|
InlineBotSettings,
|
||||||
|
LeftColumnContent,
|
||||||
ManagementProgress,
|
ManagementProgress,
|
||||||
ManagementState,
|
ManagementState,
|
||||||
MediaViewerMedia,
|
MediaViewerMedia,
|
||||||
@ -120,7 +121,6 @@ export type TabState = {
|
|||||||
shouldCloseRightColumn?: boolean;
|
shouldCloseRightColumn?: boolean;
|
||||||
nextProfileTab?: ProfileTabType;
|
nextProfileTab?: ProfileTabType;
|
||||||
forceScrollProfileTab?: boolean;
|
forceScrollProfileTab?: boolean;
|
||||||
nextSettingsScreen?: SettingsScreens;
|
|
||||||
nextFoldersAction?: ReducerAction<FoldersActions>;
|
nextFoldersAction?: ReducerAction<FoldersActions>;
|
||||||
shareFolderScreen?: {
|
shareFolderScreen?: {
|
||||||
folderId: number;
|
folderId: number;
|
||||||
@ -217,6 +217,11 @@ export type TabState = {
|
|||||||
filter: GiftProfileFilterOptions;
|
filter: GiftProfileFilterOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
leftColumn: {
|
||||||
|
contentKey: LeftColumnContent;
|
||||||
|
settingsScreen: SettingsScreens;
|
||||||
|
};
|
||||||
|
|
||||||
globalSearch: {
|
globalSearch: {
|
||||||
query?: string;
|
query?: string;
|
||||||
minDate?: number;
|
minDate?: number;
|
||||||
|
|||||||
1
src/types/language.d.ts
vendored
1
src/types/language.d.ts
vendored
@ -1368,6 +1368,7 @@ export interface LangPair {
|
|||||||
'GiftFilterHidden': undefined;
|
'GiftFilterHidden': undefined;
|
||||||
'GiftSearchEmpty': undefined;
|
'GiftSearchEmpty': undefined;
|
||||||
'GiftSearchReset': undefined;
|
'GiftSearchReset': undefined;
|
||||||
|
'SetUp2FA': undefined;
|
||||||
'CheckPasswordTitle': undefined;
|
'CheckPasswordTitle': undefined;
|
||||||
'CheckPasswordPlaceholder': undefined;
|
'CheckPasswordPlaceholder': undefined;
|
||||||
'CheckPasswordDescription': undefined;
|
'CheckPasswordDescription': undefined;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user