From 4a9f5a58e82a9db2abdc5abd6c2b801a5b53abe4 Mon Sep 17 00:00:00 2001 From: Ikko Eltociear Ashimine Date: Fri, 15 Sep 2023 16:23:06 +0900 Subject: [PATCH 001/104] Fix typo in backendManager.ts occured -> occurred --- packages/backend/src/backendManager.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/backendManager.ts b/packages/backend/src/backendManager.ts index 9f3e9e21c6..f7e80b5e4e 100644 --- a/packages/backend/src/backendManager.ts +++ b/packages/backend/src/backendManager.ts @@ -72,7 +72,7 @@ export const runBackendDesktop = async () => { try { await connectionsManager.closeAllServices() } catch (e) { - log.error('Error occured while closing backend services', e) + log.error('Error occurred while closing backend services', e) } if (process.send) process.send('closed-services') } @@ -80,7 +80,7 @@ export const runBackendDesktop = async () => { try { await connectionsManager.leaveCommunity() } catch (e) { - log.error('Error occured while leaving community', e) + log.error('Error occurred while leaving community', e) } if (process.send) process.send('leftCommunity') } From d277513f57c684a1498a9ebfdeb8431b15b0489d Mon Sep 17 00:00:00 2001 From: Kacper Michalik Date: Tue, 19 Sep 2023 09:51:48 +0200 Subject: [PATCH 002/104] desktop - component, container, story and test --- packages/desktop/src/renderer/Root.tsx | 2 + .../AggressiveWarningModal.component.tsx | 80 ++++++++++ .../AggressiveWarningModal.container.tsx | 34 ++++ .../AggressiveWarningModal.stories.tsx | 33 ++++ .../AggressiveWarningModal.test.tsx | 146 ++++++++++++++++++ .../src/renderer/sagas/modals/modals.slice.ts | 3 +- .../src/renderer/sagas/modals/modals.types.ts | 1 + 7 files changed, 298 insertions(+), 1 deletion(-) create mode 100644 packages/desktop/src/renderer/components/widgets/aggressiveWarningModal/AggressiveWarningModal.component.tsx create mode 100644 packages/desktop/src/renderer/components/widgets/aggressiveWarningModal/AggressiveWarningModal.container.tsx create mode 100644 packages/desktop/src/renderer/components/widgets/aggressiveWarningModal/AggressiveWarningModal.stories.tsx create mode 100644 packages/desktop/src/renderer/components/widgets/aggressiveWarningModal/AggressiveWarningModal.test.tsx diff --git a/packages/desktop/src/renderer/Root.tsx b/packages/desktop/src/renderer/Root.tsx index 8717893233..09b673b166 100644 --- a/packages/desktop/src/renderer/Root.tsx +++ b/packages/desktop/src/renderer/Root.tsx @@ -31,6 +31,7 @@ import ChannelCreationModal from './components/ChannelCreationModal/ChannelCreat import { SaveStateComponent } from './components/SaveState/SaveStateComponent' import UnregisteredModalContainer from './components/widgets/userLabel/unregistered/UnregisteredModal.container' import DuplicateModalContainer from './components/widgets/userLabel/duplicate/DuplicateModal.container' +import AggressiveWarningModalContainer from './components/widgets/aggressiveWarningModal/AggressiveWarningModal.container' // Trigger lerna export const persistor = persistStore(store) @@ -48,6 +49,7 @@ export default () => { + diff --git a/packages/desktop/src/renderer/components/widgets/aggressiveWarningModal/AggressiveWarningModal.component.tsx b/packages/desktop/src/renderer/components/widgets/aggressiveWarningModal/AggressiveWarningModal.component.tsx new file mode 100644 index 0000000000..d622639a26 --- /dev/null +++ b/packages/desktop/src/renderer/components/widgets/aggressiveWarningModal/AggressiveWarningModal.component.tsx @@ -0,0 +1,80 @@ +import React from 'react' +import Modal from '../../ui/Modal/Modal' +import { Button, Grid, Typography } from '@mui/material' +import { styled } from '@mui/material/styles' +import WarnIcon from '../../../static/images/exclamationMark.svg' + +const PREFIX = 'AggressiveWarningModalComponent-' + +const classes = { + bodyText: `${PREFIX}bodyText`, + button: `${PREFIX}button`, + image: `${PREFIX}image`, +} + +const StyledGrid = styled(Grid)(({ theme }) => ({ + [`& .${classes.bodyText}`]: { + textAlign: 'center', + width: '65%', + margin: '24px 0 4px', + }, + [`& .${classes.image}`]: { + width: '70px', + height: '70px', + margin: '30px 0 24px', + }, + [`& .${classes.button}`]: { + marginTop: 16, + textTransform: 'none', + padding: '0 24px', + height: 40, + borderRadius: '8px', + color: theme.palette.colors.white, + backgroundColor: theme.palette.colors.quietBlue, + '&:hover': { + opacity: 0.7, + backgroundColor: theme.palette.colors.quietBlue, + }, + }, +})) + +export interface AggressiveWarningModalComponentProps { + communityName: string + leaveCommunity: () => void + open: boolean + handleClose: () => void +} + +const AggressiveWarningModalComponent: React.FC = ({ + communityName, + leaveCommunity, + handleClose, + open, +}) => { + return ( + + + + Possible impersonation attack + + The owner of {communityName} has registered an invalid username. Either something is very + broken, the community owner is trying to impersonate other users, or the community owner has been hacked. +
+ This should never happen and we recommend leaving this community immediately! +
+ +
+
+ ) +} + +export default AggressiveWarningModalComponent diff --git a/packages/desktop/src/renderer/components/widgets/aggressiveWarningModal/AggressiveWarningModal.container.tsx b/packages/desktop/src/renderer/components/widgets/aggressiveWarningModal/AggressiveWarningModal.container.tsx new file mode 100644 index 0000000000..03f764fa0d --- /dev/null +++ b/packages/desktop/src/renderer/components/widgets/aggressiveWarningModal/AggressiveWarningModal.container.tsx @@ -0,0 +1,34 @@ +import { capitalizeFirstLetter } from '@quiet/common' +import { communities } from '@quiet/state-manager' +import React from 'react' +import { useSelector } from 'react-redux' +import { clearCommunity } from '../../..' +import { useModal } from '../../../containers/hooks' +import { ModalName } from '../../../sagas/modals/modals.types' +import AggressiveWarningModalComponent from './AggressiveWarningModal.component' + +const AggressiveWarningModalContainer = () => { + const aggressiveWarningModal = useModal(ModalName.aggressiveWarningModal) + + const community = useSelector(communities.selectors.currentCommunity) + + let communityName = '' + + if (community?.name) { + communityName = capitalizeFirstLetter(community.name) + } + + const leaveCommunity = async () => { + await clearCommunity() + } + + return ( + + ) +} + +export default AggressiveWarningModalContainer diff --git a/packages/desktop/src/renderer/components/widgets/aggressiveWarningModal/AggressiveWarningModal.stories.tsx b/packages/desktop/src/renderer/components/widgets/aggressiveWarningModal/AggressiveWarningModal.stories.tsx new file mode 100644 index 0000000000..017046555d --- /dev/null +++ b/packages/desktop/src/renderer/components/widgets/aggressiveWarningModal/AggressiveWarningModal.stories.tsx @@ -0,0 +1,33 @@ +import React from 'react' +import { ComponentStory, ComponentMeta } from '@storybook/react' +import { withTheme } from '../../../storybook/decorators' +import AggressiveWarningModalComponent, { + AggressiveWarningModalComponentProps, +} from './AggressiveWarningModal.component' + +const Template: ComponentStory = args => { + return ( +
+ +
+ ) +} + +export const Component = Template.bind({}) + +const args: AggressiveWarningModalComponentProps = { + handleClose: function (): void {}, + open: true, + communityName: 'devteam', + leaveCommunity: function (): void {}, +} + +Component.args = args + +const component: ComponentMeta = { + title: 'Components/AggressiveWarningModalComponent', + decorators: [withTheme], + component: AggressiveWarningModalComponent, +} + +export default component diff --git a/packages/desktop/src/renderer/components/widgets/aggressiveWarningModal/AggressiveWarningModal.test.tsx b/packages/desktop/src/renderer/components/widgets/aggressiveWarningModal/AggressiveWarningModal.test.tsx new file mode 100644 index 0000000000..369755bacd --- /dev/null +++ b/packages/desktop/src/renderer/components/widgets/aggressiveWarningModal/AggressiveWarningModal.test.tsx @@ -0,0 +1,146 @@ +import React from 'react' +import theme from '../../../theme' +import { ThemeProvider } from '@mui/material/styles' +import { renderComponent } from '../../../testUtils/renderComponent' +import AggressiveWarningModalComponent from './AggressiveWarningModal.component' + +describe('UnregisteredModalComponent', () => { + it('renderComponent', () => { + const result = renderComponent( + + {}} + open={true} + communityName={'devteam'} + leaveCommunity={() => {}} + /> + + ) + expect(result.baseElement).toMatchInlineSnapshot(` + + +//
+//
+//
+// +//

+// Possible impersonation attack +//

+//

+// The owner of +// +// devteam +// +// has registered an invalid username. Either something is very broken, the community owner is trying to impersonate other users, or the community owner has been hacked. +//
+// +// This should never happen and we recommend leaving this community immediately! +// +//

+// +//
+//
+//
+// +//
+//
+// +// `) +// }) +// }) diff --git a/packages/desktop/src/renderer/sagas/modals/modals.slice.ts b/packages/desktop/src/renderer/sagas/modals/modals.slice.ts index 9452e8176a..2b5c9a42a8 100644 --- a/packages/desktop/src/renderer/sagas/modals/modals.slice.ts +++ b/packages/desktop/src/renderer/sagas/modals/modals.slice.ts @@ -35,7 +35,8 @@ export class ModalsInitialState { [ModalName.loadingPanel] = { open: true, args: {} }; // Loading modal is open by default and closes on websocket connection [ModalName.channelCreationModal] = { open: false, args: {} }; [ModalName.unregisteredUsernameModal] = { open: false, args: {} }; - [ModalName.duplicatedUsernameModal] = { open: false, args: {} } + [ModalName.duplicatedUsernameModal] = { open: false, args: {} }; + [ModalName.usernameTakenModal] = { open: false, args: {} } } export const modalsSlice = createSlice({ diff --git a/packages/desktop/src/renderer/sagas/modals/modals.types.ts b/packages/desktop/src/renderer/sagas/modals/modals.types.ts index 3b4c44ae71..26fcff1c8f 100644 --- a/packages/desktop/src/renderer/sagas/modals/modals.types.ts +++ b/packages/desktop/src/renderer/sagas/modals/modals.types.ts @@ -23,4 +23,5 @@ export enum ModalName { channelCreationModal = 'channelCreationModal', duplicatedUsernameModal = 'duplicatedUsernameModal', unregisteredUsernameModal = 'unregisteredUsernameModal', + usernameTakenModal = 'usernameTakenModal', } From 0b9157c51ee417c56533f178882c2794bd6fb473 Mon Sep 17 00:00:00 2001 From: Kacper Michalik Date: Wed, 20 Sep 2023 13:24:40 +0200 Subject: [PATCH 013/104] cleanup --- .../CreateUsername/UsernameCreated/UsernameCreated.test.tsx | 1 - .../components/AttachmentButton/AttachmentButton.component.tsx | 1 - 2 files changed, 2 deletions(-) diff --git a/packages/desktop/src/renderer/components/CreateUsername/UsernameCreated/UsernameCreated.test.tsx b/packages/desktop/src/renderer/components/CreateUsername/UsernameCreated/UsernameCreated.test.tsx index be91805216..113b477827 100644 --- a/packages/desktop/src/renderer/components/CreateUsername/UsernameCreated/UsernameCreated.test.tsx +++ b/packages/desktop/src/renderer/components/CreateUsername/UsernameCreated/UsernameCreated.test.tsx @@ -1,6 +1,5 @@ import React from 'react' import { renderComponent } from '../../../testUtils/renderComponent' - import { UsernameCreated } from './UsernameCreated' describe('UsernameCreated', () => { diff --git a/packages/mobile/src/components/AttachmentButton/AttachmentButton.component.tsx b/packages/mobile/src/components/AttachmentButton/AttachmentButton.component.tsx index 753dfcd74e..e909c12229 100644 --- a/packages/mobile/src/components/AttachmentButton/AttachmentButton.component.tsx +++ b/packages/mobile/src/components/AttachmentButton/AttachmentButton.component.tsx @@ -1,7 +1,6 @@ import React, { FC, useCallback } from 'react' import { TouchableWithoutFeedback, View, Image } from 'react-native' import { appImages } from '../../assets' - import { AttachmentButtonProps } from './AttachmentButton.types' export const AttachmentButton: FC = ({ onPress }) => { From cda3425d48b91adee6f2c4a2713dcb8aa4a01380 Mon Sep 17 00:00:00 2001 From: Kacper Michalik Date: Wed, 20 Sep 2023 13:26:01 +0200 Subject: [PATCH 014/104] Publish - quiet@2.0.0-alpha.12 - @quiet/mobile@2.0.0-alpha.12 --- packages/desktop/CHANGELOG.md | 8 ++++++++ packages/desktop/package-lock.json | 4 ++-- packages/desktop/package.json | 2 +- packages/mobile/CHANGELOG.md | 8 ++++++++ packages/mobile/android/app/build.gradle | 4 ++-- packages/mobile/ios/Quiet/Info.plist | 2 +- packages/mobile/ios/QuietTests/Info.plist | 2 +- packages/mobile/package-lock.json | 4 ++-- packages/mobile/package.json | 2 +- 9 files changed, 26 insertions(+), 10 deletions(-) diff --git a/packages/desktop/CHANGELOG.md b/packages/desktop/CHANGELOG.md index c4507beb58..d5b73f4e05 100644 --- a/packages/desktop/CHANGELOG.md +++ b/packages/desktop/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.0.0-alpha.12](https://github.com/TryQuiet/quiet/compare/quiet@2.0.0-alpha.11...quiet@2.0.0-alpha.12) (2023-09-20) + +**Note:** Version bump only for package quiet + + + + + # [2.0.0-alpha.11](https://github.com/TryQuiet/quiet/compare/quiet@2.0.0-alpha.10...quiet@2.0.0-alpha.11) (2023-09-19) **Note:** Version bump only for package quiet diff --git a/packages/desktop/package-lock.json b/packages/desktop/package-lock.json index 74cda56a8e..1061f080c1 100644 --- a/packages/desktop/package-lock.json +++ b/packages/desktop/package-lock.json @@ -1,12 +1,12 @@ { "name": "quiet", - "version": "2.0.0-alpha.11", + "version": "2.0.0-alpha.12", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "quiet", - "version": "2.0.0-alpha.11", + "version": "2.0.0-alpha.12", "license": "ISC", "dependencies": { "@electron/remote": "^2.0.8", diff --git a/packages/desktop/package.json b/packages/desktop/package.json index 8ce080c5a0..091c032dd3 100644 --- a/packages/desktop/package.json +++ b/packages/desktop/package.json @@ -80,7 +80,7 @@ }, "homepage": "https://github.com/TryQuiet", "@comment version": "To build new version for specific platform, just replace platform in version tag to one of following linux, mac, windows", - "version": "2.0.0-alpha.11", + "version": "2.0.0-alpha.12", "description": "Decentralized team chat", "main": "dist/main/main.js", "scripts": { diff --git a/packages/mobile/CHANGELOG.md b/packages/mobile/CHANGELOG.md index ad20d6c1b1..630afac4b8 100644 --- a/packages/mobile/CHANGELOG.md +++ b/packages/mobile/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.0.0-alpha.12](https://github.com/TryQuiet/quiet/compare/@quiet/mobile@2.0.0-alpha.11...@quiet/mobile@2.0.0-alpha.12) (2023-09-20) + +**Note:** Version bump only for package @quiet/mobile + + + + + # [2.0.0-alpha.11](https://github.com/TryQuiet/quiet/compare/@quiet/mobile@2.0.0-alpha.10...@quiet/mobile@2.0.0-alpha.11) (2023-09-19) **Note:** Version bump only for package @quiet/mobile diff --git a/packages/mobile/android/app/build.gradle b/packages/mobile/android/app/build.gradle index 462db8e4dc..f13e24b6dc 100644 --- a/packages/mobile/android/app/build.gradle +++ b/packages/mobile/android/app/build.gradle @@ -166,8 +166,8 @@ android { applicationId "com.quietmobile" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 326 - versionName "2.0.0-alpha.11" + versionCode 327 + versionName "2.0.0-alpha.12" resValue "string", "build_config_package", "com.quietmobile" testBuildType System.getProperty('testBuildType', 'debug') testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' diff --git a/packages/mobile/ios/Quiet/Info.plist b/packages/mobile/ios/Quiet/Info.plist index 2179911326..d41314aafb 100644 --- a/packages/mobile/ios/Quiet/Info.plist +++ b/packages/mobile/ios/Quiet/Info.plist @@ -34,7 +34,7 @@ CFBundleVersion - 305 + 306 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/packages/mobile/ios/QuietTests/Info.plist b/packages/mobile/ios/QuietTests/Info.plist index 0582485980..5fbf1ca88f 100644 --- a/packages/mobile/ios/QuietTests/Info.plist +++ b/packages/mobile/ios/QuietTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 306 + 307 diff --git a/packages/mobile/package-lock.json b/packages/mobile/package-lock.json index b50c2ddd27..45e20ecf60 100644 --- a/packages/mobile/package-lock.json +++ b/packages/mobile/package-lock.json @@ -1,12 +1,12 @@ { "name": "@quiet/mobile", - "version": "2.0.0-alpha.11", + "version": "2.0.0-alpha.12", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@quiet/mobile", - "version": "2.0.0-alpha.11", + "version": "2.0.0-alpha.12", "dependencies": { "@peculiar/webcrypto": "^1.4.3", "@react-native-clipboard/clipboard": "^1.11.2", diff --git a/packages/mobile/package.json b/packages/mobile/package.json index cfba041308..c1e2a5fb50 100644 --- a/packages/mobile/package.json +++ b/packages/mobile/package.json @@ -1,6 +1,6 @@ { "name": "@quiet/mobile", - "version": "2.0.0-alpha.11", + "version": "2.0.0-alpha.12", "scripts": { "build": "tsc -p tsconfig.build.json --noEmit", "storybook-android": "ENVFILE=.env.storybook react-native run-android --variant=storybookDebug --appIdSuffix=storybook.debug", From 1c766617c84fb15cd76a79df9e7123bff6be9a59 Mon Sep 17 00:00:00 2001 From: Kacper Michalik Date: Thu, 21 Sep 2023 11:32:41 +0200 Subject: [PATCH 015/104] adjust component --- .../CreateUsernameComponent.tsx | 242 +++++++++++------- .../UsernameTakenModal.container.tsx | 18 +- .../UsernameTakenModal.stories.tsx | 33 --- .../UsernameTakenModal.test.tsx | 146 ----------- 4 files changed, 165 insertions(+), 274 deletions(-) delete mode 100644 packages/desktop/src/renderer/components/widgets/usernameTakenModal/UsernameTakenModal.stories.tsx delete mode 100644 packages/desktop/src/renderer/components/widgets/usernameTakenModal/UsernameTakenModal.test.tsx diff --git a/packages/desktop/src/renderer/components/CreateUsername/CreateUsernameComponent.tsx b/packages/desktop/src/renderer/components/CreateUsername/CreateUsernameComponent.tsx index e6bd961bdf..1b2f2375ae 100644 --- a/packages/desktop/src/renderer/components/CreateUsername/CreateUsernameComponent.tsx +++ b/packages/desktop/src/renderer/components/CreateUsername/CreateUsernameComponent.tsx @@ -4,11 +4,8 @@ import classNames from 'classnames' import { Controller, useForm } from 'react-hook-form' import Typography from '@mui/material/Typography' import Grid from '@mui/material/Grid' - import WarningIcon from '@mui/icons-material/Warning' - import Modal from '../ui/Modal/Modal' - import { LoadingButton } from '../ui/LoadingButton/LoadingButton' import { TextInput } from '../../forms/components/textInput' import { userNameField } from '../../forms/fields/createUserFields' @@ -32,6 +29,9 @@ const classes = { progressBar: `${PREFIX}progressBar`, info: `${PREFIX}info`, inputLabel: `${PREFIX}inputLabel`, + marginMedium: `${PREFIX}marginMedium`, + buttonModern: `${PREFIX}buttonModern`, + buttonMargin: `${PREFIX}buttonMargin`, } const StyledModalContent = styled(Grid)(({ theme }) => ({ @@ -82,6 +82,11 @@ const StyledModalContent = styled(Grid)(({ theme }) => ({ fontWeight: 'normal', }, + [`& .${classes.buttonModern}`]: { + borderRadius: 8, + width: 110, + }, + [`& .${classes.title}`]: { marginBottom: 24, }, @@ -120,6 +125,10 @@ const StyledModalContent = styled(Grid)(({ theme }) => ({ marginBottom: 2, color: theme.palette.colors.black30, }, + + [`& .${classes.marginMedium}`]: { + marginTop: 24, + }, })) const userFields = { @@ -130,9 +139,9 @@ interface CreateUserValues { userName: string } -enum UsernameVariant { - NEW_USER = 'new-user', - USERNAME_TAKEN = 'username-taken', +export enum UsernameVariant { + NEW = 'new', + TAKEN = 'taken', } export interface CreateUsernameComponentProps { @@ -152,9 +161,10 @@ export const CreateUsernameComponent: React.FC = ( certificate, handleClose, currentUsername, - variant = UsernameVariant.NEW_USER, + variant = UsernameVariant.NEW, }) => { - const isNewUser = variant === UsernameVariant.NEW_USER + const isNewUser = variant === UsernameVariant.NEW + const [isUsernameRequested, setIsUsernameRequested] = useState(false) const [formSent, setFormSent] = useState(false) const [userName, setUserName] = useState('') @@ -174,7 +184,12 @@ export const CreateUsernameComponent: React.FC = ( }) const onSubmit = (values: CreateUserValues) => { - submitForm(registerUsername, values, setFormSent) + if (isNewUser) { + submitForm(registerUsername, values, setFormSent) + } else { + registerUsername(parseName(values.userName)) + setIsUsernameRequested(true) + } } const submitForm = ( @@ -206,94 +221,137 @@ export const CreateUsernameComponent: React.FC = ( }, [certificateRegistrationError]) return ( - + - <> - - - {isNewUser ? ( - <> - - Register a username - - Choose your favorite username - - ) : ( - <> - - We’re sorry, but the username {currentUsername && `@${currentUsername}`} was - already claimed by someone else.
- Can you choose another name? -
+ {!isUsernameRequested ? ( + <> + + + {isNewUser ? ( + <> + + Register a username + + Choose your favorite username + + ) : ( + <> + + We’re sorry, but the username {currentUsername && `@${currentUsername}`} was + already claimed by someone else.
+ Can you choose another name? +
+ + + Enter username + + + )} - - Enter username + ( + e.preventDefault()} + variant='outlined' + onchange={event => { + event.persist() + const value = event.target.value + onChange(value) + // Call default + field.onChange(event) + }} + onblur={() => { + field.onBlur() + }} + value={field.value} + /> + )} + /> + + {!isNewUser && ( + + Your username will be public, but you can choose any name you like. No spaces or special characters. + Lowercase letters and numbers only. - - )} - - ( - e.preventDefault()} - variant='outlined' - onchange={event => { - event.persist() - const value = event.target.value - onChange(value) - // Call default - field.onChange(event) - }} - onblur={() => { - field.onBlur() - }} - value={field.value} - /> )} - /> -
- {!errors.userName && userName.length > 0 && parsedNameDiffers && ( - - - - - - - Your username will be registered as {`@${userName}`} - +
+ {!errors.userName && userName.length > 0 && parsedNameDiffers && ( + + + + + + + Your username will be registered as {`@${userName}`} + + - - )} -
- -
- - + )} +
+ +
+ + + ) : ( + <> + + Great! Your new username should be registered automatically the next time the community owner is online. + + + + + )}
) diff --git a/packages/desktop/src/renderer/components/widgets/usernameTakenModal/UsernameTakenModal.container.tsx b/packages/desktop/src/renderer/components/widgets/usernameTakenModal/UsernameTakenModal.container.tsx index 9ba1063016..88f536e6bb 100644 --- a/packages/desktop/src/renderer/components/widgets/usernameTakenModal/UsernameTakenModal.container.tsx +++ b/packages/desktop/src/renderer/components/widgets/usernameTakenModal/UsernameTakenModal.container.tsx @@ -1,15 +1,27 @@ +import { identity } from '@quiet/state-manager' import React from 'react' +import { useSelector } from 'react-redux' import { useModal } from '../../../containers/hooks' import { ModalName } from '../../../sagas/modals/modals.types' +import CreateUsernameComponent, { UsernameVariant } from '../../CreateUsername/CreateUsernameComponent' const UsernameTakenModalContainer = () => { const usernameTakenModal = useModal(ModalName.usernameTakenModal) - const enterUsername = () => {} + const enterUsername = (username: string) => { + console.log({ username }) + } - const currentUsername = 'johhny' + const user = useSelector(identity.selectors.currentIdentity) - return

test

+ return ( + + ) } export default UsernameTakenModalContainer diff --git a/packages/desktop/src/renderer/components/widgets/usernameTakenModal/UsernameTakenModal.stories.tsx b/packages/desktop/src/renderer/components/widgets/usernameTakenModal/UsernameTakenModal.stories.tsx deleted file mode 100644 index 4ad6edf423..0000000000 --- a/packages/desktop/src/renderer/components/widgets/usernameTakenModal/UsernameTakenModal.stories.tsx +++ /dev/null @@ -1,33 +0,0 @@ -// import React from 'react' -// import { ComponentStory, ComponentMeta } from '@storybook/react' -// import { withTheme } from '../../../storybook/decorators' -// import AggressiveWarningModalComponent, { -// AggressiveWarningModalComponentProps, -// } from './AggressiveWarningModal.component' - -// const Template: ComponentStory = args => { -// return ( -//
-// -//
-// ) -// } - -// export const Component = Template.bind({}) - -// const args: AggressiveWarningModalComponentProps = { -// handleClose: function (): void {}, -// open: true, -// communityName: 'devteam', -// leaveCommunity: function (): void {}, -// } - -// Component.args = args - -// const component: ComponentMeta = { -// title: 'Components/AggressiveWarningModalComponent', -// decorators: [withTheme], -// component: AggressiveWarningModalComponent, -// } - -// export default component diff --git a/packages/desktop/src/renderer/components/widgets/usernameTakenModal/UsernameTakenModal.test.tsx b/packages/desktop/src/renderer/components/widgets/usernameTakenModal/UsernameTakenModal.test.tsx deleted file mode 100644 index 9b7a402e8c..0000000000 --- a/packages/desktop/src/renderer/components/widgets/usernameTakenModal/UsernameTakenModal.test.tsx +++ /dev/null @@ -1,146 +0,0 @@ -// import React from 'react' -// import theme from '../../../theme' -// import { ThemeProvider } from '@mui/material/styles' -// import { renderComponent } from '../../../testUtils/renderComponent' -// import AggressiveWarningModalComponent from './AggressiveWarningModal.component' - -// describe('AgressiveWarningModalComponent', () => { -// it('renderComponent', () => { -// const result = renderComponent( -// -// {}} -// open={true} -// communityName={'devteam'} -// leaveCommunity={() => {}} -// /> -// -// ) -// expect(result.baseElement).toMatchInlineSnapshot(` -// -// +
+
+
+
+
+

+ We’re sorry, but the username + + @jack + + was already claimed by someone else. +
+ Can you choose another name? +

+

+ Enter username +

+
+
+ + +
+
+

+ + Your username will be public, but you can choose any name you like. No spaces or special characters. Lowercase letters and numbers only. + +

+ +
+ +
+
+
+
+
+
+ + `) + }) +}) From 781a2bb5f8ec63e51cb23cc9e618107b03fc0278 Mon Sep 17 00:00:00 2001 From: Kacper Michalik Date: Wed, 27 Sep 2023 14:09:54 +0200 Subject: [PATCH 053/104] add test case for registerCertificate saga --- .../registerCertificate.saga.test.ts | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/packages/state-manager/src/sagas/identity/registerCertificate/registerCertificate.saga.test.ts b/packages/state-manager/src/sagas/identity/registerCertificate/registerCertificate.saga.test.ts index 81e94d2372..dacb04a8c2 100644 --- a/packages/state-manager/src/sagas/identity/registerCertificate/registerCertificate.saga.test.ts +++ b/packages/state-manager/src/sagas/identity/registerCertificate/registerCertificate.saga.test.ts @@ -105,4 +105,61 @@ describe('registerCertificateSaga', () => { .put(communitiesActions.launchCommunity(community.id)) .run() }) + + it('launch community when user is not community owner and he used username which was taken', async () => { + setupCrypto() + const socket = { emit: jest.fn(), on: jest.fn() } as unknown as Socket + + const store = prepareStore().store + + const factory = await getFactory(store) + + const community = await factory.create['payload']>( + 'Community', + { + id: '1', + name: 'rockets', + registrarUrl: 'http://registrarUrl.onion', + CA: null, + rootCa: 'rootCa', + peerList: [], + registrar: null, + onionAddress: '', + privateKey: '', + port: 0, + } + ) + + const userCsr: UserCsr = { + userCsr: 'userCsr', + userKey: 'userKey', + pkcs10: jest.fn() as unknown as CertData, + } + + const identity = ( + await factory.build('Identity', { + id: community.id, + }) + ).payload + + identity.userCsr = userCsr + + store.dispatch(identityActions.addNewIdentity(identity)) + + const registerCertificatePayload: RegisterCertificatePayload = { + communityId: community.id, + nickname: identity.nickname, + userCsr: identity.userCsr, + isUsernameTaken: true, + } + + const reducer = combineReducers(reducers) + await expectSaga(registerCertificateSaga, socket, identityActions.registerCertificate(registerCertificatePayload)) + .withReducer(reducer) + .withState(store.getState()) + .not.apply(socket, socket.emit, [SocketActionTypes.REGISTER_OWNER_CERTIFICATE]) + .not.put(communitiesActions.launchCommunity(community.id)) + .put(identityActions.saveUserCsr()) + .run() + }) }) From 85810f1c4e1b99c7f9d822f0374160d8ff524523 Mon Sep 17 00:00:00 2001 From: Emi Date: Wed, 27 Sep 2023 16:05:28 +0200 Subject: [PATCH 054/104] Bump actions/checkout to v3 (node12->node16) --- .github/workflows/build-release.yml | 6 +++--- .github/workflows/check-visual-regression.yml | 2 +- .github/workflows/check.yml | 2 +- .github/workflows/deploy-android.yaml | 2 +- .github/workflows/deploy-ios.yml | 2 +- .github/workflows/e2e-linux.yml | 2 +- .github/workflows/e2e-mac.yml | 2 +- .github/workflows/e2e-win.yml | 2 +- .github/workflows/frontend-tests.yml | 2 +- .github/workflows/identity-tests.yml | 2 +- .github/workflows/integration-tests.yml | 2 +- .github/workflows/mobile-tests.yml | 2 +- .github/workflows/nectar-tests.yml | 2 +- .github/workflows/regression-test.yml | 2 +- .github/workflows/waggle-tests.yml | 6 +++--- 15 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index cccdbde5a0..cf4631a229 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -25,7 +25,7 @@ jobs: CHECKSUM_PATH: ${{ github.event.action == 'released' && 'packages/desktop/dist/latest-linux.yml' || 'packages/desktop/dist/alpha-linux.yml' }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup environment uses: ./.github/actions/setup-env @@ -96,7 +96,7 @@ jobs: S3_BUCKET: ${{ github.event.action == 'released' && 'quiet' || 'test.quiet' }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: actions-rs/components-nightly@v1 with: @@ -169,7 +169,7 @@ jobs: S3_BUCKET: ${{ github.event.action == 'released' && 'quiet' || 'test.quiet' }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: "Fetch jsign" shell: bash diff --git a/.github/workflows/check-visual-regression.yml b/.github/workflows/check-visual-regression.yml index c0002933fb..dae9c165b4 100644 --- a/.github/workflows/check-visual-regression.yml +++ b/.github/workflows/check-visual-regression.yml @@ -17,7 +17,7 @@ jobs: - name: "Print OS" run: echo ${{ matrix.os }} - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 # Required to retrieve git history diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 863782b5e1..f10ae5150a 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -16,7 +16,7 @@ jobs: - name: "Print OS" run: echo ${{ matrix.os }} - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: "Remove test files workaround (jest types conflicting with cypress types)" if: ${{ runner.os == 'Windows' }} diff --git a/.github/workflows/deploy-android.yaml b/.github/workflows/deploy-android.yaml index 881fa11bb1..89ebf9ae28 100644 --- a/.github/workflows/deploy-android.yaml +++ b/.github/workflows/deploy-android.yaml @@ -19,7 +19,7 @@ jobs: - name: "Print OS" run: echo ${{ matrix.os }} - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: "Set up JDK" uses: actions/setup-java@v3 diff --git a/.github/workflows/deploy-ios.yml b/.github/workflows/deploy-ios.yml index 65964761c3..ad2424cde9 100644 --- a/.github/workflows/deploy-ios.yml +++ b/.github/workflows/deploy-ios.yml @@ -19,7 +19,7 @@ jobs: - name: "Print OS" run: echo ${{ matrix.os }} - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: lfs: true diff --git a/.github/workflows/e2e-linux.yml b/.github/workflows/e2e-linux.yml index e2dd29f39a..779cdfb836 100644 --- a/.github/workflows/e2e-linux.yml +++ b/.github/workflows/e2e-linux.yml @@ -18,7 +18,7 @@ jobs: TEST_MODE: true steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install WM run: sudo apt install fluxbox diff --git a/.github/workflows/e2e-mac.yml b/.github/workflows/e2e-mac.yml index 8e1b0c5e17..69df3d5d74 100644 --- a/.github/workflows/e2e-mac.yml +++ b/.github/workflows/e2e-mac.yml @@ -11,7 +11,7 @@ jobs: IS_E2E: true steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: "Setup environment" uses: ./.github/actions/setup-env diff --git a/.github/workflows/e2e-win.yml b/.github/workflows/e2e-win.yml index 9f3fa52e37..b654561d3f 100644 --- a/.github/workflows/e2e-win.yml +++ b/.github/workflows/e2e-win.yml @@ -13,7 +13,7 @@ jobs: E2E: true steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: "Setup environment" uses: ./.github/actions/setup-env diff --git a/.github/workflows/frontend-tests.yml b/.github/workflows/frontend-tests.yml index fbdbdf19d9..9fdf6487cb 100644 --- a/.github/workflows/frontend-tests.yml +++ b/.github/workflows/frontend-tests.yml @@ -18,7 +18,7 @@ jobs: - name: "Print OS" run: echo ${{ matrix.os }} - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: "Setup environment" uses: ./.github/actions/setup-env diff --git a/.github/workflows/identity-tests.yml b/.github/workflows/identity-tests.yml index 6a83d07a21..a553775f8c 100644 --- a/.github/workflows/identity-tests.yml +++ b/.github/workflows/identity-tests.yml @@ -18,7 +18,7 @@ jobs: - name: "Print OS" run: echo ${{ matrix.os }} - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: "Setup environment" uses: ./.github/actions/setup-env diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 48bc41d289..ed217a897e 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -20,7 +20,7 @@ jobs: - name: 'Print OS' run: echo ${{ matrix.os }} - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: "Setup environment" uses: ./.github/actions/setup-env diff --git a/.github/workflows/mobile-tests.yml b/.github/workflows/mobile-tests.yml index ad9e047059..cd57d786f3 100644 --- a/.github/workflows/mobile-tests.yml +++ b/.github/workflows/mobile-tests.yml @@ -18,7 +18,7 @@ jobs: - name: "Print OS" run: echo ${{ matrix.os }} - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup environment uses: ./.github/actions/setup-env diff --git a/.github/workflows/nectar-tests.yml b/.github/workflows/nectar-tests.yml index b5e3b966bb..2eea110f1d 100644 --- a/.github/workflows/nectar-tests.yml +++ b/.github/workflows/nectar-tests.yml @@ -18,7 +18,7 @@ jobs: - name: "Print OS" run: echo ${{ matrix.os }} - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: "Setup environment" uses: ./.github/actions/setup-env diff --git a/.github/workflows/regression-test.yml b/.github/workflows/regression-test.yml index 1eb554931e..9a07c459eb 100644 --- a/.github/workflows/regression-test.yml +++ b/.github/workflows/regression-test.yml @@ -18,7 +18,7 @@ jobs: - name: "Print OS" run: echo ${{ matrix.os }} - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup environment uses: ./.github/actions/setup-env diff --git a/.github/workflows/waggle-tests.yml b/.github/workflows/waggle-tests.yml index 6bae30f594..3bf08f322d 100644 --- a/.github/workflows/waggle-tests.yml +++ b/.github/workflows/waggle-tests.yml @@ -17,7 +17,7 @@ jobs: - name: "Print OS" run: echo ${{ matrix.os }} - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: "Setup environment" uses: ./.github/actions/setup-env @@ -38,7 +38,7 @@ jobs: - name: "Print OS" run: echo ${{ matrix.os }} - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: "Setup environment" uses: ./.github/actions/setup-env @@ -59,7 +59,7 @@ jobs: - name: "Print OS" run: echo ${{ matrix.os }} - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: "Setup environment" uses: ./.github/actions/setup-env From 102ef6e9deb5f4de8fee5e9b152d0e495f6a2227 Mon Sep 17 00:00:00 2001 From: Emi Date: Wed, 27 Sep 2023 16:58:44 +0200 Subject: [PATCH 055/104] Bump Saionaro/extract-package-version and actions/upload-artifact to versions using node16 --- .github/workflows/build-release.yml | 6 +++--- .github/workflows/deploy-android.yaml | 2 +- .github/workflows/deploy-ios.yml | 2 +- .github/workflows/e2e-win.yml | 4 ++-- .github/workflows/regression-test.yml | 2 +- CHANGELOG.md | 2 ++ 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index cf4631a229..12a1ecdbf3 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -144,7 +144,7 @@ jobs: - name: Extract version id: extract_version - uses: Saionaro/extract-package-version@v1.1.1 + uses: Saionaro/extract-package-version@v1.2.1 with: path: packages/desktop @@ -208,7 +208,7 @@ jobs: # - name: E2E - Extract version # id: extract_version - # uses: Saionaro/extract-package-version@v1.1.1 + # uses: Saionaro/extract-package-version@v1.2.1 # with: # path: packages/desktop @@ -265,7 +265,7 @@ jobs: - name: Extract version id: extract_version - uses: Saionaro/extract-package-version@v1.1.1 + uses: Saionaro/extract-package-version@v1.2.1 with: path: packages/desktop diff --git a/.github/workflows/deploy-android.yaml b/.github/workflows/deploy-android.yaml index 89ebf9ae28..192e83131a 100644 --- a/.github/workflows/deploy-android.yaml +++ b/.github/workflows/deploy-android.yaml @@ -65,7 +65,7 @@ jobs: - name: "Upload Artifact" continue-on-error: true - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: app-standard-release.aab path: ./packages/mobile/android/app/build/outputs/bundle/standardRelease/app-standard-release.aab diff --git a/.github/workflows/deploy-ios.yml b/.github/workflows/deploy-ios.yml index ad2424cde9..cab540230a 100644 --- a/.github/workflows/deploy-ios.yml +++ b/.github/workflows/deploy-ios.yml @@ -70,7 +70,7 @@ jobs: -exportPath build/ - name: Upload artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: Quiet.ipa path: ./packages/mobile/ios/build/Quiet.ipa diff --git a/.github/workflows/e2e-win.yml b/.github/workflows/e2e-win.yml index b654561d3f..12d617de4c 100644 --- a/.github/workflows/e2e-win.yml +++ b/.github/workflows/e2e-win.yml @@ -41,7 +41,7 @@ jobs: - name: Extract version id: extract_version - uses: Saionaro/extract-package-version@v1.1.1 + uses: Saionaro/extract-package-version@v1.2.1 with: path: packages/desktop @@ -56,7 +56,7 @@ jobs: shell: bash - name: "Upload built app" - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: quiet-windows path: ./packages/desktop/dist/Quiet Setup ${{ steps.extract_version.outputs.version }}.exe diff --git a/.github/workflows/regression-test.yml b/.github/workflows/regression-test.yml index 9a07c459eb..1df9b377dd 100644 --- a/.github/workflows/regression-test.yml +++ b/.github/workflows/regression-test.yml @@ -38,7 +38,7 @@ jobs: working-directory: packages/desktop - name: Archive test screenshots - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: always() with: name: test-screenshots-linux diff --git a/CHANGELOG.md b/CHANGELOG.md index aa1dfc66ae..118a8cc78a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ * Running Chromatic tests for forked PRs +* Bump github actions/* to versions using node16 + [2.0.0-alpha.11] * Customize Launch Screen on iOS From e8f7c100b662a5449d41de80257b96627ac1fbab Mon Sep 17 00:00:00 2001 From: Wiktor Sieprawski Date: Thu, 28 Sep 2023 10:42:16 +0200 Subject: [PATCH 056/104] Match designs for mobile chat input (#1841) * Adapt chat input to match designs * Support multiline input formatting * Undo chat stories changes * Lint fix --- .../mobile/assets/icons/paperclip_black.png | Bin 423 -> 0 bytes .../mobile/assets/icons/paperclip_gray.png | Bin 655 -> 1637 bytes packages/mobile/src/assets.ts | 4 +- .../AttachmentButton.component.tsx | 6 +- .../AttachmentButton.test.tsx | 6 +- .../src/components/Chat/Chat.component.tsx | 48 ++-- .../__snapshots__/Chat.test.tsx.snap | 213 ++++++++++-------- .../CreateCommunity.test.tsx.snap | 16 +- .../src/components/Input/Input.component.tsx | 21 +- .../src/components/Input/Input.styles.ts | 33 +-- .../src/components/Input/Input.test.tsx | 16 +- .../src/components/Input/Input.types.ts | 1 + .../__snapshots__/JoinCommunity.test.tsx.snap | 16 +- .../MessageSendButton.component.tsx | 4 +- .../MessageSendButton.test.tsx | 4 +- .../src/styles/palettes/default.palette.ts | 2 +- 16 files changed, 224 insertions(+), 166 deletions(-) delete mode 100644 packages/mobile/assets/icons/paperclip_black.png diff --git a/packages/mobile/assets/icons/paperclip_black.png b/packages/mobile/assets/icons/paperclip_black.png deleted file mode 100644 index 7bd53562a2a7479dd4ba75a0ce5dad28c2194477..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 423 zcmV;Y0a*TtP)t}_E(7?^o8@7$R?_svjn zlrqlmL=P@-nf-SDL!VLPyLj7>(eEolur#%|y*?+yO1 zvP?y?EoqT8mSrTa8E}jG-xlAyhR;eJ^!g_JAvQALpV4|#f{D2BT@g5Zk$Sl#y|i3$ z_>PaUzlM`MaX7+K>@T8@~0drDELIAGL9O(c600d`2O+f$vv5yPP6!yFDWFpsl>m=%PKGHkJeHY-5Af_Bdh^u2cJ zU>e<0y(H^#zjJ(~qbilH|F`O;suF-82!bF8f*{n+4)l;DNrsP)k7L}8c6WE*=f|I) zpTFVe0gv5doD^!HR|cG)pC6;RN4OgsL|@?Nc4ud2f@Wk;5xp<~1&s0E{SWR&;Kr;f zBRXvWWi=@L1@4}JKN+T#TwY$@KtT4OqoDW^3idzljv)*~ybH#o(FpDk2t+3hP~v~W z-Jc;aXhIy)gwAC_8{$U>(W#(K)fUt_vB7zOwW!1E>+4(aq*Df1h);#;O;J^o$_?C% zRoM|~(pX>`A29v`Jm`!8hT>-^+MlL%e2kYUBRHm$$>bC~=!5|l;vd*nCCf~}G~fB$ z1-sC4suW+PPX_$Wg=1OZRmE+!0ac5igRSQTUJB|T!;Zj%)*4Wk`0Bf;z~%0Oh<*z= z(nt9Km)`lyc%6a zw8DUfh!5c2oz2pC1DYbfs_8^UVS~ZoGdR*{0~++trv_Kdh2d}f0**A+fF_AgV1tY6 zj>z!)=ir(yG?0+uQ(8U^C6$J*XEX&58rK;YO8kO!=mGnw?cIXCokvekPctrDbxCL7 z$N(Bdh2j&`$4~Y312Cjad}QXE{WT^Fs#yG-7z{BGpZbR;;7KD4s7ZWd48&hW3sLxQ zJqxN?{27#BB0h#suCA`85P+@T0X2(1r$Sg0ZX+Y!`& zu8L2;hn@-V?d@er;OVQu4Ct`<7c@C<;}BiLuZicxjGQ37p*<3xhdN0MNbS^F~g3Xq9GN8}mhi)%e8<4C= ziS28mi1-#*wF8p%sw1B?QAB)8tnL7{-i=P|ki&d$zO>#H%rGhMYz#MfhF0QLg1O>f-*RS~}&(=s4tj?cJ!U&J?~)Bvh_ z0y7U5^Zr}zJQ3fFQUmaZvyCpy`~NFCUQ%NsM0|yh0V#J*Nq4P?zd@-1DAxO;<9K2B zn$u$DcqZb%#<@EhFRoBTyl^(lQp<&j_#2oQ5P=;-E+El7(C(x7goy#R51-lisz&vO zzKTyc8-Upf_fOB5<50BtU7y7#O8bIn9Rw8n&2es(D9YopdYVFUK^$Y)1Ex7eF}`4J zX^dO#1MV)1Pm~&fLeFtiB$BSMy+J`@COE?IDRyr_8C@5jFsX*lnV=z;r{nP%Zn*P| z=!5u#Nf|&w7M25e@w!gBLvUPSsxRUbCVfF9BKL0|C+oGAi_Tj$y1;S_O`pUkj2dE^ zH8W{=%3s`hDAZh;z;@bgKt`YTNqoZSp}ZOg^Z-mFOLZ@#C27Pc%(1FHy?8OvTYv@rl~U1=)fP zH!5RJbaC1$K4J9^nKVta(P;DzMgEP6vU>Xj##!9m-Q9x+bT?r-|Kjc+x_E6CpRk@G zle`Sf-7krnzXZ*yK}PALs2}lM`qyih1a7;}m;Qr_cesCg~{?D4#CNjzY0ePt{Bs zcC8@DEXk5KLMW(JeOP5%V;j^xP1Oa;t|nc{a(<+WnexYI#7FSYmh$(uOp`!!a+^qS z19E6|gzEblfw>v^JA7%d@4U;x=Tv6ECaTMNpE}~Ox=9VWA%1?M$C87=;42>chE>qC jYx%n%2!bF8g23?|g43A#n!YBa00000NkvXXu0mjf*!}&i literal 655 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM3?#3wJbQ|Pfss4FC&U%V1%if#hS1PZAPEGy zxw(afg+NA0NePfFD=Pz%<>lo-vZ|^INCH7kO$~%mTU!fZ)Ya7i89)-kfD1xIAcAly zI2R%d(FoB3A?xewfeauC2M{h?5TXoO5K{zGFS2@|EQAYm1Cagy|NqzPf8Pd%MR-Y& zUoZnB6Eh1NJ0}-64=*3TfVh;3x{i^tm4l;;tEZQbUvOk}Y+QU&N_s|aesM{CL(7DD z3zsZkxpw`Ajhi-a-L+@m!6QeHoj7&%#?AW=pFVs3>fQS<-+%u4`)`vf%SxaXj7i?^ zE)j3H9_a&e&U?BzhG?Acy>vb3P=WyK17=4K6_3ertWJS1JGzuYy-pT0N6pCYp6y$IND{O^bR`}Ou$QvR-av3lXpoqZgsJNk5vN}e}o zSiei4H||p1!@2T@&EL(-P!&0+eAC!=na_`<%UATO>{aiaaN?KGcP-oayVv%Ae|Ok4 z;6?9ii4{&=&u?tG7+oxL+P~!6)1OE8=gY`jTW(mCd+0?+ptrz$mF%+*9OfRInNZ~s t&({7l)!pTH*MWPt1kWCgRlEOGo~=@+WmDRntw66ac)I$ztaD0e0sukTG|m73 diff --git a/packages/mobile/src/assets.ts b/packages/mobile/src/assets.ts index 5dcceb57ca..b2d5be2dac 100644 --- a/packages/mobile/src/assets.ts +++ b/packages/mobile/src/assets.ts @@ -12,7 +12,7 @@ import icon_warning from '../assets/icons/icon_warning.png' import icon_close from '../assets/icons/icon_close.png' import file_document from '../assets/icons/file_document.png' import dots from '../assets/icons/dots.png' -import paperclip_active from '../assets/icons/paperclip_black.png' +import paperclip_gray from '../assets/icons/paperclip_gray.png' /** * @description This assets are for the app. @@ -32,7 +32,7 @@ export const appImages = { icon_close, file_document, dots, - paperclip_active, + paperclip_gray, } /** diff --git a/packages/mobile/src/components/AttachmentButton/AttachmentButton.component.tsx b/packages/mobile/src/components/AttachmentButton/AttachmentButton.component.tsx index e909c12229..f1e51928e8 100644 --- a/packages/mobile/src/components/AttachmentButton/AttachmentButton.component.tsx +++ b/packages/mobile/src/components/AttachmentButton/AttachmentButton.component.tsx @@ -4,7 +4,7 @@ import { appImages } from '../../assets' import { AttachmentButtonProps } from './AttachmentButton.types' export const AttachmentButton: FC = ({ onPress }) => { - const icon = appImages.paperclip_active + const icon = appImages.paperclip_gray return ( @@ -19,8 +19,8 @@ export const AttachmentButton: FC = ({ onPress }) => { source={icon} style={{ alignSelf: 'center', - width: 20, - height: 20, + width: 24, + height: 24, }} /> diff --git a/packages/mobile/src/components/AttachmentButton/AttachmentButton.test.tsx b/packages/mobile/src/components/AttachmentButton/AttachmentButton.test.tsx index c4b7b64503..8ecc10dd9d 100644 --- a/packages/mobile/src/components/AttachmentButton/AttachmentButton.test.tsx +++ b/packages/mobile/src/components/AttachmentButton/AttachmentButton.test.tsx @@ -39,14 +39,14 @@ describe('Attachment button component', () => { diff --git a/packages/mobile/src/components/Chat/Chat.component.tsx b/packages/mobile/src/components/Chat/Chat.component.tsx index ccabf7c5d4..49c63793d9 100644 --- a/packages/mobile/src/components/Chat/Chat.component.tsx +++ b/packages/mobile/src/components/Chat/Chat.component.tsx @@ -177,38 +177,40 @@ export const Chat: FC = ({ style={{ width: '100%', paddingLeft: defaultPadding, - paddingRight: 0, + paddingRight: !didKeyboardShow && !areFilesUploaded ? defaultPadding : 0, }} > - - - - {(didKeyboardShow || areFilesUploaded) && ( - - )} + + + + + + + + {(didKeyboardShow || areFilesUploaded) && ( + + )} - {uploadedFiles && } diff --git a/packages/mobile/src/components/Chat/__tests__/__snapshots__/Chat.test.tsx.snap b/packages/mobile/src/components/Chat/__tests__/__snapshots__/Chat.test.tsx.snap index 9c5d659a56..4981500348 100644 --- a/packages/mobile/src/components/Chat/__tests__/__snapshots__/Chat.test.tsx.snap +++ b/packages/mobile/src/components/Chat/__tests__/__snapshots__/Chat.test.tsx.snap @@ -2830,7 +2830,7 @@ exports[`Chat component renders component 1`] = ` style={ { "paddingLeft": 20, - "paddingRight": 0, + "paddingRight": 20, "width": "100%", } } @@ -2839,134 +2839,149 @@ exports[`Chat component renders component 1`] = ` style={ { "flexDirection": "row", - "width": "100%", } } > - + + "busy": undefined, + "checked": undefined, + "disabled": false, + "expanded": undefined, + "selected": undefined, + } + } + accessibilityValue={ + { + "max": undefined, + "min": undefined, + "now": undefined, + "text": undefined, + } + } + accessible={true} + collapsable={false} + focusable={true} + onBlur={[Function]} + onClick={[Function]} + onFocus={[Function]} + onResponderGrant={[Function]} + onResponderMove={[Function]} + onResponderRelease={[Function]} + onResponderTerminate={[Function]} + onResponderTerminationRequest={[Function]} + onStartShouldSetResponder={[Function]} + round={true} + style={ + [ + { + "backgroundColor": "#ffffff", + "borderColor": "#C4C4C4", + "borderRadius": 16, + "borderWidth": 1, + "flexGrow": 1, + "height": 56, + "justifyContent": "center", + "paddingLeft": 16, + "paddingRight": 16, + }, + { + "height": 74, + "paddingRight": 50, + }, + ] + } + > + + + - - - + testID="attach_file_button" + > + + diff --git a/packages/mobile/src/components/CreateCommunity/__tests__/__snapshots__/CreateCommunity.test.tsx.snap b/packages/mobile/src/components/CreateCommunity/__tests__/__snapshots__/CreateCommunity.test.tsx.snap index 440ebbd134..ee221bc050 100644 --- a/packages/mobile/src/components/CreateCommunity/__tests__/__snapshots__/CreateCommunity.test.tsx.snap +++ b/packages/mobile/src/components/CreateCommunity/__tests__/__snapshots__/CreateCommunity.test.tsx.snap @@ -98,30 +98,36 @@ exports[`Spinner component renders component 1`] = ` onResponderTerminate={[Function]} onResponderTerminationRequest={[Function]} onStartShouldSetResponder={[Function]} + round={false} style={ [ { "backgroundColor": "#ffffff", - "borderColor": "#B3B3B3", + "borderColor": "#C4C4C4", "borderRadius": 4, "borderWidth": 1, "flexGrow": 1, - "height": 60, + "height": 56, "justifyContent": "center", - "paddingLeft": 15, - "paddingRight": 15, + "paddingLeft": 16, + "paddingRight": 16, + }, + { + "height": 54, }, ] } > ( hint, multiline, disabled = false, + round = false, style, wrapperStyle, children, }, ref ) => { + const [height, setHeight] = useState(54) + const textInputRef = useRef(null) const handleViewPress = useCallback(() => { @@ -39,15 +42,29 @@ export const Input = forwardRef( {label} )} - + { + if (multiline) { + setHeight(event.nativeEvent.contentSize.height) + } + }} ref={(instance: TextInput | null) => { textInputRef.current = instance if (ref !== null && 'current' in ref) { ref.current = instance } }} + height={height} multiline={multiline} editable={!disabled} placeholder={placeholder} diff --git a/packages/mobile/src/components/Input/Input.styles.ts b/packages/mobile/src/components/Input/Input.styles.ts index e2c0172176..4fb78e0bd7 100644 --- a/packages/mobile/src/components/Input/Input.styles.ts +++ b/packages/mobile/src/components/Input/Input.styles.ts @@ -2,30 +2,35 @@ import { Platform, Pressable, TextInput } from 'react-native' import styled, { css } from 'styled-components/native' import { defaultTheme } from '../../styles/themes/default.theme' -export const StyledTextInput = styled(TextInput)` - text-align-vertical: center; - ${Platform.select({ - ios: { - paddingTop: 12, - paddingBottom: 12, - }, - android: {}, - })} +export const StyledTextInput = styled(TextInput)<{ + height: number +}>` + ${({ height }) => css` + text-align-vertical: center; + height: ${Math.max(40, height)}; + ${Platform.select({ + ios: { + paddingTop: 12, + }, + android: {}, + })} + `} ` export const StyledWrapper = styled(Pressable)<{ disabled: boolean + round: boolean }>` - ${({ disabled }) => css` + ${({ disabled, round }) => css` background-color: ${disabled ? defaultTheme.palette.input.backgroundDisabled : defaultTheme.palette.input.backgroundDefault}; border-color: ${defaultTheme.palette.input.border}; - border-radius: 4px; + border-radius: ${round ? '16px' : '4px'}; border-width: 1px; - padding-left: 15px; - padding-right: 15px; - height: 60px; + padding-left: 16px; + padding-right: 16px; + height: 56px; justify-content: center; flex-grow: 1; `} diff --git a/packages/mobile/src/components/Input/Input.test.tsx b/packages/mobile/src/components/Input/Input.test.tsx index 0a03ff0b09..b8a4f13ff3 100644 --- a/packages/mobile/src/components/Input/Input.test.tsx +++ b/packages/mobile/src/components/Input/Input.test.tsx @@ -39,30 +39,36 @@ describe('MessageInput component', () => { onResponderTerminate={[Function]} onResponderTerminationRequest={[Function]} onStartShouldSetResponder={[Function]} + round={false} style={ [ { "backgroundColor": "#ffffff", - "borderColor": "#B3B3B3", + "borderColor": "#C4C4C4", "borderRadius": 4, "borderWidth": 1, "flexGrow": 1, - "height": 60, + "height": 56, "justifyContent": "center", - "paddingLeft": 15, - "paddingRight": 15, + "paddingLeft": 16, + "paddingRight": 16, + }, + { + "height": 54, }, ] } > = ({ onPress, disable diff --git a/packages/mobile/src/components/MessageSendButton/MessageSendButton.test.tsx b/packages/mobile/src/components/MessageSendButton/MessageSendButton.test.tsx index 74ec4df15d..92c34bd10a 100644 --- a/packages/mobile/src/components/MessageSendButton/MessageSendButton.test.tsx +++ b/packages/mobile/src/components/MessageSendButton/MessageSendButton.test.tsx @@ -30,8 +30,8 @@ describe('MessageSendButton component', () => { style={ { "justifyContent": "center", - "paddingLeft": 5, - "paddingRight": 5, + "paddingLeft": 20, + "paddingRight": 20, } } testID="send_message_button" diff --git a/packages/mobile/src/styles/palettes/default.palette.ts b/packages/mobile/src/styles/palettes/default.palette.ts index 0c0a696dfe..226fdade57 100644 --- a/packages/mobile/src/styles/palettes/default.palette.ts +++ b/packages/mobile/src/styles/palettes/default.palette.ts @@ -28,7 +28,7 @@ export const defaultPalette = { lightGray: '#B2B2B2', }, input: { - border: '#B3B3B3', + border: '#C4C4C4', backgroundDefault: '#ffffff', backgroundDisabled: '#EBEBEB', }, From b1d2f6b6559dea5fd0cfe12f59f5aa29c900a737 Mon Sep 17 00:00:00 2001 From: Kacper Michalik Date: Thu, 28 Sep 2023 11:31:06 +0200 Subject: [PATCH 057/104] show username taken screen on mobile, error handling on mobile --- .../src/components/Button/Button.component.tsx | 2 +- .../UsernameRegistration.component.tsx | 16 +++++++++++++++- .../Registration/UsernameRegistration.types.ts | 3 +++ .../UsernameTaken/UsernameTaken.screen.tsx | 6 +++--- .../navigation/redirection/redirection.saga.ts | 18 ++++++++++++++++-- .../src/sagas/identity/identity.selectors.ts | 2 +- 6 files changed, 39 insertions(+), 8 deletions(-) diff --git a/packages/mobile/src/components/Button/Button.component.tsx b/packages/mobile/src/components/Button/Button.component.tsx index 4702677645..9c9fc97999 100644 --- a/packages/mobile/src/components/Button/Button.component.tsx +++ b/packages/mobile/src/components/Button/Button.component.tsx @@ -18,7 +18,7 @@ export const Button: FC = ({ onPress, title, width, loading, negati style={{ paddingVertical: 12, marginVertical: !negative ? 12 : 0, - backgroundColor: !negative ? defaultTheme.palette.main.brand : 'transparent', + backgroundColor: disabled ? 'grey' : !negative ? defaultTheme.palette.main.brand : 'transparent', borderRadius: 8, justifyContent: 'center', alignItems: 'center', diff --git a/packages/mobile/src/components/Registration/UsernameRegistration.component.tsx b/packages/mobile/src/components/Registration/UsernameRegistration.component.tsx index b9230d1e2d..44d3a1b5bb 100644 --- a/packages/mobile/src/components/Registration/UsernameRegistration.component.tsx +++ b/packages/mobile/src/components/Registration/UsernameRegistration.component.tsx @@ -16,6 +16,7 @@ export const UsernameRegistration: FC = ({ fetching, currentUsername, handleBackButton, + registeredUsers, variant = UsernameVariant.NEW, }) => { const isNewUser = variant === UsernameVariant.NEW @@ -46,6 +47,12 @@ export const UsernameRegistration: FC = ({ const parsedName = parseName(name) setUserName(parsedName) setParsedNameDiffers(name !== parsedName) + if (registeredUsers && !isNewUser) { + const allUsersArr = Object.values(registeredUsers).map(user => user.username) + if (allUsersArr.includes(name)) { + setInputError(`Username @${name} is already taken`) + } + } } const onPress = () => { @@ -139,8 +146,15 @@ export const UsernameRegistration: FC = ({ )} + -