mirror of
https://github.com/XcodesOrg/XcodesApp.git
synced 2026-03-25 08:55:46 +00:00
Adds a bottom status bar to the window
This commit is contained in:
parent
b9140036e2
commit
9f013ccdf2
4 changed files with 66 additions and 0 deletions
|
|
@ -107,6 +107,7 @@
|
|||
E8977EA325C11E1500835F80 /* PreferencesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E8977EA225C11E1500835F80 /* PreferencesView.swift */; };
|
||||
E8CBDB8927ADE32300B22292 /* unxip in Copy aria2c */ = {isa = PBXBuildFile; fileRef = E8CBDB8627ADD92000B22292 /* unxip */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
|
||||
E8CBDB8B27AE02FF00B22292 /* ExperiementsPreferencePane.swift in Sources */ = {isa = PBXBuildFile; fileRef = E8CBDB8A27AE02FF00B22292 /* ExperiementsPreferencePane.swift */; };
|
||||
E8D0296F284B029800647641 /* BottomStatusBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = E8D0296E284B029800647641 /* BottomStatusBar.swift */; };
|
||||
E8DA461125FAF7FB002E85EF /* NotificationsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E8DA461025FAF7FB002E85EF /* NotificationsView.swift */; };
|
||||
E8E98A9025D8631800EC89A0 /* InstallationStepRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CAFBC3FF259AC17F00E2A3D8 /* InstallationStepRowView.swift */; };
|
||||
E8E98A9625D863D700EC89A0 /* InstallationStepDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E8E98A9525D863D700EC89A0 /* InstallationStepDetailView.swift */; };
|
||||
|
|
@ -289,6 +290,7 @@
|
|||
E8977EA225C11E1500835F80 /* PreferencesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferencesView.swift; sourceTree = "<group>"; };
|
||||
E8CBDB8627ADD92000B22292 /* unxip */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = unxip; sourceTree = "<group>"; };
|
||||
E8CBDB8A27AE02FF00B22292 /* ExperiementsPreferencePane.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExperiementsPreferencePane.swift; sourceTree = "<group>"; };
|
||||
E8D0296E284B029800647641 /* BottomStatusBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BottomStatusBar.swift; sourceTree = "<group>"; };
|
||||
E8DA461025FAF7FB002E85EF /* NotificationsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationsView.swift; sourceTree = "<group>"; };
|
||||
E8E98A9525D863D700EC89A0 /* InstallationStepDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InstallationStepDetailView.swift; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
|
@ -426,6 +428,7 @@
|
|||
CAE42486259A68A300B8B246 /* XcodeListCategory.swift */,
|
||||
CAD2E7A32449574E00113D76 /* XcodeListView.swift */,
|
||||
CAFFFED7259CDA5000903F81 /* XcodeListViewRow.swift */,
|
||||
E8D0296E284B029800647641 /* BottomStatusBar.swift */,
|
||||
);
|
||||
path = XcodeList;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -860,6 +863,7 @@
|
|||
CA9FF87B2595293E00E47BAF /* DataSource.swift in Sources */,
|
||||
CABFA9C92592EEEA00380FEE /* URLRequest+Apple.swift in Sources */,
|
||||
CABFAA432593104F00380FEE /* AboutView.swift in Sources */,
|
||||
E8D0296F284B029800647641 /* BottomStatusBar.swift in Sources */,
|
||||
E8E98A9025D8631800EC89A0 /* InstallationStepRowView.swift in Sources */,
|
||||
CABFA9CC2592EEEA00380FEE /* Path+.swift in Sources */,
|
||||
CAD2E7A22449574E00113D76 /* XcodesApp.swift in Sources */,
|
||||
|
|
|
|||
|
|
@ -96,6 +96,17 @@ class AppState: ObservableObject {
|
|||
savedUsername != nil
|
||||
}
|
||||
|
||||
var bottomStatusBarMessage: String {
|
||||
let formatter = DateFormatter()
|
||||
formatter.dateFormat = "dd/MM/yyyy"
|
||||
let finishDate = formatter.date(from: "11/06/2022")
|
||||
|
||||
if Date().compare(finishDate!) == .orderedAscending {
|
||||
return "👨🏻💻👩🏼💻 Happy WWDC 2022! 👨🏽💻🧑🏻💻"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// MARK: - Init
|
||||
|
||||
init() {
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ struct MainWindow: View {
|
|||
isShowingInfoPane: $isShowingInfoPane,
|
||||
searchText: $searchText
|
||||
)
|
||||
.bottomStatusBar()
|
||||
.padding([.top], 0)
|
||||
.navigationSubtitle(subtitleText)
|
||||
.frame(minWidth: 600, maxWidth: .infinity, minHeight: 300, maxHeight: .infinity)
|
||||
.emittingError($appState.error, recoveryHandler: { _ in })
|
||||
|
|
|
|||
49
Xcodes/Frontend/XcodeList/BottomStatusBar.swift
Normal file
49
Xcodes/Frontend/XcodeList/BottomStatusBar.swift
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
//
|
||||
// BottomStatusBar.swift
|
||||
// Xcodes
|
||||
//
|
||||
// Created by Matt Kiazyk on 2022-06-03.
|
||||
// Copyright © 2022 Robots and Pencils. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import SwiftUI
|
||||
|
||||
|
||||
struct BottomStatusModifier: ViewModifier {
|
||||
@EnvironmentObject var appState: AppState
|
||||
|
||||
func body(content: Content) -> some View {
|
||||
content
|
||||
VStack(spacing: 0) {
|
||||
Divider()
|
||||
HStack {
|
||||
Text(appState.bottomStatusBarMessage)
|
||||
.font(.subheadline)
|
||||
Spacer()
|
||||
Text(Bundle.main.shortVersion!)
|
||||
.font(.subheadline)
|
||||
}
|
||||
.frame(maxWidth: .infinity, maxHeight: 30, alignment: .leading)
|
||||
.padding([.leading, .trailing], 10)
|
||||
}
|
||||
.frame(maxWidth: .infinity, maxHeight: 30, alignment: .leading)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension View {
|
||||
func bottomStatusBar() -> some View {
|
||||
self.modifier(
|
||||
BottomStatusModifier()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
struct Previews_BottomStatusBar_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
HStack {
|
||||
|
||||
}.bottomStatusBar()
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue