Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: Improve repositories folder structure #18235

Open
wants to merge 13 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
# Components
'comp: calling':
files:
- 'src/script/calling/.*'
- 'src/script/repositories/calling/.*'
'comp: preferences':
files:
- 'src/script/properties/.*'
- 'src/script/repositories/properties/.*'
'comp: infrastructure':
files:
- '.elasticbeanstalk'
Expand Down
1 change: 1 addition & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const config: Config = {
'Hooks/(.*)': '<rootDir>/src/script/hooks/$1',
'I18n/(.*)': '<rootDir>/src/i18n/$1',
'Resource/(.*)': '<rootDir>/resource/$1',
'Repositories/(.*)': '<rootDir>/src/script/repositories/$1',
'Util/(.*)': '<rootDir>/src/script/util/$1',
'^react(.*)$': '<rootDir>/node_modules/react$1',
'.*\\.glsl': 'jest-transform-stub',
Expand Down
4 changes: 2 additions & 2 deletions src/script/E2EIdentity/E2EIdentityEnrollment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ import {container} from 'tsyringe';

import {PrimaryModal} from 'Components/Modals/PrimaryModal';
import {PrimaryModalType} from 'Components/Modals/PrimaryModal/PrimaryModalTypes';
import {ConversationState} from 'Repositories/conversation/ConversationState';
import {UserState} from 'Repositories/user/UserState';
import {Core} from 'src/script/service/CoreSingleton';
import {UserState} from 'src/script/user/UserState';
import * as util from 'Util/util';

import {E2EIHandler} from './E2EIdentityEnrollment';
import * as e2EIdentityVerification from './E2EIdentityVerification';
import {getEnrollmentStore} from './Enrollment.store';
import {OIDCServiceStore} from './OIDCService/OIDCServiceStorage';

import {ConversationState} from '../conversation/ConversationState';
import {Conversation} from '../entity/Conversation';
import {User} from '../entity/User';

Expand Down
2 changes: 1 addition & 1 deletion src/script/E2EIdentity/E2EIdentityEnrollment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import {TypedEventEmitter} from '@wireapp/commons';
import {WebAppEvents} from '@wireapp/webapp-events';

import {PrimaryModal, removeCurrentModal} from 'Components/Modals/PrimaryModal';
import {UserState} from 'Repositories/user/UserState';
import {Core} from 'src/script/service/CoreSingleton';
import {UserState} from 'src/script/user/UserState';
import {getLogger} from 'Util/Logger';
import {formatDelayTime, TIME_IN_MILLIS} from 'Util/TimeUtil';
import {removeUrlParameters} from 'Util/UrlUtil';
Expand Down
3 changes: 1 addition & 2 deletions src/script/E2EIdentity/E2EIdentityVerification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ import {DeviceIdentity} from '@wireapp/core/lib/messagingProtocols/mls';
import {StringifiedQualifiedId, stringifyQualifiedId} from '@wireapp/core/lib/util/qualifiedIdUtil';
import {container} from 'tsyringe';

import {ConversationState} from 'Repositories/conversation/ConversationState';
import {Core} from 'src/script/service/CoreSingleton';
import {base64ToArray} from 'Util/util';

import {mapMLSStatus, MLSStatuses} from './mlsStatus';

import {ConversationState} from '../conversation/ConversationState';

export {MLSStatuses};

export type WireIdentity = Omit<DeviceIdentity, 'status'> & {
Expand Down
4 changes: 2 additions & 2 deletions src/script/auth/configureEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
*
*/

import '../event/Client';
import '../message/MessageCategorization';
import '../message/MessageCategory';
import '../repositories/event/Client';
import '../repositories/storage/StorageSchemata';
import '../service/BackendEnvironment';
import '../storage/StorageSchemata';
2 changes: 1 addition & 1 deletion src/script/auth/module/action/ClientAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {ClientInfo} from '@wireapp/core/lib/client/';

import {Runtime} from '@wireapp/commons';

import {getClientMLSConfig} from 'src/script/client/clientMLSConfig';
import {getClientMLSConfig} from 'Repositories/client/clientMLSConfig';

import {ClientActionCreator} from './creator/';

Expand Down
4 changes: 2 additions & 2 deletions src/script/auth/page/OAuthPermissions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ import {
} from '@wireapp/react-ui-kit';

import * as Icon from 'Components/Icon';
import {AssetRemoteData} from 'src/script/assets/AssetRemoteData';
import {AssetRepository} from 'src/script/assets/AssetRepository';
import {AssetRemoteData} from 'Repositories/assets/AssetRemoteData';
import {AssetRepository} from 'Repositories/assets/AssetRepository';
import {handleEscDown, handleKeyDown} from 'Util/KeyboardUtil';
import {loadDataUrl} from 'Util/util';

Expand Down
6 changes: 3 additions & 3 deletions src/script/components/AppContainer/AppContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ import {StyledApp, THEME_ID} from '@wireapp/react-ui-kit';
import {DetachedCallingCell} from 'Components/calling/DetachedCallingCell';
import {PrimaryModalComponent} from 'Components/Modals/PrimaryModal/PrimaryModal';
import {QualityFeedbackModal} from 'Components/Modals/QualityFeedbackModal';
import {useAppSoftLock} from 'Hooks/useAppSoftLock';
import {useSingleInstance} from 'Hooks/useSingleInstance';
import {PROPERTIES_TYPE} from 'Repositories/properties/PropertiesType';
import {SIGN_OUT_REASON} from 'src/script/auth/SignOutReason';
import {useAppSoftLock} from 'src/script/hooks/useAppSoftLock';
import {useSingleInstance} from 'src/script/hooks/useSingleInstance';
import {PROPERTIES_TYPE} from 'src/script/properties/PropertiesType';
import {isDetachedCallingFeatureEnabled} from 'Util/isDetachedCallingFeatureEnabled';

import {useAccentColor} from './hooks/useAccentColor';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {useEffect} from 'react';
import ko from 'knockout';
import {container} from 'tsyringe';

import {UserState} from 'src/script/user/UserState';
import {UserState} from 'Repositories/user/UserState';

function setAccentColor(accentColor?: number) {
if (!accentColor) {
Expand Down
3 changes: 2 additions & 1 deletion src/script/components/Avatar/Avatar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@

import {fireEvent, render} from '@testing-library/react';

import {ServiceEntity} from 'Repositories/integration/ServiceEntity';

import {Avatar} from './Avatar';

import {User} from '../../entity/User';
import {ServiceEntity} from '../../integration/ServiceEntity';

describe('Avatar', () => {
it('executes onClick with current participant', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/script/components/Avatar/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import {HTMLProps, MouseEvent as ReactMouseEvent, KeyboardEvent as ReactKeyBoardEvent} from 'react';

import {ServiceEntity} from 'Repositories/integration/ServiceEntity';
import {useKoSubscribableChildren} from 'Util/ComponentUtil';
import {handleKeyDown, isKeyboardEvent} from 'Util/KeyboardUtil';

Expand All @@ -29,7 +30,6 @@ import {UserAvatar} from './UserAvatar';

import {User} from '../../entity/User';
import {isServiceEntity} from '../../guards/Service';
import {ServiceEntity} from '../../integration/ServiceEntity';

export enum AVATAR_SIZE {
LARGE = 'avatar-l',
Expand Down
4 changes: 2 additions & 2 deletions src/script/components/Avatar/AvatarImage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
import {render, waitFor} from '@testing-library/react';

import {AVATAR_SIZE} from 'Components/Avatar';
import {AssetRemoteData} from 'src/script/assets/AssetRemoteData';
import {AssetRemoteData} from 'Repositories/assets/AssetRemoteData';
import {AssetRepository} from 'Repositories/assets/AssetRepository';

import {AvatarImage} from './AvatarImage';

import {AssetRepository} from '../../assets/AssetRepository';
import {User} from '../../entity/User';

describe('AvatarImage', () => {
Expand Down
5 changes: 2 additions & 3 deletions src/script/components/Avatar/AvatarImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@ import {Transition} from 'react-transition-group';
import {container} from 'tsyringe';

import {InViewport} from 'Components/InViewport';
import {AssetRemoteData} from 'Repositories/assets/AssetRemoteData';
import {AssetRepository} from 'Repositories/assets/AssetRepository';
import {CSS_FILL_PARENT} from 'Util/CSSMixin';

import {AssetRemoteData} from '../../assets/AssetRemoteData';
import {AssetRepository} from '../../assets/AssetRepository';

import {AVATAR_SIZE} from '.';

export interface AvatarImageProps {
Expand Down
3 changes: 1 addition & 2 deletions src/script/components/Avatar/ServiceAvatar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@
import {render} from '@testing-library/react';

import {AVATAR_SIZE} from 'Components/Avatar';
import {ServiceEntity} from 'Repositories/integration/ServiceEntity';

import {ServiceAvatar} from './ServiceAvatar';

import {ServiceEntity} from '../../integration/ServiceEntity';

describe('ServiceAvatar', () => {
it('shows a service icon', async () => {
const service = new ServiceEntity({id: 'id'});
Expand Down
3 changes: 1 addition & 2 deletions src/script/components/Avatar/ServiceAvatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@ import React from 'react';
import ko from 'knockout';

import * as Icon from 'Components/Icon';
import {ServiceEntity} from 'Repositories/integration/ServiceEntity';
import {CSS_FILL_PARENT} from 'Util/CSSMixin';

import {AvatarBackground} from './AvatarBackground';
import {AvatarBorder} from './AvatarBorder';
import {AvatarImage} from './AvatarImage';
import {AvatarWrapper} from './AvatarWrapper';

import {ServiceEntity} from '../../integration/ServiceEntity';

import {AVATAR_SIZE} from '.';

interface ServiceAvatarProps extends React.HTMLProps<HTMLDivElement> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import {render} from '@testing-library/react';

import {Availability} from '@wireapp/protocol-messaging';

import {TeamState} from 'Repositories/team/TeamState';
import {User} from 'src/script/entity/User';
import {TeamState} from 'src/script/team/TeamState';

import {UserAvatar} from './UserAvatar';

Expand Down
2 changes: 1 addition & 1 deletion src/script/components/Avatar/UserAvatar/UserAvatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ import {COLOR} from '@wireapp/react-ui-kit';

import {AvailabilityIcon} from 'Components/AvailabilityIcon';
import {useUserName} from 'Components/UserName';
import {TeamState} from 'Repositories/team/TeamState';
import {useKoSubscribableChildren} from 'Util/ComponentUtil';
import {t} from 'Util/LocalizerUtil';

import {User} from '../../../entity/User';
import {TeamState} from '../../../team/TeamState';
import {AVATAR_SIZE, STATE} from '../Avatar';
import {AvatarBackground} from '../AvatarBackground';
import {AvatarBadge} from '../AvatarBadge';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ import {
Tooltip,
} from '@wireapp/react-ui-kit';

import {ClientEntity} from 'src/script/client';
import {ConversationVerificationState} from 'src/script/conversation/ConversationVerificationState';
import {checkUserHandle} from 'src/script/conversation/ConversationVerificationStateHandler';
import {useUserIdentity} from 'Hooks/useDeviceIdentities';
import {ClientEntity} from 'Repositories/client';
import {ConversationVerificationState} from 'Repositories/conversation/ConversationVerificationState';
import {checkUserHandle} from 'Repositories/conversation/ConversationVerificationStateHandler';
import {UserState} from 'Repositories/user/UserState';
import {MLSStatuses, WireIdentity} from 'src/script/E2EIdentity/E2EIdentityVerification';
import {Conversation} from 'src/script/entity/Conversation';
import {User} from 'src/script/entity/User';
import {useUserIdentity} from 'src/script/hooks/useDeviceIdentities';
import {UserState} from 'src/script/user/UserState';
import {useKoSubscribableChildren} from 'Util/ComponentUtil';
import {StringIdentifer, t} from 'Util/LocalizerUtil';
import {waitFor} from 'Util/waitFor';
Expand Down
2 changes: 1 addition & 1 deletion src/script/components/ConfigToolbar/ConfigToolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import {container} from 'tsyringe';

import {Button, Input, Switch} from '@wireapp/react-ui-kit';

import {ConversationState} from 'Repositories/conversation/ConversationState';
import {Config, Configuration} from 'src/script/Config';
import {ConversationState} from 'src/script/conversation/ConversationState';
import {useClickOutside} from 'src/script/hooks/useClickOutside';

import {wrapperStyles} from './ConfigToolbar.styles';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ import {Avatar, AVATAR_SIZE} from 'Components/Avatar';
import {UserClassifiedBar} from 'Components/ClassifiedBar/ClassifiedBar';
import {UnverifiedUserWarning} from 'Components/Modals/UserModal';
import {UserName} from 'Components/UserName';
import {TeamState} from 'Repositories/team/TeamState';
import {UserState} from 'Repositories/user/UserState';
import {SidebarTabs, useSidebarStore} from 'src/script/page/LeftSidebar/panels/Conversations/useSidebarStore';
import {useAppMainState, ViewType} from 'src/script/page/state';
import {useKoSubscribableChildren} from 'Util/ComponentUtil';
import {t} from 'Util/LocalizerUtil';

import {User} from '../../entity/User';
import {RootContext} from '../../page/RootProvider';
import {TeamState} from '../../team/TeamState';
import {UserState} from '../../user/UserState';

interface ConnectRequestsProps {
readonly userState: UserState;
Expand Down
10 changes: 5 additions & 5 deletions src/script/components/Conversation/Conversation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@ import {showDetailViewModal} from 'Components/Modals/DetailViewModal';
import {PrimaryModal} from 'Components/Modals/PrimaryModal';
import {showWarningModal} from 'Components/Modals/utils/showWarningModal';
import {TitleBar} from 'Components/TitleBar';
import {CallState} from 'src/script/calling/CallState';
import {CallState} from 'Repositories/calling/CallState';
import {ConversationState} from 'Repositories/conversation/ConversationState';
import {ServiceEntity} from 'Repositories/integration/ServiceEntity';
import {PROPERTIES_TYPE} from 'Repositories/properties/PropertiesType';
import {TeamState} from 'Repositories/team/TeamState';
import {Config} from 'src/script/Config';
import {PROPERTIES_TYPE} from 'src/script/properties/PropertiesType';
import {useKoSubscribableChildren} from 'Util/ComponentUtil';
import {isLastReceivedMessage} from 'Util/conversationMessages';
import {allowsAllFiles, getFileExtensionOrName, hasAllowedExtension} from 'Util/FileTypeUtil';
Expand All @@ -49,7 +52,6 @@ import {useReadReceiptSender} from './hooks/useReadReceipt';
import {ReadOnlyConversationMessage} from './ReadOnlyConversationMessage';
import {checkFileSharingPermission} from './utils/checkFileSharingPermission';

import {ConversationState} from '../../conversation/ConversationState';
import {Conversation as ConversationEntity} from '../../entity/Conversation';
import {ContentMessage} from '../../entity/message/ContentMessage';
import {DecryptErrorMessage} from '../../entity/message/DecryptErrorMessage';
Expand All @@ -59,12 +61,10 @@ import {User} from '../../entity/User';
import {UserError} from '../../error/UserError';
import {isMouseRightClickEvent, isAuxRightClickEvent} from '../../guards/Mouse';
import {isServiceEntity} from '../../guards/Service';
import {ServiceEntity} from '../../integration/ServiceEntity';
import {MotionDuration} from '../../motion/MotionDuration';
import {RightSidebarParams} from '../../page/AppMain';
import {PanelState} from '../../page/RightSidebar';
import {useMainViewModel} from '../../page/RootProvider';
import {TeamState} from '../../team/TeamState';
import {ElementType, MessageDetails} from '../MessagesList/Message/ContentMessage/asset/TextMessageRenderer';

interface ConversationProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import {render} from '@testing-library/react';
import {ConnectionStatus} from '@wireapp/api-client/lib/connection';
import {CONVERSATION_TYPE} from '@wireapp/api-client/lib/conversation';

import {ConnectionEntity} from 'Repositories/connection/ConnectionEntity';
import {CONVERSATION_READONLY_STATE} from 'Repositories/conversation/ConversationRepository';
import {withTheme} from 'src/script/auth/util/test/TestUtil';
import {ConnectionEntity} from 'src/script/connection/ConnectionEntity';
import {CONVERSATION_READONLY_STATE} from 'src/script/conversation/ConversationRepository';
import {Conversation} from 'src/script/entity/Conversation';
import {User} from 'src/script/entity/User';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import ko from 'knockout';
import {Link, LinkVariant} from '@wireapp/react-ui-kit';

import * as Icon from 'Components/Icon';
import {CONVERSATION_READONLY_STATE} from 'src/script/conversation/ConversationRepository';
import {CONVERSATION_READONLY_STATE} from 'Repositories/conversation/ConversationRepository';
import {Conversation} from 'src/script/entity/Conversation';
import {useKoSubscribableChildren} from 'Util/ComponentUtil';
import {t} from 'Util/LocalizerUtil';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {useCallback, useRef} from 'react';

import {groupBy} from 'underscore';

import {MessageRepository} from 'src/script/conversation/MessageRepository';
import {MessageRepository} from 'Repositories/conversation/MessageRepository';
import {Conversation} from 'src/script/entity/Conversation';
import {Message} from 'src/script/entity/message/Message';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import {container} from 'tsyringe';

import {showWarningModal} from 'Components/Modals/utils/showWarningModal';
import {TeamState} from 'src/script/team/TeamState';
import {TeamState} from 'Repositories/team/TeamState';
import {t} from 'Util/LocalizerUtil';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ import cx from 'classnames';
import {Avatar, AVATAR_SIZE, GroupAvatar} from 'Components/Avatar';
import {UserBlockedBadge} from 'Components/Badge';
import {UserInfo} from 'Components/UserInfo';
import {generateCellState} from 'Repositories/conversation/ConversationCellState';
import {MediaType} from 'Repositories/media/MediaType';
import {useKoSubscribableChildren} from 'Util/ComponentUtil';
import {isKey, isOneOfKeys, KEY} from 'Util/KeyboardUtil';
import {t} from 'Util/LocalizerUtil';
import {noop, setContextMenuPosition} from 'Util/util';

import {StatusIcon} from './components/StatusIcon';

import {generateCellState} from '../../conversation/ConversationCellState';
import type {Conversation} from '../../entity/Conversation';
import {MediaType} from '../../media/MediaType';

export interface ConversationListCellProps {
conversation: Conversation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
import {useMemo} from 'react';

import * as Icon from 'Components/Icon';
import {generateCellState} from 'Repositories/conversation/ConversationCellState';
import {ConversationStatusIcon} from 'Repositories/conversation/ConversationStatusIcon';
import {useKoSubscribableChildren} from 'Util/ComponentUtil';
import {t} from 'Util/LocalizerUtil';

import {generateCellState} from '../../../../conversation/ConversationCellState';
import {ConversationStatusIcon} from '../../../../conversation/ConversationStatusIcon';
import type {Conversation} from '../../../../entity/Conversation';

export interface Props {
Expand Down
3 changes: 1 addition & 2 deletions src/script/components/Giphy/Giphy.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@

import {fireEvent, render, waitFor} from '@testing-library/react';

import {GiphyRepository} from 'Repositories/giphy/GiphyRepository';
import {withTheme} from 'src/script/auth/util/test/TestUtil';

import {GiphyRepository} from '../../extension/GiphyRepository';

import {Giphy, GiphyState} from '.';

const inputValue = 'Yammy yammy';
Expand Down
Loading
Loading