2
0
Эх сурвалжийг харах

display(iOS): add headless display

osy 3 жил өмнө
parent
commit
73108cf324

+ 1 - 1
Platform/iOS/VMToolbarView.swift

@@ -65,7 +65,7 @@ struct VMToolbarView: View {
     }
     }
     
     
     private var toolbarToggleOpacity: Double {
     private var toolbarToggleOpacity: Double {
-        if !state.isBusy && state.isRunning && isCollapsed && !isMoving {
+        if state.device != nil && !state.isBusy && state.isRunning && isCollapsed && !isMoving {
             if !longIdleTimeout.isUserInteracting {
             if !longIdleTimeout.isUserInteracting {
                 return 0
                 return 0
             } else if isIdle {
             } else if isIdle {

+ 24 - 1
Platform/iOS/VMWindowView.swift

@@ -45,7 +45,7 @@ struct VMWindowView: View {
                     }
                     }
                 } else if !state.isBusy && state.isRunning {
                 } else if !state.isBusy && state.isRunning {
                     // headless
                     // headless
-                    BusyIndicator()
+                    HeadlessView()
                 }
                 }
                 if state.isBusy || !state.isRunning {
                 if state.isBusy || !state.isRunning {
                     BlurEffect().blurEffectStyle(.light)
                     BlurEffect().blurEffectStyle(.light)
@@ -82,6 +82,7 @@ struct VMWindowView: View {
                 VMToolbarView(state: $state)
                 VMToolbarView(state: $state)
             }
             }
         }
         }
+        .statusBarHidden(true)
         .alert(item: $state.alert, content: { type in
         .alert(item: $state.alert, content: { type in
             switch type {
             switch type {
             case .powerDown:
             case .powerDown:
@@ -196,6 +197,28 @@ struct VMWindowView: View {
     }
     }
 }
 }
 
 
+private struct HeadlessView: View {
+    var body: some View {
+        ZStack {
+            BlurEffect().blurEffectStyle(.dark)
+            VStack {
+                Image(systemName: "rectangle.dashed")
+                    .font(.title)
+                Text("No output device is selected for this window.")
+                    .foregroundColor(.white)
+                    .font(.headline)
+                    .multilineTextAlignment(.center)
+            }.padding()
+                .frame(width: 200, height: 200, alignment: .center)
+                .foregroundColor(.white)
+                .background(Color.gray.opacity(0.5))
+                .clipShape(RoundedRectangle(cornerRadius: 25.0, style: .continuous))
+                .vibrancyEffect()
+                .vibrancyEffectStyle(.label)
+        }
+    }
+}
+
 struct VMWindowView_Previews: PreviewProvider {
 struct VMWindowView_Previews: PreviewProvider {
     static var previews: some View {
     static var previews: some View {
         VMWindowView()
         VMWindowView()