@@ -490,6 +490,26 @@ export default function Mac({
490490 ) ;
491491 }
492492
493+ const { showMacOSXSlowNotification, clearMacOSXSlowNotification} =
494+ useMacOSXSlowNotification (
495+ ! progress &&
496+ emulatorLoaded &&
497+ disks [ 0 ] ?. infiniteHdSubset === "macosx"
498+ ) ;
499+ if ( showMacOSXSlowNotification ) {
500+ progress = (
501+ < div className = "Mac-Loading Mac-Loading-Non-Modal Mac-Loading-Slow" >
502+ < span
503+ className = "Mac-Loading-Dismiss"
504+ onClick = { clearMacOSXSlowNotification } >
505+ ⓧ
506+ </ span >
507+ Mac OS X may take a minute or two to start up, please be
508+ patient.
509+ </ div >
510+ ) ;
511+ }
512+
493513 function handleDragStart ( event : React . DragEvent ) {
494514 // Don't allow the screen to be dragged off when using a touchpad on
495515 // the iPad.
@@ -995,3 +1015,28 @@ function MacError({text, onDone}: {text: string; onDone: () => void}) {
9951015 </ Dialog >
9961016 ) ;
9971017}
1018+
1019+ function useMacOSXSlowNotification ( emulatorReady : boolean ) {
1020+ const [ count , setCount ] = usePersistentState (
1021+ 10 ,
1022+ "mac-os-x-slow-notification-count"
1023+ ) ;
1024+ const [ hide , setHide ] = useState ( false ) ;
1025+ const shouldShow = count > 0 && emulatorReady ;
1026+
1027+ useEffect ( ( ) => {
1028+ if ( shouldShow ) {
1029+ setCount ( v => v - 1 ) ;
1030+ }
1031+ setTimeout ( ( ) => setHide ( true ) , 10_000 ) ;
1032+ } , [ setCount , shouldShow ] ) ;
1033+
1034+ const clearMacOSXSlowNotification = useCallback (
1035+ ( ) => setCount ( 0 ) ,
1036+ [ setCount ]
1037+ ) ;
1038+ return {
1039+ showMacOSXSlowNotification : shouldShow && ! hide ,
1040+ clearMacOSXSlowNotification,
1041+ } ;
1042+ }
0 commit comments