diff --git a/packages/mobile/src/screens/CreateChannel/CreateChannel.screen.tsx b/packages/mobile/src/screens/CreateChannel/CreateChannel.screen.tsx index 9d94b1b3ec..14f1248e9d 100644 --- a/packages/mobile/src/screens/CreateChannel/CreateChannel.screen.tsx +++ b/packages/mobile/src/screens/CreateChannel/CreateChannel.screen.tsx @@ -15,6 +15,7 @@ import { DateTime } from 'luxon' import { navigationSelectors } from '../../store/navigation/navigation.selectors' import { ScreenNames } from '../../const/ScreenNames.enum' import { navigationActions } from '../../store/navigation/navigation.slice' +import { generateChannelAddress } from '@quiet/common' export const CreateChannelScreen: FC = () => { const dispatch = useDispatch() @@ -79,7 +80,7 @@ export const CreateChannelScreen: FC = () => { name: name, description: `Welcome to #${name}`, owner: user.nickname, - address: name, + address: generateChannelAddress(name), timestamp: DateTime.utc().valueOf() } diff --git a/packages/mobile/src/screens/DeleteChannel/DeleteChannel.screen.tsx b/packages/mobile/src/screens/DeleteChannel/DeleteChannel.screen.tsx index 6637223b50..ac57130fd9 100644 --- a/packages/mobile/src/screens/DeleteChannel/DeleteChannel.screen.tsx +++ b/packages/mobile/src/screens/DeleteChannel/DeleteChannel.screen.tsx @@ -9,8 +9,8 @@ import { navigationSelectors } from '../../store/navigation/navigation.selectors export const DeleteChannelScreen: FC = ({ route }) => { const dispatch = useDispatch() -// KACPER - const { channel } = route.params + + const { channel: channelRouteParam } = route.params const channels = useSelector(publicChannels.selectors.publicChannels) @@ -19,18 +19,19 @@ export const DeleteChannelScreen: FC = ({ route }) => console.log({ channels }) useEffect(() => { - if (screen === ScreenNames.DeleteChannelScreen && !channels.find(c => c.name === channel)) { + if (screen === ScreenNames.DeleteChannelScreen && !channels.find(c => c.name === channelRouteParam)) { dispatch(navigationActions.replaceScreen({ screen: ScreenNames.ChannelListScreen })) } }, [dispatch, screen, channels]) const deleteChannel = useCallback(() => { + const deletedChannel = channels.find((channel) => channel.name === channelRouteParam) dispatch( publicChannels.actions.deleteChannel({ - channelAddress: channel + channelAddress: deletedChannel.address }) ) - }, [dispatch]) + }, [dispatch, channels, channelRouteParam]) const handleBackButton = useCallback(() => { dispatch( @@ -42,7 +43,7 @@ export const DeleteChannelScreen: FC = ({ route }) => return (