forked from firka/student-legacy
commit
9e9e46d0f8
@ -52,14 +52,30 @@ struct LockScreenLiveActivityView: View {
|
||||
VStack(alignment: .center) {
|
||||
// Jelenlegi óra
|
||||
VStack {
|
||||
Text(context.state.index + " " + context.state.title)
|
||||
.font(.body)
|
||||
.bold()
|
||||
.multilineTextAlignment(.center)
|
||||
if(context.state.title.contains("Az első órádig")) {
|
||||
Text(context.state.title)
|
||||
.font(.system(size: 15))
|
||||
.bold()
|
||||
.multilineTextAlignment(.center)
|
||||
} else if(context.state.title == "Szünet") {
|
||||
Text(context.state.title)
|
||||
.font(.body)
|
||||
.bold()
|
||||
.padding(.trailing, 90)
|
||||
|
||||
Text("Terem: \(context.state.subtitle)")
|
||||
.italic()
|
||||
.font(.caption)
|
||||
} else {
|
||||
Text(context.state.index + " " + context.state.title)
|
||||
.font(.body)
|
||||
.bold()
|
||||
.multilineTextAlignment(.center)
|
||||
}
|
||||
|
||||
//Terem
|
||||
if (!context.state.subtitle.isEmpty) {
|
||||
Text(context.state.subtitle)
|
||||
.italic()
|
||||
.font(.system(size: 13))
|
||||
}
|
||||
}
|
||||
|
||||
// Leírás
|
||||
@ -69,6 +85,7 @@ struct LockScreenLiveActivityView: View {
|
||||
}
|
||||
|
||||
// Következő óra
|
||||
if(context.state.nextSubject != "" && context.state.nextRoom != "") {
|
||||
HStack {
|
||||
Image(systemName: "arrow.right")
|
||||
.resizable()
|
||||
@ -80,6 +97,12 @@ struct LockScreenLiveActivityView: View {
|
||||
.font(.caption2)
|
||||
}
|
||||
.multilineTextAlignment(.center)
|
||||
} else {
|
||||
Spacer(minLength: 5)
|
||||
Text("Ez az utolsó óra! Kitartást!")
|
||||
.font(.system(size: 15))
|
||||
}
|
||||
|
||||
}
|
||||
.padding(15)
|
||||
|
||||
@ -91,7 +114,7 @@ struct LockScreenLiveActivityView: View {
|
||||
.frame(width: 85)
|
||||
.font(.title2)
|
||||
.monospacedDigit()
|
||||
.padding(.trailing, CGFloat(24))
|
||||
.padding(.trailing)
|
||||
}
|
||||
.activityBackgroundTint(
|
||||
context.state.color != "#676767"
|
||||
@ -133,32 +156,84 @@ struct LiveCardWidget: Widget {
|
||||
).progressViewStyle(.circular)
|
||||
}
|
||||
}
|
||||
DynamicIslandExpandedRegion(.center) {
|
||||
VStack(alignment: .center) {
|
||||
Text(context.state.index + context.state.title)
|
||||
.lineLimit(1)
|
||||
.font(.body)
|
||||
.bold()
|
||||
DynamicIslandExpandedRegion(.center) {
|
||||
VStack(alignment: .center) {
|
||||
// Első óra előtti expanded DynamicIsland
|
||||
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(context.state.subtitle)
|
||||
.lineLimit(1)
|
||||
.font(.subheadline)
|
||||
Spacer()
|
||||
Text("Ebben a teremben:")
|
||||
.font(.body)
|
||||
.bold()
|
||||
.padding(.leading, 15)
|
||||
Text(context.state.nextRoom)
|
||||
.font(.body)
|
||||
.padding(.leading, 15)
|
||||
} else if(context.state.title == "Szünet") {
|
||||
// Amikor szünet van, expanded DynamicIsland
|
||||
Text(context.state.title)
|
||||
.lineLimit(1)
|
||||
.font(.body)
|
||||
.bold()
|
||||
.padding(.leading, 15)
|
||||
|
||||
Text(context.state.description)
|
||||
.lineLimit(2)
|
||||
.font(.caption)
|
||||
}.padding(EdgeInsets(top: 0.0, leading: 5.0, bottom: 0.0, trailing: 0.0))
|
||||
}
|
||||
Spacer(minLength: 5)
|
||||
Text("Következő óra és terem:")
|
||||
.font(.system(size: 13))
|
||||
.padding(.leading, 25)
|
||||
Text(context.state.nextSubject)
|
||||
.font(.caption)
|
||||
.padding(.leading, 15)
|
||||
Text(context.state.nextRoom)
|
||||
.font(.caption2)
|
||||
.padding(.leading, 15)
|
||||
|
||||
} else {
|
||||
// Amikor óra van, expanded DynamicIsland
|
||||
Text(context.state.index + context.state.title)
|
||||
.lineLimit(1)
|
||||
.font(.body)
|
||||
.bold()
|
||||
.padding(.trailing, -35)
|
||||
|
||||
Text(context.state.subtitle)
|
||||
.lineLimit(1)
|
||||
.font(.subheadline)
|
||||
.padding(.trailing, -50)
|
||||
|
||||
Spacer(minLength: 5)
|
||||
|
||||
if(context.state.nextRoom != "" && context.state.nextSubject != "") {
|
||||
Text("Következő óra és terem:")
|
||||
.font(.system(size: 13))
|
||||
.padding(.trailing, -35)
|
||||
Text(context.state.nextSubject)
|
||||
.font(.caption)
|
||||
.padding(.trailing, -35)
|
||||
Text(context.state.nextRoom)
|
||||
.font(.caption2)
|
||||
.padding(.trailing, -35)
|
||||
} else {
|
||||
Text("Ez az utolsó óra! Kitartást!")
|
||||
.font(.system(size: 14))
|
||||
.padding(.trailing, -30)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}.padding(EdgeInsets(top: 0.0, leading: 5.0, bottom: 0.0, trailing: 0.0))
|
||||
|
||||
}
|
||||
|
||||
/// Compact
|
||||
} compactLeading: {
|
||||
Label {
|
||||
Text(context.state.title)
|
||||
} icon: {
|
||||
Image(systemName: context.state.icon)
|
||||
}
|
||||
.font(.caption2)
|
||||
Image(systemName: context.state.icon)
|
||||
}
|
||||
compactTrailing: {
|
||||
Text(timerInterval: context.state.date, countsDown: true)
|
||||
@ -191,7 +266,7 @@ struct LiveCardWidget: Widget {
|
||||
context.state.color != "#676767"
|
||||
? Color(hex: context.state.color)
|
||||
: Color.clear
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ class LiveCardProvider extends ChangeNotifier {
|
||||
"icon": nextLesson != null
|
||||
? SubjectIcon.resolveName(subject: nextLesson?.subject)
|
||||
: "book",
|
||||
"title": "Első órádig:",
|
||||
"title": "Jó reggelt! Az első órádig:",
|
||||
"subtitle": "",
|
||||
"description": "",
|
||||
"startDate": storeFirstRunDate != null
|
||||
@ -117,7 +117,7 @@ class LiveCardProvider extends ChangeNotifier {
|
||||
"icon": nextLesson != null
|
||||
? SubjectIcon.resolveName(subject: nextLesson?.subject)
|
||||
: "book",
|
||||
"title": "Első órádig:",
|
||||
"title": "Jó napot! Az első órádig:",
|
||||
"subtitle": "",
|
||||
"description": "",
|
||||
"startDate": storeFirstRunDate != null
|
||||
@ -142,7 +142,7 @@ class LiveCardProvider extends ChangeNotifier {
|
||||
"icon": nextLesson != null
|
||||
? SubjectIcon.resolveName(subject: nextLesson?.subject)
|
||||
: "book",
|
||||
"title": "Első órádig:",
|
||||
"title": "Jó estét! Az első órádig:",
|
||||
"subtitle": "",
|
||||
"description": "",
|
||||
"startDate": storeFirstRunDate != null
|
||||
@ -174,7 +174,7 @@ class LiveCardProvider extends ChangeNotifier {
|
||||
ShortSubject.resolve(subject: currentLesson?.subject)
|
||||
.capital()
|
||||
: "",
|
||||
"subtitle": currentLesson?.room.replaceAll("_", " ") ?? "",
|
||||
"subtitle": "Terem: ${currentLesson?.room.replaceAll("_", " ") ?? ""}",
|
||||
"description": currentLesson?.description ?? "",
|
||||
"startDate": ((currentLesson?.start.millisecondsSinceEpoch ?? 0) -
|
||||
_delay.inMilliseconds)
|
||||
|
Loading…
x
Reference in New Issue
Block a user