Improve look

release
Laurent 3 years ago
parent 1db60171e1
commit fffaf67caa
  1. 4
      LeCountdown.xcodeproj/project.pbxproj
  2. 3
      LeCountdown/ContentView.swift
  3. 29
      LeCountdown/Countdown+Extension.swift

@ -41,6 +41,7 @@
C438C8012981327600BF3EF9 /* Persistence.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4060DC8297AE73D003FAB80 /* Persistence.swift */; };
C438C802298132B900BF3EF9 /* LeCountdown.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = C4060DCA297AE73D003FAB80 /* LeCountdown.xcdatamodeld */; };
C438C80529813FB400BF3EF9 /* TimeInterval+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4060DF4297AE9A7003FAB80 /* TimeInterval+Extensions.swift */; };
C438C807298195E600BF3EF9 /* Countdown+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C438C806298195E600BF3EF9 /* Countdown+Extension.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@ -125,6 +126,7 @@
C438C7FE2981300500BF3EF9 /* IntentDataProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IntentDataProvider.swift; sourceTree = "<group>"; };
C438C80329813B2500BF3EF9 /* LaunchIntents.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = LaunchIntents.entitlements; sourceTree = "<group>"; };
C438C80429813B3100BF3EF9 /* LeCountdown.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = LeCountdown.entitlements; sourceTree = "<group>"; };
C438C806298195E600BF3EF9 /* Countdown+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Countdown+Extension.swift"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -211,6 +213,7 @@
C4060DCD297AE73D003FAB80 /* Info.plist */,
C4060DCA297AE73D003FAB80 /* LeCountdown.xcdatamodeld */,
C4060DC5297AE73D003FAB80 /* Preview Content */,
C438C806298195E600BF3EF9 /* Countdown+Extension.swift */,
);
path = LeCountdown;
sourceTree = "<group>";
@ -465,6 +468,7 @@
buildActionMask = 2147483647;
files = (
C4060DC9297AE73D003FAB80 /* Persistence.swift in Sources */,
C438C807298195E600BF3EF9 /* Countdown+Extension.swift in Sources */,
C438C7FF2981300500BF3EF9 /* IntentDataProvider.swift in Sources */,
C4060DC2297AE73B003FAB80 /* ContentView.swift in Sources */,
C438C7C12980228B00BF3EF9 /* CountdownScheduler.swift in Sources */,

@ -66,12 +66,13 @@ struct ContentView: View {
Button {
self._launchCountdown(countdown)
} label: {
CountdownLiveView(countdown: countdown)
.environmentObject(AppEnvironment.sun)
.aspectRatio(contentMode: .fill)
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity)
.aspectRatio(1, contentMode: .fit)
.background(Color(red: 0.9, green: 0.95, blue: 1.0))
.background(countdown.colorForStatus)
.cornerRadius(40.0)
}
// Text("ORder = \(countdown.order)")

@ -0,0 +1,29 @@
//
// Countdown+Extension.swift
// LeCountdown
//
// Created by Laurent Morvillier on 25/01/2023.
//
import Foundation
import SwiftUI
extension Countdown {
var endDate: Date? {
return AppEnvironment.sun.notificationDates[self.stringId]
}
var isLive: Bool {
return endDate != nil
}
var colorForStatus: Color {
if isLive {
return Color(red: 0.9, green: 1.0, blue: 0.95)
} else {
return Color(red: 0.9, green: 0.95, blue: 1.0)
}
}
}
Loading…
Cancel
Save