forked from firka/student-legacy
Fixes
This commit is contained in:
parent
2406e9a45d
commit
894f370dad
@ -11,6 +11,33 @@ struct Widgets: WidgetBundle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Color Converter
|
||||||
|
extension Color {
|
||||||
|
init(hex: String, alpha: Double = 1.0) {
|
||||||
|
var hexValue = hex.trimmingCharacters(in: .whitespacesAndNewlines).uppercased()
|
||||||
|
|
||||||
|
if hexValue.hasPrefix("#") {
|
||||||
|
hexValue.remove(at: hexValue.startIndex)
|
||||||
|
}
|
||||||
|
|
||||||
|
var rgbValue: UInt64 = 0
|
||||||
|
Scanner(string: hexValue).scanHexInt64(&rgbValue)
|
||||||
|
|
||||||
|
let red = Double((rgbValue & 0xFF0000) >> 16) / 255.0
|
||||||
|
let green = Double((rgbValue & 0x00FF00) >> 8) / 255.0
|
||||||
|
let blue = Double(rgbValue & 0x0000FF) / 255.0
|
||||||
|
|
||||||
|
self.init(
|
||||||
|
.sRGB,
|
||||||
|
red: red,
|
||||||
|
green: green,
|
||||||
|
blue: blue,
|
||||||
|
opacity: alpha
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// We need to redefined live activities pipe
|
// We need to redefined live activities pipe
|
||||||
struct LiveActivitiesAppAttributes: ActivityAttributes, Identifiable {
|
struct LiveActivitiesAppAttributes: ActivityAttributes, Identifiable {
|
||||||
public struct ContentState: Codable, Hashable { }
|
public struct ContentState: Codable, Hashable { }
|
||||||
@ -69,7 +96,9 @@ struct LockScreenLiveActivityView: View {
|
|||||||
.padding(.trailing, CGFloat(24))
|
.padding(.trailing, CGFloat(24))
|
||||||
}
|
}
|
||||||
.activityBackgroundTint(
|
.activityBackgroundTint(
|
||||||
lesson!.color != "0xFF676767" ? Color(lesson!.color) : nil
|
lesson!.color == "#676767"
|
||||||
|
? nil
|
||||||
|
: Color(hex: lesson!.color)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -147,7 +176,11 @@ struct LiveCardWidget: Widget {
|
|||||||
.font(.system(size: CGFloat(10)))
|
.font(.system(size: CGFloat(10)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.keylineTint(.accentColor)
|
.keylineTint(
|
||||||
|
lesson!.color == "#676767"
|
||||||
|
? nil
|
||||||
|
: Color(hex: lesson!.color)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,6 +87,7 @@ class LiveCardProvider extends ChangeNotifier {
|
|||||||
|
|
||||||
// Debugging
|
// Debugging
|
||||||
static DateTime _now() {
|
static DateTime _now() {
|
||||||
|
// return DateTime(2023, 8, 31, 8, 0);
|
||||||
return DateTime.now();
|
return DateTime.now();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +111,8 @@ class LiveCardProvider extends ChangeNotifier {
|
|||||||
switch (currentState) {
|
switch (currentState) {
|
||||||
case LiveCardState.duringLesson:
|
case LiveCardState.duringLesson:
|
||||||
return {
|
return {
|
||||||
"color": _settings.liveActivityColor.toString(),
|
"color":
|
||||||
|
'#${_settings.liveActivityColor.toString().substring(10, 16)}',
|
||||||
"icon": currentLesson != null
|
"icon": currentLesson != null
|
||||||
? SubjectIcon.resolveName(subject: currentLesson?.subject)
|
? SubjectIcon.resolveName(subject: currentLesson?.subject)
|
||||||
: "book",
|
: "book",
|
||||||
@ -143,7 +145,8 @@ class LiveCardProvider extends ChangeNotifier {
|
|||||||
final diff = getFloorDifference();
|
final diff = getFloorDifference();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"color": _settings.liveActivityColor.toString(),
|
"color":
|
||||||
|
'#${_settings.liveActivityColor.toString().substring(10, 16)}',
|
||||||
"icon": iconFloorMap[diff] ?? "cup.and.saucer",
|
"icon": iconFloorMap[diff] ?? "cup.and.saucer",
|
||||||
"title": "Szünet",
|
"title": "Szünet",
|
||||||
"description": "go $diff".i18n.fill([
|
"description": "go $diff".i18n.fill([
|
||||||
|
Loading…
x
Reference in New Issue
Block a user