Transition

This commit is contained in:
Manav Rathi 2024-04-08 20:40:43 +05:30
parent 5339b1aa89
commit 3e3712efb3
No known key found for this signature in database
4 changed files with 24 additions and 28 deletions

View file

@ -1,6 +1,6 @@
import EnteSpinner from "@ente/shared/components/EnteSpinner"; import EnteSpinner from "@ente/shared/components/EnteSpinner";
import { boxSealOpen, toB64 } from "@ente/shared/crypto/internal/libsodium"; import { boxSealOpen, toB64 } from "@ente/shared/crypto/internal/libsodium";
import { addLogLine } from "@ente/shared/logging"; import log from "@/next/log";
import castGateway from "@ente/shared/network/cast"; import castGateway from "@ente/shared/network/cast";
import LargeType from "components/LargeType"; import LargeType from "components/LargeType";
import _sodium from "libsodium-wrappers"; import _sodium from "libsodium-wrappers";
@ -60,7 +60,7 @@ export default function PairingMode() {
); );
context.start(options); context.start(options);
} catch (e) { } catch (e) {
addLogLine(e, "failed to create cast context"); log.error("failed to create cast context", e);
} }
setIsCastReady(true); setIsCastReady(true);
return () => { return () => {

View file

@ -1,3 +1,4 @@
import log from "@/next/log";
import { VerticallyCentered } from "@ente/shared/components/Container"; import { VerticallyCentered } from "@ente/shared/components/Container";
import DialogBoxV2 from "@ente/shared/components/DialogBoxV2"; import DialogBoxV2 from "@ente/shared/components/DialogBoxV2";
import EnteButton from "@ente/shared/components/EnteButton"; import EnteButton from "@ente/shared/components/EnteButton";
@ -6,9 +7,7 @@ import SingleInputForm, {
SingleInputFormProps, SingleInputFormProps,
} from "@ente/shared/components/SingleInputForm"; } from "@ente/shared/components/SingleInputForm";
import { boxSeal } from "@ente/shared/crypto/internal/libsodium"; import { boxSeal } from "@ente/shared/crypto/internal/libsodium";
import { addLogLine } from "@ente/shared/logging";
import castGateway from "@ente/shared/network/cast"; import castGateway from "@ente/shared/network/cast";
import { logError } from "@ente/shared/sentry";
import { Link, Typography } from "@mui/material"; import { Link, Typography } from "@mui/material";
import { t } from "i18next"; import { t } from "i18next";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
@ -105,7 +104,7 @@ export default function AlbumCastDialog(props: Props) {
await instance.requestSession(); await instance.requestSession();
} catch (e) { } catch (e) {
setView("auto-cast-error"); setView("auto-cast-error");
logError(e, "Error requesting session"); log.error("Error requesting session", e);
return; return;
} }
const session = instance.getCurrentSession(); const session = instance.getCurrentSession();
@ -124,7 +123,7 @@ export default function AlbumCastDialog(props: Props) {
}) })
.catch((e) => { .catch((e) => {
setView("auto-cast-error"); setView("auto-cast-error");
logError(e, "Error casting to TV"); log.error("Error casting to TV", e);
}); });
} }
}, },
@ -133,10 +132,10 @@ export default function AlbumCastDialog(props: Props) {
session session
.sendMessage("urn:x-cast:pair-request", {}) .sendMessage("urn:x-cast:pair-request", {})
.then(() => { .then(() => {
addLogLine("Message sent successfully"); log.debug("Message sent successfully");
}) })
.catch((error) => { .catch((e) => {
logError(error, "Error sending message"); log.error("Error sending message", e);
}); });
}); });
} }

View file

@ -1,11 +1,10 @@
import log from "@/next/log";
import { import {
SpaceBetweenFlex, SpaceBetweenFlex,
VerticallyCenteredFlex, VerticallyCenteredFlex,
} from "@ente/shared/components/Container"; } from "@ente/shared/components/Container";
import DialogTitleWithCloseButton from "@ente/shared/components/DialogBox/TitleWithCloseButton"; import DialogTitleWithCloseButton from "@ente/shared/components/DialogBox/TitleWithCloseButton";
import { CustomError } from "@ente/shared/error"; import { CustomError } from "@ente/shared/error";
import { addLogLine } from "@ente/shared/logging";
import { logError } from "@ente/shared/sentry";
import { import {
Box, Box,
Button, Button,
@ -68,7 +67,7 @@ export default function ExportModal(props: Props) {
setContinuousExport(exportSettings?.continuousExport ?? false); setContinuousExport(exportSettings?.continuousExport ?? false);
void syncExportRecord(exportSettings?.folder); void syncExportRecord(exportSettings?.folder);
} catch (e) { } catch (e) {
logError(e, "export on mount useEffect failed"); log.error("export on mount useEffect failed", e);
} }
}, []); }, []);
@ -123,7 +122,7 @@ export default function ExportModal(props: Props) {
setPendingExports(pendingExports); setPendingExports(pendingExports);
} catch (e) { } catch (e) {
if (e.message !== CustomError.EXPORT_FOLDER_DOES_NOT_EXIST) { if (e.message !== CustomError.EXPORT_FOLDER_DOES_NOT_EXIST) {
logError(e, "syncExportRecord failed"); log.error("syncExportRecord failed", e);
} }
} }
}; };
@ -135,12 +134,12 @@ export default function ExportModal(props: Props) {
const handleChangeExportDirectoryClick = async () => { const handleChangeExportDirectoryClick = async () => {
try { try {
const newFolder = await exportService.changeExportDirectory(); const newFolder = await exportService.changeExportDirectory();
addLogLine(`Export folder changed to ${newFolder}`); log.info(`Export folder changed to ${newFolder}`);
updateExportFolder(newFolder); updateExportFolder(newFolder);
void syncExportRecord(newFolder); void syncExportRecord(newFolder);
} catch (e) { } catch (e) {
if (e.message !== CustomError.SELECT_FOLDER_ABORTED) { if (e.message !== CustomError.SELECT_FOLDER_ABORTED) {
logError(e, "handleChangeExportDirectoryClick failed"); log.error("handleChangeExportDirectoryClick failed", e);
} }
} }
}; };
@ -156,7 +155,7 @@ export default function ExportModal(props: Props) {
} }
updateContinuousExport(newContinuousExport); updateContinuousExport(newContinuousExport);
} catch (e) { } catch (e) {
logError(e, "onContinuousExportChange failed"); log.error("onContinuousExportChange failed", e);
} }
}; };
@ -166,7 +165,7 @@ export default function ExportModal(props: Props) {
await exportService.scheduleExport(); await exportService.scheduleExport();
} catch (e) { } catch (e) {
if (e.message !== CustomError.EXPORT_FOLDER_DOES_NOT_EXIST) { if (e.message !== CustomError.EXPORT_FOLDER_DOES_NOT_EXIST) {
logError(e, "scheduleExport failed"); log.error("scheduleExport failed", e);
} }
} }
}; };

View file

@ -1,11 +1,9 @@
import { Skeleton, styled } from "@mui/material"; import log from "@/next/log";
import { useEffect, useState } from "react";
import { addLogLine } from "@ente/shared/logging";
import { logError } from "@ente/shared/sentry";
import { cached } from "@ente/shared/storage/cacheStorage/helpers"; import { cached } from "@ente/shared/storage/cacheStorage/helpers";
import { LS_KEYS, getData } from "@ente/shared/storage/localStorage"; import { LS_KEYS, getData } from "@ente/shared/storage/localStorage";
import { User } from "@ente/shared/user/types"; import { User } from "@ente/shared/user/types";
import { Skeleton, styled } from "@mui/material";
import { useEffect, useState } from "react";
import machineLearningService from "services/machineLearning/machineLearningService"; import machineLearningService from "services/machineLearning/machineLearningService";
import { imageBitmapToBlob } from "utils/image"; import { imageBitmapToBlob } from "utils/image";
@ -44,9 +42,9 @@ export function ImageCacheView(props: {
props.url, props.url,
async () => { async () => {
try { try {
addLogLine( log.debug(
"ImageCacheView: regenerate face crop", () =>
props.faceID, `ImageCacheView: regenerate face crop for ${props.faceID}`,
); );
return machineLearningService.regenerateFaceCrop( return machineLearningService.regenerateFaceCrop(
user.token, user.token,
@ -54,9 +52,9 @@ export function ImageCacheView(props: {
props.faceID, props.faceID,
); );
} catch (e) { } catch (e) {
logError( log.error(
e,
"ImageCacheView: regenerate face crop failed", "ImageCacheView: regenerate face crop failed",
e,
); );
} }
}, },
@ -65,7 +63,7 @@ export function ImageCacheView(props: {
!didCancel && setImageBlob(blob); !didCancel && setImageBlob(blob);
} catch (e) { } catch (e) {
logError(e, "ImageCacheView useEffect failed"); log.error("ImageCacheView useEffect failed", e);
} }
} }
loadImage(); loadImage();