Browse Source

Cast logs v2 (#1569)

## Description

## Tests
Neeraj Gupta 1 year ago
parent
commit
f7a62c91e9

+ 3 - 1
web/apps/cast/src/components/PhotoAuditorium.tsx

@@ -11,14 +11,16 @@ export const PhotoAuditorium: React.FC<PhotoAuditoriumProps> = ({
     showNextSlide,
 }) => {
     useEffect(() => {
+        console.log("showing slide");
         const timeoutId = window.setTimeout(() => {
+            console.log("showing next slide  timer");
             showNextSlide();
         }, 10000);
 
         return () => {
             if (timeoutId) clearTimeout(timeoutId);
         };
-    }, [showNextSlide]);
+    }, []);
 
     return (
         <div

+ 7 - 1
web/apps/cast/src/pages/index.tsx

@@ -174,12 +174,18 @@ export default function PairingMode() {
     const router = useRouter();
 
     useEffect(() => {
+        console.log("useEffect for pairing called");
         if (digits.length < 1 || !publicKeyB64 || !privateKeyB64) return;
 
         const interval = setInterval(async () => {
+            console.log("polling for cast data");
             const data = await pollForCastData();
-            if (!data) return;
+            if (!data) {
+                console.log("no data");
+                return;
+            }
             storeCastData(data);
+            console.log("pushing slideshow");
             await router.push("/slideshow");
         }, 1000);
 

+ 12 - 0
web/apps/cast/src/pages/slideshow.tsx

@@ -131,29 +131,41 @@ export default function Slideshow() {
 
             if (!nextURL) {
                 try {
+                    console.log("nextURL doesn't exist yet");
                     const blob = await getPreviewableImage(nextFile, castToken);
+                    console.log("nextURL blobread");
                     const url = URL.createObjectURL(blob);
+                    console.log("nextURL", url);
                     renderableFileURLCache.set(nextFile.id, url);
+                    console.log("nextUrlCache set");
                     nextURL = url;
                 } catch (e) {
                     console.log("error in nextUrl", e);
                     return;
                 }
+            } else {
+                console.log("nextURL already exists");
             }
 
             if (!nextNextURL) {
                 try {
+                    console.log("nextNextURL doesn't exist yet");
                     const blob = await getPreviewableImage(
                         nextNextFile,
                         castToken,
                     );
+                    console.log("nextNextURL blobread");
                     const url = URL.createObjectURL(blob);
+                    console.log("nextNextURL", url);
                     renderableFileURLCache.set(nextNextFile.id, url);
+                    console.log("nextNextURCacheL set");
                     nextNextURL = url;
                 } catch (e) {
                     console.log("error in nextNextURL", e);
                     return;
                 }
+            } else {
+                console.log("nextNextURL already exists");
             }
 
             setLoading(false);