From 4ce4264deaa7f091737fd59d0257c0f18376857e Mon Sep 17 00:00:00 2001 From: PhilReact Date: Wed, 30 Oct 2024 19:17:12 +0200 Subject: [PATCH] remove logs --- src/App.tsx | 5 -- src/background-cases.ts | 7 -- src/background.ts | 3 - src/components/Apps/AppViewer.tsx | 5 -- .../Apps/useQortalMessageListener.tsx | 67 +------------------ src/components/Chat/ChatGroup.tsx | 1 - src/components/Group/Forum/GroupMail.tsx | 19 +----- src/components/Group/Group.tsx | 4 -- src/components/Group/WebsocketActive.tsx | 2 - src/qdn/encryption/group-encryption.ts | 1 - src/qortalRequests.ts | 4 -- src/qortalRequests/get.ts | 5 -- src/useRetrieveDataLocalStorage.tsx | 1 - 13 files changed, 3 insertions(+), 121 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index c0624fb..d1aeee5 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -641,9 +641,7 @@ function App() { const qortalRequestPermissonFromExtension = async (message, event) => { if (message.action === "QORTAL_REQUEST_PERMISSION") { try { - console.log("QORTAL_REQUEST_PERMISSION2", event, message); await showQortalRequestExtension(message?.payload); - console.log("event100", event); if (qortalRequestCheckbox1Ref.current) { event.source.postMessage( { @@ -686,7 +684,6 @@ function App() { useEffect(() => { // Handler function for incoming messages const messageHandler = (event) => { - console.log("messageHandler", event); const message = event.data; if (message?.action === "CHECK_FOCUS") { @@ -761,7 +758,6 @@ function App() { window .sendMessage("getWalletInfo") .then((response) => { - console.log("getwalll", response); if (response && response?.walletInfo) { setRawWallet(response?.walletInfo); if ( @@ -1022,7 +1018,6 @@ function App() { wallet: rawWallet, }) .then((response) => { - console.log("response2", response); if (response && !response.error) { setAuthenticatePassword(""); setExtstate("authenticated"); diff --git a/src/background-cases.ts b/src/background-cases.ts index cc22692..dff5ed9 100644 --- a/src/background-cases.ts +++ b/src/background-cases.ts @@ -200,11 +200,8 @@ export async function userInfoCase(request, event) { export async function decryptWalletCase(request, event) { try { - console.log('request', request) const { password, wallet } = request.payload; - console.log({password, wallet}) const response = await decryptWallet({password, wallet, walletVersion}); - console.log('response', response) event.source.postMessage( { requestId: request.requestId, @@ -1368,9 +1365,7 @@ export async function publishGroupEncryptedResourceCase(request, event) { export async function decryptGroupEncryptionCase(request, event) { try { const { data} = request.payload; - console.log('data', data) const response = await decryptGroupEncryption({ data }); - console.log('dataresponse', response) event.source.postMessage( { requestId: request.requestId, @@ -1423,9 +1418,7 @@ export async function publishGroupEncryptedResourceCase(request, event) { export async function decryptSingleCase(request, event) { try { const { data, secretKeyObject, skipDecodeBase64} = request.payload; - 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 3eb637d..f45e376 100644 --- a/src/background.ts +++ b/src/background.ts @@ -1560,7 +1560,6 @@ const getStoredData = async (key) => { export async function handleActiveGroupDataFromSocket({ groups, directs }) { try { - console.log('handleActiveGroupDataFromSocket3', groups, directs) window.postMessage({ action: "SET_GROUPS", payload: groups, @@ -2887,7 +2886,6 @@ function setupMessageListener() { // Check if the message is intended for this listener if (request?.type !== "backgroundMessage") return; // Only process messages of type 'backgroundMessage' - console.log("REQUEST MESSAGE", request); switch (request.action) { case "version": @@ -2913,7 +2911,6 @@ function setupMessageListener() { userInfoCase(request, event); break; case "decryptWallet": - console.log('going through') decryptWalletCase(request, event); break; case "balance": diff --git a/src/components/Apps/AppViewer.tsx b/src/components/Apps/AppViewer.tsx index 7304b3c..2aa71a8 100644 --- a/src/components/Apps/AppViewer.tsx +++ b/src/components/Apps/AppViewer.tsx @@ -17,7 +17,6 @@ export const AppViewer = React.forwardRef(({ app , hide}, iframeRef) => { const { document, window: frameWindow } = useFrame(); const {path, history, changeCurrentIndex} = useQortalMessageListener(frameWindow, iframeRef, app?.tabId) const [url, setUrl] = useState('') - console.log('historyreact', history) useEffect(()=> { setUrl(`${getBaseApiReact()}/render/${app?.service}/${app?.name}${app?.path != null ? `/${app?.path}` : ''}?theme=dark&identifier=${(app?.identifier != null && app?.identifier != 'null') ? app?.identifier : ''}`) @@ -55,14 +54,12 @@ export const AppViewer = React.forwardRef(({ app , hide}, iframeRef) => { iframeRef.current.contentWindow.postMessage( { action: 'PERFORMING_NON_MANUAL', currentIndex: previousPageIndex }, '*' ); - console.log('previousPageIndex', previousPageIndex) // Update the current index locally changeCurrentIndex(previousPageIndex); // Create a navigation promise with a 200ms timeout const navigationPromise = new Promise((resolve, reject) => { function handleNavigationSuccess(event) { - console.log('listeninghandlenav', event) if (event.data?.action === 'NAVIGATION_SUCCESS' && event.data.path === previousPath) { frameWindow.removeEventListener('message', handleNavigationSuccess); resolve(); @@ -86,7 +83,6 @@ export const AppViewer = React.forwardRef(({ app , hide}, iframeRef) => { // Execute navigation promise and handle timeout fallback try { await navigationPromise; - console.log('Navigation succeeded within 200ms.'); } catch (error) { setUrl(`${getBaseApiReact()}/render/${app?.service}/${app?.name}${previousPath != null ? previousPath : ''}?theme=dark&identifier=${(app?.identifier != null && app?.identifier != 'null') ? app?.identifier : ''}&time=${new Date().getMilliseconds()}&isManualNavigation=false`) @@ -117,7 +113,6 @@ export const AppViewer = React.forwardRef(({ app , hide}, iframeRef) => { if (iframeRef.current && iframeRef.current.contentWindow) { - console.log('iframeRef.contentWindow', iframeRef.current.contentWindow); iframeRef.current.contentWindow.postMessage( { action: 'NAVIGATE_FORWARD'}, '*' diff --git a/src/components/Apps/useQortalMessageListener.tsx b/src/components/Apps/useQortalMessageListener.tsx index 0468afe..c578595 100644 --- a/src/components/Apps/useQortalMessageListener.tsx +++ b/src/components/Apps/useQortalMessageListener.tsx @@ -241,68 +241,7 @@ const UIQortalRequests = [ declare var cordova: any; - // try { - // const { filename, mimeType, fileId } = data; - - // // Request legacy storage permissions if applicable (for Android 12 and below) - // // await requestLegacyPermissions(); - - // // Retrieve file from IndexedDB or another source - // const blob = await retrieveFileFromIndexedDB(fileId); - // const buffer = await blob.arrayBuffer(); - - // return new Promise((resolve, reject) => { - // window.resolveLocalFileSystemURL( - // cordova.file.externalRootDirectory, // Points to the root of public external storage - // (rootDirectoryEntry) => { - // rootDirectoryEntry.getDirectory( - // "Downloads", - // { create: true }, - // (downloadsDirectory) => { - // downloadsDirectory.getFile( - // filename, - // { create: true, exclusive: false }, - // (fileEntry) => { - // fileEntry.createWriter((fileWriter) => { - // fileWriter.onwriteend = () => { - // console.log("Video saved successfully in public Downloads:", fileEntry.nativeURL); - // resolve(fileEntry.nativeURL); - // }; - - // fileWriter.onerror = (error) => { - // console.error("Error writing video file:", error); - // reject(error); - // }; - - // const videoBlob = new Blob([buffer], { type: mimeType || "video/mp4" }); - // fileWriter.truncate(0); - // fileWriter.write(videoBlob); - // }); - // }, - // (error) => { - // console.error("Error accessing or creating file:", error); - // reject(error); - // } - // ); - // }, - // (error) => { - // console.error("Error accessing Downloads folder:", error); - // reject(error); - // } - // ); - // }, - // (error) => { - // console.error("Error accessing external storage:", error); - // reject(error); - // } - // ); - // }); - // } catch (error) { - // console.error("Error saving video file:", error); - // throw error; - // } - // }; - + async function storeFilesInIndexedDB(obj) { // First delete any existing files in IndexedDB with '_qortalfile' in their ID await deleteQortalFilesFromIndexedDB(); @@ -421,9 +360,7 @@ isDOMContentLoaded: false useEffect(() => { const listener = async (event) => { - console.log('eventreactt', event) - // event.preventDefault(); // Prevent default behavior - // event.stopImmediatePropagation(); // Stop other listeners from firing + if (event?.data?.requestedHandler !== 'UI') return; diff --git a/src/components/Chat/ChatGroup.tsx b/src/components/Chat/ChatGroup.tsx index 44ae8bb..b1637f9 100644 --- a/src/components/Chat/ChatGroup.tsx +++ b/src/components/Chat/ChatGroup.tsx @@ -130,7 +130,6 @@ 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/Group/Forum/GroupMail.tsx b/src/components/Group/Forum/GroupMail.tsx index 9d2e42d..d569b27 100644 --- a/src/components/Group/Forum/GroupMail.tsx +++ b/src/components/Group/Forum/GroupMail.tsx @@ -261,12 +261,7 @@ export const GroupMail = ({ async (groupId: string, members: any) => { try { setIsLoading(true) - // const memberNames = Object.keys(members); - // const queryString = memberNames - // .map(name => `&name=${encodeURIComponent(name)}`) - // .join(""); - // dispatch(setIsLoadingCustom("Loading recent threads")); const identifier = `thmsg-grp-${groupId}-thread-`; const url = `${getBaseApiReact()}${getArbitraryEndpointReact()}?mode=ALL&service=${threadIdentifier}&identifier=${identifier}&limit=100&includemetadata=false&offset=${0}&reverse=true&prefix=true`; const response = await fetch(url, { @@ -432,19 +427,7 @@ export const GroupMail = ({ } }, []); - // useEffect(() => { - // if(groupId){ - // getGroupMembers(groupId); - // interval.current = setInterval(async () => { - // getGroupMembers(groupId); - // }, 180000) - // } - // return () => { - // if (interval?.current) { - // clearInterval(interval.current) - // } - // } - // }, [getGroupMembers, groupId]); + let listOfThreadsToDisplay = recentThreads; diff --git a/src/components/Group/Group.tsx b/src/components/Group/Group.tsx index bfdb5d6..6654111 100644 --- a/src/components/Group/Group.tsx +++ b/src/components/Group/Group.tsx @@ -203,7 +203,6 @@ export const decryptResource = async (data: string) => { data, }) .then((response) => { - console.log('decryptseroucs', response) if (!response?.error) { res(response); return; @@ -440,7 +439,6 @@ export const Group = ({ const [appsMode, setAppsMode] = useState('home') const [isOpenSideViewDirects, setIsOpenSideViewDirects] = useState(false) const [isOpenSideViewGroups, setIsOpenSideViewGroups] = useState(false) - console.log('groups', groups) const toggleSideViewDirects = ()=> { if(isOpenSideViewGroups){ setIsOpenSideViewGroups(false) @@ -896,9 +894,7 @@ export const Group = ({ // Handler function for incoming messages const messageHandler = (event) => { const message = event.data; - console.log('SET_GROUPS100', event) if (message?.action === "SET_GROUPS") { - console.log('SET_GROUPS200', event) // Update the component state with the received 'sendqort' state setGroups(message.payload); diff --git a/src/components/Group/WebsocketActive.tsx b/src/components/Group/WebsocketActive.tsx index c60f1f7..36ef1f7 100644 --- a/src/components/Group/WebsocketActive.tsx +++ b/src/components/Group/WebsocketActive.tsx @@ -50,7 +50,6 @@ export const WebSocketActive = ({ myAddress, setIsLoadingGroups }) => { socketRef.current = new WebSocket(socketLink); socketRef.current.onopen = () => { - console.log('WebSocket connection opened'); setTimeout(pingHeads, 50); // Initial ping }; @@ -72,7 +71,6 @@ export const WebSocketActive = ({ myAddress, setIsLoadingGroups }) => { const sortedDirects = (data?.direct || []).filter(item => item?.name !== 'extension-proxy' && item?.address !== 'QSMMGSgysEuqDCuLw3S4cHrQkBrh3vP3VH' ).sort((a, b) => (b.timestamp || 0) - (a.timestamp || 0)); - console.log('sortedGroups', sortedGroups) window.sendMessage("handleActiveGroupDataFromSocket", { groups: sortedGroups, diff --git a/src/qdn/encryption/group-encryption.ts b/src/qdn/encryption/group-encryption.ts index f0bf5f1..4f61dd8 100644 --- a/src/qdn/encryption/group-encryption.ts +++ b/src/qdn/encryption/group-encryption.ts @@ -330,7 +330,6 @@ export const decodeBase64ForUIChatMessages = (messages)=> { export function decryptGroupData(data64EncryptedData: string, privateKey: string) { - console.log({data64EncryptedData, privateKey}) const allCombined = base64ToUint8Array(data64EncryptedData) const str = "qortalGroupEncryptedData" const strEncoder = new TextEncoder() diff --git a/src/qortalRequests.ts b/src/qortalRequests.ts index fde249d..3ca1c9e 100644 --- a/src/qortalRequests.ts +++ b/src/qortalRequests.ts @@ -30,7 +30,6 @@ function setLocalStorage(key, data) { // Save the updated object back to storage await setLocalStorage('qortalRequestPermissions', qortalRequestPermissions ); - console.log('Permission set for', key); } catch (error) { console.error('Error setting permission:', error); } @@ -61,7 +60,6 @@ function setLocalStorage(key, data) { const isFromExtension = request?.isExtension; if (request?.type !== "backgroundMessage") return; // Only process messages of type 'backgroundMessage' - console.log("REQUEST MESSAGE QORTALREQUEST", request); // Handle actions based on the `request.action` value switch (request.action) { @@ -87,7 +85,6 @@ function setLocalStorage(key, data) { case "ENCRYPT_DATA": { try { - console.log('ENCRYPTDATA', request) const res = await encryptData(request.payload, event.source); event.source.postMessage({ requestId: request.requestId, @@ -369,7 +366,6 @@ function setLocalStorage(key, data) { case "GET_WALLET_BALANCE": { try { const res = await getWalletBalance(request.payload, false, isFromExtension); - console.log('ressss', res) event.source.postMessage({ requestId: request.requestId, action: request.action, diff --git a/src/qortalRequests/get.ts b/src/qortalRequests/get.ts index 2509583..88c4091 100644 --- a/src/qortalRequests/get.ts +++ b/src/qortalRequests/get.ts @@ -201,20 +201,16 @@ const handleFileMessage = (event) => { window.addEventListener("message", handleFileMessage); function getFileFromContentScript(fileId) { - console.log('handleGetFileFromIndexedDB', fileId) return new Promise((resolve, reject) => { const requestId = `getFile_${fileId}_${Date.now()}`; - console.log('handleGetFileFromIndexedDB', requestId) fileRequestResolvers.set(requestId, { resolve, reject }); // Store resolvers by requestId - console.log('handleGetFileFromIndexedDB', 'passed') // Send the request message window.postMessage( { action: "getFileFromIndexedDB", fileId, requestId }, "*" ); - console.log('handleGetFileFromIndexedDB', 'after', window.origin) // Timeout to handle no response scenario setTimeout(() => { @@ -239,7 +235,6 @@ const responseResolvers = new Map(); const handleMessage = (event) => { const { action, requestId, result } = event.data; - console.log("Received message:", event); // Check if this is the expected response action and if we have a stored resolver if (action === "QORTAL_REQUEST_PERMISSION_RESPONSE" && responseResolvers.has(requestId)) { diff --git a/src/useRetrieveDataLocalStorage.tsx b/src/useRetrieveDataLocalStorage.tsx index 6d7b05e..88e93f4 100644 --- a/src/useRetrieveDataLocalStorage.tsx +++ b/src/useRetrieveDataLocalStorage.tsx @@ -6,7 +6,6 @@ function fetchFromLocalStorage(key) { try { const serializedValue = localStorage.getItem(key); if (serializedValue === null) { - console.log(`No data found for key: ${key}`); return null; } return JSON.parse(serializedValue);