fixing build

This commit is contained in:
Roland Osborne 2023-01-12 10:14:37 -08:00
parent c1a66e2fa7
commit dd05284e23
4 changed files with 20 additions and 16 deletions

View File

@ -5,8 +5,6 @@ import { HashRouter as Router, Routes, Route } from "react-router-dom";
import { AppContextProvider } from 'context/AppContext';
import { AccountContextProvider } from 'context/AccountContext';
import { ProfileContextProvider } from 'context/ProfileContext';
import { ArticleContextProvider } from 'context/ArticleContext';
import { GroupContextProvider } from 'context/GroupContext';
import { CardContextProvider } from 'context/CardContext';
import { ChannelContextProvider } from 'context/ChannelContext';
import { StoreContextProvider } from 'context/StoreContext';

View File

@ -1,10 +1,8 @@
import { useEffect, useState, useRef, useContext } from 'react';
import { getAvailable } from 'api/getAvailable';
import { setLogin } from 'api/setLogin';
import { clearLogin } from 'api/clearLogin';
import { setAccountAccess } from 'api/setAccountAccess';
import { addAccount } from 'api/addAccount';
import { getUsername } from 'api/getUsername';
import { AccountContext } from './AccountContext';
import { ProfileContext } from './ProfileContext';
import { CardContext } from './CardContext';

View File

@ -149,7 +149,7 @@ export function useCardContext() {
// sync profile
if (card.data.setNotifiedProfile !== card.data.curNotifiedProfile) {
if (card.data.profileRevision != card.data.curNotifiedProfile) {
if (card.data.profileRevision !== card.data.curNotifiedProfile) {
const token = `${cardProfile.guid}.${cardDetail.token}`;
const message = await getContactProfile(cardProfile.node, token);
await setCardProfile(token, card.id, message);
@ -266,6 +266,13 @@ export function useCardContext() {
setCardCloseMessage: async (server, message) => {
return await setCardCloseMessage(server, message);
},
getCardImageUrl: (cardId) => {
const card = cards.current.get(cardId);
if (card) {
const revision = card.data.profileRevision;
return getCardImageUrl(access.current, cardId, revision)
}
},
removeChannel: async (cardId, channelId) => {
let { cardProfile, cardDetail } = cards.current.get(cardId).data;
let token = cardProfile.guid + '.' + cardDetail.token;
@ -282,7 +289,7 @@ export function useCardContext() {
updateState({ cards: cards.current });
}
},
unsealChannelSummary: async (channelId, unsealed, revision) => {
unsealChannelSummary: async (cardId, channelId, unsealed, revision) => {
const card = cards.current.get(cardId);
const channel = card.channels.get(channelId);
if (channel.revision === revision) {
@ -366,7 +373,7 @@ export function useCardContext() {
const { cardProfile, cardDetail } = card.data;
const token = cardProfile.guid + '.' + cardDetail.token;
const node = cardProfile.node;
return await getChannelTopic(node, token, channelId, topicId);
return await getContactChannelTopic(node, token, channelId, topicId);
},
resync: async () => {
await resync();

View File

@ -80,7 +80,7 @@ export function useConversationContext() {
}
else {
await channel.actions.clearChannelCard(channelId, id);
await channelactions.resync();
await channel.actions.resync();
}
};
@ -123,14 +123,6 @@ export function useConversationContext() {
}
};
useEffect(() => {
if (conversationId.current) {
const { cardId, channelId } = conversationId.current;
setChannelRevision(cardId, channelId);
sync();
}
}, [card.state, channel.state]);
const setChannelRevision = (cardId, channelId) => {
let setChannel;
if (cardId) {
@ -264,6 +256,15 @@ export function useConversationContext() {
}
};
useEffect(() => {
if (conversationId.current) {
const { cardId, channelId } = conversationId.current;
setChannelRevision(cardId, channelId);
sync();
}
// eslint-disable-next-line
}, [card.state, channel.state]);
const actions = {
setChannel: async (cardId, channelId) => {
conversationId.current = { cardId, channelId };