{
+ const iframeRef = useRef(null);
+ const [isOpen, setIsOpen] = useState(false);
+ const [navigationController, setNavigationController] = useRecoilState(
+ navigationControllerAtom
+ );
+ const [selectedTab, setSelectedTab] = useState({
+ tabId: "5558589",
+ name: "Q-Wallets",
+ service: "APP",
+ path: '/qortal'
+ });
+
+ const isDisableBackButton = useMemo(() => {
+ if (selectedTab && navigationController[selectedTab?.tabId]?.hasBack)
+ return false;
+ if (selectedTab && !navigationController[selectedTab?.tabId]?.hasBack)
+ return true;
+ return false;
+ }, [navigationController, selectedTab]);
+
+ const openWalletsAppFunc = useCallback(
+ (e) => {
+ setIsOpen(true);
+ },
+ [setIsOpen]
+ );
+
+ useEffect(() => {
+ subscribeToEvent("openWalletsApp", openWalletsAppFunc);
+
+ return () => {
+ unsubscribeFromEvent("openWalletsApp", openWalletsAppFunc);
+ };
+ }, [openWalletsAppFunc]);
+
+ const handleClose = ()=> {
+ setIsOpen(false);
+ iframeRef.current = null
+ }
+
+ return (
+ <>
+ {isOpen && (
+
+
+
+ Q-Wallets
+
+
+
+
+
+
+
+
+ {
+ executeEvent(`navigateBackApp-${selectedTab?.tabId}`, {});
+ }}
+ disabled={isDisableBackButton}
+ sx={{
+ opacity: !isDisableBackButton ? 1 : 0.1,
+ cursor: !isDisableBackButton ? "pointer" : "default",
+ }}
+ >
+
+
+ {
+ if (selectedTab?.refreshFunc) {
+ selectedTab.refreshFunc(selectedTab?.tabId);
+
+ } else {
+ executeEvent("refreshApp", {
+ tabId: selectedTab?.tabId,
+ });
+ }
+
+
+ }}>
+
+
+
+
+
+
+ )}
+ >
+ );
+};
diff --git a/src/components/Mobile/MobileHeader.tsx b/src/components/Mobile/MobileHeader.tsx
index d25b84b..e224bd0 100644
--- a/src/components/Mobile/MobileHeader.tsx
+++ b/src/components/Mobile/MobileHeader.tsx
@@ -28,6 +28,7 @@ import { useAppFullScreen } from "../../useAppFullscreen";
import { useHandlePaymentNotification } from "../../hooks/useHandlePaymentNotification";
import { formatDate } from "../../utils/time";
import AccountBalanceWalletIcon from "@mui/icons-material/AccountBalanceWallet";
+import { executeEvent } from "../../utils/events";
const Header = ({
logoutFunc,
@@ -545,12 +546,12 @@ const Header = ({
width: "100%",
alignItems: "flex-start",
textWrap: "auto",
- cursor: 'default'
- }}
- onClick={(e) => {
- // executeEvent("addTab", { data: { service: 'APP', name: 'q-mail' } });
- // executeEvent("open-apps-mode", { });
}}
+ onClick={() => {
+
+ executeEvent('openWalletsApp', {})
+ handleClose()
+ }}
>
{
const [latestTx, setLatestTx] = useState(null);
@@ -106,6 +107,21 @@ export const useHandlePaymentNotification = (address) => {
window.removeEventListener("message", messageHandler);
};
}, [getLastSeenData]);
+
+ const setLastEnteredTimestampPaymentEventFunc = useCallback(
+ (e) => {
+ setLastEnteredTimestampPayment(Date.now)
+ },
+ [setLastEnteredTimestampPayment]
+ );
+
+ useEffect(() => {
+ subscribeToEvent("setLastEnteredTimestampPaymentEvent", setLastEnteredTimestampPaymentEventFunc);
+
+ return () => {
+ unsubscribeFromEvent("setLastEnteredTimestampPaymentEvent", setLastEnteredTimestampPaymentEventFunc);
+ };
+ }, [setLastEnteredTimestampPaymentEventFunc]);
return {
latestTx,
getNameOrAddressOfSenderMiddle,
diff --git a/src/messaging/messagesToBackground.tsx b/src/messaging/messagesToBackground.tsx
index 4ad3812..1304b41 100644
--- a/src/messaging/messagesToBackground.tsx
+++ b/src/messaging/messagesToBackground.tsx
@@ -24,14 +24,14 @@ window.addEventListener("message", (event) => {
}
});
-export const sendMessageBackground = (action, data = {}, timeout = 180000, isExtension, appInfo) => {
+export const sendMessageBackground = (action, data = {}, timeout = 180000, isExtension, appInfo, skipAuth) => {
return new Promise((resolve, reject) => {
const requestId = generateRequestId(); // Unique ID for each request
callbackMap.set(requestId, { resolve, reject }); // Store both resolve and reject callbacks
const targetOrigin = window.location.origin
// Send the message with `backgroundMessage` type
- window.postMessage({ type: "backgroundMessage", action, requestId, payload: data, isExtension, appInfo }, targetOrigin);
+ window.postMessage({ type: "backgroundMessage", action, requestId, payload: data, isExtension, appInfo, skipAuth }, targetOrigin);
// Set up a timeout to automatically reject if no response is received
const timeoutId = setTimeout(() => {
diff --git a/src/qortalRequests.ts b/src/qortalRequests.ts
index 116a50a..ba5d476 100644
--- a/src/qortalRequests.ts
+++ b/src/qortalRequests.ts
@@ -71,6 +71,7 @@ export const isRunningGateway = async ()=> {
// Ensure the message is from a trusted source
const isFromExtension = request?.isExtension;
const appInfo = request?.appInfo;
+ const skipAuth = request?.skipAuth || false
if (request?.type !== "backgroundMessage") return; // Only process messages of type 'backgroundMessage'
@@ -78,7 +79,7 @@ export const isRunningGateway = async ()=> {
switch (request.action) {
case "GET_USER_ACCOUNT": {
try {
- const res = await getUserAccount({isFromExtension, appInfo});
+ const res = await getUserAccount({isFromExtension, appInfo, skipAuth});
event.source.postMessage({
requestId: request.requestId,
action: request.action,
diff --git a/src/qortalRequests/get.ts b/src/qortalRequests/get.ts
index c7e4cf7..2cadaaa 100644
--- a/src/qortalRequests/get.ts
+++ b/src/qortalRequests/get.ts
@@ -354,13 +354,16 @@ async function getUserPermission(payload, isFromExtension) {
}
-export const getUserAccount = async ({isFromExtension, appInfo}) => {
+export const getUserAccount = async ({isFromExtension, appInfo, skipAuth}) => {
try {
const value = (await getPermission(`qAPPAutoAuth-${appInfo?.name}`)) || false;
let skip = false;
if (value) {
skip = true;
}
+ if(skipAuth){
+ skip = true
+ }
let resPermission
if(!skip){
resPermission = await getUserPermission({