Small improvements and better dark mode support

main
Laurent 3 years ago
parent 3c77bcafca
commit f521f35cba
  1. 24
      LeCountdown.xcodeproj/project.pbxproj
  2. 17
      LeCountdown/LeCountdownApp.swift
  3. 19
      LeCountdown/Subscription/AppGuard.swift
  4. 9
      LeCountdown/Views/ContentView.swift
  5. 37
      LeCountdown/Views/Countdown/CountdownDialView.swift
  6. 1
      LeCountdown/Views/Countdown/NewCountdownView.swift
  7. 21
      LeCountdown/Views/DialView.swift
  8. 19
      LeCountdown/Views/LiveTimerListView.swift
  9. 4
      LeCountdown/Views/PresetsView.swift
  10. 10
      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;
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;

@ -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 {

@ -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() {

@ -21,7 +21,8 @@ struct ContentView<T : AbstractTimer>: 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<T : AbstractTimer>: 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<T : AbstractTimer>: 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) {

@ -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)
}

@ -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")

@ -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")

@ -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()

@ -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))

@ -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)

@ -26,6 +26,7 @@ extension View {
/// }
/// ```
func focusNextField<F: RawRepresentable>(_ field: FocusState<F?>.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) {

@ -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)
}
}
}

@ -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)
}

@ -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";

Loading…
Cancel
Save