diff --git a/Mythic.xcodeproj/project.pbxproj b/Mythic.xcodeproj/project.pbxproj index 3d28664a..a3fc5a84 100644 --- a/Mythic.xcodeproj/project.pbxproj +++ b/Mythic.xcodeproj/project.pbxproj @@ -14,6 +14,7 @@ 6A00F20D2AC5F8F90054858A /* ProgressViewWithError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A00F20C2AC5F8F90054858A /* ProgressViewWithError.swift */; }; 6A0585482ADEC17300165C3C /* WhiskyInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A0585472ADEC17300165C3C /* WhiskyInterface.swift */; }; 6A0C66852ABC4092004B0755 /* CachedAsyncImage in Frameworks */ = {isa = PBXBuildFile; productRef = 6A0C66842ABC4092004B0755 /* CachedAsyncImage */; }; + 6A1322382B1C98AE0049BB64 /* InstallStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A1322372B1C98AE0049BB64 /* InstallStatus.swift */; }; 6A1417B82AF7CCD80022DE24 /* FileLocations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A1417B72AF7CCD80022DE24 /* FileLocations.swift */; }; 6A1C6F422AEFD95900F89AE7 /* WineInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A1C6F412AEFD95900F89AE7 /* WineInterface.swift */; }; 6A1C6F462AEFD9B100F89AE7 /* WineExt.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A1C6F452AEFD9B100F89AE7 /* WineExt.swift */; }; @@ -61,6 +62,7 @@ 6A00F20A2AC5F8730054858A /* Auth.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Auth.swift; sourceTree = ""; }; 6A00F20C2AC5F8F90054858A /* ProgressViewWithError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressViewWithError.swift; sourceTree = ""; }; 6A0585472ADEC17300165C3C /* WhiskyInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WhiskyInterface.swift; sourceTree = ""; }; + 6A1322372B1C98AE0049BB64 /* InstallStatus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InstallStatus.swift; sourceTree = ""; }; 6A1417B72AF7CCD80022DE24 /* FileLocations.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileLocations.swift; sourceTree = ""; }; 6A1C6F412AEFD95900F89AE7 /* WineInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WineInterface.swift; sourceTree = ""; }; 6A1C6F452AEFD9B100F89AE7 /* WineExt.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WineExt.swift; sourceTree = ""; }; @@ -249,6 +251,7 @@ 6A00F20A2AC5F8730054858A /* Auth.swift */, 6A371B502AE7A4870054BF7A /* Onboarding */, 6A00F2082AC5F7DE0054858A /* ProgressView */, + 6A1322372B1C98AE0049BB64 /* InstallStatus.swift */, ); path = Base; sourceTree = ""; @@ -540,6 +543,7 @@ 6A1C6F462AEFD9B100F89AE7 /* WineExt.swift in Sources */, 6AA6CCE72AD571C500F664A5 /* LegendaryExt.swift in Sources */, 6AD5065C2AAFF6F0008A28C1 /* Support.swift in Sources */, + 6A1322382B1C98AE0049BB64 /* InstallStatus.swift in Sources */, 6AD5065A2AAFF6E2008A28C1 /* Wine.swift in Sources */, 6AF0EB1F2AAD4E0A0044C09C /* Onboarding.swift in Sources */, 6AC25CBD2AAED24700D395CF /* Settings.swift in Sources */, @@ -695,7 +699,7 @@ "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 2008; + CURRENT_PROJECT_VERSION = 2014; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = "\"Mythic/Preview Content\""; DEVELOPMENT_TEAM = 67ZBY275P8; @@ -734,7 +738,7 @@ "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 2008; + CURRENT_PROJECT_VERSION = 2014; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = "\"Mythic/Preview Content\""; DEVELOPMENT_TEAM = 67ZBY275P8; diff --git a/Mythic/Views/Base/GameList/GameList.swift b/Mythic/Views/Base/GameList/GameList.swift index 2efb38c3..fc77fc4c 100644 --- a/Mythic/Views/Base/GameList/GameList.swift +++ b/Mythic/Views/Base/GameList/GameList.swift @@ -34,6 +34,8 @@ struct GameListView: View { @State private var installableGames: [Legendary.Game] = Array() @State private var installedGames: [Legendary.Game] = Array() @StateObject private var installing = Legendary.Installing.shared + + @State private var isInstallStatusViewPresented: Bool = false @State private var gameThumbnails: [String: String] = Dictionary() @State private var optionalPacks: [String: String] = Dictionary() @@ -181,13 +183,18 @@ struct GameListView: View { .controlSize(.large) } else { if installing._value && installing._game == game { - if installing._status.progress?.percentage == nil { - ProgressView() - .progressViewStyle(.linear) - } else { - ProgressView(value: installing._status.progress?.percentage, total: 100) - .progressViewStyle(.linear) + Button { + isInstallStatusViewPresented = true + } label: { + if installing._status.progress?.percentage == nil { + ProgressView() + .progressViewStyle(.linear) + } else { + ProgressView(value: installing._status.progress?.percentage, total: 100) + .progressViewStyle(.linear) + } } + .buttonStyle(.plain) Button { Logger.app.warning("Stop install not implemented yet; execute \"killall cli\" lol") @@ -315,6 +322,10 @@ struct GameListView: View { isGameListRefreshCalled: $isRefreshCalled ) } + + .sheet(isPresented: $isInstallStatusViewPresented) { + InstallStatusView(isPresented: $isInstallStatusViewPresented) + } .alert(isPresented: $isAlertPresented) { switch activeAlert { diff --git a/Mythic/Views/Navigation/Main.swift b/Mythic/Views/Navigation/Main.swift index a740fe33..105c95d2 100644 --- a/Mythic/Views/Navigation/Main.swift +++ b/Mythic/Views/Navigation/Main.swift @@ -16,6 +16,7 @@ import CachedAsyncImage struct MainView: View { @State private var isAuthViewPresented: Bool = false + @State private var isInstallStatusViewPresented: Bool = false @State private var epicUserAsync: String = "Loading..." @State private var signedIn: Bool = false @@ -109,7 +110,7 @@ struct MainView: View { HStack { Button { - // Not implemented + isInstallStatusViewPresented = true } label: { if installing._status.progress?.percentage == nil { ProgressView() @@ -194,6 +195,10 @@ struct MainView: View { updateLegendaryAccountState() } } + + .sheet(isPresented: $isInstallStatusViewPresented) { + InstallStatusView(isPresented: $isInstallStatusViewPresented) + } .listStyle(SidebarListStyle()) .frame(minWidth: 150, idealWidth: 250, maxWidth: 300) .toolbar { diff --git a/Mythic/Views/Sheets/Base/InstallStatus.swift b/Mythic/Views/Sheets/Base/InstallStatus.swift new file mode 100644 index 00000000..9e34fea4 --- /dev/null +++ b/Mythic/Views/Sheets/Base/InstallStatus.swift @@ -0,0 +1,38 @@ +// +// InstallStatus.swift +// Mythic +// +// Created by Esiayo Alegbe on 3/12/2023. +// + +import SwiftUI +import Foundation +import Charts // TBA + +struct InstallStatusView: View { + private let status: Legendary.InstallStatus = Legendary.Installing.installStatus + @Binding var isPresented: Bool + + var body: some View { + VStack { + Text("Downloading \(Legendary.Installing.game?.title ?? "[unknown]")…") + .font(.title) + + GroupBox { + Text("Progress: \(Int(status.progress?.percentage ?? 0))% (\(status.progress?.downloaded ?? 0)/\(status.progress?.total ?? 0) objects)") + Text("Downloaded \(status.download?.downloaded ?? 0) MiB, Written \(status.download?.written ?? 0)") + Text("Elapsed: \("\(status.progress?.runtime ?? "[unknown]")"), ETA: \("\(status.progress?.eta ?? "[unknown]")")") + } + .fixedSize() + + Button("Close") { isPresented = false } + .buttonStyle(.borderedProminent) + .foregroundStyle(.accent) + } + .padding() + } +} + +#Preview { + InstallStatusView(isPresented: .constant(true)) +}