forked from firka/student-legacy
LiveActivities design fix
- Fixed if the user opens the app 1 hour before their first class, the Room section is empty in LiveActivity lock screen - DynamicIsland reworked and improved - The room section moved to Flutter side
This commit is contained in:
parent
587c16fb1f
commit
ae66a462e7
@ -52,14 +52,24 @@ struct LockScreenLiveActivityView: View {
|
|||||||
VStack(alignment: .center) {
|
VStack(alignment: .center) {
|
||||||
// Jelenlegi óra
|
// Jelenlegi óra
|
||||||
VStack {
|
VStack {
|
||||||
|
if(context.state.title.contains("Az első órádig")) {
|
||||||
|
Text(context.state.title)
|
||||||
|
.font(.system(size: 15))
|
||||||
|
.bold()
|
||||||
|
.multilineTextAlignment(.center)
|
||||||
|
} else {
|
||||||
Text(context.state.index + " " + context.state.title)
|
Text(context.state.index + " " + context.state.title)
|
||||||
.font(.body)
|
.font(.body)
|
||||||
.bold()
|
.bold()
|
||||||
.multilineTextAlignment(.center)
|
.multilineTextAlignment(.center)
|
||||||
|
}
|
||||||
Text("Terem: \(context.state.subtitle)")
|
|
||||||
.italic()
|
//Terem
|
||||||
.font(.caption)
|
if (!context.state.subtitle.isEmpty) {
|
||||||
|
Text(context.state.subtitle)
|
||||||
|
.italic()
|
||||||
|
.font(.caption)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Leírás
|
// Leírás
|
||||||
@ -84,14 +94,14 @@ struct LockScreenLiveActivityView: View {
|
|||||||
.padding(15)
|
.padding(15)
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
// Visszaszámláló
|
// Visszaszámláló
|
||||||
Text(timerInterval: context.state.date, countsDown: true)
|
Text(timerInterval: context.state.date, countsDown: true)
|
||||||
.multilineTextAlignment(.center)
|
.multilineTextAlignment(.center)
|
||||||
.frame(width: 85)
|
.frame(width: 85)
|
||||||
.font(.title2)
|
.font(.title2)
|
||||||
.monospacedDigit()
|
.monospacedDigit()
|
||||||
.padding(.trailing, CGFloat(24))
|
.padding(.trailing)
|
||||||
}
|
}
|
||||||
.activityBackgroundTint(
|
.activityBackgroundTint(
|
||||||
context.state.color != "#676767"
|
context.state.color != "#676767"
|
||||||
@ -109,7 +119,7 @@ struct LiveCardWidget: Widget {
|
|||||||
LockScreenLiveActivityView(context: context)
|
LockScreenLiveActivityView(context: context)
|
||||||
/// Dynamic Island
|
/// Dynamic Island
|
||||||
} dynamicIsland: { context in
|
} dynamicIsland: { context in
|
||||||
|
|
||||||
/// Expanded
|
/// Expanded
|
||||||
return DynamicIsland {
|
return DynamicIsland {
|
||||||
DynamicIslandExpandedRegion(.leading) {
|
DynamicIslandExpandedRegion(.leading) {
|
||||||
@ -135,30 +145,49 @@ struct LiveCardWidget: Widget {
|
|||||||
}
|
}
|
||||||
DynamicIslandExpandedRegion(.center) {
|
DynamicIslandExpandedRegion(.center) {
|
||||||
VStack(alignment: .center) {
|
VStack(alignment: .center) {
|
||||||
|
if(context.state.title.contains("Az első órádig")) {
|
||||||
|
Text("Az első órád:")
|
||||||
|
.font(.body)
|
||||||
|
.bold()
|
||||||
|
.padding(.leading, 15)
|
||||||
|
Text(context.state.nextSubject)
|
||||||
|
.font(.body)
|
||||||
|
.padding(.leading, 15)
|
||||||
|
|
||||||
|
Text("Ebben a teremben:")
|
||||||
|
.font(.body)
|
||||||
|
.bold()
|
||||||
|
.padding(.leading, 15)
|
||||||
|
Text(context.state.nextRoom)
|
||||||
|
.font(.body)
|
||||||
|
.padding(.leading, 15)
|
||||||
|
} else {
|
||||||
Text(context.state.index + context.state.title)
|
Text(context.state.index + context.state.title)
|
||||||
.lineLimit(1)
|
.lineLimit(1)
|
||||||
.font(.body)
|
.font(.body)
|
||||||
.bold()
|
.bold()
|
||||||
|
|
||||||
Text(context.state.subtitle)
|
Text(context.state.subtitle)
|
||||||
.lineLimit(1)
|
.lineLimit(1)
|
||||||
.font(.subheadline)
|
.font(.subheadline)
|
||||||
Spacer()
|
Spacer(minLength: 5)
|
||||||
|
|
||||||
Text(context.state.description)
|
Text("Következő óra és terem:")
|
||||||
.lineLimit(2)
|
.font(.system(size: 13))
|
||||||
.font(.caption)
|
Text(context.state.nextSubject)
|
||||||
|
.font(.caption)
|
||||||
|
Text(context.state.nextRoom)
|
||||||
|
.font(.caption2)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}.padding(EdgeInsets(top: 0.0, leading: 5.0, bottom: 0.0, trailing: 0.0))
|
}.padding(EdgeInsets(top: 0.0, leading: 5.0, bottom: 0.0, trailing: 0.0))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compact
|
/// Compact
|
||||||
} compactLeading: {
|
} compactLeading: {
|
||||||
Label {
|
Image(systemName: context.state.icon)
|
||||||
Text(context.state.title)
|
|
||||||
} icon: {
|
|
||||||
Image(systemName: context.state.icon)
|
|
||||||
}
|
|
||||||
.font(.caption2)
|
|
||||||
}
|
}
|
||||||
compactTrailing: {
|
compactTrailing: {
|
||||||
Text(timerInterval: context.state.date, countsDown: true)
|
Text(timerInterval: context.state.date, countsDown: true)
|
||||||
@ -191,7 +220,7 @@ struct LiveCardWidget: Widget {
|
|||||||
context.state.color != "#676767"
|
context.state.color != "#676767"
|
||||||
? Color(hex: context.state.color)
|
? Color(hex: context.state.color)
|
||||||
: Color.clear
|
: Color.clear
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ class LiveCardProvider extends ChangeNotifier {
|
|||||||
"icon": nextLesson != null
|
"icon": nextLesson != null
|
||||||
? SubjectIcon.resolveName(subject: nextLesson?.subject)
|
? SubjectIcon.resolveName(subject: nextLesson?.subject)
|
||||||
: "book",
|
: "book",
|
||||||
"title": "Első órádig:",
|
"title": "Jó reggelt! Az első órádig:",
|
||||||
"subtitle": "",
|
"subtitle": "",
|
||||||
"description": "",
|
"description": "",
|
||||||
"startDate": storeFirstRunDate != null ? ((storeFirstRunDate?.millisecondsSinceEpoch ?? 0) - (_delay.inMilliseconds)).toString(): "",
|
"startDate": storeFirstRunDate != null ? ((storeFirstRunDate?.millisecondsSinceEpoch ?? 0) - (_delay.inMilliseconds)).toString(): "",
|
||||||
@ -111,7 +111,7 @@ class LiveCardProvider extends ChangeNotifier {
|
|||||||
"icon": nextLesson != null
|
"icon": nextLesson != null
|
||||||
? SubjectIcon.resolveName(subject: nextLesson?.subject)
|
? SubjectIcon.resolveName(subject: nextLesson?.subject)
|
||||||
: "book",
|
: "book",
|
||||||
"title": "Első órádig:",
|
"title": "Jó napot! Az első órádig:",
|
||||||
"subtitle": "",
|
"subtitle": "",
|
||||||
"description": "",
|
"description": "",
|
||||||
"startDate": storeFirstRunDate != null ? ((storeFirstRunDate?.millisecondsSinceEpoch ?? 0) - (_delay.inMilliseconds)).toString(): "",
|
"startDate": storeFirstRunDate != null ? ((storeFirstRunDate?.millisecondsSinceEpoch ?? 0) - (_delay.inMilliseconds)).toString(): "",
|
||||||
@ -131,7 +131,7 @@ class LiveCardProvider extends ChangeNotifier {
|
|||||||
"icon": nextLesson != null
|
"icon": nextLesson != null
|
||||||
? SubjectIcon.resolveName(subject: nextLesson?.subject)
|
? SubjectIcon.resolveName(subject: nextLesson?.subject)
|
||||||
: "book",
|
: "book",
|
||||||
"title": "Első órádig:",
|
"title": "Jó estét! Az első órádig:",
|
||||||
"subtitle": "",
|
"subtitle": "",
|
||||||
"description": "",
|
"description": "",
|
||||||
"startDate": storeFirstRunDate != null ? ((storeFirstRunDate?.millisecondsSinceEpoch ?? 0) - (_delay.inMilliseconds)).toString(): "",
|
"startDate": storeFirstRunDate != null ? ((storeFirstRunDate?.millisecondsSinceEpoch ?? 0) - (_delay.inMilliseconds)).toString(): "",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user