From ae66a462e75254118a4c835c1a106c74e0e2fbae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Horv=C3=A1th=20Gergely?= Date: Mon, 6 May 2024 06:01:15 +0200 Subject: [PATCH] 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 --- refilc/ios/livecard/livecard.swift | 87 ++++++++++++------- .../lib/api/providers/live_card_provider.dart | 6 +- 2 files changed, 61 insertions(+), 32 deletions(-) diff --git a/refilc/ios/livecard/livecard.swift b/refilc/ios/livecard/livecard.swift index f5f27e7..b59b707 100644 --- a/refilc/ios/livecard/livecard.swift +++ b/refilc/ios/livecard/livecard.swift @@ -52,14 +52,24 @@ struct LockScreenLiveActivityView: View { VStack(alignment: .center) { // Jelenlegi óra 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) - .font(.body) - .bold() - .multilineTextAlignment(.center) - - Text("Terem: \(context.state.subtitle)") - .italic() - .font(.caption) + .font(.body) + .bold() + .multilineTextAlignment(.center) + } + + //Terem + if (!context.state.subtitle.isEmpty) { + Text(context.state.subtitle) + .italic() + .font(.caption) + } } // Leírás @@ -84,14 +94,14 @@ struct LockScreenLiveActivityView: View { .padding(15) Spacer() - + // Visszaszámláló Text(timerInterval: context.state.date, countsDown: true) .multilineTextAlignment(.center) .frame(width: 85) .font(.title2) .monospacedDigit() - .padding(.trailing, CGFloat(24)) + .padding(.trailing) } .activityBackgroundTint( context.state.color != "#676767" @@ -109,7 +119,7 @@ struct LiveCardWidget: Widget { LockScreenLiveActivityView(context: context) /// Dynamic Island } dynamicIsland: { context in - + /// Expanded return DynamicIsland { DynamicIslandExpandedRegion(.leading) { @@ -135,30 +145,49 @@ struct LiveCardWidget: Widget { } DynamicIslandExpandedRegion(.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) - .lineLimit(1) - .font(.body) - .bold() - + .lineLimit(1) + .font(.body) + .bold() + Text(context.state.subtitle) - .lineLimit(1) - .font(.subheadline) - Spacer() - - Text(context.state.description) - .lineLimit(2) - .font(.caption) + .lineLimit(1) + .font(.subheadline) + Spacer(minLength: 5) + + Text("Következő óra és terem:") + .font(.system(size: 13)) + 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)) + } - + /// 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 +220,7 @@ struct LiveCardWidget: Widget { context.state.color != "#676767" ? Color(hex: context.state.color) : Color.clear - ) + ) } } } diff --git a/refilc/lib/api/providers/live_card_provider.dart b/refilc/lib/api/providers/live_card_provider.dart index 7ace094..ab5acd3 100644 --- a/refilc/lib/api/providers/live_card_provider.dart +++ b/refilc/lib/api/providers/live_card_provider.dart @@ -91,7 +91,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 ? ((storeFirstRunDate?.millisecondsSinceEpoch ?? 0) - (_delay.inMilliseconds)).toString(): "", @@ -111,7 +111,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 ? ((storeFirstRunDate?.millisecondsSinceEpoch ?? 0) - (_delay.inMilliseconds)).toString(): "", @@ -131,7 +131,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 ? ((storeFirstRunDate?.millisecondsSinceEpoch ?? 0) - (_delay.inMilliseconds)).toString(): "",