converted sendmessage

This commit is contained in:
2024-10-29 18:50:03 +02:00
parent c9306493f0
commit 4f91924947
35 changed files with 163 additions and 225 deletions

View File

@@ -471,16 +471,17 @@ isDOMContentLoaded: false
}, []); // Empty dependency array to run once when the component mounts
chrome.runtime?.onMessage.addListener( function (message, sender, sendResponse) {
if(message.action === "SHOW_SAVE_FILE_PICKER"){
showSaveFilePicker(message?.data)
}
// TODO
// chrome.runtime?.onMessage.addListener( function (message, sender, sendResponse) {
// if(message.action === "SHOW_SAVE_FILE_PICKER"){
// showSaveFilePicker(message?.data)
// }
else if (message.action === "getFileFromIndexedDB") {
handleGetFileFromIndexedDB(message.fileId, sendResponse);
return true; // Keep the message channel open for async response
}
});
// else if (message.action === "getFileFromIndexedDB") {
// handleGetFileFromIndexedDB(message.fileId, sendResponse);
// return true; // Keep the message channel open for async response
// }
// });
return {path, history, resetHistory, changeCurrentIndex}
};

View File

@@ -130,6 +130,7 @@ export const ChatGroup = ({selectedGroup, secretKey, setSecretKey, getSecretKey,
secretKeyObject: secretKey,
})
.then((response) => {
console.log('decryptSingle', response)
if (!response?.error) {
const filterUIMessages = encryptedMessages.filter((item) => !isExtMsg(item.data));
const decodedUIMessages = decodeBase64ForUIChatMessages(filterUIMessages);

View File

@@ -35,18 +35,18 @@ export const MessageDisplay = ({ htmlContent , isReply}) => {
const target = e.target.closest('a');
if (target) {
const href = target.getAttribute('href');
if (chrome && chrome.tabs) {
chrome.tabs.create({ url: href }, (tab) => {
if (chrome.runtime.lastError) {
console.error('Error opening tab:', chrome.runtime.lastError);
} else {
console.log('Tab opened successfully:', tab);
}
});
} else {
console.error('chrome.tabs API is not available.');
}
// TODO
// if (chrome && chrome.tabs) {
// chrome.tabs.create({ url: href }, (tab) => {
// if (chrome.runtime.lastError) {
// console.error('Error opening tab:', chrome.runtime.lastError);
// } else {
// console.log('Tab opened successfully:', tab);
// }
// });
// } else {
// console.error('chrome.tabs API is not available.');
// }
} else {
console.error('No <a> tag found or href is null.');
}

View File

@@ -184,7 +184,8 @@ export const MobileFooter = ({
/>
<BottomNavigationAction
onClick={() => {
chrome.tabs.create({ url: "https://www.qort.trade"});
// TODO
// chrome.tabs.create({ url: "https://www.qort.trade"});
}}
icon={
<IconWrapper label="Trading" color="rgba(250, 250, 250, 0.5)">