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 { 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 LargeType from "components/LargeType";
import _sodium from "libsodium-wrappers";
@ -60,7 +60,7 @@ export default function PairingMode() {
);
context.start(options);
} catch (e) {
addLogLine(e, "failed to create cast context");
log.error("failed to create cast context", e);
}
setIsCastReady(true);
return () => {

View file

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

View file

@ -1,11 +1,10 @@
import log from "@/next/log";
import {
SpaceBetweenFlex,
VerticallyCenteredFlex,
} from "@ente/shared/components/Container";
import DialogTitleWithCloseButton from "@ente/shared/components/DialogBox/TitleWithCloseButton";
import { CustomError } from "@ente/shared/error";
import { addLogLine } from "@ente/shared/logging";
import { logError } from "@ente/shared/sentry";
import {
Box,
Button,
@ -68,7 +67,7 @@ export default function ExportModal(props: Props) {
setContinuousExport(exportSettings?.continuousExport ?? false);
void syncExportRecord(exportSettings?.folder);
} 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);
} catch (e) {
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 () => {
try {
const newFolder = await exportService.changeExportDirectory();
addLogLine(`Export folder changed to ${newFolder}`);
log.info(`Export folder changed to ${newFolder}`);
updateExportFolder(newFolder);
void syncExportRecord(newFolder);
} catch (e) {
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);
} catch (e) {
logError(e, "onContinuousExportChange failed");
log.error("onContinuousExportChange failed", e);
}
};
@ -166,7 +165,7 @@ export default function ExportModal(props: Props) {
await exportService.scheduleExport();
} catch (e) {
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 { useEffect, useState } from "react";
import { addLogLine } from "@ente/shared/logging";
import { logError } from "@ente/shared/sentry";
import log from "@/next/log";
import { cached } from "@ente/shared/storage/cacheStorage/helpers";
import { LS_KEYS, getData } from "@ente/shared/storage/localStorage";
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 { imageBitmapToBlob } from "utils/image";
@ -44,9 +42,9 @@ export function ImageCacheView(props: {
props.url,
async () => {
try {
addLogLine(
"ImageCacheView: regenerate face crop",
props.faceID,
log.debug(
() =>
`ImageCacheView: regenerate face crop for ${props.faceID}`,
);
return machineLearningService.regenerateFaceCrop(
user.token,
@ -54,9 +52,9 @@ export function ImageCacheView(props: {
props.faceID,
);
} catch (e) {
logError(
e,
log.error(
"ImageCacheView: regenerate face crop failed",
e,
);
}
},
@ -65,7 +63,7 @@ export function ImageCacheView(props: {
!didCancel && setImageBlob(blob);
} catch (e) {
logError(e, "ImageCacheView useEffect failed");
log.error("ImageCacheView useEffect failed", e);
}
}
loadImage();