mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-04-23 19:37:52 +00:00
cases
This commit is contained in:
parent
c9055e4b68
commit
4d570068ef
@ -19,6 +19,8 @@ import {
|
|||||||
getLTCBalance,
|
getLTCBalance,
|
||||||
getNameInfo,
|
getNameInfo,
|
||||||
getTempPublish,
|
getTempPublish,
|
||||||
|
getTimestampEnterChat,
|
||||||
|
getTimestampGroupAnnouncement,
|
||||||
getUserInfo,
|
getUserInfo,
|
||||||
getUserSettings,
|
getUserSettings,
|
||||||
inviteToGroup,
|
inviteToGroup,
|
||||||
@ -1037,4 +1039,57 @@ export async function balanceCase(request, event) {
|
|||||||
event.origin
|
event.origin
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getTimestampEnterChatCase(request, event) {
|
||||||
|
try {
|
||||||
|
const response = await getTimestampEnterChat();
|
||||||
|
|
||||||
|
event.source.postMessage(
|
||||||
|
{
|
||||||
|
requestId: request.requestId,
|
||||||
|
action: "getTimestampEnterChat",
|
||||||
|
payload: response,
|
||||||
|
type: "backgroundMessageResponse",
|
||||||
|
},
|
||||||
|
event.origin
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
event.source.postMessage(
|
||||||
|
{
|
||||||
|
requestId: request.requestId,
|
||||||
|
action: "getTimestampEnterChat",
|
||||||
|
error: error?.message,
|
||||||
|
type: "backgroundMessageResponse",
|
||||||
|
},
|
||||||
|
event.origin
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export async function getGroupNotificationTimestampCase(request, event) {
|
||||||
|
try {
|
||||||
|
const response = await getTimestampGroupAnnouncement();
|
||||||
|
|
||||||
|
event.source.postMessage(
|
||||||
|
{
|
||||||
|
requestId: request.requestId,
|
||||||
|
action: "getGroupNotificationTimestamp",
|
||||||
|
payload: response,
|
||||||
|
type: "backgroundMessageResponse",
|
||||||
|
},
|
||||||
|
event.origin
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
event.source.postMessage(
|
||||||
|
{
|
||||||
|
requestId: request.requestId,
|
||||||
|
action: "getGroupNotificationTimestamp",
|
||||||
|
error: error?.message,
|
||||||
|
type: "backgroundMessageResponse",
|
||||||
|
},
|
||||||
|
event.origin
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
@ -44,7 +44,9 @@ import {
|
|||||||
getCustomNodesFromStorageCase,
|
getCustomNodesFromStorageCase,
|
||||||
getDataPublishesCase,
|
getDataPublishesCase,
|
||||||
getGroupDataSingleCase,
|
getGroupDataSingleCase,
|
||||||
|
getGroupNotificationTimestampCase,
|
||||||
getTempPublishCase,
|
getTempPublishCase,
|
||||||
|
getTimestampEnterChatCase,
|
||||||
getUserSettingsCase,
|
getUserSettingsCase,
|
||||||
getWalletInfoCase,
|
getWalletInfoCase,
|
||||||
inviteToGroupCase,
|
inviteToGroupCase,
|
||||||
@ -2734,7 +2736,7 @@ async function setChatHeadsDirect(data) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getTimestampEnterChat() {
|
export async function getTimestampEnterChat() {
|
||||||
const wallet = await getSaveWallet();
|
const wallet = await getSaveWallet();
|
||||||
const address = wallet.address0;
|
const address = wallet.address0;
|
||||||
const key = `enter-chat-timestamp-${address}`;
|
const key = `enter-chat-timestamp-${address}`;
|
||||||
@ -2746,7 +2748,7 @@ async function getTimestampEnterChat() {
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async function getTimestampGroupAnnouncement() {
|
export async function getTimestampGroupAnnouncement() {
|
||||||
const wallet = await getSaveWallet();
|
const wallet = await getSaveWallet();
|
||||||
const address = wallet.address0;
|
const address = wallet.address0;
|
||||||
const key = `group-announcement-${address}`;
|
const key = `group-announcement-${address}`;
|
||||||
@ -3030,6 +3032,12 @@ function setupMessageListener() {
|
|||||||
case "getGroupDataSingle":
|
case "getGroupDataSingle":
|
||||||
getGroupDataSingleCase(request, event);
|
getGroupDataSingleCase(request, event);
|
||||||
break;
|
break;
|
||||||
|
case "getTimestampEnterChat":
|
||||||
|
getTimestampEnterChatCase(request, event);
|
||||||
|
break;
|
||||||
|
case "getGroupNotificationTimestamp":
|
||||||
|
getGroupNotificationTimestampCase(request, event);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
console.error("Unknown action:", request.action);
|
console.error("Unknown action:", request.action);
|
||||||
}
|
}
|
||||||
|
@ -503,18 +503,19 @@ export const Group = ({
|
|||||||
const getTimestampEnterChat = async () => {
|
const getTimestampEnterChat = async () => {
|
||||||
try {
|
try {
|
||||||
return new Promise((res, rej) => {
|
return new Promise((res, rej) => {
|
||||||
chrome?.runtime?.sendMessage(
|
window.sendMessage("getTimestampEnterChat")
|
||||||
{
|
.then((response) => {
|
||||||
action: "getTimestampEnterChat",
|
if (!response?.error) {
|
||||||
},
|
setTimestampEnterData(response);
|
||||||
(response) => {
|
res(response);
|
||||||
if (!response?.error) {
|
return;
|
||||||
setTimestampEnterData(response);
|
}
|
||||||
res(response);
|
rej(response.error);
|
||||||
}
|
})
|
||||||
rej(response.error);
|
.catch((error) => {
|
||||||
}
|
rej(error.message || "An error occurred");
|
||||||
);
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
};
|
};
|
||||||
@ -550,18 +551,19 @@ export const Group = ({
|
|||||||
const getGroupAnnouncements = async () => {
|
const getGroupAnnouncements = async () => {
|
||||||
try {
|
try {
|
||||||
return new Promise((res, rej) => {
|
return new Promise((res, rej) => {
|
||||||
chrome?.runtime?.sendMessage(
|
window.sendMessage("getGroupNotificationTimestamp")
|
||||||
{
|
.then((response) => {
|
||||||
action: "getGroupNotificationTimestamp",
|
if (!response?.error) {
|
||||||
},
|
setGroupAnnouncements(response);
|
||||||
(response) => {
|
res(response);
|
||||||
if (!response?.error) {
|
return;
|
||||||
setGroupAnnouncements(response);
|
|
||||||
res(response);
|
|
||||||
}
|
|
||||||
rej(response.error);
|
|
||||||
}
|
}
|
||||||
);
|
rej(response.error);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
rej(error.message || "An error occurred");
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user