diff --git a/LeCountdown.xcodeproj/project.pbxproj b/LeCountdown.xcodeproj/project.pbxproj index 6ddde5f..9bad2f6 100644 --- a/LeCountdown.xcodeproj/project.pbxproj +++ b/LeCountdown.xcodeproj/project.pbxproj @@ -1640,7 +1640,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = LeCountdown/LeCountdown.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 5; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"LeCountdown/Preview Content\""; DEVELOPMENT_TEAM = 526E96RFNP; ENABLE_PREVIEWS = YES; @@ -1657,7 +1657,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0; + MARKETING_VERSION = 1.0.2; PRODUCT_BUNDLE_IDENTIFIER = com.staxriver.LeCountdown; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; @@ -1677,7 +1677,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = LeCountdown/LeCountdown.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 5; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"LeCountdown/Preview Content\""; DEVELOPMENT_TEAM = 526E96RFNP; ENABLE_PREVIEWS = YES; @@ -1694,7 +1694,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0; + MARKETING_VERSION = 1.0.2; PRODUCT_BUNDLE_IDENTIFIER = com.staxriver.LeCountdown; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; @@ -1789,7 +1789,7 @@ ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; CODE_SIGN_ENTITLEMENTS = LaunchWidgetExtension.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 5; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 526E96RFNP; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = LaunchWidget/Info.plist; @@ -1800,7 +1800,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0; + MARKETING_VERSION = 1.0.2; PRODUCT_BUNDLE_IDENTIFIER = com.staxriver.LeCountdown.LaunchWidget; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -1817,7 +1817,7 @@ ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; CODE_SIGN_ENTITLEMENTS = LaunchWidgetExtension.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 5; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 526E96RFNP; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = LaunchWidget/Info.plist; @@ -1828,7 +1828,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0; + MARKETING_VERSION = 1.0.2; PRODUCT_BUNDLE_IDENTIFIER = com.staxriver.LeCountdown.LaunchWidget; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -1843,7 +1843,7 @@ buildSettings = { CODE_SIGN_ENTITLEMENTS = LaunchIntents/LaunchIntents.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 5; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 526E96RFNP; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = LaunchIntents/Info.plist; @@ -1855,7 +1855,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0; + MARKETING_VERSION = 1.0.2; PRODUCT_BUNDLE_IDENTIFIER = com.staxriver.LeCountdown.LaunchIntents; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -1870,7 +1870,7 @@ buildSettings = { CODE_SIGN_ENTITLEMENTS = LaunchIntents/LaunchIntents.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 5; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 526E96RFNP; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = LaunchIntents/Info.plist; @@ -1882,7 +1882,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0; + MARKETING_VERSION = 1.0.2; PRODUCT_BUNDLE_IDENTIFIER = com.staxriver.LeCountdown.LaunchIntents; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; diff --git a/LeCountdown/LeCountdownApp.swift b/LeCountdown/LeCountdownApp.swift index 4659327..04255d4 100644 --- a/LeCountdown/LeCountdownApp.swift +++ b/LeCountdown/LeCountdownApp.swift @@ -16,34 +16,21 @@ import CloudKit struct LeCountdownApp: App { let persistenceController = PersistenceController.shared - + @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate + @Environment(\.scenePhase) var scenePhase init() { - UITabBar.appearance().backgroundColor = UIColor(white: 0.96, alpha: 1.0) UIPageControl.appearance().currentPageIndicatorTintColor = .systemPink UIPageControl.appearance().pageIndicatorTintColor = UIColor(white: 0.7, alpha: 1.0) 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() -// if !ProcessInfo.processInfo.isiOSAppOnMac { -// self._initSchemaIfNeeded() -// self._activateAudioSession() -// } - } - @Environment(\.scenePhase) var scenePhase - var body: some Scene { WindowGroup { diff --git a/LeCountdown/Subscription/AppGuard.swift b/LeCountdown/Subscription/AppGuard.swift index 970da5f..81edb0b 100644 --- a/LeCountdown/Subscription/AppGuard.swift +++ b/LeCountdown/Subscription/AppGuard.swift @@ -130,16 +130,17 @@ extension Notification.Name { } var currentPlan: StorePlan { - - #if DEBUG return .yearly - #else - if let currentBestPlan = self.currentBestPlan, - let plan = StorePlan(rawValue: currentBestPlan.productID) { - return plan - } - return .none - #endif + +// #if DEBUG +// return .yearly +// #else +// if let currentBestPlan = self.currentBestPlan, +// let plan = StorePlan(rawValue: currentBestPlan.productID) { +// return plan +// } +// return .none +// #endif } fileprivate func _updateBestPlan() { diff --git a/LeCountdown/Views/ContentView.swift b/LeCountdown/Views/ContentView.swift index d1cc3d4..0a9fa54 100644 --- a/LeCountdown/Views/ContentView.swift +++ b/LeCountdown/Views/ContentView.swift @@ -21,7 +21,8 @@ struct ContentView: View { @Environment(\.managedObjectContext) private var viewContext @EnvironmentObject var conductor: Conductor - + @Environment(\.colorScheme) var colorScheme + @StateObject var boringContext: BoringContext = BoringContext() @State private var isEditing: Bool = false @@ -62,7 +63,7 @@ struct ContentView: View { .environmentObject(conductor) .padding(.horizontal, 12.0) .foregroundColor(.black) - .background(Color(white: 0.9)) + .background(self._backgroundColor) .cornerRadius(32.0, corners: [.topRight, .topLeft]) } } @@ -87,6 +88,10 @@ struct ContentView: View { } + fileprivate var _backgroundColor: Color { + return Color(white: self.colorScheme == .dark ? 0.1 : 0.9) + } + fileprivate func _handleSiriTips(timer: AbstractTimer) { let timerId = timer.stringId if !Preferences.timerSiriTips.contains(timerId) { diff --git a/LeCountdown/Views/Countdown/CountdownDialView.swift b/LeCountdown/Views/Countdown/CountdownDialView.swift index 59833aa..4fb8bd4 100644 --- a/LeCountdown/Views/Countdown/CountdownDialView.swift +++ b/LeCountdown/Views/Countdown/CountdownDialView.swift @@ -10,7 +10,8 @@ import SwiftUI struct CountdownDialView: View { @EnvironmentObject var conductor: Conductor - + @Environment(\.colorScheme) var colorScheme + @ObservedObject var countdown: Countdown @State var isEditing: Bool @@ -20,21 +21,49 @@ struct CountdownDialView: View { HStack { VStack(alignment: .leading) { Text(countdown.activity?.name?.uppercased() ?? "") - .foregroundColor(isEditing ? .white : .black) + .foregroundColor(self._titleColor) .multilineTextAlignment(.leading) Text(countdown.duration.hourMinuteSecond) .fontWeight(.semibold) - .foregroundColor(.accentColor) + .foregroundColor(self._durationColor) } 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 { 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) .environmentObject(Conductor.maestro) } diff --git a/LeCountdown/Views/Countdown/NewCountdownView.swift b/LeCountdown/Views/Countdown/NewCountdownView.swift index e4b831e..09e4dff 100644 --- a/LeCountdown/Views/Countdown/NewCountdownView.swift +++ b/LeCountdown/Views/Countdown/NewCountdownView.swift @@ -132,6 +132,7 @@ struct CountdownEditView : View { }.toolbar { ToolbarItemGroup(placement: .keyboard) { Button { + Logger.log("NIL!!!!") self.focusedField = nil } label: { Image(systemName: "keyboard.chevron.compact.down") diff --git a/LeCountdown/Views/DialView.swift b/LeCountdown/Views/DialView.swift index e2cc896..3595f91 100644 --- a/LeCountdown/Views/DialView.swift +++ b/LeCountdown/Views/DialView.swift @@ -10,7 +10,8 @@ import SwiftUI struct DialView: View { @Environment(\.managedObjectContext) private var viewContext - + @Environment(\.colorScheme) var colorScheme + @EnvironmentObject var boringContext: BoringContext @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) .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 fileprivate func _dialView() -> some View { Group { @@ -80,7 +95,7 @@ struct DialView: View { AlarmDialView(alarm: alarm) .environmentObject(Conductor.maestro) case let stopwatch as Stopwatch: - StopwatchDialView(stopwatch: stopwatch) + StopwatchDialView(stopwatch: stopwatch, isEditing: self.isEditingBinding.wrappedValue) .environmentObject(Conductor.maestro) default: Text("missing dial view") diff --git a/LeCountdown/Views/LiveTimerListView.swift b/LeCountdown/Views/LiveTimerListView.swift index 87e891a..0647c3b 100644 --- a/LeCountdown/Views/LiveTimerListView.swift +++ b/LeCountdown/Views/LiveTimerListView.swift @@ -13,12 +13,15 @@ fileprivate let actionButtonFontSize: CGFloat = 36.0 struct TimeView: View { + @Environment(\.colorScheme) var colorScheme + var text: String var body: some View { Text(self.text) .font(.system(size: timerFontSize, weight: .medium)) .minimumScaleFactor(0.1) + .foregroundColor(self.colorScheme == .dark ? .white : .black) } } @@ -26,6 +29,8 @@ struct TimeView: View { struct LiveTimerListView: View { @Environment(\.managedObjectContext) private var viewContext + @Environment(\.colorScheme) var colorScheme + @EnvironmentObject var conductor: Conductor var body: some View { @@ -37,7 +42,9 @@ struct LiveTimerListView: View { } } - }.padding() + } + .padding() + } @@ -82,7 +89,8 @@ struct LiveTimerView: View { struct LiveStopwatchView: View { @Environment(\.managedObjectContext) private var viewContext - + @Environment(\.colorScheme) var colorScheme + @State var stopwatch: Stopwatch var date: Date @@ -102,7 +110,8 @@ struct LiveStopwatchView: View { let duration = self.endDate?.timeIntervalSince(self.date) ?? 0.0 TimeView(text: duration.hourMinuteSecondHS) } - Text(self.stopwatch.displayName.uppercased()) + Text(self.stopwatch.displayName.uppercased()) .foregroundColor(self.colorScheme == .dark ? .white : .black) + } Spacer() @@ -153,7 +162,8 @@ struct LiveStopwatchView: View { struct LiveCountdownView: View { @Environment(\.managedObjectContext) private var viewContext - + @Environment(\.colorScheme) var colorScheme + @State var countdown: Countdown var date: Date @@ -180,6 +190,7 @@ struct LiveCountdownView: View { } Text(self.countdown.displayName.uppercased()) + .foregroundColor(self.colorScheme == .dark ? .white : .black) } Spacer() diff --git a/LeCountdown/Views/PresetsView.swift b/LeCountdown/Views/PresetsView.swift index 052b7e9..f3aeab8 100644 --- a/LeCountdown/Views/PresetsView.swift +++ b/LeCountdown/Views/PresetsView.swift @@ -164,6 +164,8 @@ struct PresetsView: View { struct TimerItemView: View { + @Environment(\.colorScheme) var colorScheme + var name: String var duration: String var sound: String @@ -171,7 +173,7 @@ struct TimerItemView: View { var body: some View { HStack { VStack(alignment: .leading) { - Text(self.name.uppercased()).foregroundColor(.black) + Text(self.name.uppercased()).foregroundColor(colorScheme == .dark ? .white : .black) Text(self.duration) .foregroundColor(Color.accentColor) Text(self.sound.uppercased()).foregroundColor(Color(white: 0.7)) diff --git a/LeCountdown/Views/Reusable/SiriTimerView.swift b/LeCountdown/Views/Reusable/SiriTimerView.swift index ac1128c..be0945a 100644 --- a/LeCountdown/Views/Reusable/SiriTimerView.swift +++ b/LeCountdown/Views/Reusable/SiriTimerView.swift @@ -9,7 +9,9 @@ import SwiftUI import _AppIntents_SwiftUI struct SiriVolumeView: View { - + + @Environment(\.colorScheme) var colorScheme + var timer: AbstractTimer? = nil @Binding var siriTipShown: Bool @@ -20,10 +22,11 @@ struct SiriVolumeView: View { isVisible: self.$siriTipShown) HStack(alignment: .center) { + Text("Volume").padding(.horizontal).monospaced() VolumeView(changeVolume: true) .padding(12.0) - }.frame(width: 300.0, height: 40.0) - .background(Color(white: 0.9)) + }.frame(width: 320.0, height: 40.0) + .background(Color(white: colorScheme == .dark ? 0.1 : 0.9)) .cornerRadius(16.0) } else { @@ -33,6 +36,7 @@ struct SiriVolumeView: View { isVisible: self.$siriTipShown) Spacer() } + Text("Volume") VolumeView() .padding(12.0) .frame(width: 300.0, height: 40.0) diff --git a/LeCountdown/Views/Reusable/View+Extension.swift b/LeCountdown/Views/Reusable/View+Extension.swift index 6b01329..68b4664 100644 --- a/LeCountdown/Views/Reusable/View+Extension.swift +++ b/LeCountdown/Views/Reusable/View+Extension.swift @@ -26,6 +26,7 @@ extension View { /// } /// ``` func focusNextField(_ field: FocusState.Binding) where F.RawValue == Int { + Logger.log("focusNextField") guard let currentValue = field.wrappedValue else { return } let nextValue = currentValue.rawValue + 1 if let newValue = F.init(rawValue: nextValue) { diff --git a/LeCountdown/Views/Stats/ActivityCalendarView.swift b/LeCountdown/Views/Stats/ActivityCalendarView.swift index 8f720eb..6743ee7 100644 --- a/LeCountdown/Views/Stats/ActivityCalendarView.swift +++ b/LeCountdown/Views/Stats/ActivityCalendarView.swift @@ -37,6 +37,7 @@ struct MonthView: View { struct ActivityCalendarView: View { @Environment(\.calendar) var calendar + @Environment(\.colorScheme) var colorScheme var activity: Activity @@ -56,13 +57,14 @@ struct ActivityCalendarView: View { if let oldestDate { CalendarView(interval: DateInterval(start: oldestDate, end: today)) { date in - ZStack { - - if self._hasRecord(date: date) { - Circle().fill(Color.green).brightness(0.5) - } - Text(date.get(.day).formatted()) - }.padding(6.0) + if self._hasRecord(date: date) { + ZStack { + Circle().fill(Color.accentColor) + Text(date.get(.day).formatted()).foregroundColor(.white) + }.padding(6.0) + } else { + Text(date.get(.day).formatted()).padding(6.0) + } } } diff --git a/LeCountdown/Views/Stopwatch/StopwatchDialView.swift b/LeCountdown/Views/Stopwatch/StopwatchDialView.swift index 19dff92..cce7405 100644 --- a/LeCountdown/Views/Stopwatch/StopwatchDialView.swift +++ b/LeCountdown/Views/Stopwatch/StopwatchDialView.swift @@ -10,21 +10,42 @@ import SwiftUI struct StopwatchDialView: View { @EnvironmentObject var conductor: Conductor + @Environment(\.colorScheme) var colorScheme @ObservedObject var stopwatch: Stopwatch + @State var isEditing: Bool + var body: some View { HStack { - Text(stopwatch.activity?.name?.uppercased() ?? "").foregroundColor(.black) + Text(stopwatch.activity?.name?.uppercased() ?? "").foregroundColor(self._titleColor) 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 { 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) .background(.cyan) } diff --git a/LeCountdown/fr.lproj/Localizable.strings b/LeCountdown/fr.lproj/Localizable.strings index 2b6fc3b..34e79b4 100644 --- a/LeCountdown/fr.lproj/Localizable.strings +++ b/LeCountdown/fr.lproj/Localizable.strings @@ -266,3 +266,4 @@ "Cancel %@" = "Annuler %@"; "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."; +"Volume" = "Volume";