Skip to content

Commit

Permalink
Merge branch 'newArchitecture' of https://github.com/dappros/ethora
Browse files Browse the repository at this point in the history
  • Loading branch information
dendidibe committed Jun 21, 2023
2 parents 692deb6 + bce5727 commit 7555ca0
Show file tree
Hide file tree
Showing 15 changed files with 1,086 additions and 194 deletions.
61 changes: 32 additions & 29 deletions client-reactnative/src/Screens/Chat/ChatScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
import {observer} from 'mobx-react-lite';
import React, {useEffect} from 'react';
import {format} from 'date-fns';
import {useStores} from '../../stores/context';
import {getRoomArchiveStanza, getPaginatedArchive} from '../../xmpp/stanzas';
import ChatContainer from '../../components/Chat/ChatContainer';
import {IMessage, roomListProps} from '../../stores/chatStore';
import { View } from 'native-base';
import { observer } from "mobx-react-lite";
import React, { useEffect } from "react";
import { format } from "date-fns";
import { useStores } from "../../stores/context";
import { getRoomArchiveStanza, getPaginatedArchive } from "../../xmpp/stanzas";
import ChatContainer from "../../components/Chat/ChatContainer";
import { IMessage, roomListProps } from "../../stores/chatStore";
import { View } from "native-base";

const ChatScreen = observer(({route}: any) => {
const {chatStore} = useStores();
const ChatScreen = observer(({ route }: any) => {
const { chatStore } = useStores();

const {chatJid, chatName} = route.params;
const room:roomListProps = chatStore.roomList.find(item => item.jid === chatJid)||{
avatar:"",
counter:0,
createdAt:"",
jid:chatJid,
lastUserName:"",
lastUserText:"",
name:chatName?chatName:'',
participants:0,
isFavourite:false,
muted:false,
priority:0,
roomBackground:"",
roomBackgroundIndex:0,
roomThumbnail:""
const { chatJid, chatName } = route.params;
const room: roomListProps = chatStore.roomList.find(
(item) => item.jid === chatJid
) || {
avatar: "",
counter: 0,
createdAt: "",
jid: chatJid,
lastUserName: "",
lastUserText: "",
name: chatName ? chatName : "",
participants: 0,
isFavourite: false,
muted: false,
priority: 0,
roomBackground: "",
roomBackgroundIndex: 0,
roomThumbnail: "",
};
const messages = chatStore.messages
.filter((item: IMessage) => {
Expand Down Expand Up @@ -66,7 +68,8 @@ const ChatScreen = observer(({route}: any) => {
lastUserText: lastMessage?.text,
lastUserName: lastMessage?.user?.name,
lastMessageTime:
lastMessage?.createdAt && format(lastMessage?.createdAt as Date, 'hh:mm'),
lastMessage?.createdAt &&
format(new Date(lastMessage?.createdAt), "hh:mm"),
});
}, [!!messages]);

Expand All @@ -79,7 +82,7 @@ const ChatScreen = observer(({route}: any) => {
};

return (
<View testID='ChatScreen'>
<View testID="ChatScreen">
<ChatContainer
containerType="main"
roomDetails={room}
Expand All @@ -90,4 +93,4 @@ const ChatScreen = observer(({route}: any) => {
);
});

export default ChatScreen;
export default ChatScreen;
3 changes: 1 addition & 2 deletions client-reactnative/src/Screens/Chat/NewChatScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,12 @@ const NewChatScreen = (props: NewChatScreenProps) => {
{ roomName: chatName, roomDescription: chatDescription },
chatStore.xmpp
);

chatAvatar &&
setRoomImage(
manipulatedWalletAddress + "@" + apiStore.xmppDomains.DOMAIN,
roomHash + apiStore.xmppDomains.CONFERENCEDOMAIN,
chatAvatar,
"",
"none",
"icon",
chatStore.xmpp
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ export const RegularLoginScreen = ({navigation}: ScreenProps) => {
<Input
testID={'loginPassword'}
accessibilityLabel="Enter your password"
maxLength={15}
marginBottom={2}
fontFamily={textStyles.lightFont}
fontSize={hp('1.6%')}
Expand Down
Loading

0 comments on commit 7555ca0

Please sign in to comment.