Skip to content

Commit

Permalink
Merge pull request #29 from RocketCommunicationsInc/development
Browse files Browse the repository at this point in the history
2.0 Release
  • Loading branch information
rocketjeff authored Aug 18, 2022
2 parents 8c0ce94 + dc1549d commit f57fbcb
Show file tree
Hide file tree
Showing 10 changed files with 185 additions and 140 deletions.
37 changes: 22 additions & 15 deletions Astro Launches TV/ConferenceRoomView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

import SwiftUI
import AstroSwiftFoundation
import SDWebImageSwiftUI

import CachedAsyncImage
// Display Launch info with conventional tvOS sizing
struct ConferenceRoomView: View {

Expand All @@ -24,12 +23,16 @@ struct ConferenceRoomView: View {
HStack(spacing:0) {
// ZStack for the large left side image and overlaid contents
ZStack(alignment:.leading) {
WebImage(url: launch.imageURL)
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: 1280, height: 1080, alignment: .topLeading)
.clipped()
.blur(radius:4)

CachedAsyncImage(url:launch.imageURL, content: { image in
image.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: 1280, height: 1080, alignment: .topLeading)
.clipped()
.blur(radius:4)
}, placeholder: {
ProgressView()
}).frame(width: 1280, height: 1080)

VStack(alignment:.leading,spacing: 100) {
LogoNameCountdown(launch:launch)
Expand Down Expand Up @@ -125,13 +128,17 @@ struct LogoNameCountdown: View {
}
else
{
WebImage(url:url)
.resizable()
.padding()
.aspectRatio(contentMode: .fit)
.frame(width: 300, height: 300,alignment: .center)
.background(.ultraThinMaterial)
.cornerRadius(6)
CachedAsyncImage(url:url, content: { image in
image.resizable()
.padding()
.aspectRatio(contentMode: .fit)
.frame(width: 300, height: 300,alignment: .center)
.background(.ultraThinMaterial)
.cornerRadius(6)

}, placeholder: {
ProgressView()
}).frame(width: 300, height: 300)
}
}

Expand Down
22 changes: 14 additions & 8 deletions Astro Launches TV/OpsFloorView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

import SwiftUI
import AstroSwiftFoundation
import SDWebImageSwiftUI
//import SDWebImageSwiftUI
import CachedAsyncImage

// Display Launch info in a super-sized format suitable for larger screens and longer distance, a "Giant Screen UI"
struct OpsFloorView: View {
Expand All @@ -23,13 +24,18 @@ struct OpsFloorView: View {
HStack(spacing:0) {
// Left side: image, mission name and coundtown clock
ZStack(alignment:.leading) {
WebImage(url: launch.imageURL)
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: 1280, height: 1080, alignment: .topLeading)
.clipped()
.blur(radius:2)


CachedAsyncImage(url:launch.imageURL, content: { image in
image.resizable()
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: 1280, height: 1080, alignment: .topLeading)
.clipped()
.blur(radius:2)
}, placeholder: {
ProgressView()
}).frame(width: 1280, height: 1080)

VStack(alignment: .leading)
{
Text(launch.missionName)
Expand Down
54 changes: 31 additions & 23 deletions Astro Launches.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
objects = {

/* Begin PBXBuildFile section */
7C268AD0270E4C3E005932AB /* SDWebImageSwiftUI in Frameworks */ = {isa = PBXBuildFile; productRef = 7C268ACF270E4C3E005932AB /* SDWebImageSwiftUI */; };
7C268AD2270E4E09005932AB /* SDWebImageSwiftUI in Frameworks */ = {isa = PBXBuildFile; productRef = 7C268AD1270E4E09005932AB /* SDWebImageSwiftUI */; };
7C31CEB727F7B74600EA2DCC /* LaunchMissionBlock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C31CEB627F7B6C000EA2DCC /* LaunchMissionBlock.swift */; };
7C31CEB927F7BC3D00EA2DCC /* LaunchImageBlock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C31CEB827F7BC3D00EA2DCC /* LaunchImageBlock.swift */; };
7C37E65B2603CDC300F259F8 /* AstroSwiftFoundation in Frameworks */ = {isa = PBXBuildFile; productRef = 7C37E65A2603CDC300F259F8 /* AstroSwiftFoundation */; };
Expand Down Expand Up @@ -60,6 +58,9 @@
7C9BDD88271642EC00A97374 /* PadMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C9BDD87271642EC00A97374 /* PadMap.swift */; };
7C9BDD89271642EC00A97374 /* PadMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C9BDD87271642EC00A97374 /* PadMap.swift */; };
7C9BDD8A271642EC00A97374 /* PadMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C9BDD87271642EC00A97374 /* PadMap.swift */; };
7C9FCDDC2882057F0032EA88 /* CachedAsyncImage in Frameworks */ = {isa = PBXBuildFile; productRef = 7C9FCDDB2882057F0032EA88 /* CachedAsyncImage */; };
7C9FCDDE288208F70032EA88 /* CachedAsyncImage in Frameworks */ = {isa = PBXBuildFile; productRef = 7C9FCDDD288208F70032EA88 /* CachedAsyncImage */; };
7C9FCDE0288209040032EA88 /* CachedAsyncImage in Frameworks */ = {isa = PBXBuildFile; productRef = 7C9FCDDF288209040032EA88 /* CachedAsyncImage */; };
7CA49FAA270BB08F00181220 /* ConferenceRoomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CA49FA9270BB08F00181220 /* ConferenceRoomView.swift */; };
7CB0A2C82788F99200A542D5 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CB0A2C72788F99200A542D5 /* SettingsView.swift */; };
7CB1EE8727062383004E0CD4 /* Tag.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CB1EE8627062383004E0CD4 /* Tag.swift */; };
Expand Down Expand Up @@ -172,7 +173,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
7C268AD0270E4C3E005932AB /* SDWebImageSwiftUI in Frameworks */,
7C9FCDDC2882057F0032EA88 /* CachedAsyncImage in Frameworks */,
7C83150125AE52B700E18441 /* AstroSwiftFoundation in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -182,6 +183,7 @@
buildActionMask = 2147483647;
files = (
7C37E65B2603CDC300F259F8 /* AstroSwiftFoundation in Frameworks */,
7C9FCDDE288208F70032EA88 /* CachedAsyncImage in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -196,8 +198,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
7C268AD2270E4E09005932AB /* SDWebImageSwiftUI in Frameworks */,
7C5A1B18261BB5E700E452DE /* AstroSwiftFoundation in Frameworks */,
7C9FCDE0288209040032EA88 /* CachedAsyncImage in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -366,7 +368,7 @@
name = "Astro Launches (iOS)";
packageProductDependencies = (
7C83150025AE52B700E18441 /* AstroSwiftFoundation */,
7C268ACF270E4C3E005932AB /* SDWebImageSwiftUI */,
7C9FCDDB2882057F0032EA88 /* CachedAsyncImage */,
);
productName = "Astro Launches (iOS)";
productReference = 7CF87F2025AE45F300BD9D06 /* Astro Launches.app */;
Expand All @@ -387,6 +389,7 @@
name = "Astro Launches (macOS)";
packageProductDependencies = (
7C37E65A2603CDC300F259F8 /* AstroSwiftFoundation */,
7C9FCDDD288208F70032EA88 /* CachedAsyncImage */,
);
productName = "Astro Launches (macOS)";
productReference = 7CF87F2825AE45F300BD9D06 /* Astro Launches.app */;
Expand Down Expand Up @@ -441,7 +444,7 @@
name = "Astro Launches TV";
packageProductDependencies = (
7C5A1B17261BB5E700E452DE /* AstroSwiftFoundation */,
7C268AD1270E4E09005932AB /* SDWebImageSwiftUI */,
7C9FCDDF288209040032EA88 /* CachedAsyncImage */,
);
productName = "Astro Launches TV";
productReference = 7CF87F8325AE49B600BD9D06 /* Astro Launches TV.app */;
Expand Down Expand Up @@ -484,7 +487,7 @@
mainGroup = 7CF87F1025AE45F200BD9D06;
packageReferences = (
7C8314FF25AE52B700E18441 /* XCRemoteSwiftPackageReference "AstroSwiftFoundation" */,
7C268ACE270E4C3E005932AB /* XCRemoteSwiftPackageReference "SDWebImageSwiftUI" */,
7C9FCDDA2882057F0032EA88 /* XCRemoteSwiftPackageReference "swiftui-cached-async-image" */,
);
productRefGroup = 7CF87F2125AE45F300BD9D06 /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -1073,35 +1076,25 @@
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
7C268ACE270E4C3E005932AB /* XCRemoteSwiftPackageReference "SDWebImageSwiftUI" */ = {
7C8314FF25AE52B700E18441 /* XCRemoteSwiftPackageReference "AstroSwiftFoundation" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/SDWebImage/SDWebImageSwiftUI.git";
repositoryURL = "https://github.com/RocketCommunicationsInc/AstroSwiftFoundation.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 2.0.0;
};
};
7C8314FF25AE52B700E18441 /* XCRemoteSwiftPackageReference "AstroSwiftFoundation" */ = {
7C9FCDDA2882057F0032EA88 /* XCRemoteSwiftPackageReference "swiftui-cached-async-image" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/RocketCommunicationsInc/AstroSwiftFoundation.git";
repositoryURL = "https://github.com/lorenzofiamingo/swiftui-cached-async-image";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.0.8;
branch = main;
kind = branch;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
7C268ACF270E4C3E005932AB /* SDWebImageSwiftUI */ = {
isa = XCSwiftPackageProductDependency;
package = 7C268ACE270E4C3E005932AB /* XCRemoteSwiftPackageReference "SDWebImageSwiftUI" */;
productName = SDWebImageSwiftUI;
};
7C268AD1270E4E09005932AB /* SDWebImageSwiftUI */ = {
isa = XCSwiftPackageProductDependency;
package = 7C268ACE270E4C3E005932AB /* XCRemoteSwiftPackageReference "SDWebImageSwiftUI" */;
productName = SDWebImageSwiftUI;
};
7C37E65A2603CDC300F259F8 /* AstroSwiftFoundation */ = {
isa = XCSwiftPackageProductDependency;
package = 7C8314FF25AE52B700E18441 /* XCRemoteSwiftPackageReference "AstroSwiftFoundation" */;
Expand All @@ -1117,6 +1110,21 @@
package = 7C8314FF25AE52B700E18441 /* XCRemoteSwiftPackageReference "AstroSwiftFoundation" */;
productName = AstroSwiftFoundation;
};
7C9FCDDB2882057F0032EA88 /* CachedAsyncImage */ = {
isa = XCSwiftPackageProductDependency;
package = 7C9FCDDA2882057F0032EA88 /* XCRemoteSwiftPackageReference "swiftui-cached-async-image" */;
productName = CachedAsyncImage;
};
7C9FCDDD288208F70032EA88 /* CachedAsyncImage */ = {
isa = XCSwiftPackageProductDependency;
package = 7C9FCDDA2882057F0032EA88 /* XCRemoteSwiftPackageReference "swiftui-cached-async-image" */;
productName = CachedAsyncImage;
};
7C9FCDDF288209040032EA88 /* CachedAsyncImage */ = {
isa = XCSwiftPackageProductDependency;
package = 7C9FCDDA2882057F0032EA88 /* XCRemoteSwiftPackageReference "swiftui-cached-async-image" */;
productName = CachedAsyncImage;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 7CF87F1125AE45F200BD9D06 /* Project object */;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/RocketCommunicationsInc/AstroSwiftFoundation.git",
"state" : {
"revision" : "f071c518e86bdaf66e8debdc1ec56c84ff90e596",
"version" : "1.1.0"
"revision" : "03db5d05516d348da170c3dc0d954d842b0554f2",
"version" : "2.0.0"
}
},
{
"identity" : "sdwebimage",
"identity" : "swiftui-cached-async-image",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SDWebImage/SDWebImage.git",
"location" : "https://github.com/lorenzofiamingo/swiftui-cached-async-image",
"state" : {
"revision" : "a72df4849408da7e5d3c1b586797b7c601c41d1b",
"version" : "5.12.1"
}
},
{
"identity" : "sdwebimageswiftui",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SDWebImage/SDWebImageSwiftUI.git",
"state" : {
"revision" : "cd8625b7cf11a97698e180d28bb7d5d357196678",
"version" : "2.0.2"
"branch" : "main",
"revision" : "f94be38411297c71aa8df69c6875127e6d8d7a92"
}
}
],
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

Astro Launches is a multiplatorm SwiftUI app that displays interesting info about upcoming space launches all over the world.

Launches runs on iPhone, iPad, and AppleTV, and is available on the [App Store](https://apps.apple.com/app/astro-launches/id1555135768)
Launches runs on iPhone, iPad, and AppleTV, and is available on the [App Store](https://apps.apple.com/app/astro-launches/id1555135768.

Launches is built upon, and demonstrates, the [Astro Space UX Design System](https://www.astrouxds.com) and [Astro Swift Foundation](https://github.com/RocketCommunicationsInc/AstroSwiftFoundation)
Launches is built upon, and demonstrates, the [Astro Space UX Design System](https://www.astrouxds.com) and [Astro Swift Foundation](https://github.com/RocketCommunicationsInc/AstroSwiftFoundation).

The apps are built with Xcode, and require the latest verison on the latest macOS. App Store versions are marked with tags.
52 changes: 27 additions & 25 deletions Shared/Launch.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ struct LaunchServiceProvider:Decodable{
//
// Our Launch struct that represents the original JSON data as Swift types, and checks for missing values
//
struct Launch: Equatable{
class Launch: Equatable{
let id:String // a unique ID, always present
let missionName:String
let missionDescription:String
Expand Down Expand Up @@ -150,29 +150,6 @@ struct Launch: Equatable{
let longitudeCoordinate = Double(launchReply.pad?.longitude ?? "-122.009_020")
locationCoordinate = CLLocationCoordinate2D(latitude: latitudeCoordinate ?? -122.009_020 , longitude: longitudeCoordinate ?? 31.422878000000000)

if let agencyURL = launchReply.launch_service_provider?.url
{
do {
let data = try Data(contentsOf: agencyURL)
let theAgency = try! JSONDecoder().decode(AgencyReply.self, from: data)
agency = Agency(theAgency)
} catch {
agency = nil
}
}
// self.agency = nil

// if let agencyURL = launchReply.launch_service_provider?.dataURL
// {
// URLSession.shared.dataTask(with: agencyURL) { (data,_ , _) in
// guard let data = data else {return}
// let theAgency = try! JSONDecoder().decode(AgencyReply.self, from: data)
// DispatchQueue.main.async {
// // post process Agency
// self.agency = Agency(theAgency)
// }
// }.resume()
// }

// webcast_live is non-nil and true if live video is availabl
if let webwebcast_live = launchReply.webwebcast_live {
Expand All @@ -191,6 +168,31 @@ struct Launch: Equatable{
} else {
videoURL = nil
}

// fetching the agency requires another web request, start that on another thread
self.agency = nil
if let agencyURL = launchReply.launch_service_provider?.url
{
URLSession.shared.dataTask(with: agencyURL) { data, urlResponse, error in
if let _ = error {
return // don't show an error, the agency will just remain nil
}

let response = urlResponse as! HTTPURLResponse
let status = response.statusCode
guard (200...299).contains(status) else {
return // don't show an error, the agency will just remain nil
}

guard let data = data else {
// handle zero data error
return // don't show an error, the agency will just remain nil
}

let theAgency = try! JSONDecoder().decode(AgencyReply.self, from: data)
self.agency = Agency(theAgency)
}.resume()
}
}

// Convert API Status to Astro Status
Expand All @@ -215,7 +217,7 @@ struct Launch: Equatable{
let name:String
let logoURL:URL?

// Parse a LaunchReply, see which fields were returned and convert to Swift types
// Parse a AgencyReply, see which fields were returned and convert to Swift types
init(_ agencyReply:AgencyReply) {
id = agencyReply.id
name = agencyReply.name ?? "Unknown Agency"
Expand Down
Loading

0 comments on commit f57fbcb

Please sign in to comment.