Skip to content

Commit

Permalink
Fix shell crash (PlayCover#118)
Browse files Browse the repository at this point in the history
* Add DocC to PlayCover

* Update

* Add website to Readme

* Fix error sometimes cause by shell on startup
  • Loading branch information
IsaacMarovitz authored Jul 30, 2022
1 parent 4f1725c commit 2e8e0f4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
8 changes: 2 additions & 6 deletions PlayCover/View/AppsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,23 @@ import AppKit

struct AppsView: View {
@Binding public var bottomPadding: CGFloat
@Binding public var xcodeCliInstalled: Bool

@EnvironmentObject var appVm: AppsVM

@State private var gridLayout = [GridItem(.adaptive(minimum: 150, maximum: 150), spacing: 0)]

@State private var alertTitle = ""

@State private var alertText = ""

@State private var alertBtn = ""

@State private var alertAction : (() -> Void) = {}

@State private var showAlert = false

var body: some View {
VStack(alignment: .leading, spacing: 0) {
HStack {
SearchView().padding(.horizontal, 20).padding(.vertical, 8)
}
if !shell.isXcodeCliToolsInstalled {
if !xcodeCliInstalled {
VStack(spacing: 12) {
Text("You need to install Xcode Commandline tools and restart this App.")
.font(.title3)
Expand Down
6 changes: 4 additions & 2 deletions PlayCover/View/MainView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,12 @@ struct MainView: View {
@State var bottomHeight: CGFloat = 0

@Binding var showToast: Bool
@Binding public var xcodeCliInstalled: Bool

var body: some View {
if apps.updatingApps { ProgressView() } else {
ZStack(alignment: .bottom) {
AppsView(bottomPadding: $bottomHeight)
AppsView(bottomPadding: $bottomHeight, xcodeCliInstalled: $xcodeCliInstalled)
.frame(maxWidth: .infinity, maxHeight: .infinity).environmentObject(AppsVM.shared)

VStack(alignment: .leading, spacing: 0) {
Expand Down Expand Up @@ -155,8 +156,9 @@ struct MainView: View {

struct Previews_MainView_Previews: PreviewProvider {
@State static var showToast = false
@State static var xcodeCliInstalled = true
static var previews: some View {
MainView(showToast: $showToast)
MainView(showToast: $showToast, xcodeCliInstalled: $xcodeCliInstalled)
.padding()
.environmentObject(InstallVM.shared)
.environmentObject(AppsVM.shared)
Expand Down
3 changes: 2 additions & 1 deletion PlayCover/View/PlayCoverApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ struct PlayCoverApp: App {
@StateObject var updaterViewModel = UpdaterViewModel()

@State var showToast = false
@State var xcodeCliInstalled = shell.isXcodeCliToolsInstalled

var body: some Scene {
WindowGroup {
MainView(showToast: $showToast)
MainView(showToast: $showToast, xcodeCliInstalled: $xcodeCliInstalled)
.padding()
.environmentObject(InstallVM.shared)
.environmentObject(AppsVM.shared)
Expand Down

0 comments on commit 2e8e0f4

Please sign in to comment.