Small improvements and better dark mode support

main
Laurent 3 years ago
parent 3c77bcafca
commit f521f35cba
  1. 24
      LeCountdown.xcodeproj/project.pbxproj
  2. 15
      LeCountdown/LeCountdownApp.swift
  3. 19
      LeCountdown/Subscription/AppGuard.swift
  4. 7
      LeCountdown/Views/ContentView.swift
  5. 35
      LeCountdown/Views/Countdown/CountdownDialView.swift
  6. 1
      LeCountdown/Views/Countdown/NewCountdownView.swift
  7. 19
      LeCountdown/Views/DialView.swift
  8. 15
      LeCountdown/Views/LiveTimerListView.swift
  9. 4
      LeCountdown/Views/PresetsView.swift
  10. 8
      LeCountdown/Views/Reusable/SiriTimerView.swift
  11. 1
      LeCountdown/Views/Reusable/View+Extension.swift
  12. 16
      LeCountdown/Views/Stats/ActivityCalendarView.swift
  13. 25
      LeCountdown/Views/Stopwatch/StopwatchDialView.swift
  14. 1
      LeCountdown/fr.lproj/Localizable.strings

@ -1640,7 +1640,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = LeCountdown/LeCountdown.entitlements; CODE_SIGN_ENTITLEMENTS = LeCountdown/LeCountdown.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 5; CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"LeCountdown/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"LeCountdown/Preview Content\"";
DEVELOPMENT_TEAM = 526E96RFNP; DEVELOPMENT_TEAM = 526E96RFNP;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
@ -1657,7 +1657,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0; MARKETING_VERSION = 1.0.2;
PRODUCT_BUNDLE_IDENTIFIER = com.staxriver.LeCountdown; PRODUCT_BUNDLE_IDENTIFIER = com.staxriver.LeCountdown;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
@ -1677,7 +1677,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = LeCountdown/LeCountdown.entitlements; CODE_SIGN_ENTITLEMENTS = LeCountdown/LeCountdown.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 5; CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"LeCountdown/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"LeCountdown/Preview Content\"";
DEVELOPMENT_TEAM = 526E96RFNP; DEVELOPMENT_TEAM = 526E96RFNP;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
@ -1694,7 +1694,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0; MARKETING_VERSION = 1.0.2;
PRODUCT_BUNDLE_IDENTIFIER = com.staxriver.LeCountdown; PRODUCT_BUNDLE_IDENTIFIER = com.staxriver.LeCountdown;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
@ -1789,7 +1789,7 @@
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
CODE_SIGN_ENTITLEMENTS = LaunchWidgetExtension.entitlements; CODE_SIGN_ENTITLEMENTS = LaunchWidgetExtension.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 5; CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 526E96RFNP; DEVELOPMENT_TEAM = 526E96RFNP;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = LaunchWidget/Info.plist; INFOPLIST_FILE = LaunchWidget/Info.plist;
@ -1800,7 +1800,7 @@
"@executable_path/Frameworks", "@executable_path/Frameworks",
"@executable_path/../../Frameworks", "@executable_path/../../Frameworks",
); );
MARKETING_VERSION = 1.0; MARKETING_VERSION = 1.0.2;
PRODUCT_BUNDLE_IDENTIFIER = com.staxriver.LeCountdown.LaunchWidget; PRODUCT_BUNDLE_IDENTIFIER = com.staxriver.LeCountdown.LaunchWidget;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
@ -1817,7 +1817,7 @@
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
CODE_SIGN_ENTITLEMENTS = LaunchWidgetExtension.entitlements; CODE_SIGN_ENTITLEMENTS = LaunchWidgetExtension.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 5; CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 526E96RFNP; DEVELOPMENT_TEAM = 526E96RFNP;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = LaunchWidget/Info.plist; INFOPLIST_FILE = LaunchWidget/Info.plist;
@ -1828,7 +1828,7 @@
"@executable_path/Frameworks", "@executable_path/Frameworks",
"@executable_path/../../Frameworks", "@executable_path/../../Frameworks",
); );
MARKETING_VERSION = 1.0; MARKETING_VERSION = 1.0.2;
PRODUCT_BUNDLE_IDENTIFIER = com.staxriver.LeCountdown.LaunchWidget; PRODUCT_BUNDLE_IDENTIFIER = com.staxriver.LeCountdown.LaunchWidget;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
@ -1843,7 +1843,7 @@
buildSettings = { buildSettings = {
CODE_SIGN_ENTITLEMENTS = LaunchIntents/LaunchIntents.entitlements; CODE_SIGN_ENTITLEMENTS = LaunchIntents/LaunchIntents.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 5; CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 526E96RFNP; DEVELOPMENT_TEAM = 526E96RFNP;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = LaunchIntents/Info.plist; INFOPLIST_FILE = LaunchIntents/Info.plist;
@ -1855,7 +1855,7 @@
"@executable_path/Frameworks", "@executable_path/Frameworks",
"@executable_path/../../Frameworks", "@executable_path/../../Frameworks",
); );
MARKETING_VERSION = 1.0; MARKETING_VERSION = 1.0.2;
PRODUCT_BUNDLE_IDENTIFIER = com.staxriver.LeCountdown.LaunchIntents; PRODUCT_BUNDLE_IDENTIFIER = com.staxriver.LeCountdown.LaunchIntents;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
@ -1870,7 +1870,7 @@
buildSettings = { buildSettings = {
CODE_SIGN_ENTITLEMENTS = LaunchIntents/LaunchIntents.entitlements; CODE_SIGN_ENTITLEMENTS = LaunchIntents/LaunchIntents.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 5; CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 526E96RFNP; DEVELOPMENT_TEAM = 526E96RFNP;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = LaunchIntents/Info.plist; INFOPLIST_FILE = LaunchIntents/Info.plist;
@ -1882,7 +1882,7 @@
"@executable_path/Frameworks", "@executable_path/Frameworks",
"@executable_path/../../Frameworks", "@executable_path/../../Frameworks",
); );
MARKETING_VERSION = 1.0; MARKETING_VERSION = 1.0.2;
PRODUCT_BUNDLE_IDENTIFIER = com.staxriver.LeCountdown.LaunchIntents; PRODUCT_BUNDLE_IDENTIFIER = com.staxriver.LeCountdown.LaunchIntents;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES; SKIP_INSTALL = YES;

@ -18,32 +18,19 @@ struct LeCountdownApp: App {
let persistenceController = PersistenceController.shared let persistenceController = PersistenceController.shared
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
@Environment(\.scenePhase) var scenePhase
init() { init() {
UITabBar.appearance().backgroundColor = UIColor(white: 0.96, alpha: 1.0)
UIPageControl.appearance().currentPageIndicatorTintColor = .systemPink UIPageControl.appearance().currentPageIndicatorTintColor = .systemPink
UIPageControl.appearance().pageIndicatorTintColor = UIColor(white: 0.7, alpha: 1.0) UIPageControl.appearance().pageIndicatorTintColor = UIColor(white: 0.7, alpha: 1.0)
Logger.log("path = \(Bundle.main.bundlePath)") Logger.log("path = \(Bundle.main.bundlePath)")
// let context = self.persistenceController.container.viewContext
// let records: [Record] = context.fetch(entityName: Record.entityName, sortDescriptor: NSSortDescriptor(key: "start", ascending: false))
// for record in records {
// Logger.log("duration = \(record.duration)")
// }
self._registerBackgroundRefreshes() self._registerBackgroundRefreshes()
// if !ProcessInfo.processInfo.isiOSAppOnMac {
// self._initSchemaIfNeeded()
// self._activateAudioSession()
// }
} }
@Environment(\.scenePhase) var scenePhase
var body: some Scene { var body: some Scene {
WindowGroup { WindowGroup {

@ -130,16 +130,17 @@ extension Notification.Name {
} }
var currentPlan: StorePlan { var currentPlan: StorePlan {
#if DEBUG
return .yearly return .yearly
#else
if let currentBestPlan = self.currentBestPlan, // #if DEBUG
let plan = StorePlan(rawValue: currentBestPlan.productID) { // return .yearly
return plan // #else
} // if let currentBestPlan = self.currentBestPlan,
return .none // let plan = StorePlan(rawValue: currentBestPlan.productID) {
#endif // return plan
// }
// return .none
// #endif
} }
fileprivate func _updateBestPlan() { fileprivate func _updateBestPlan() {

@ -21,6 +21,7 @@ struct ContentView<T : AbstractTimer>: View {
@Environment(\.managedObjectContext) private var viewContext @Environment(\.managedObjectContext) private var viewContext
@EnvironmentObject var conductor: Conductor @EnvironmentObject var conductor: Conductor
@Environment(\.colorScheme) var colorScheme
@StateObject var boringContext: BoringContext = BoringContext() @StateObject var boringContext: BoringContext = BoringContext()
@ -62,7 +63,7 @@ struct ContentView<T : AbstractTimer>: View {
.environmentObject(conductor) .environmentObject(conductor)
.padding(.horizontal, 12.0) .padding(.horizontal, 12.0)
.foregroundColor(.black) .foregroundColor(.black)
.background(Color(white: 0.9)) .background(self._backgroundColor)
.cornerRadius(32.0, corners: [.topRight, .topLeft]) .cornerRadius(32.0, corners: [.topRight, .topLeft])
} }
} }
@ -87,6 +88,10 @@ struct ContentView<T : AbstractTimer>: View {
} }
fileprivate var _backgroundColor: Color {
return Color(white: self.colorScheme == .dark ? 0.1 : 0.9)
}
fileprivate func _handleSiriTips(timer: AbstractTimer) { fileprivate func _handleSiriTips(timer: AbstractTimer) {
let timerId = timer.stringId let timerId = timer.stringId
if !Preferences.timerSiriTips.contains(timerId) { if !Preferences.timerSiriTips.contains(timerId) {

@ -10,6 +10,7 @@ import SwiftUI
struct CountdownDialView: View { struct CountdownDialView: View {
@EnvironmentObject var conductor: Conductor @EnvironmentObject var conductor: Conductor
@Environment(\.colorScheme) var colorScheme
@ObservedObject var countdown: Countdown @ObservedObject var countdown: Countdown
@ -20,21 +21,49 @@ struct CountdownDialView: View {
HStack { HStack {
VStack(alignment: .leading) { VStack(alignment: .leading) {
Text(countdown.activity?.name?.uppercased() ?? "") Text(countdown.activity?.name?.uppercased() ?? "")
.foregroundColor(isEditing ? .white : .black) .foregroundColor(self._titleColor)
.multilineTextAlignment(.leading) .multilineTextAlignment(.leading)
Text(countdown.duration.hourMinuteSecond) Text(countdown.duration.hourMinuteSecond)
.fontWeight(.semibold) .fontWeight(.semibold)
.foregroundColor(.accentColor) .foregroundColor(self._durationColor)
} }
Spacer() Spacer()
} }
} }
private var _titleColor: Color {
let darkMode = colorScheme == .dark
if self.isEditing {
if darkMode {
return .white
} else {
return .white
}
} else {
if darkMode {
return .white
} else {
return .black
}
}
}
private var _durationColor: Color {
let darkMode = colorScheme == .dark
if self.isEditing && darkMode {
return Color(white: 0.8)
} else {
return .accentColor
}
}
} }
struct CountdownLiveView_Previews: PreviewProvider { struct CountdownLiveView_Previews: PreviewProvider {
static var previews: some View { static var previews: some View {
CountdownDialView(countdown: Countdown.fake(context: PersistenceController.preview.container.viewContext), isEditing: false) CountdownDialView(countdown: Countdown.fake(context: PersistenceController.preview.container.viewContext),
isEditing: false)
.background(.cyan) .background(.cyan)
.environmentObject(Conductor.maestro) .environmentObject(Conductor.maestro)
} }

@ -132,6 +132,7 @@ struct CountdownEditView : View {
}.toolbar { }.toolbar {
ToolbarItemGroup(placement: .keyboard) { ToolbarItemGroup(placement: .keyboard) {
Button { Button {
Logger.log("NIL!!!!")
self.focusedField = nil self.focusedField = nil
} label: { } label: {
Image(systemName: "keyboard.chevron.compact.down") Image(systemName: "keyboard.chevron.compact.down")

@ -10,6 +10,7 @@ import SwiftUI
struct DialView: View { struct DialView: View {
@Environment(\.managedObjectContext) private var viewContext @Environment(\.managedObjectContext) private var viewContext
@Environment(\.colorScheme) var colorScheme
@EnvironmentObject var boringContext: BoringContext @EnvironmentObject var boringContext: BoringContext
@EnvironmentObject var conductor: Conductor @EnvironmentObject var conductor: Conductor
@ -64,11 +65,25 @@ struct DialView: View {
} }
} }
}.background(Color(white: self.isEditingBinding.wrappedValue ? 0.1 : 0.95)) }.background(self._dialBackgroundColor)
.frame(width: frameSize, height: 80.0) .frame(width: frameSize, height: 80.0)
.cornerRadius(20.0) .cornerRadius(20.0)
} }
private var _dialBackgroundColor: Color {
let darkMode = self.colorScheme == .dark
let isEditing = self.isEditingBinding.wrappedValue
if darkMode {
if isEditing {
return Color.accentColor
} else {
return Color(white: 0.1)
}
} else {
return Color(white: isEditing ? 0.1 : 0.95)
}
}
@ViewBuilder @ViewBuilder
fileprivate func _dialView() -> some View { fileprivate func _dialView() -> some View {
Group { Group {
@ -80,7 +95,7 @@ struct DialView: View {
AlarmDialView(alarm: alarm) AlarmDialView(alarm: alarm)
.environmentObject(Conductor.maestro) .environmentObject(Conductor.maestro)
case let stopwatch as Stopwatch: case let stopwatch as Stopwatch:
StopwatchDialView(stopwatch: stopwatch) StopwatchDialView(stopwatch: stopwatch, isEditing: self.isEditingBinding.wrappedValue)
.environmentObject(Conductor.maestro) .environmentObject(Conductor.maestro)
default: default:
Text("missing dial view") Text("missing dial view")

@ -13,12 +13,15 @@ fileprivate let actionButtonFontSize: CGFloat = 36.0
struct TimeView: View { struct TimeView: View {
@Environment(\.colorScheme) var colorScheme
var text: String var text: String
var body: some View { var body: some View {
Text(self.text) Text(self.text)
.font(.system(size: timerFontSize, weight: .medium)) .font(.system(size: timerFontSize, weight: .medium))
.minimumScaleFactor(0.1) .minimumScaleFactor(0.1)
.foregroundColor(self.colorScheme == .dark ? .white : .black)
} }
} }
@ -26,6 +29,8 @@ struct TimeView: View {
struct LiveTimerListView: View { struct LiveTimerListView: View {
@Environment(\.managedObjectContext) private var viewContext @Environment(\.managedObjectContext) private var viewContext
@Environment(\.colorScheme) var colorScheme
@EnvironmentObject var conductor: Conductor @EnvironmentObject var conductor: Conductor
var body: some View { var body: some View {
@ -37,7 +42,9 @@ struct LiveTimerListView: View {
} }
} }
}.padding() }
.padding()
} }
@ -82,6 +89,7 @@ struct LiveTimerView: View {
struct LiveStopwatchView: View { struct LiveStopwatchView: View {
@Environment(\.managedObjectContext) private var viewContext @Environment(\.managedObjectContext) private var viewContext
@Environment(\.colorScheme) var colorScheme
@State var stopwatch: Stopwatch @State var stopwatch: Stopwatch
@ -102,7 +110,8 @@ struct LiveStopwatchView: View {
let duration = self.endDate?.timeIntervalSince(self.date) ?? 0.0 let duration = self.endDate?.timeIntervalSince(self.date) ?? 0.0
TimeView(text: duration.hourMinuteSecondHS) TimeView(text: duration.hourMinuteSecondHS)
} }
Text(self.stopwatch.displayName.uppercased()) Text(self.stopwatch.displayName.uppercased()) .foregroundColor(self.colorScheme == .dark ? .white : .black)
} }
Spacer() Spacer()
@ -153,6 +162,7 @@ struct LiveStopwatchView: View {
struct LiveCountdownView: View { struct LiveCountdownView: View {
@Environment(\.managedObjectContext) private var viewContext @Environment(\.managedObjectContext) private var viewContext
@Environment(\.colorScheme) var colorScheme
@State var countdown: Countdown @State var countdown: Countdown
var date: Date var date: Date
@ -180,6 +190,7 @@ struct LiveCountdownView: View {
} }
Text(self.countdown.displayName.uppercased()) Text(self.countdown.displayName.uppercased())
.foregroundColor(self.colorScheme == .dark ? .white : .black)
} }
Spacer() Spacer()

@ -164,6 +164,8 @@ struct PresetsView: View {
struct TimerItemView: View { struct TimerItemView: View {
@Environment(\.colorScheme) var colorScheme
var name: String var name: String
var duration: String var duration: String
var sound: String var sound: String
@ -171,7 +173,7 @@ struct TimerItemView: View {
var body: some View { var body: some View {
HStack { HStack {
VStack(alignment: .leading) { VStack(alignment: .leading) {
Text(self.name.uppercased()).foregroundColor(.black) Text(self.name.uppercased()).foregroundColor(colorScheme == .dark ? .white : .black)
Text(self.duration) Text(self.duration)
.foregroundColor(Color.accentColor) .foregroundColor(Color.accentColor)
Text(self.sound.uppercased()).foregroundColor(Color(white: 0.7)) Text(self.sound.uppercased()).foregroundColor(Color(white: 0.7))

@ -10,6 +10,8 @@ import _AppIntents_SwiftUI
struct SiriVolumeView: View { struct SiriVolumeView: View {
@Environment(\.colorScheme) var colorScheme
var timer: AbstractTimer? = nil var timer: AbstractTimer? = nil
@Binding var siriTipShown: Bool @Binding var siriTipShown: Bool
@ -20,10 +22,11 @@ struct SiriVolumeView: View {
isVisible: self.$siriTipShown) isVisible: self.$siriTipShown)
HStack(alignment: .center) { HStack(alignment: .center) {
Text("Volume").padding(.horizontal).monospaced()
VolumeView(changeVolume: true) VolumeView(changeVolume: true)
.padding(12.0) .padding(12.0)
}.frame(width: 300.0, height: 40.0) }.frame(width: 320.0, height: 40.0)
.background(Color(white: 0.9)) .background(Color(white: colorScheme == .dark ? 0.1 : 0.9))
.cornerRadius(16.0) .cornerRadius(16.0)
} else { } else {
@ -33,6 +36,7 @@ struct SiriVolumeView: View {
isVisible: self.$siriTipShown) isVisible: self.$siriTipShown)
Spacer() Spacer()
} }
Text("Volume")
VolumeView() VolumeView()
.padding(12.0) .padding(12.0)
.frame(width: 300.0, height: 40.0) .frame(width: 300.0, height: 40.0)

@ -26,6 +26,7 @@ extension View {
/// } /// }
/// ``` /// ```
func focusNextField<F: RawRepresentable>(_ field: FocusState<F?>.Binding) where F.RawValue == Int { func focusNextField<F: RawRepresentable>(_ field: FocusState<F?>.Binding) where F.RawValue == Int {
Logger.log("focusNextField")
guard let currentValue = field.wrappedValue else { return } guard let currentValue = field.wrappedValue else { return }
let nextValue = currentValue.rawValue + 1 let nextValue = currentValue.rawValue + 1
if let newValue = F.init(rawValue: nextValue) { if let newValue = F.init(rawValue: nextValue) {

@ -37,6 +37,7 @@ struct MonthView: View {
struct ActivityCalendarView: View { struct ActivityCalendarView: View {
@Environment(\.calendar) var calendar @Environment(\.calendar) var calendar
@Environment(\.colorScheme) var colorScheme
var activity: Activity var activity: Activity
@ -56,13 +57,14 @@ struct ActivityCalendarView: View {
if let oldestDate { if let oldestDate {
CalendarView(interval: DateInterval(start: oldestDate, end: today)) { date in CalendarView(interval: DateInterval(start: oldestDate, end: today)) { date in
ZStack { if self._hasRecord(date: date) {
ZStack {
if self._hasRecord(date: date) { Circle().fill(Color.accentColor)
Circle().fill(Color.green).brightness(0.5) Text(date.get(.day).formatted()).foregroundColor(.white)
} }.padding(6.0)
Text(date.get(.day).formatted()) } else {
}.padding(6.0) Text(date.get(.day).formatted()).padding(6.0)
}
} }
} }

@ -10,21 +10,42 @@ import SwiftUI
struct StopwatchDialView: View { struct StopwatchDialView: View {
@EnvironmentObject var conductor: Conductor @EnvironmentObject var conductor: Conductor
@Environment(\.colorScheme) var colorScheme
@ObservedObject var stopwatch: Stopwatch @ObservedObject var stopwatch: Stopwatch
@State var isEditing: Bool
var body: some View { var body: some View {
HStack { HStack {
Text(stopwatch.activity?.name?.uppercased() ?? "").foregroundColor(.black) Text(stopwatch.activity?.name?.uppercased() ?? "").foregroundColor(self._titleColor)
Spacer() Spacer()
} }
} }
private var _titleColor: Color {
let darkMode = colorScheme == .dark
if self.isEditing {
if darkMode {
return .white
} else {
return .white
}
} else {
if darkMode {
return .white
} else {
return .black
}
}
}
} }
struct StopwatchDialView_Previews: PreviewProvider { struct StopwatchDialView_Previews: PreviewProvider {
static var previews: some View { static var previews: some View {
StopwatchDialView(stopwatch: Stopwatch.fake(context: PersistenceController.preview.container.viewContext)) StopwatchDialView(stopwatch: Stopwatch.fake(context: PersistenceController.preview.container.viewContext), isEditing: false)
.environmentObject(Conductor.maestro) .environmentObject(Conductor.maestro)
.background(.cyan) .background(.cyan)
} }

@ -266,3 +266,4 @@
"Cancel %@" = "Annuler %@"; "Cancel %@" = "Annuler %@";
"Calendar" = "Calendrier"; "Calendar" = "Calendrier";
"Disclaimer" = "Ceci est une version beta d'Enchante.\n\nPour l'instant, veillez à ne pas dépendre de l'app pour des évènements trop critiques, on ne sait jamais :)\n\nSi vous avez des remarques ou un problème, merci de me contacter en allant dans les réglages."; "Disclaimer" = "Ceci est une version beta d'Enchante.\n\nPour l'instant, veillez à ne pas dépendre de l'app pour des évènements trop critiques, on ne sait jamais :)\n\nSi vous avez des remarques ou un problème, merci de me contacter en allant dans les réglages.";
"Volume" = "Volume";

Loading…
Cancel
Save