diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 4d7ca38..6b53b21 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -5,7 +5,7 @@
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
- android:roundIcon="@mipmap/ic_launcher_round"
+ android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/AppTheme">
diff --git a/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
index 036d09b..90f9580 100644
--- a/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
+++ b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -1,5 +1,5 @@
-
-
+
+
\ No newline at end of file
diff --git a/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
deleted file mode 100644
index 036d09b..0000000
--- a/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
index c023e50..12a409b 100644
Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher_adaptive_back.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher_adaptive_back.png
new file mode 100644
index 0000000..a05f3fc
Binary files /dev/null and b/android/app/src/main/res/mipmap-hdpi/ic_launcher_adaptive_back.png differ
diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher_adaptive_fore.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher_adaptive_fore.png
new file mode 100644
index 0000000..d6bdb01
Binary files /dev/null and b/android/app/src/main/res/mipmap-hdpi/ic_launcher_adaptive_fore.png differ
diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
deleted file mode 100644
index 2127973..0000000
Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png and /dev/null differ
diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
deleted file mode 100644
index b441f37..0000000
Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and /dev/null differ
diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
index 72905b8..3966b05 100644
Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher_adaptive_back.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher_adaptive_back.png
new file mode 100644
index 0000000..3814b23
Binary files /dev/null and b/android/app/src/main/res/mipmap-mdpi/ic_launcher_adaptive_back.png differ
diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher_adaptive_fore.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher_adaptive_fore.png
new file mode 100644
index 0000000..1907b24
Binary files /dev/null and b/android/app/src/main/res/mipmap-mdpi/ic_launcher_adaptive_fore.png differ
diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
deleted file mode 100644
index 8ed0605..0000000
Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png and /dev/null differ
diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
deleted file mode 100644
index 9502e47..0000000
Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and /dev/null differ
diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
index 4d1e077..ff8e391 100644
Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_adaptive_back.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_adaptive_back.png
new file mode 100644
index 0000000..2e1846f
Binary files /dev/null and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_adaptive_back.png differ
diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_adaptive_fore.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_adaptive_fore.png
new file mode 100644
index 0000000..123ff93
Binary files /dev/null and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_adaptive_fore.png differ
diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
deleted file mode 100644
index df0f158..0000000
Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png and /dev/null differ
diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
deleted file mode 100644
index 853db04..0000000
Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and /dev/null differ
diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
index 6cdf97c..f1f3036 100644
Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_adaptive_back.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_adaptive_back.png
new file mode 100644
index 0000000..fe154c8
Binary files /dev/null and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_adaptive_back.png differ
diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_adaptive_fore.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_adaptive_fore.png
new file mode 100644
index 0000000..c4fdc57
Binary files /dev/null and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_adaptive_fore.png differ
diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
deleted file mode 100644
index 2960cbb..0000000
Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png and /dev/null differ
diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
deleted file mode 100644
index 8e3093a..0000000
Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and /dev/null differ
diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
index 46de6e2..7191d0c 100644
Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_adaptive_back.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_adaptive_back.png
new file mode 100644
index 0000000..b640524
Binary files /dev/null and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_adaptive_back.png differ
diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_adaptive_fore.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_adaptive_fore.png
new file mode 100644
index 0000000..69a0eb8
Binary files /dev/null and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_adaptive_fore.png differ
diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
deleted file mode 100644
index d2ea9ab..0000000
Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png and /dev/null differ
diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
deleted file mode 100644
index a40d73e..0000000
Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and /dev/null differ
diff --git a/src/App.tsx b/src/App.tsx
index 07ea067..be4e85c 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -645,46 +645,16 @@ function App() {
};
useEffect(() => {
- // Listen for messages from the background script
- const messageListener = (message, sender, sendResponse) => {
- // Handle various actions
- if (
- message.action === "UPDATE_STATE_CONFIRM_SEND_QORT" &&
- !isMainWindow
- ) {
- setSendqortState(message.payload);
- setExtstate("web-app-request-payment");
- } else if (message.action === "closePopup" && !isMainWindow) {
- window.close();
+ // Handler function for incoming messages
+ const messageHandler = (event) => {
+ const message = event.data;
+
+ if (message?.action === "CHECK_FOCUS") {
+
+ event.source.postMessage({ action: "CHECK_FOCUS_RESPONSE", isFocused: isFocusedRef.current }, event.origin);
+
} else if (
- message.action === "UPDATE_STATE_REQUEST_CONNECTION" &&
- !isMainWindow
- ) {
- setRequestConnection(message.payload);
- setExtstate("web-app-request-connection");
- } else if (
- message.action === "UPDATE_STATE_REQUEST_BUY_ORDER" &&
- !isMainWindow
- ) {
- setRequestBuyOrder(message.payload);
- setExtstate("web-app-request-buy-order");
- } else if (
- message.action === "UPDATE_STATE_REQUEST_AUTHENTICATION" &&
- !isMainWindow
- ) {
- setRequestAuthentication(message.payload);
- setExtstate("web-app-request-authentication");
- } else if (message.action === "SET_COUNTDOWN" && !isMainWindow) {
- setCountdown(message.payload);
- } else if (message.action === "INITIATE_MAIN") {
- setIsMain(true);
- isMainRef.current = true;
- } else if (message.action === "CHECK_FOCUS" && isMainWindow) {
- sendResponse(isFocusedRef.current); // Synchronous response
- return true; // Return true if you plan to send a response asynchronously
- } else if (
- message.action === "NOTIFICATION_OPEN_DIRECT" &&
- isMainWindow
+ message.action === "NOTIFICATION_OPEN_DIRECT"
) {
executeEvent("openDirectMessage", {
from: message.payload.from,
@@ -693,7 +663,7 @@ function App() {
executeEvent("openGroupMessage", {
from: message.payload.from,
});
- } else if (
+ } else if (
message.action === "NOTIFICATION_OPEN_ANNOUNCEMENT_GROUP" &&
isMainWindow
) {
@@ -708,31 +678,21 @@ function App() {
data: message.payload.data,
});
}
-
- // Call the permission request handler for "QORTAL_REQUEST_PERMISSION"
- qortalRequestPermisson(message, sender, sendResponse);
- if (message.action === "QORTAL_REQUEST_PERMISSION" && !isMainWindow) {
- return true; // Return true to indicate an async response is coming
- }
- if (message.action === "QORTAL_REQUEST_PERMISSION" && isMainWindow && message?.isFromExtension) {
- qortalRequestPermissonFromExtension(message, sender, sendResponse);
- return true;
- }
- if (message.action === "QORTAL_REQUEST_PERMISSION" && isMainWindow) {
-
- return;
- }
+
+
};
-
- // Add message listener
- chrome.runtime?.onMessage.addListener(messageListener);
-
- // Clean up the listener on component unmount
+
+ // Attach the event listener
+ window.addEventListener("message", messageHandler);
+
+ // Clean up the event listener on component unmount
return () => {
- chrome.runtime?.onMessage.removeListener(messageListener);
+ window.removeEventListener("message", messageHandler);
};
}, []);
+
+
//param = isDecline
const confirmPayment = (isDecline: boolean) => {
// REMOVED FOR MOBILE APP
@@ -1396,7 +1356,7 @@ function App() {
textDecoration: "underline",
}}
onClick={() => {
- chrome.tabs.create({ url: "https://www.qort.trade" });
+ // TODO
}}
>
Get QORT at qort.trade
diff --git a/src/background-cases.ts b/src/background-cases.ts
index 5eb5daf..cc22692 100644
--- a/src/background-cases.ts
+++ b/src/background-cases.ts
@@ -804,30 +804,27 @@ export async function notificationCase(request, event) {
try {
const notificationId = "chat_notification_" + Date.now(); // Create a unique ID
- chrome.notifications.create(notificationId, {
- type: "basic",
- iconUrl: "qort.png", // Add an appropriate icon for chat notifications
- title: "New Group Message!",
- message: "You have received a new message from one of your groups",
- priority: 2, // Use the maximum priority to ensure it's noticeable
- // buttons: [
- // { title: 'Go to group' }
- // ]
- });
+ // chrome.notifications.create(notificationId, {
+ // type: "basic",
+ // iconUrl: "qort.png", // Add an appropriate icon for chat notifications
+ // title: "New Group Message!",
+ // message: "You have received a new message from one of your groups",
+ // priority: 2, // Use the maximum priority to ensure it's
+ // });
// Set a timeout to clear the notification after 'timeout' milliseconds
- setTimeout(() => {
- chrome.notifications.clear(notificationId);
- }, 3000);
+ // setTimeout(() => {
+ // chrome.notifications.clear(notificationId);
+ // }, 3000);
- event.source.postMessage(
- {
- requestId: request.requestId,
- action: "notification",
- payload: true,
- type: "backgroundMessageResponse",
- },
- event.origin
- );
+ // event.source.postMessage(
+ // {
+ // requestId: request.requestId,
+ // action: "notification",
+ // payload: true,
+ // type: "backgroundMessageResponse",
+ // },
+ // event.origin
+ // );
} catch (error) {
event.source.postMessage(
{
@@ -1399,7 +1396,7 @@ export async function publishGroupEncryptedResourceCase(request, event) {
export async function encryptSingleCase(request, event) {
try {
const { data, secretKeyObject, typeNumber} = request.payload;
- const response = await encryptSingle({ data, secretKeyObject, typeNumber });
+ const response = await encryptSingle({ data64: data, secretKeyObject, typeNumber });
event.source.postMessage(
{
@@ -1426,8 +1423,9 @@ export async function publishGroupEncryptedResourceCase(request, event) {
export async function decryptSingleCase(request, event) {
try {
const { data, secretKeyObject, skipDecodeBase64} = request.payload;
- const response = await decryptSingleFunc({ data, secretKeyObject, skipDecodeBase64 });
-
+ console.log({data, secretKeyObject, skipDecodeBase64})
+ const response = await decryptSingleFunc({ messages: data, secretKeyObject, skipDecodeBase64 });
+ console.log('response', response)
event.source.postMessage(
{
requestId: request.requestId,
diff --git a/src/background.ts b/src/background.ts
index 723af24..33df21e 100644
--- a/src/background.ts
+++ b/src/background.ts
@@ -1,6 +1,6 @@
// @ts-nocheck
-
-import "./qortalRequests";
+// TODO
+// import "./qortalRequests";
import { isArray } from "lodash";
import {
decryptGroupEncryption,
@@ -311,24 +311,27 @@ export function isUpdateMsg(data) {
async function checkWebviewFocus() {
return new Promise((resolve) => {
- // Set a timeout for 1 second
const timeout = setTimeout(() => {
resolve(false); // No response within 1 second, assume not focused
}, 1000);
- // Send message to the content script to check focus
- chrome.runtime.sendMessage({ action: "CHECK_FOCUS" }, (response) => {
- clearTimeout(timeout); // Clear the timeout if we get a response
+ // Send a message to check focus
+ window.postMessage({ action: "CHECK_FOCUS" }, "*");
- if (chrome.runtime.lastError) {
- resolve(false); // Error occurred, assume not focused
- } else {
- resolve(response); // Resolve based on the response
+ // Listen for the response
+ const handleMessage = (event) => {
+ if (event.data?.action === "CHECK_FOCUS_RESPONSE") {
+ clearTimeout(timeout);
+ window.removeEventListener("message", handleMessage); // Clean up listener
+ resolve(event.data.isFocused); // Resolve with the response
}
- });
+ };
+
+ window.addEventListener("message", handleMessage);
});
}
+
function playNotificationSound() {
// chrome.runtime.sendMessage({ action: "PLAY_NOTIFICATION_SOUND" });
}
@@ -395,11 +398,11 @@ const handleNotificationDirect = async (directs) => {
// message: "You have received a new direct message",
// priority: 2, // Use the maximum priority to ensure it's noticeable
// });
- if (!isMobile) {
- setTimeout(() => {
- chrome.notifications.clear(notificationId);
- }, 7000);
- }
+ // if (!isMobile) {
+ // setTimeout(() => {
+ // chrome.notifications.clear(notificationId);
+ // }, 7000);
+ // }
// chrome.runtime.sendMessage(
// {
@@ -817,19 +820,19 @@ export const checkThreads = async (bringBack) => {
// priority: 2, // Use the maximum priority to ensure it's noticeable
// });
- if (!isMobile) {
- setTimeout(() => {
- chrome.notifications.clear(notificationId);
- }, 7000);
- }
+ // if (!isMobile) {
+ // setTimeout(() => {
+ // chrome.notifications.clear(notificationId);
+ // }, 7000);
+ // }
playNotificationSound();
}
}
const savedtimestampAfter = await getTimestampGroupAnnouncement();
- chrome.runtime.sendMessage({
+ window.postMessage({
action: "SET_GROUP_ANNOUNCEMENTS",
payload: savedtimestampAfter,
- });
+ }, "*");
} catch (error) {
} finally {
}
@@ -918,18 +921,19 @@ export const checkNewMessages = async () => {
// priority: 2, // Use the maximum priority to ensure it's noticeable
// });
- if (!isMobile) {
- setTimeout(() => {
- chrome.notifications.clear(notificationId);
- }, 7000);
- }
+ // if (!isMobile) {
+ // setTimeout(() => {
+ // chrome.notifications.clear(notificationId);
+ // }, 7000);
+ // }
playNotificationSound();
}
const savedtimestampAfter = await getTimestampGroupAnnouncement();
- chrome.runtime.sendMessage({
+ window.postMessage({
action: "SET_GROUP_ANNOUNCEMENTS",
payload: savedtimestampAfter,
- });
+ }, "*");
+
} catch (error) {
} finally {
}
@@ -1031,10 +1035,10 @@ export async function getSaveWallet() {
export async function clearAllNotifications() {
- const notifications = await chrome.notifications.getAll();
- for (const notificationId of Object.keys(notifications)) {
- await chrome.notifications.clear(notificationId);
- }
+ // const notifications = await chrome.notifications.getAll();
+ // for (const notificationId of Object.keys(notifications)) {
+ // await chrome.notifications.clear(notificationId);
+ // }
}
export async function getUserInfo() {
@@ -1634,7 +1638,7 @@ async function sendChat({ qortAddress, recipientPublicKey, message }) {
reference,
};
}
- const path = chrome.runtime.getURL("memory-pow.wasm.full");
+ const path = `${import.meta.env.BASE_URL}memory-pow.wasm.full`;
const { nonce, chatBytesArray } = await computePow({
chatBytes: tx.chatBytes,
@@ -1696,7 +1700,7 @@ export async function sendChatGroup({
// if (!hasEnoughBalance) {
// throw new Error("Must have at least 4 QORT to send a chat message");
// }
- const path = chrome.runtime.getURL("memory-pow.wasm.full");
+ const path = `${import.meta.env.BASE_URL}memory-pow.wasm.full`;
const { nonce, chatBytesArray } = await computePow({
chatBytes: tx.chatBytes,
@@ -1776,7 +1780,7 @@ export async function sendChatDirect({
// if (!hasEnoughBalance) {
// throw new Error("Must have at least 4 QORT to send a chat message");
// }
- const path = chrome.runtime.getURL("memory-pow.wasm.full");
+ const path = `${import.meta.env.BASE_URL}memory-pow.wasm.full`;
const { nonce, chatBytesArray } = await computePow({
chatBytes: tx.chatBytes,
@@ -1923,16 +1927,16 @@ async function createBuyOrderTx({ crosschainAtInfo, useLocal }) {
};
}
- setTimeout(() => {
- chrome.tabs.query({}, function (tabs) {
- tabs.forEach((tab) => {
- chrome.tabs.sendMessage(tab.id, {
- type: "RESPONSE_FOR_TRADES",
- message: responseMessage,
- });
- });
- });
- }, 5000);
+ // setTimeout(() => {
+ // chrome.tabs.query({}, function (tabs) {
+ // tabs.forEach((tab) => {
+ // chrome.tabs.sendMessage(tab.id, {
+ // type: "RESPONSE_FOR_TRADES",
+ // message: responseMessage,
+ // });
+ // });
+ // });
+ // }, 5000);
return;
}
@@ -2579,14 +2583,14 @@ async function listenForChatMessageForBuyOrder({
senderPublicKey
);
- chrome.tabs.query({}, function (tabs) {
- tabs.forEach((tab) => {
- chrome.tabs.sendMessage(tab.id, {
- type: "RESPONSE_FOR_TRADES",
- message: parsedMessageObj,
- });
- });
- });
+ // chrome.tabs.query({}, function (tabs) {
+ // tabs.forEach((tab) => {
+ // chrome.tabs.sendMessage(tab.id, {
+ // type: "RESPONSE_FOR_TRADES",
+ // message: parsedMessageObj,
+ // });
+ // });
+ // });
} catch (error) {
console.error(error);
throw new Error(error.message);
@@ -2594,39 +2598,39 @@ async function listenForChatMessageForBuyOrder({
}
export function removeDuplicateWindow(popupUrl) {
- chrome.windows.getAll(
- { populate: true, windowTypes: ["popup"] },
- (windows) => {
- // Filter to find popups matching the specific URL
- const existingPopupsPending = windows.filter(
- (w) =>
- w.tabs &&
- w.tabs.some(
- (tab) => tab.pendingUrl && tab.pendingUrl.startsWith(popupUrl)
- )
- );
- const existingPopups = windows.filter(
- (w) =>
- w.tabs &&
- w.tabs.some((tab) => tab.url && tab.url.startsWith(popupUrl))
- );
+ // chrome.windows.getAll(
+ // { populate: true, windowTypes: ["popup"] },
+ // (windows) => {
+ // // Filter to find popups matching the specific URL
+ // const existingPopupsPending = windows.filter(
+ // (w) =>
+ // w.tabs &&
+ // w.tabs.some(
+ // (tab) => tab.pendingUrl && tab.pendingUrl.startsWith(popupUrl)
+ // )
+ // );
+ // const existingPopups = windows.filter(
+ // (w) =>
+ // w.tabs &&
+ // w.tabs.some((tab) => tab.url && tab.url.startsWith(popupUrl))
+ // );
- if (existingPopupsPending.length > 1) {
- chrome.windows.remove(
- existingPopupsPending?.[0]?.tabs?.[0]?.windowId,
- () => {}
- );
- } else if (
- existingPopupsPending.length > 0 &&
- existingPopups.length > 0
- ) {
- chrome.windows.remove(
- existingPopupsPending?.[0]?.tabs?.[0]?.windowId,
- () => {}
- );
- }
- }
- );
+ // if (existingPopupsPending.length > 1) {
+ // chrome.windows.remove(
+ // existingPopupsPending?.[0]?.tabs?.[0]?.windowId,
+ // () => {}
+ // );
+ // } else if (
+ // existingPopupsPending.length > 0 &&
+ // existingPopups.length > 0
+ // ) {
+ // chrome.windows.remove(
+ // existingPopupsPending?.[0]?.tabs?.[0]?.windowId,
+ // () => {}
+ // );
+ // }
+ // }
+ // );
}
export async function setChatHeads(data) {
@@ -3143,29 +3147,7 @@ const checkGroupList = async () => {
}
};
-const checkActiveChatsForNotifications = async () => {
- try {
- const popupUrl = chrome.runtime.getURL("index.html?main=true");
- chrome.windows.getAll(
- { populate: true, windowTypes: ["popup"] },
- (windows) => {
- // Attempt to find an existing popup window that has a tab with the correct URL
- const existingPopup = windows.find((w) => {
- return (
- w.tabs &&
- w.tabs.some((tab) => tab.url && tab.url.startsWith(popupUrl))
- );
- });
-
- if (existingPopup) {
- } else {
- checkGroupList();
- }
- }
- );
- } catch (error) {}
-};
// Reconnect when service worker wakes up
diff --git a/src/components/Apps/useQortalMessageListener.tsx b/src/components/Apps/useQortalMessageListener.tsx
index 228bff6..765848f 100644
--- a/src/components/Apps/useQortalMessageListener.tsx
+++ b/src/components/Apps/useQortalMessageListener.tsx
@@ -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}
};
diff --git a/src/components/Chat/ChatGroup.tsx b/src/components/Chat/ChatGroup.tsx
index b1637f9..44ae8bb 100644
--- a/src/components/Chat/ChatGroup.tsx
+++ b/src/components/Chat/ChatGroup.tsx
@@ -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);
diff --git a/src/components/Chat/MessageDisplay.tsx b/src/components/Chat/MessageDisplay.tsx
index f4cdce7..64a0cf6 100644
--- a/src/components/Chat/MessageDisplay.tsx
+++ b/src/components/Chat/MessageDisplay.tsx
@@ -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 tag found or href is null.');
}
diff --git a/src/components/Mobile/MobileFooter.tsx b/src/components/Mobile/MobileFooter.tsx
index 7cb3a32..70304de 100644
--- a/src/components/Mobile/MobileFooter.tsx
+++ b/src/components/Mobile/MobileFooter.tsx
@@ -184,7 +184,8 @@ export const MobileFooter = ({
/>
{
- chrome.tabs.create({ url: "https://www.qort.trade"});
+ // TODO
+ // chrome.tabs.create({ url: "https://www.qort.trade"});
}}
icon={