Skip to content

Commit

Permalink
Updated TV View
Browse files Browse the repository at this point in the history
New details in Launch structure
  • Loading branch information
rocketjeff committed Sep 30, 2021
1 parent 4bcca84 commit 8d5a606
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 25 deletions.
78 changes: 58 additions & 20 deletions Astro Launches TV/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,36 +19,43 @@ struct ContentView: View {
HStack(spacing:0) {
if let image = launch.image
{
ZStack {
ZStack(alignment:.leading) {
Image(uiImage: image)
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: 1280, height: 1080, alignment: .topLeading)
.clipped()
.blur(radius:2)

VStack
VStack(alignment: .leading)
{
Spacer()
HStack {
Text(launch.missionName)
.padding()
.font(.system(size: 90
, weight: .semibold, design: .default))
.frame(alignment: .leading)
Spacer()
Text("T- 00:00:00")
.padding()
.font(.system(size: 90
, weight: .semibold, design: .default))
}
.frame(width: 1280, alignment: .leading)
.background(.ultraThinMaterial)
}.frame(width: 1280)
Text(launch.missionName)
.font(.system(size: 90
, weight: .semibold, design: .default))
.padding()
Countdown(launch:launch)
.padding()
}.padding(.leading,40)//.frame(width: 1280)
}
}
VStack {
VStack(alignment: .leading) {
Image("AstroLogoLarge")
}.padding()
Spacer()
Text("ROCKET").font(.system(size: 60)) .foregroundColor(.launchesTextColor)
Text(launch.rocketName).font(.system(size: 60)) .foregroundColor(.white)
Spacer()

Text("STATUS").font(.system(size: 60)) .foregroundColor(.launchesTextColor)
if let status = launch.status
{
GiantStatusTag(text: status,status: launch.astroStatus)
}
Spacer()

Text("LOCATION").font(.system(size: 60)) .foregroundColor(.launchesTextColor)
Text(launch.locationName).font(.system(size: 60)) .foregroundColor(.white)

}.padding(.all,40)
.frame(width: 640, height: 1080, alignment: .leading)
.background(Color.launchesCardColor)

Expand All @@ -58,6 +65,37 @@ struct ContentView: View {
}
}


struct Countdown: View {
// let timer = Timer.publish(every: 1, on: .main, in: .common).autoconnect()

var launch:Launch

var body: some View {
HStack {
if let windowOpenDate = launch.windowOpenDate
{
HStack {
Text("T-")
.font(.system(size: 90
, weight: .semibold, design: .default))
.foregroundColor(.white)

Text(windowOpenDate, style: .timer)
.foregroundColor(.white)
.font(.system(size: 90, weight: .semibold,design: .monospaced))

}.padding()
.background(.ultraThinMaterial)
.cornerRadius(6)



}
}
}
}

struct ContentView_Previews: PreviewProvider {
static var networkManager = NetworkManager()

Expand Down
2 changes: 1 addition & 1 deletion Astro Launches TV/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>19</string>
<string>20</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchScreen</key>
Expand Down
2 changes: 1 addition & 1 deletion Astro Launches WatchKit App/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>19</string>
<string>20</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
Expand Down
2 changes: 1 addition & 1 deletion Astro Launches WatchKit Extension/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>19</string>
<string>20</string>
<key>CLKComplicationPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).ComplicationController</string>
<key>NSExtension</key>
Expand Down
16 changes: 16 additions & 0 deletions Shared/Launch.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ struct LaunchReply:Decodable{
let rocket:Rocket?
let status:Status?
let image:String?
let pad:Pad?
}

struct Mission:Decodable{
Expand All @@ -33,6 +34,17 @@ struct Status:Decodable{
let abbrev:String?
}

struct Pad:Decodable{
let name:String
let location:Location?
}


struct Location:Decodable{
let name:String
}


struct Rocket:Decodable{
let id:Int
let configuration:RocketConfiguration?
Expand All @@ -54,6 +66,8 @@ struct Launch{
let image:UIImage?
let status:String?
let astroStatus:AstroStatus
let padName:String
let locationName:String

// Parse a LaunchReply, see which fields were returned and convert to Swift types
init(_ launchReply:LaunchReply)
Expand Down Expand Up @@ -116,6 +130,8 @@ struct Launch{
image = nil
}

padName = launchReply.pad?.name ?? "Unknown Pad Name"
locationName = launchReply.pad?.location?.name ?? "Unknown Location Name"
}

static func AstroStatusForLaunchStatus(abbreviation:String)->AstroStatus
Expand Down
21 changes: 21 additions & 0 deletions Shared/Tag.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,22 @@ struct StatusTag: View {
}
}

struct GiantStatusTag: View {
var text:String
var status:AstroStatus
var body: some View {
Text(text)
.padding(.all,25.0)
.font(.system(size: 60)).foregroundColor(.black)
.background(RoundedRectangle(cornerRadius: 12.0, style: .continuous)
.stroke(Color.borderColorForAstroStatus(status), style: StrokeStyle(lineWidth: 10))
.background(Color.colorForAstroStatus(status))
.shadow(color:Color.borderColorForAstroStatus(status), radius: 10, x:0, y: 0)
.clipShape(RoundedRectangle(cornerRadius: 12.0, style: .continuous)
)
)
}
}

struct Tag_Previews: PreviewProvider {
static var previews: some View {
Expand All @@ -56,5 +72,10 @@ struct StatusTag_Previews: PreviewProvider {
}
}

struct GiantStatusTag_Previews: PreviewProvider {
static var previews: some View {
GiantStatusTag(text: "test", status:.Normal)
}
}


2 changes: 1 addition & 1 deletion iOS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>19</string>
<string>20</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key>
Expand Down
2 changes: 1 addition & 1 deletion macOS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>19</string>
<string>20</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
</dict>
Expand Down

0 comments on commit 8d5a606

Please sign in to comment.