macOS widgets

This commit is contained in:
Hillel Coren 2023-06-27 15:47:27 +03:00
parent 0412aa99cb
commit cbfc96ee4b
3 changed files with 13 additions and 4 deletions

View File

@ -1204,6 +1204,18 @@ abstract class UserSettingsEntity
} }
} }
String get validatedAccentColor {
if ((accentColor ?? '').isEmpty) {
return kDefaultAccentColor;
}
if (accentColor.toLowerCase() == '#ffffff') {
return kDefaultAccentColor;
}
return accentColor;
}
// ignore: unused_element // ignore: unused_element
static void _initializeBuilder(UserSettingsEntityBuilder builder) => builder static void _initializeBuilder(UserSettingsEntityBuilder builder) => builder
..accentColor = kDefaultAccentColor ..accentColor = kDefaultAccentColor

View File

@ -157,7 +157,7 @@ class WidgetCompany {
: id = userCompanyState.userCompany.company.id, : id = userCompanyState.userCompany.company.id,
name = userCompanyState.userCompany.company.displayName, name = userCompanyState.userCompany.company.displayName,
token = userCompanyState.userCompany.token.token, token = userCompanyState.userCompany.token.token,
accentColor = userCompanyState.userCompany.settings.accentColor, accentColor = userCompanyState.userCompany.settings.validatedAccentColor,
firstMonthOfYear = firstMonthOfYear =
parseInt(userCompanyState.userCompany.company.firstMonthOfYear), parseInt(userCompanyState.userCompany.company.firstMonthOfYear),
currencyId = userCompanyState.userCompany.company.currencyId, currencyId = userCompanyState.userCompany.company.currencyId,

View File

@ -153,7 +153,6 @@ struct Provider: IntentTimelineProvider {
field: label, field: label,
value: formatter.string(from: NSNumber(value: value))!) value: formatter.string(from: NSNumber(value: value))!)
// Next fetch happens 15 minutes later
let nextUpdate = Calendar.current.date( let nextUpdate = Calendar.current.date(
byAdding: DateComponents(minute: 15), byAdding: DateComponents(minute: 15),
to: Date() to: Date()
@ -189,8 +188,6 @@ struct Provider: IntentTimelineProvider {
var start: Date = Date() var start: Date = Date()
var end: Date = Date() var end: Date = Date()
var dateComponents = calendar.dateComponents([.year, .month, .day], from: Date())
if (dateRange == "all_time") { if (dateRange == "all_time") {
start = calendar.date(byAdding: .year, value: -100, to: Date())! start = calendar.date(byAdding: .year, value: -100, to: Date())!
} else if (dateRange == "today") { } else if (dateRange == "today") {