Remove non-null assertion in ConversationProvider
- Add `createOptionalContext` that is used by `AuthContext` and `ConversationContext` to create a context with a hook
that can be used to retrieve its value and throw an error if it's undefined.
- In `router.tsx`, put `Messenger` inside `ConversationProvider`.
- In `ConversationListItem`, use the conversationId from the `ConversationContext ` instead of the url params.
- Fix bug in `CallInterface` with fullscreen.
- Remove unecessary useEffect dependency in `NotificationManager`.
Change-Id: Ib5f0ae6a0a34cdbdb02f871e36194376d945230d
diff --git a/client/src/pages/CallPending.tsx b/client/src/pages/CallPending.tsx
index 4bdbef4..2cd57c6 100644
--- a/client/src/pages/CallPending.tsx
+++ b/client/src/pages/CallPending.tsx
@@ -29,13 +29,13 @@
} from '../components/CallButtons';
import ConversationAvatar from '../components/ConversationAvatar';
import { CallContext, CallStatus } from '../contexts/CallProvider';
-import { ConversationContext } from '../contexts/ConversationProvider';
+import { useConversationContext } from '../contexts/ConversationProvider';
import { WebRtcContext } from '../contexts/WebRtcProvider';
import { VideoElementWithSinkId } from '../utils/utils';
export const CallPending = () => {
const { localStream } = useContext(WebRtcContext);
- const { conversation } = useContext(ConversationContext);
+ const { conversation } = useConversationContext();
const { callRole } = useContext(CallContext);
const localVideoRef = useRef<VideoElementWithSinkId | null>(null);
@@ -148,7 +148,7 @@
export const CallPendingCallerInterface = () => {
const { callStatus } = useContext(CallContext);
const { t } = useTranslation();
- const { conversation } = useContext(ConversationContext);
+ const { conversation } = useConversationContext();
const memberName = useMemo(() => conversation.getFirstMember().contact.getRegisteredName(), [conversation]);
let title = t('loading');
@@ -182,7 +182,7 @@
const { callStatus } = useContext(CallContext);
const { t } = useTranslation();
- const { conversation } = useContext(ConversationContext);
+ const { conversation } = useConversationContext();
const memberName = useMemo(() => conversation.getFirstMember().contact.getRegisteredName(), [conversation]);
let title = t('loading');