Merge branch 'clearnet' into audio-messages-play-all
commit
397b0d09dc
@ -1,4 +0,0 @@
|
||||
[submodule "session-file-server"]
|
||||
path = session-file-server
|
||||
url = https://github.com/loki-project/session-file-server/
|
||||
branch = session
|
@ -0,0 +1,68 @@
|
||||
import React from 'react';
|
||||
import { useSelector } from 'react-redux';
|
||||
import {
|
||||
getAddModeratorsModal,
|
||||
getAdminLeaveClosedGroupDialog,
|
||||
getChangeNickNameDialog,
|
||||
getConfirmModal,
|
||||
getEditProfileDialog,
|
||||
getInviteContactModal,
|
||||
getOnionPathDialog,
|
||||
getRecoveryPhraseDialog,
|
||||
getRemoveModeratorsModal,
|
||||
getSessionPasswordDialog,
|
||||
getUpdateGroupMembersModal,
|
||||
getUpdateGroupNameModal,
|
||||
getUserDetailsModal,
|
||||
} from '../../state/selectors/modal';
|
||||
import { AdminLeaveClosedGroupDialog } from '../conversation/AdminLeaveClosedGroupDialog';
|
||||
import { InviteContactsDialog } from '../conversation/InviteContactsDialog';
|
||||
import { AddModeratorsDialog } from '../conversation/ModeratorsAddDialog';
|
||||
import { RemoveModeratorsDialog } from '../conversation/ModeratorsRemoveDialog';
|
||||
import { UpdateGroupMembersDialog } from '../conversation/UpdateGroupMembersDialog';
|
||||
import { UpdateGroupNameDialog } from '../conversation/UpdateGroupNameDialog';
|
||||
import { EditProfileDialog } from '../EditProfileDialog';
|
||||
import { OnionPathModal } from '../OnionStatusPathDialog';
|
||||
import { UserDetailsDialog } from '../UserDetailsDialog';
|
||||
import { SessionConfirm } from './SessionConfirm';
|
||||
import { SessionNicknameDialog } from './SessionNicknameDialog';
|
||||
import { SessionPasswordModal } from './SessionPasswordModal';
|
||||
import { SessionSeedModal } from './SessionSeedModal';
|
||||
|
||||
export const ModalContainer = () => {
|
||||
const confirmModalState = useSelector(getConfirmModal);
|
||||
const inviteModalState = useSelector(getInviteContactModal);
|
||||
const addModeratorsModalState = useSelector(getAddModeratorsModal);
|
||||
const removeModeratorsModalState = useSelector(getRemoveModeratorsModal);
|
||||
const updateGroupMembersModalState = useSelector(getUpdateGroupMembersModal);
|
||||
const updateGroupNameModalState = useSelector(getUpdateGroupNameModal);
|
||||
const userDetailsModalState = useSelector(getUserDetailsModal);
|
||||
const changeNicknameModal = useSelector(getChangeNickNameDialog);
|
||||
const editProfileModalState = useSelector(getEditProfileDialog);
|
||||
const onionPathModalState = useSelector(getOnionPathDialog);
|
||||
const recoveryPhraseModalState = useSelector(getRecoveryPhraseDialog);
|
||||
const adminLeaveClosedGroupModalState = useSelector(getAdminLeaveClosedGroupDialog);
|
||||
const sessionPasswordModalState = useSelector(getSessionPasswordDialog);
|
||||
|
||||
return (
|
||||
<>
|
||||
{confirmModalState && <SessionConfirm {...confirmModalState} />}
|
||||
{inviteModalState && <InviteContactsDialog {...inviteModalState} />}
|
||||
{addModeratorsModalState && <AddModeratorsDialog {...addModeratorsModalState} />}
|
||||
{removeModeratorsModalState && <RemoveModeratorsDialog {...removeModeratorsModalState} />}
|
||||
{updateGroupMembersModalState && (
|
||||
<UpdateGroupMembersDialog {...updateGroupMembersModalState} />
|
||||
)}
|
||||
{updateGroupNameModalState && <UpdateGroupNameDialog {...updateGroupNameModalState} />}
|
||||
{userDetailsModalState && <UserDetailsDialog {...userDetailsModalState} />}
|
||||
{changeNicknameModal && <SessionNicknameDialog {...changeNicknameModal} />}
|
||||
{editProfileModalState && <EditProfileDialog {...editProfileModalState} />}
|
||||
{onionPathModalState && <OnionPathModal {...onionPathModalState} />}
|
||||
{recoveryPhraseModalState && <SessionSeedModal {...recoveryPhraseModalState} />}
|
||||
{adminLeaveClosedGroupModalState && (
|
||||
<AdminLeaveClosedGroupDialog {...adminLeaveClosedGroupModalState} />
|
||||
)}
|
||||
{sessionPasswordModalState && <SessionPasswordModal {...sessionPasswordModalState} />}
|
||||
</>
|
||||
);
|
||||
};
|
@ -1,22 +0,0 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
export function useNetwork() {
|
||||
const [isOnline, setNetwork] = useState(window.navigator.onLine);
|
||||
const updateNetwork = () => {
|
||||
setNetwork(window.navigator.onLine);
|
||||
};
|
||||
|
||||
// there are some weird behavior with this api.
|
||||
// basically, online events might not be called if the pc has a virtual machine running
|
||||
// https://github.com/electron/electron/issues/11290#issuecomment-348598311
|
||||
useEffect(() => {
|
||||
window.addEventListener('offline', updateNetwork);
|
||||
window.addEventListener('online', updateNetwork);
|
||||
|
||||
return () => {
|
||||
window.removeEventListener('offline', updateNetwork);
|
||||
window.removeEventListener('online', updateNetwork);
|
||||
};
|
||||
});
|
||||
return isOnline;
|
||||
}
|
Loading…
Reference in New Issue