Merge remote-tracking branch 'refs/remotes/origin/dev' into dev
This commit is contained in:
commit
6e31989262
40 changed files with 613 additions and 696 deletions
|
|
@ -27,7 +27,7 @@
|
|||
"@tensamin/mtp": "workspace:*",
|
||||
"@tensamin/shared": "workspace:*",
|
||||
"@tensamin/storage": "workspace:*",
|
||||
"@tensamin/user": "workspace:*",
|
||||
"@tensamin/identity": "workspace:*",
|
||||
"lucide-react": "^1.29.0",
|
||||
"motion": "^13.0.0",
|
||||
"react": "^19.2.8",
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import GifPicker from "./media/gifPicker";
|
|||
import ReplyBox from "./replyBox";
|
||||
import { useHotkey } from "@tensamin/hotkeys";
|
||||
import { editLastMessageHotkey } from "../hotkeys";
|
||||
import { useUser } from "@tensamin/identity/context";
|
||||
|
||||
export default function InputComponent({
|
||||
value,
|
||||
|
|
@ -39,7 +40,8 @@ export default function InputComponent({
|
|||
}) {
|
||||
const [invertEnterBehavior, setInvertEnterBehavior] = useState(false);
|
||||
|
||||
const { send, sendSealedRelay } = useMTP();
|
||||
const { sendSealedRelay } = useMTP();
|
||||
const { getIota } = useUser();
|
||||
const {
|
||||
addLiveMessage,
|
||||
chatSecret,
|
||||
|
|
@ -176,12 +178,9 @@ export default function InputComponent({
|
|||
|
||||
try {
|
||||
const [ownIota, peerIota] = await Promise.all([
|
||||
send("GetIotaData", { UserId: ownId }),
|
||||
send("GetIotaData", { UserId: userId }),
|
||||
getIota(ownId),
|
||||
getIota(userId),
|
||||
]);
|
||||
if (ownIota.type !== "GetIotaData" || peerIota.type !== "GetIotaData") {
|
||||
throw new Error("Could not resolve an Iota for this message");
|
||||
}
|
||||
const response = await sendSealedRelay(
|
||||
"MessageSend",
|
||||
{
|
||||
|
|
@ -191,15 +190,15 @@ export default function InputComponent({
|
|||
...(replyTo && { ReplyId: replyTo }),
|
||||
},
|
||||
{
|
||||
nextHop: { kind: "iota", id: ownIota.data.IotaId },
|
||||
nextHop: { kind: "iota", id: ownIota.IotaId },
|
||||
finalRecipientId: userId,
|
||||
metadataRecipients: [
|
||||
{ value: ownIota.data.PublicKey, encoding: "base64" },
|
||||
{ value: peerIota.data.PublicKey, encoding: "base64" },
|
||||
{ value: ownIota.PublicKey, encoding: "base64" },
|
||||
{ value: peerIota.PublicKey, encoding: "base64" },
|
||||
],
|
||||
contentRecipients: [
|
||||
{ value: ownIota.data.PublicKey, encoding: "base64" },
|
||||
{ value: peerIota.data.PublicKey, encoding: "base64" },
|
||||
{ value: ownIota.PublicKey, encoding: "base64" },
|
||||
{ value: peerIota.PublicKey, encoding: "base64" },
|
||||
],
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import {
|
|||
} from "lucide-react";
|
||||
import { useState, useMemo, useEffect, useRef, type WheelEvent } from "react";
|
||||
import MediaSaveButton from "./mediaSaveButton";
|
||||
import { useUserFields } from "@tensamin/user/context";
|
||||
import { useUserFields } from "@tensamin/identity/context";
|
||||
|
||||
const zoomLevels = [1, 1.5, 2, 3];
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import type { RawMessage } from "../values";
|
||||
import { AlertTriangle, Check, CheckLine, RefreshCw } from "lucide-react";
|
||||
import { memo, useCallback, useEffect, useRef, useState } from "react";
|
||||
import { type SelectedUser, useUserFields } from "@tensamin/user/context";
|
||||
import { type SelectedUser, useUserFields } from "@tensamin/identity/context";
|
||||
|
||||
import {
|
||||
Avatar,
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ import {
|
|||
Skeleton,
|
||||
} from "@methanium/ui";
|
||||
import { Text } from "@methanium/ui/markdown";
|
||||
import type { SelectedUser } from "@tensamin/user/context";
|
||||
import Wrapper from "@tensamin/user/wrapper";
|
||||
import type { SelectedUser } from "@tensamin/identity/context";
|
||||
import Wrapper from "@tensamin/identity/wrapper";
|
||||
import { Forward, X } from "lucide-react";
|
||||
|
||||
type ReplyUserData = SelectedUser<readonly ["Avatar", "Display"]>;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import { useStorage } from "@tensamin/storage/context";
|
|||
import { requireRelaySuccess, useMTP } from "@tensamin/mtp";
|
||||
import { log, toast } from "@tensamin/shared/log";
|
||||
import { useSession } from "@tensamin/storage/session";
|
||||
import { useUser } from "@tensamin/user/context";
|
||||
import { useUser } from "@tensamin/identity/context";
|
||||
import { createCache, type ChatDraft } from "@tensamin/cache";
|
||||
import { secureValueCodec } from "@tensamin/storage/secure";
|
||||
|
||||
|
|
@ -242,7 +242,7 @@ export async function fetchReplyMessage({
|
|||
export default function Provider({ children }: { children: ReactNode }) {
|
||||
const { load } = useStorage();
|
||||
const { send, sendSealedRelay, subscribe } = useMTP();
|
||||
const { get: getUser } = useUser();
|
||||
const { get: getUser, getIota } = useUser();
|
||||
const { moveUserIdToTop } = useSession();
|
||||
|
||||
const [error, setError] = useState("");
|
||||
|
|
@ -484,14 +484,8 @@ export default function Provider({ children }: { children: ReactNode }) {
|
|||
version: CHAT_SECRET_VERSION,
|
||||
});
|
||||
|
||||
const ownIota = await send("GetIotaData", { UserId: ownUserId });
|
||||
if (ownIota.type !== "GetIotaData") {
|
||||
throw new Error(`Own Iota lookup failed: ${ownIota.type}`);
|
||||
}
|
||||
const peerIota = await send("GetIotaData", { UserId: userIdValue });
|
||||
if (peerIota.type !== "GetIotaData") {
|
||||
throw new Error(`Peer Iota lookup failed: ${peerIota.type}`);
|
||||
}
|
||||
const ownIota = await getIota(ownUserId);
|
||||
const peerIota = await getIota(userIdValue);
|
||||
const response = await sendSealedRelay(
|
||||
"SetChatSecret",
|
||||
{
|
||||
|
|
@ -514,15 +508,15 @@ export default function Provider({ children }: { children: ReactNode }) {
|
|||
],
|
||||
},
|
||||
{
|
||||
nextHop: { kind: "iota", id: ownIota.data.IotaId },
|
||||
nextHop: { kind: "iota", id: ownIota.IotaId },
|
||||
finalRecipientId: userIdValue,
|
||||
metadataRecipients: [
|
||||
{ value: ownIota.data.PublicKey, encoding: "base64" },
|
||||
{ value: peerIota.data.PublicKey, encoding: "base64" },
|
||||
{ value: ownIota.PublicKey, encoding: "base64" },
|
||||
{ value: peerIota.PublicKey, encoding: "base64" },
|
||||
],
|
||||
contentRecipients: [
|
||||
{ value: ownIota.data.PublicKey, encoding: "base64" },
|
||||
{ value: peerIota.data.PublicKey, encoding: "base64" },
|
||||
{ value: ownIota.PublicKey, encoding: "base64" },
|
||||
{ value: peerIota.PublicKey, encoding: "base64" },
|
||||
],
|
||||
},
|
||||
);
|
||||
|
|
@ -544,7 +538,7 @@ export default function Provider({ children }: { children: ReactNode }) {
|
|||
return () => {
|
||||
active = false;
|
||||
};
|
||||
}, [getUser, load, send, sendSealedRelay, userIdValue]);
|
||||
}, [getIota, getUser, load, send, sendSealedRelay, userIdValue]);
|
||||
|
||||
const getChatSecret = useCallback(
|
||||
async (userId: number): Promise<Uint8Array | null> => {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import {
|
|||
type LiveMessage,
|
||||
type RawMessage,
|
||||
} from "./values";
|
||||
import Wrapper from "@tensamin/user/wrapper";
|
||||
import Wrapper from "@tensamin/identity/wrapper";
|
||||
|
||||
function shouldFetchPreviousPage({
|
||||
entry,
|
||||
|
|
|
|||
Loading…
Reference in a new issue