Skip to content

Commit

Permalink
refactored and updated views for iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
rocketjeff committed Sep 30, 2021
1 parent b9dc752 commit 4bcca84
Show file tree
Hide file tree
Showing 17 changed files with 1,282 additions and 253 deletions.
8 changes: 8 additions & 0 deletions Astro Launches.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
7C834939260931D1008B4895 /* Settings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C834937260931D1008B4895 /* Settings.swift */; };
7C8BFBF1270374BD00D6AB09 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7CF87F1B25AE45F300BD9D06 /* Assets.xcassets */; };
7C8BFBF22703808C00D6AB09 /* Colors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C79988226FB7EC700FCAEF2 /* Colors.swift */; };
7CB1EE8727062383004E0CD4 /* Tag.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CB1EE8627062383004E0CD4 /* Tag.swift */; };
7CB1EE8827062810004E0CD4 /* Tag.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CB1EE8627062383004E0CD4 /* Tag.swift */; };
7CB1EE8927062816004E0CD4 /* Tag.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CB1EE8627062383004E0CD4 /* Tag.swift */; };
7CD3C90526028B020071FB78 /* NetworkManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CD3C90426028B020071FB78 /* NetworkManager.swift */; };
7CD3C90626028B020071FB78 /* NetworkManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CD3C90426028B020071FB78 /* NetworkManager.swift */; };
7CF87F2E25AE45F300BD9D06 /* AstroLaunchesApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CF87F1825AE45F300BD9D06 /* AstroLaunchesApp.swift */; };
Expand Down Expand Up @@ -115,6 +118,7 @@
7C7243C826E8188400233B33 /* LaunchDetail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LaunchDetail.swift; sourceTree = "<group>"; };
7C79988226FB7EC700FCAEF2 /* Colors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Colors.swift; sourceTree = "<group>"; };
7C834937260931D1008B4895 /* Settings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Settings.swift; sourceTree = "<group>"; };
7CB1EE8627062383004E0CD4 /* Tag.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tag.swift; sourceTree = "<group>"; };
7CD3C90426028B020071FB78 /* NetworkManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkManager.swift; sourceTree = "<group>"; };
7CF87F1825AE45F300BD9D06 /* AstroLaunchesApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AstroLaunchesApp.swift; sourceTree = "<group>"; };
7CF87F1925AE45F300BD9D06 /* LaunchList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LaunchList.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -218,6 +222,7 @@
7CD3C90426028B020071FB78 /* NetworkManager.swift */,
7C6954092612876E008A811E /* Launch.swift */,
7C79988226FB7EC700FCAEF2 /* Colors.swift */,
7CB1EE8627062383004E0CD4 /* Tag.swift */,
7C44C05B2608FEDB00B8D86A /* launches.json */,
7CF87F1B25AE45F300BD9D06 /* Assets.xcassets */,
7C6A025626278C0C00273563 /* Preview Content */,
Expand Down Expand Up @@ -555,6 +560,7 @@
7C3D4CCE2603EFDA00CB0C41 /* LaunchRow.swift in Sources */,
7CF87F2E25AE45F300BD9D06 /* AstroLaunchesApp.swift in Sources */,
7C79988326FB7EC700FCAEF2 /* Colors.swift in Sources */,
7CB1EE8727062383004E0CD4 /* Tag.swift in Sources */,
7CF87F3025AE45F300BD9D06 /* LaunchList.swift in Sources */,
7C7243C926E8188400233B33 /* LaunchDetail.swift in Sources */,
7C69540A2612876E008A811E /* Launch.swift in Sources */,
Expand All @@ -572,6 +578,7 @@
7C3D4CCF2603EFDA00CB0C41 /* LaunchRow.swift in Sources */,
7CF87F2F25AE45F300BD9D06 /* AstroLaunchesApp.swift in Sources */,
7C79988426FB7EC700FCAEF2 /* Colors.swift in Sources */,
7CB1EE8827062810004E0CD4 /* Tag.swift in Sources */,
7CF87F3125AE45F300BD9D06 /* LaunchList.swift in Sources */,
7C7243CA26E8188400233B33 /* LaunchDetail.swift in Sources */,
7C69540B2612876E008A811E /* Launch.swift in Sources */,
Expand All @@ -596,6 +603,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
7CB1EE8927062816004E0CD4 /* Tag.swift in Sources */,
7C5A1B09261BB52B00E452DE /* DateFormatters.swift in Sources */,
7C5A1AFB261BB51A00E452DE /* NetworkManager.swift in Sources */,
7CF87F8825AE49B600BD9D06 /* ContentView.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x00",
"green" : "0x49",
"red" : "0x55"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x01",
"green" : "0x0D",
"red" : "0x57"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x00",
"green" : "0x58",
"red" : "0x01"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "extended-srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x3A",
"green" : "0x36",
"red" : "0x32"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x1A",
"green" : "0x45",
"red" : "0x64"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x58",
"green" : "0x4C",
"red" : "0x22"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "0.851",
"red" : "0.392"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
103 changes: 103 additions & 0 deletions Shared/Assets.xcassets/Colors.dataset/Colors.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
//
// Colors.swift
// Astro Launches
//
// Created by rocketjeff on 9/22/21.
//

import Foundation
import SwiftUI
import AstroSwiftFoundation

public extension Color
{

// based on a similar function for UIColor at https://stackoverflow.com/questions/56487679/how-do-i-easily-support-light-and-dark-mode-with-a-custom-color-used-in-my-app
static func dynamicColor(light: Color, dark: Color) -> Color {
@Environment(\.colorScheme) var colorScheme // iOS 15.0, always returns light

if (colorScheme == .dark)
{
return dark
}
else
{
return light
}
// return Color { colorScheme == .dark ? dark : light }
}

//——————————————————————————————————————————————————————————————————————————————
// New Astro Colors, not yet in Foundation
//——————————————————————————————————————————————————————————————————————————————
//MARK: Color - Astro Status colors
//——————————————————————————————————————————————————————————————————————————————
// Astro status colors
//——————————————————————————————————————————————————————————————————————————————
static var astroStatusBorderOff:Color
{ return Color("#32363A")}

static var astroStatusBorderStandby:Color
{ return Color("#224C58")}

static var astroStatusBorderNormal:Color
{ return Color("#015800")}

static var astroStatusBorderCaution:Color
{ return Color("#544900")}

static var astroStatusBorderSerious:Color
{ return Color("#64451A")}

static var astroStatusBorderCritical:Color
{ return Color("#570D01")}

static func borderColorForAstroStatus(_ status:AstroStatus)->Color
{
switch status {
case .Off:
return Color.astroStatusBorderOff
case .Standby:
return Color.astroStatusBorderStandby
case .Normal:
return Color.astroStatusBorderNormal
case .Caution:
return Color.astroStatusBorderCaution
case .Serious:
return Color.astroStatusBorderSerious
case .Critical:
return Color.astroStatusBorderCritical
}
}
//——————————————————————————————————————————————————————————————————————————————
// Semantic UI colors
//——————————————————————————————————————————————————————————————————————————————
static var launchesTextColor:Color
{return Color("Text Color")} // astroUIPrimaryLighten4,astroUITertiaryLighten1

static var launchesBackgroundColor:Color
{return Color("Background Color")} //

static var launchesCardColor:Color
{return Color("Card Color")} //

static var launchesTagBorderColor:Color
{return Color("Tag Border")} // not Astro colors

static var launchesTagBackgroundColor:Color
{return Color("Tag Background")} //astroUIPrimaryLighten2,astroUISecondaryLighten4

// static var launchesTextColor:Color
// {
// @Environment(\.colorScheme) var colorScheme // iOS 15.0, always returns light
//
// if (colorScheme == .dark)
// {
// return .astroUITertiaryLighten1
// }
// else
// {
// return .astroUIPrimaryLighten4
// }
// }
}
12 changes: 12 additions & 0 deletions Shared/Assets.xcassets/Colors.dataset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"data" : [
{
"filename" : "Colors.swift",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
43 changes: 43 additions & 0 deletions Shared/Colors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Foundation
import SwiftUI
import AstroSwiftFoundation

public extension Color
{
Expand All @@ -26,6 +27,48 @@ public extension Color
// return Color { colorScheme == .dark ? dark : light }
}

//——————————————————————————————————————————————————————————————————————————————
// New Astro Colors, not yet in Foundation
//——————————————————————————————————————————————————————————————————————————————
//MARK: Color - Astro Status colors
//——————————————————————————————————————————————————————————————————————————————
// Astro status colors
//——————————————————————————————————————————————————————————————————————————————
static var astroStatusBorderOff:Color
{ return Color("Astro Status Off Border Color")}

static var astroStatusBorderStandby:Color
{ return Color("Astro Status Standby Border Color")}

static var astroStatusBorderNormal:Color
{ return Color("Astro Status Normal Border Color")}

static var astroStatusBorderCaution:Color
{ return Color("Astro Status Caution Border Color")}

static var astroStatusBorderSerious:Color
{ return Color("Astro Status Serious Border Color")}

static var astroStatusBorderCritical:Color
{ return Color("Astro Status Critical Border Color")}

static func borderColorForAstroStatus(_ status:AstroStatus)->Color
{
switch status {
case .Off:
return Color.astroStatusBorderOff
case .Standby:
return Color.astroStatusBorderStandby
case .Normal:
return Color.astroStatusBorderNormal
case .Caution:
return Color.astroStatusBorderCaution
case .Serious:
return Color.astroStatusBorderSerious
case .Critical:
return Color.astroStatusBorderCritical
}
}
//——————————————————————————————————————————————————————————————————————————————
// Semantic UI colors
//——————————————————————————————————————————————————————————————————————————————
Expand Down
Loading

0 comments on commit 4bcca84

Please sign in to comment.