feat(user): rename to identity
feat(identity): add getIota function with caching
This commit is contained in:
parent
c386e8d5cb
commit
042141c781
40 changed files with 613 additions and 668 deletions
|
|
@ -32,7 +32,7 @@
|
|||
"@tensamin/storage": "workspace:*",
|
||||
"@tensamin/tauri": "workspace:*",
|
||||
"@tensamin/tauth": "workspace:*",
|
||||
"@tensamin/user": "workspace:*",
|
||||
"@tensamin/identity": "workspace:*",
|
||||
"decimal.js-light": "^2.5.1",
|
||||
"eventemitter3": "^5.0.4",
|
||||
"lucide-react": "^1.29.0",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { User } from "@tensamin/user/context";
|
||||
import type { User } from "@tensamin/identity/context";
|
||||
import {
|
||||
Avatar,
|
||||
AvatarImage,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { User } from "@tensamin/user/context";
|
||||
import type { User } from "@tensamin/identity/context";
|
||||
import { Avatar, AvatarFallback, AvatarImage, Button } from "@methanium/ui";
|
||||
import { Text } from "@methanium/ui/markdown";
|
||||
import { ChevronDown, ChevronUp } from "lucide-react";
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import {
|
|||
} from "lucide-react";
|
||||
import { useLocation, useNavigate, useSearch } from "@tanstack/react-router";
|
||||
import { joinCall, useCall } from "@tensamin/call/store";
|
||||
import Wrapper from "@tensamin/user/wrapper";
|
||||
import Wrapper from "@tensamin/identity/wrapper";
|
||||
import { Skeleton } from "@methanium/ui";
|
||||
import {
|
||||
Select,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import Wrapper from "@tensamin/user/wrapper";
|
||||
import Wrapper from "@tensamin/identity/wrapper";
|
||||
import { Basic, Loading } from "./modals/basic";
|
||||
import List from "@/features/conversation/list/body";
|
||||
|
||||
|
|
@ -34,7 +34,7 @@ import SidebarBox from "@tensamin/call/sidebarBox";
|
|||
import { useShowMobileNavbar } from "@/routes/app/useShowMobileNavbar";
|
||||
import { Ellipsis, Check } from "lucide-react";
|
||||
import { useState } from "react";
|
||||
import { useUser, type User } from "@tensamin/user/context";
|
||||
import { useUser, type User } from "@tensamin/identity/context";
|
||||
import { mtp, userPresencePreferenceSchema } from "@tensamin/shared/data";
|
||||
import { useMTP } from "@tensamin/mtp";
|
||||
import {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Basic, Loading } from "@/components/modals/basic";
|
||||
import Wrapper from "@tensamin/user/wrapper";
|
||||
import Wrapper from "@tensamin/identity/wrapper";
|
||||
import {
|
||||
ContextMenu,
|
||||
ContextMenuContent,
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import ChatContext from "@tensamin/chat/context";
|
|||
import { useCall, useInitializeCall } from "@tensamin/call/store";
|
||||
import { useIsSpeaking } from "@tensamin/call/speakingState";
|
||||
import { Provider as MTPProvider } from "@tensamin/mtp";
|
||||
import UserProvider from "@tensamin/user/context";
|
||||
import UserProvider from "@tensamin/identity/context";
|
||||
import DeeplinkContext, { useDeeplinks } from "@tensamin/tauri/deeplinkHandler";
|
||||
import NotificationsProvider from "@tensamin/notifications/context";
|
||||
import PwaRuntime from "@tensamin/pwa/runtime";
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import { isTauri } from "@tauri-apps/api/core";
|
|||
import { useSession } from "@tensamin/storage/session";
|
||||
import { useStorage } from "@tensamin/storage/context";
|
||||
import { ShieldAlert } from "lucide-react";
|
||||
import { useUser } from "@tensamin/identity/context";
|
||||
|
||||
// The page
|
||||
export default function Page() {
|
||||
|
|
@ -56,6 +57,7 @@ function AddConversationButton() {
|
|||
const { send, sendSealedRelay } = useMTP();
|
||||
const { contacts, insertContact } = useSession();
|
||||
const { load } = useStorage();
|
||||
const { getIota } = useUser();
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [open, setOpen] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
|
@ -110,23 +112,15 @@ function AddConversationButton() {
|
|||
|
||||
try {
|
||||
const userId = await load("user_id");
|
||||
const iota = await send("GetIotaData", { UserId: userId });
|
||||
if (iota.type !== "GetIotaData") {
|
||||
setError(`Iota lookup failed: ${iota.type}`);
|
||||
return;
|
||||
}
|
||||
const iota = await getIota(userId);
|
||||
const response = await sendSealedRelay(
|
||||
"AddConversation",
|
||||
{ ChatPartnerId: user.data.UserId },
|
||||
{
|
||||
nextHop: { kind: "iota", id: iota.data.IotaId },
|
||||
nextHop: { kind: "iota", id: iota.IotaId },
|
||||
finalRecipientId: userId,
|
||||
metadataRecipients: [
|
||||
{ value: iota.data.PublicKey, encoding: "base64" },
|
||||
],
|
||||
contentRecipients: [
|
||||
{ value: iota.data.PublicKey, encoding: "base64" },
|
||||
],
|
||||
metadataRecipients: [{ value: iota.PublicKey, encoding: "base64" }],
|
||||
contentRecipients: [{ value: iota.PublicKey, encoding: "base64" }],
|
||||
},
|
||||
);
|
||||
requireRelaySuccess(response);
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ export default defineConfig({
|
|||
"@tensamin/settings",
|
||||
"@tensamin/storage",
|
||||
"@tensamin/mtp",
|
||||
"@tensamin/user",
|
||||
"@tensamin/identity",
|
||||
"@tensamin/tauri",
|
||||
"@tensamin/chat",
|
||||
],
|
||||
|
|
@ -118,7 +118,7 @@ export default defineConfig({
|
|||
"@tensamin/storage/context",
|
||||
"@tensamin/tauri",
|
||||
"@tensamin/tauth",
|
||||
"@tensamin/user",
|
||||
"@tensamin/identity",
|
||||
],
|
||||
},
|
||||
build: {
|
||||
|
|
|
|||
Loading…
Reference in a new issue