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 1/8] 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(): "", From 2ca8f4b8fececf8fd0e4eb8fdd851a840f1ff58a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Horv=C3=A1th=20Gergely?= Date: Mon, 6 May 2024 06:03:06 +0200 Subject: [PATCH 2/8] 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 --- .../lib/api/providers/live_card_provider.dart | 139 +++++++++++------- 1 file changed, 84 insertions(+), 55 deletions(-) diff --git a/refilc/lib/api/providers/live_card_provider.dart b/refilc/lib/api/providers/live_card_provider.dart index ab5acd3..4e0443b 100644 --- a/refilc/lib/api/providers/live_card_provider.dart +++ b/refilc/lib/api/providers/live_card_provider.dart @@ -1,7 +1,6 @@ // ignore_for_file: no_leading_underscores_for_local_identifiers import 'dart:async'; -import 'dart:io'; import 'package:refilc/api/providers/liveactivity/platform_channel.dart'; import 'package:refilc/helpers/subject.dart'; @@ -18,9 +17,10 @@ enum LiveCardState { duringLesson, duringBreak, morning, + weekendMorning, afternoon, night, - summary + summary, } class LiveCardProvider extends ChangeNotifier { @@ -34,18 +34,19 @@ class LiveCardProvider extends ChangeNotifier { static bool hasDayEnd = false; static DateTime? storeFirstRunDate; static bool hasActivitySettingsChanged = false; + // ignore: non_constant_identifier_names static Map LAData = {}; static DateTime? now; // LiveCardState currentState = LiveCardState.empty; + // ignore: unused_field late Timer _timer; late final TimetableProvider _timetable; late final SettingsProvider _settings; late Duration _delay; - bool _hasCheckedTimetable = false; LiveCardProvider({ @@ -87,19 +88,24 @@ class LiveCardProvider extends ChangeNotifier { case LiveCardState.morning: return { "color": - '#${_settings.liveActivityColor.toString().substring(10, 16)}', + '#${_settings.liveActivityColor.toString().substring(10, 16)}', "icon": nextLesson != null ? SubjectIcon.resolveName(subject: nextLesson?.subject) : "book", "title": "Jó reggelt! Az első órádig:", "subtitle": "", "description": "", - "startDate": storeFirstRunDate != null ? ((storeFirstRunDate?.millisecondsSinceEpoch ?? 0) - (_delay.inMilliseconds)).toString(): "", + "startDate": storeFirstRunDate != null + ? ((storeFirstRunDate?.millisecondsSinceEpoch ?? 0) - + (_delay.inMilliseconds)) + .toString() + : "", "endDate": ((nextLesson?.start.millisecondsSinceEpoch ?? 0) - - _delay.inMilliseconds) + _delay.inMilliseconds) .toString(), "nextSubject": nextLesson != null - ? nextLesson?.subject.renamedTo ?? ShortSubject.resolve(subject: nextLesson?.subject).capital() + ? nextLesson?.subject.renamedTo ?? + ShortSubject.resolve(subject: nextLesson?.subject).capital() : "", "nextRoom": nextLesson?.room.replaceAll("_", " ") ?? "", }; @@ -107,19 +113,24 @@ class LiveCardProvider extends ChangeNotifier { case LiveCardState.afternoon: return { "color": - '#${_settings.liveActivityColor.toString().substring(10, 16)}', + '#${_settings.liveActivityColor.toString().substring(10, 16)}', "icon": nextLesson != null ? SubjectIcon.resolveName(subject: nextLesson?.subject) : "book", "title": "Jó napot! Az első órádig:", "subtitle": "", "description": "", - "startDate": storeFirstRunDate != null ? ((storeFirstRunDate?.millisecondsSinceEpoch ?? 0) - (_delay.inMilliseconds)).toString(): "", + "startDate": storeFirstRunDate != null + ? ((storeFirstRunDate?.millisecondsSinceEpoch ?? 0) - + (_delay.inMilliseconds)) + .toString() + : "", "endDate": ((nextLesson?.start.millisecondsSinceEpoch ?? 0) - - _delay.inMilliseconds) + _delay.inMilliseconds) .toString(), "nextSubject": nextLesson != null - ? nextLesson?.subject.renamedTo ?? ShortSubject.resolve(subject: nextLesson?.subject).capital() + ? nextLesson?.subject.renamedTo ?? + ShortSubject.resolve(subject: nextLesson?.subject).capital() : "", "nextRoom": nextLesson?.room.replaceAll("_", " ") ?? "", }; @@ -127,19 +138,24 @@ class LiveCardProvider extends ChangeNotifier { case LiveCardState.night: return { "color": - '#${_settings.liveActivityColor.toString().substring(10, 16)}', + '#${_settings.liveActivityColor.toString().substring(10, 16)}', "icon": nextLesson != null ? SubjectIcon.resolveName(subject: nextLesson?.subject) : "book", "title": "Jó estét! Az első órádig:", "subtitle": "", "description": "", - "startDate": storeFirstRunDate != null ? ((storeFirstRunDate?.millisecondsSinceEpoch ?? 0) - (_delay.inMilliseconds)).toString(): "", + "startDate": storeFirstRunDate != null + ? ((storeFirstRunDate?.millisecondsSinceEpoch ?? 0) - + (_delay.inMilliseconds)) + .toString() + : "", "endDate": ((nextLesson?.start.millisecondsSinceEpoch ?? 0) - - _delay.inMilliseconds) + _delay.inMilliseconds) .toString(), "nextSubject": nextLesson != null - ? nextLesson?.subject.renamedTo ?? ShortSubject.resolve(subject: nextLesson?.subject).capital() + ? nextLesson?.subject.renamedTo ?? + ShortSubject.resolve(subject: nextLesson?.subject).capital() : "", "nextRoom": nextLesson?.room.replaceAll("_", " ") ?? "", }; @@ -147,25 +163,28 @@ class LiveCardProvider extends ChangeNotifier { case LiveCardState.duringLesson: return { "color": - '#${_settings.liveActivityColor.toString().substring(10, 16)}', + '#${_settings.liveActivityColor.toString().substring(10, 16)}', "icon": currentLesson != null ? SubjectIcon.resolveName(subject: currentLesson?.subject) : "book", "index": - currentLesson != null ? '${currentLesson!.lessonIndex}. ' : "", + currentLesson != null ? '${currentLesson!.lessonIndex}. ' : "", "title": currentLesson != null - ? currentLesson?.subject.renamedTo ?? ShortSubject.resolve(subject: currentLesson?.subject).capital() + ? currentLesson?.subject.renamedTo ?? + 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) + _delay.inMilliseconds) .toString(), "endDate": ((currentLesson?.end.millisecondsSinceEpoch ?? 0) - - _delay.inMilliseconds) + _delay.inMilliseconds) .toString(), "nextSubject": nextLesson != null - ? nextLesson?.subject.renamedTo ?? ShortSubject.resolve(subject: nextLesson?.subject).capital() + ? nextLesson?.subject.renamedTo ?? + ShortSubject.resolve(subject: nextLesson?.subject).capital() : "", "nextRoom": nextLesson?.room.replaceAll("_", " ") ?? "", }; @@ -181,21 +200,23 @@ class LiveCardProvider extends ChangeNotifier { return { "color": - '#${_settings.liveActivityColor.toString().substring(10, 16)}', + '#${_settings.liveActivityColor.toString().substring(10, 16)}', "icon": iconFloorMap[diff] ?? "cup.and.saucer", "title": "Szünet", "description": "go $diff".i18n.fill([ diff != "to room" ? (nextLesson!.getFloor() ?? 0) : nextLesson!.room ]), "startDate": ((prevLesson?.end.millisecondsSinceEpoch ?? 0) - - _delay.inMilliseconds) + _delay.inMilliseconds) .toString(), "endDate": ((nextLesson?.start.millisecondsSinceEpoch ?? 0) - - _delay.inMilliseconds) + _delay.inMilliseconds) .toString(), "nextSubject": (nextLesson != null - ? nextLesson?.subject.renamedTo ?? ShortSubject.resolve(subject: nextLesson?.subject).capital() - : "") + ? nextLesson?.subject.renamedTo ?? + ShortSubject.resolve(subject: nextLesson?.subject) + .capital() + : "") .capital(), "nextRoom": nextLesson?.room.replaceAll("_", " ") ?? "", "index": "", @@ -219,12 +240,12 @@ class LiveCardProvider extends ChangeNotifier { ? Duration(seconds: _settings.bellDelay) : Duration.zero; - DateTime now = _now().add(_delay); if ((currentState == LiveCardState.morning || - currentState == LiveCardState.afternoon || - currentState == LiveCardState.night) && storeFirstRunDate == null) { + currentState == LiveCardState.afternoon || + currentState == LiveCardState.night) && + storeFirstRunDate == null) { storeFirstRunDate = now; } @@ -232,9 +253,9 @@ class LiveCardProvider extends ChangeNotifier { // Filter label lessons #128 today = today .where((lesson) => - lesson.status?.name != "Elmaradt" && - lesson.subject.id != '' && - !lesson.isEmpty) + lesson.status?.name != "Elmaradt" && + lesson.subject.id != '' && + !lesson.isEmpty) .toList(); if (today.isNotEmpty) { @@ -242,7 +263,7 @@ class LiveCardProvider extends ChangeNotifier { today.sort((a, b) => a.start.compareTo(b.start)); final _lesson = today.firstWhere( - (l) => l.start.isBefore(now) && l.end.isAfter(now), + (l) => l.start.isBefore(now) && l.end.isAfter(now), orElse: () => Lesson.fromJson({})); if (_lesson.start.year != 0) { @@ -283,7 +304,11 @@ class LiveCardProvider extends ChangeNotifier { } else if (now.hour >= 20) { currentState = LiveCardState.night; } else if (now.hour >= 5 && now.hour <= 10) { - currentState = LiveCardState.morning; + if (nextLesson == null || now.weekday == 6 || now.weekday == 7) { + currentState = LiveCardState.empty; + } else { + currentState = LiveCardState.morning; + } } else { currentState = LiveCardState.empty; } @@ -291,22 +316,21 @@ class LiveCardProvider extends ChangeNotifier { //LIVE ACTIVITIES //CREATE - if (!hasActivityStarted && nextLesson != null && nextLesson! - .start - .difference(now) - .inMinutes <= 60 && (currentState == LiveCardState.morning || - currentState == LiveCardState.afternoon || - currentState == LiveCardState.night)) { + if (!hasActivityStarted && + nextLesson != null && + nextLesson!.start.difference(now).inMinutes <= 60 && + (currentState == LiveCardState.morning || + currentState == LiveCardState.afternoon || + currentState == LiveCardState.night)) { debugPrint( "Az első óra előtt állunk, kevesebb mint egy órával. Létrehozás..."); PlatformChannel.createLiveActivity(toMap()); hasActivityStarted = true; - } - else if (!hasActivityStarted && ((currentState == LiveCardState.duringLesson && - currentLesson != null) || - currentState == LiveCardState.duringBreak)) { - debugPrint( - "Óra van, vagy szünet, de nincs LiveActivity. létrehozás..."); + } else if (!hasActivityStarted && + ((currentState == LiveCardState.duringLesson && + currentLesson != null) || + currentState == LiveCardState.duringBreak)) { + debugPrint("Óra van, vagy szünet, de nincs LiveActivity. létrehozás..."); PlatformChannel.createLiveActivity(toMap()); hasActivityStarted = true; } @@ -317,15 +341,18 @@ class LiveCardProvider extends ChangeNotifier { debugPrint("Valamelyik beállítás megváltozott. Frissítés..."); PlatformChannel.updateLiveActivity(toMap()); hasActivitySettingsChanged = false; - } - else if (nextLesson != null || currentLesson != null) { + } else if (nextLesson != null || currentLesson != null) { bool afterPrevLessonEnd = prevLesson != null && - now.subtract(const Duration(seconds: 1)).isBefore( - prevLesson!.end) && now.isAfter(prevLesson!.end); + now + .subtract(const Duration(seconds: 1)) + .isBefore(prevLesson!.end) && + now.isAfter(prevLesson!.end); bool afterCurrentLessonStart = currentLesson != null && - now.subtract(const Duration(seconds: 1)).isBefore( - currentLesson!.start) && now.isAfter(currentLesson!.start); + now + .subtract(const Duration(seconds: 1)) + .isBefore(currentLesson!.start) && + now.isAfter(currentLesson!.start); if (afterPrevLessonEnd || afterCurrentLessonStart) { debugPrint( "Óra kezdete/vége után 1 másodperccel vagyunk. Frissítés..."); @@ -335,7 +362,9 @@ class LiveCardProvider extends ChangeNotifier { } //END - if (hasActivityStarted && !hasDayEnd && nextLesson == null && + if (hasActivityStarted && + !hasDayEnd && + nextLesson == null && now.isAfter(prevLesson!.end)) { debugPrint("Az utolsó óra véget ért. Befejezés..."); PlatformChannel.endLiveActivity(); @@ -355,4 +384,4 @@ class LiveCardProvider extends ChangeNotifier { List _today(TimetableProvider p) => (p.getWeek(Week.current()) ?? []) .where((l) => _sameDate(l.date, _now())) .toList(); -} \ No newline at end of file +} From 9901251cfc9c2ea85d78cebacf72d22338fc5793 Mon Sep 17 00:00:00 2001 From: Geryy <33695813+geryyhu@users.noreply.github.com> Date: Mon, 6 May 2024 15:25:54 +0200 Subject: [PATCH 3/8] LiveActivities design fix 2.0 --- refilc/ios/livecard/livecard.swift | 132 +++++++++++++++++++---------- 1 file changed, 89 insertions(+), 43 deletions(-) diff --git a/refilc/ios/livecard/livecard.swift b/refilc/ios/livecard/livecard.swift index b59b707..9ee1ac7 100644 --- a/refilc/ios/livecard/livecard.swift +++ b/refilc/ios/livecard/livecard.swift @@ -57,6 +57,12 @@ struct LockScreenLiveActivityView: View { .font(.system(size: 15)) .bold() .multilineTextAlignment(.center) + } else if(context.state.title == "Szünet") { + Text(context.state.title) + .font(.body) + .bold() + .padding(.trailing, 90) + } else { Text(context.state.index + " " + context.state.title) .font(.body) @@ -68,7 +74,7 @@ struct LockScreenLiveActivityView: View { if (!context.state.subtitle.isEmpty) { Text(context.state.subtitle) .italic() - .font(.caption) + .font(.system(size: 13)) } } @@ -79,6 +85,7 @@ struct LockScreenLiveActivityView: View { } // Következő óra + if(context.state.nextSubject != "" && context.state.nextRoom != "") { HStack { Image(systemName: "arrow.right") .resizable() @@ -90,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) @@ -143,47 +156,80 @@ struct LiveCardWidget: Widget { ).progressViewStyle(.circular) } } - 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() - - Text(context.state.subtitle) - .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)) - - } + 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("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) + + 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: { @@ -194,7 +240,7 @@ struct LiveCardWidget: Widget { .multilineTextAlignment(.center) .frame(width: 40) .font(.caption2) - + /// Collapsed } minimal: { VStack(alignment: .center, content: { From 9b29ede6eb65ce042dde2ecec1189bb9cd8a397f Mon Sep 17 00:00:00 2001 From: pml68 Date: Wed, 8 May 2024 16:12:09 +0200 Subject: [PATCH 4/8] fix: change all remaining #3D7BF4 color codes to #052460 (new primary) --- refilc/android/app/src/main/res/layout/timetable_item.xml | 4 ++-- refilc/android/app/src/main/res/values/colors.xml | 8 ++++---- refilc/lib/models/settings.dart | 2 +- refilc/lib/theme/colors/accent.dart | 6 +++--- refilc/lib/theme/colors/dark_desktop.dart | 4 ++-- refilc/lib/theme/colors/dark_mobile.dart | 4 ++-- refilc/lib/theme/colors/light_desktop.dart | 4 ++-- refilc/lib/theme/colors/light_mobile.dart | 2 +- refilc_kreta_api/lib/providers/share_provider.dart | 2 +- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/refilc/android/app/src/main/res/layout/timetable_item.xml b/refilc/android/app/src/main/res/layout/timetable_item.xml index f057d2d..c72dc65 100644 --- a/refilc/android/app/src/main/res/layout/timetable_item.xml +++ b/refilc/android/app/src/main/res/layout/timetable_item.xml @@ -20,7 +20,7 @@ android:gravity="center" android:text="1." android:textColor="@color/filc" - android:textColorLink="#ff3D7BF4" + android:textColorLink="#ff052460" android:textSize="30sp" android:textStyle="bold" tools:ignore="HardcodedText" /> @@ -110,4 +110,4 @@ android:textColor="@color/white" tools:ignore="HardcodedText" /> - \ No newline at end of file + diff --git a/refilc/android/app/src/main/res/values/colors.xml b/refilc/android/app/src/main/res/values/colors.xml index 955cc10..f1facef 100644 --- a/refilc/android/app/src/main/res/values/colors.xml +++ b/refilc/android/app/src/main/res/values/colors.xml @@ -27,7 +27,7 @@ #ffFFCC00 #40FFD60A #ff34C759 - #ff3D7BF4 + #ff052460 #ff5AC8FA #ff007AFF #ff5856D6 @@ -49,8 +49,8 @@ #ffFFD60A #40FFD60A #ff32D74B - #ff3D7BF4 - #ff3D93F5 + #ff052460 + #ff06348f #ff64D2FF #ff0A84FF #ff5E5CE6 @@ -66,4 +66,4 @@ #FFF06292 #FFBA68C8 #FF22AC9B - \ No newline at end of file + diff --git a/refilc/lib/models/settings.dart b/refilc/lib/models/settings.dart index 72d23f1..bd52e48 100644 --- a/refilc/lib/models/settings.dart +++ b/refilc/lib/models/settings.dart @@ -450,7 +450,7 @@ class SettingsProvider extends ChangeNotifier { bellDelay: 0, gradeOpeningFun: false, iconPack: IconPack.cupertino, - customAccentColor: const Color(0xff3D7BF4), + customAccentColor: const Color(0xff052460), customBackgroundColor: const Color(0xff000000), customHighlightColor: const Color(0xff222222), customIconColor: const Color(0x00000000), diff --git a/refilc/lib/theme/colors/accent.dart b/refilc/lib/theme/colors/accent.dart index df27bc0..d6d3f2f 100644 --- a/refilc/lib/theme/colors/accent.dart +++ b/refilc/lib/theme/colors/accent.dart @@ -17,7 +17,7 @@ enum AccentColor { } Map accentColorMap = { - AccentColor.filc: const Color(0xFF3D7BF4), + AccentColor.filc: const Color(0xFF052460), AccentColor.blue: Colors.blue.shade300, AccentColor.green: Colors.green.shade400, AccentColor.lime: Colors.lightGreen.shade400, @@ -28,8 +28,8 @@ Map accentColorMap = { AccentColor.purple: Colors.purple.shade300, //AccentColor.none: Colors.black, AccentColor.ogfilc: const Color(0xff20AC9B), - AccentColor.adaptive: const Color(0xFF3D7BF4), - AccentColor.custom: const Color(0xFF3D7BF4), + AccentColor.adaptive: const Color(0xFF052460), + AccentColor.custom: const Color(0xFF052460), }; // new v5 things diff --git a/refilc/lib/theme/colors/dark_desktop.dart b/refilc/lib/theme/colors/dark_desktop.dart index 58aaf08..f0f3115 100644 --- a/refilc/lib/theme/colors/dark_desktop.dart +++ b/refilc/lib/theme/colors/dark_desktop.dart @@ -19,7 +19,7 @@ class DarkDesktopAppColors implements ThemeAppColors { @override final green = const Color(0xff32D74B); @override - final filc = const Color(0xff3d7bf4); + final filc = const Color(0xff052460); @override final teal = const Color(0xff64D2FF); @override @@ -32,7 +32,7 @@ class DarkDesktopAppColors implements ThemeAppColors { final pink = const Color(0xffFF375F); // new default grade colors @override - final gradeFive = const Color(0xff3d7bf4); + final gradeFive = const Color(0xff052460); @override final gradeFour = const Color(0xFF4C3DF4); @override diff --git a/refilc/lib/theme/colors/dark_mobile.dart b/refilc/lib/theme/colors/dark_mobile.dart index cc1ac5c..47e7f45 100644 --- a/refilc/lib/theme/colors/dark_mobile.dart +++ b/refilc/lib/theme/colors/dark_mobile.dart @@ -19,7 +19,7 @@ class DarkMobileAppColors implements ThemeAppColors { @override final green = const Color(0xff32D74B); @override - final filc = const Color(0xff3d7bf4); + final filc = const Color(0xff052460); @override final teal = const Color(0xff64D2FF); @override @@ -51,5 +51,5 @@ class DarkMobileAppColors implements ThemeAppColors { @override final loginBackground = const Color(0xFF0F131D); @override - final buttonBackground = const Color(0xFF3D7BF4); + final buttonBackground = const Color(0xFF052460); } diff --git a/refilc/lib/theme/colors/light_desktop.dart b/refilc/lib/theme/colors/light_desktop.dart index 56fcd0b..e5b2e29 100644 --- a/refilc/lib/theme/colors/light_desktop.dart +++ b/refilc/lib/theme/colors/light_desktop.dart @@ -19,7 +19,7 @@ class LightDesktopAppColors implements ThemeAppColors { @override final green = const Color(0xff34C759); @override - final filc = const Color(0xff3d7bf4); + final filc = const Color(0xff052460); @override final teal = const Color(0xff5AC8FA); @override @@ -32,7 +32,7 @@ class LightDesktopAppColors implements ThemeAppColors { final pink = const Color(0xffFF2D55); // new default grade colors @override - final gradeFive = const Color(0xff3d7bf4); + final gradeFive = const Color(0xff052460); @override final gradeFour = const Color(0xFF4C3DF4); @override diff --git a/refilc/lib/theme/colors/light_mobile.dart b/refilc/lib/theme/colors/light_mobile.dart index eede7c7..90c6bba 100644 --- a/refilc/lib/theme/colors/light_mobile.dart +++ b/refilc/lib/theme/colors/light_mobile.dart @@ -19,7 +19,7 @@ class LightMobileAppColors implements ThemeAppColors { @override final green = const Color(0xff34C759); @override - final filc = const Color(0xff3d7bf4); + final filc = const Color(0xff052460); @override final teal = const Color(0xff5AC8FA); @override diff --git a/refilc_kreta_api/lib/providers/share_provider.dart b/refilc_kreta_api/lib/providers/share_provider.dart index e44d3b7..7d2597d 100644 --- a/refilc_kreta_api/lib/providers/share_provider.dart +++ b/refilc_kreta_api/lib/providers/share_provider.dart @@ -41,7 +41,7 @@ class ShareProvider extends ChangeNotifier { 'accent_color': (settings.customAccentColor ?? SettingsProvider.defaultSettings().customAccentColor) ?.value ?? - const Color(0xFF3D7BF4).value, + const Color(0xFF052460).value, 'icon_color': (settings.customIconColor ?? SettingsProvider.defaultSettings().customIconColor) ?.value ?? From cacf566794b7522c246fce38b5bc456db0bb6e02 Mon Sep 17 00:00:00 2001 From: pml68 Date: Wed, 8 May 2024 17:58:31 +0200 Subject: [PATCH 5/8] Revert "fix: change all remaining #3D7BF4 color codes to #052460 (new primary)" This reverts commit 9b29ede6eb65ce042dde2ecec1189bb9cd8a397f. --- refilc/android/app/src/main/res/layout/timetable_item.xml | 4 ++-- refilc/android/app/src/main/res/values/colors.xml | 8 ++++---- refilc/lib/models/settings.dart | 2 +- refilc/lib/theme/colors/accent.dart | 6 +++--- refilc/lib/theme/colors/dark_desktop.dart | 4 ++-- refilc/lib/theme/colors/dark_mobile.dart | 4 ++-- refilc/lib/theme/colors/light_desktop.dart | 4 ++-- refilc/lib/theme/colors/light_mobile.dart | 2 +- refilc_kreta_api/lib/providers/share_provider.dart | 2 +- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/refilc/android/app/src/main/res/layout/timetable_item.xml b/refilc/android/app/src/main/res/layout/timetable_item.xml index c72dc65..f057d2d 100644 --- a/refilc/android/app/src/main/res/layout/timetable_item.xml +++ b/refilc/android/app/src/main/res/layout/timetable_item.xml @@ -20,7 +20,7 @@ android:gravity="center" android:text="1." android:textColor="@color/filc" - android:textColorLink="#ff052460" + android:textColorLink="#ff3D7BF4" android:textSize="30sp" android:textStyle="bold" tools:ignore="HardcodedText" /> @@ -110,4 +110,4 @@ android:textColor="@color/white" tools:ignore="HardcodedText" /> - + \ No newline at end of file diff --git a/refilc/android/app/src/main/res/values/colors.xml b/refilc/android/app/src/main/res/values/colors.xml index f1facef..955cc10 100644 --- a/refilc/android/app/src/main/res/values/colors.xml +++ b/refilc/android/app/src/main/res/values/colors.xml @@ -27,7 +27,7 @@ #ffFFCC00 #40FFD60A #ff34C759 - #ff052460 + #ff3D7BF4 #ff5AC8FA #ff007AFF #ff5856D6 @@ -49,8 +49,8 @@ #ffFFD60A #40FFD60A #ff32D74B - #ff052460 - #ff06348f + #ff3D7BF4 + #ff3D93F5 #ff64D2FF #ff0A84FF #ff5E5CE6 @@ -66,4 +66,4 @@ #FFF06292 #FFBA68C8 #FF22AC9B - + \ No newline at end of file diff --git a/refilc/lib/models/settings.dart b/refilc/lib/models/settings.dart index bd52e48..72d23f1 100644 --- a/refilc/lib/models/settings.dart +++ b/refilc/lib/models/settings.dart @@ -450,7 +450,7 @@ class SettingsProvider extends ChangeNotifier { bellDelay: 0, gradeOpeningFun: false, iconPack: IconPack.cupertino, - customAccentColor: const Color(0xff052460), + customAccentColor: const Color(0xff3D7BF4), customBackgroundColor: const Color(0xff000000), customHighlightColor: const Color(0xff222222), customIconColor: const Color(0x00000000), diff --git a/refilc/lib/theme/colors/accent.dart b/refilc/lib/theme/colors/accent.dart index d6d3f2f..df27bc0 100644 --- a/refilc/lib/theme/colors/accent.dart +++ b/refilc/lib/theme/colors/accent.dart @@ -17,7 +17,7 @@ enum AccentColor { } Map accentColorMap = { - AccentColor.filc: const Color(0xFF052460), + AccentColor.filc: const Color(0xFF3D7BF4), AccentColor.blue: Colors.blue.shade300, AccentColor.green: Colors.green.shade400, AccentColor.lime: Colors.lightGreen.shade400, @@ -28,8 +28,8 @@ Map accentColorMap = { AccentColor.purple: Colors.purple.shade300, //AccentColor.none: Colors.black, AccentColor.ogfilc: const Color(0xff20AC9B), - AccentColor.adaptive: const Color(0xFF052460), - AccentColor.custom: const Color(0xFF052460), + AccentColor.adaptive: const Color(0xFF3D7BF4), + AccentColor.custom: const Color(0xFF3D7BF4), }; // new v5 things diff --git a/refilc/lib/theme/colors/dark_desktop.dart b/refilc/lib/theme/colors/dark_desktop.dart index f0f3115..58aaf08 100644 --- a/refilc/lib/theme/colors/dark_desktop.dart +++ b/refilc/lib/theme/colors/dark_desktop.dart @@ -19,7 +19,7 @@ class DarkDesktopAppColors implements ThemeAppColors { @override final green = const Color(0xff32D74B); @override - final filc = const Color(0xff052460); + final filc = const Color(0xff3d7bf4); @override final teal = const Color(0xff64D2FF); @override @@ -32,7 +32,7 @@ class DarkDesktopAppColors implements ThemeAppColors { final pink = const Color(0xffFF375F); // new default grade colors @override - final gradeFive = const Color(0xff052460); + final gradeFive = const Color(0xff3d7bf4); @override final gradeFour = const Color(0xFF4C3DF4); @override diff --git a/refilc/lib/theme/colors/dark_mobile.dart b/refilc/lib/theme/colors/dark_mobile.dart index 47e7f45..cc1ac5c 100644 --- a/refilc/lib/theme/colors/dark_mobile.dart +++ b/refilc/lib/theme/colors/dark_mobile.dart @@ -19,7 +19,7 @@ class DarkMobileAppColors implements ThemeAppColors { @override final green = const Color(0xff32D74B); @override - final filc = const Color(0xff052460); + final filc = const Color(0xff3d7bf4); @override final teal = const Color(0xff64D2FF); @override @@ -51,5 +51,5 @@ class DarkMobileAppColors implements ThemeAppColors { @override final loginBackground = const Color(0xFF0F131D); @override - final buttonBackground = const Color(0xFF052460); + final buttonBackground = const Color(0xFF3D7BF4); } diff --git a/refilc/lib/theme/colors/light_desktop.dart b/refilc/lib/theme/colors/light_desktop.dart index e5b2e29..56fcd0b 100644 --- a/refilc/lib/theme/colors/light_desktop.dart +++ b/refilc/lib/theme/colors/light_desktop.dart @@ -19,7 +19,7 @@ class LightDesktopAppColors implements ThemeAppColors { @override final green = const Color(0xff34C759); @override - final filc = const Color(0xff052460); + final filc = const Color(0xff3d7bf4); @override final teal = const Color(0xff5AC8FA); @override @@ -32,7 +32,7 @@ class LightDesktopAppColors implements ThemeAppColors { final pink = const Color(0xffFF2D55); // new default grade colors @override - final gradeFive = const Color(0xff052460); + final gradeFive = const Color(0xff3d7bf4); @override final gradeFour = const Color(0xFF4C3DF4); @override diff --git a/refilc/lib/theme/colors/light_mobile.dart b/refilc/lib/theme/colors/light_mobile.dart index 90c6bba..eede7c7 100644 --- a/refilc/lib/theme/colors/light_mobile.dart +++ b/refilc/lib/theme/colors/light_mobile.dart @@ -19,7 +19,7 @@ class LightMobileAppColors implements ThemeAppColors { @override final green = const Color(0xff34C759); @override - final filc = const Color(0xff052460); + final filc = const Color(0xff3d7bf4); @override final teal = const Color(0xff5AC8FA); @override diff --git a/refilc_kreta_api/lib/providers/share_provider.dart b/refilc_kreta_api/lib/providers/share_provider.dart index 7d2597d..e44d3b7 100644 --- a/refilc_kreta_api/lib/providers/share_provider.dart +++ b/refilc_kreta_api/lib/providers/share_provider.dart @@ -41,7 +41,7 @@ class ShareProvider extends ChangeNotifier { 'accent_color': (settings.customAccentColor ?? SettingsProvider.defaultSettings().customAccentColor) ?.value ?? - const Color(0xFF052460).value, + const Color(0xFF3D7BF4).value, 'icon_color': (settings.customIconColor ?? SettingsProvider.defaultSettings().customIconColor) ?.value ?? From aaa3d79b304fabbb66e37a828fd9b9d979833857 Mon Sep 17 00:00:00 2001 From: pml68 Date: Wed, 8 May 2024 18:00:33 +0200 Subject: [PATCH 6/8] fix: change only the widget's "filc" color to the new primary --- refilc/android/app/src/main/res/layout/timetable_item.xml | 4 ++-- refilc/android/app/src/main/res/values/colors.xml | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/refilc/android/app/src/main/res/layout/timetable_item.xml b/refilc/android/app/src/main/res/layout/timetable_item.xml index f057d2d..c72dc65 100644 --- a/refilc/android/app/src/main/res/layout/timetable_item.xml +++ b/refilc/android/app/src/main/res/layout/timetable_item.xml @@ -20,7 +20,7 @@ android:gravity="center" android:text="1." android:textColor="@color/filc" - android:textColorLink="#ff3D7BF4" + android:textColorLink="#ff052460" android:textSize="30sp" android:textStyle="bold" tools:ignore="HardcodedText" /> @@ -110,4 +110,4 @@ android:textColor="@color/white" tools:ignore="HardcodedText" /> - \ No newline at end of file + diff --git a/refilc/android/app/src/main/res/values/colors.xml b/refilc/android/app/src/main/res/values/colors.xml index 955cc10..f1facef 100644 --- a/refilc/android/app/src/main/res/values/colors.xml +++ b/refilc/android/app/src/main/res/values/colors.xml @@ -27,7 +27,7 @@ #ffFFCC00 #40FFD60A #ff34C759 - #ff3D7BF4 + #ff052460 #ff5AC8FA #ff007AFF #ff5856D6 @@ -49,8 +49,8 @@ #ffFFD60A #40FFD60A #ff32D74B - #ff3D7BF4 - #ff3D93F5 + #ff052460 + #ff06348f #ff64D2FF #ff0A84FF #ff5E5CE6 @@ -66,4 +66,4 @@ #FFF06292 #FFBA68C8 #FF22AC9B - \ No newline at end of file + From 56a0c2c02e4b6f333618b0768677d675b57e9b2e Mon Sep 17 00:00:00 2001 From: Geryy <33695813+geryyhu@users.noreply.github.com> Date: Thu, 9 May 2024 14:46:01 +0200 Subject: [PATCH 7/8] LiveActivities design fix - Fixed issue where long subject names did not fit. - Formatting improvements on DynamicIsland and LockScreen notifications. - Smarter wrapping for long subjects. --- refilc/ios/livecard/livecard.swift | 77 ++++++++++++++++++++++++++---- 1 file changed, 67 insertions(+), 10 deletions(-) diff --git a/refilc/ios/livecard/livecard.swift b/refilc/ios/livecard/livecard.swift index 9ee1ac7..851e446 100644 --- a/refilc/ios/livecard/livecard.swift +++ b/refilc/ios/livecard/livecard.swift @@ -54,9 +54,9 @@ struct LockScreenLiveActivityView: View { VStack { if(context.state.title.contains("Az első órádig")) { Text(context.state.title) - .font(.system(size: 15)) - .bold() - .multilineTextAlignment(.center) + .font(.system(size: 15)) + .bold() + .multilineTextAlignment(.center) } else if(context.state.title == "Szünet") { Text(context.state.title) .font(.body) @@ -64,7 +64,7 @@ struct LockScreenLiveActivityView: View { .padding(.trailing, 90) } else { - Text(context.state.index + " " + context.state.title) + MultilineTextView(text: "\(context.state.index) \(context.state.title)", limit: 25) .font(.body) .bold() .multilineTextAlignment(.center) @@ -74,6 +74,7 @@ struct LockScreenLiveActivityView: View { if (!context.state.subtitle.isEmpty) { Text(context.state.subtitle) .italic() + .bold() .font(.system(size: 13)) } } @@ -164,7 +165,7 @@ struct LiveCardWidget: Widget { .font(.body) .bold() .padding(.leading, 15) - Text(context.state.nextSubject) + MultilineTextView(text: "\(context.state.index) \(context.state.title)", limit: 25) .font(.body) .padding(.leading, 15) @@ -196,7 +197,7 @@ struct LiveCardWidget: Widget { } else { // Amikor óra van, expanded DynamicIsland - Text(context.state.index + context.state.title) + MultilineTextView(text: "\(context.state.index) \(context.state.title)", limit: 25) .lineLimit(1) .font(.body) .bold() @@ -204,20 +205,24 @@ struct LiveCardWidget: Widget { Text(context.state.subtitle) .lineLimit(1) - .font(.subheadline) + .italic() + .bold() + .font(.system(size: 13)) .padding(.trailing, -50) Spacer(minLength: 5) if(context.state.nextRoom != "" && context.state.nextSubject != "") { Text("Következő óra és terem:") - .font(.system(size: 13)) + .font(.system(size: 14)) .padding(.trailing, -35) + Spacer(minLength: 2) Text(context.state.nextSubject) - .font(.caption) + .modifier(DynamicFontSizeModifier(text: context.state.nextSubject)) .padding(.trailing, -35) Text(context.state.nextRoom) - .font(.caption2) + // ignore: based on nextSubject characters, I check that the font size of the room is the same as the next subject. + .modifier(DynamicFontSizeModifier(text: context.state.nextSubject)) .padding(.trailing, -35) } else { Text("Ez az utolsó óra! Kitartást!") @@ -270,3 +275,55 @@ struct LiveCardWidget: Widget { } } } + +struct MultilineTextView: View { + var text: String + var limit: Int = 20 // default is 20 character + + var body: some View { + let words = text.split(separator: " ") + var currentLine = "" + var lines: [String] = [] + + for word in words { + if (currentLine.count + word.count + 1) > limit { + lines.append(currentLine) + currentLine = "" + } + if !currentLine.isEmpty { + currentLine += " " + } + currentLine += word + } + if !currentLine.isEmpty { + lines.append(currentLine) + } + + return VStack(alignment: .center) { + ForEach(lines, id: \.self) { line in + Text(line) + } + Spacer(minLength: 1) + } + } +} + +struct DynamicFontSizeModifier: ViewModifier { + var text: String + + func body(content: Content) -> some View { + content + .font(.system(size: fontSize(for: text))) + } + + private func fontSize(for text: String) -> CGFloat { + let length = text.count + if length < 10 { + return 12 + } else if length < 20 { + return 12 + } else { + return 11 + } + } +} From bbe53b8c0135805813d5aa150d369bb55d49dc31 Mon Sep 17 00:00:00 2001 From: Geryy <33695813+geryyhu@users.noreply.github.com> Date: Thu, 9 May 2024 16:11:43 +0200 Subject: [PATCH 8/8] LiveActivities design fix - Fixed issue where long subject names did not fit. - Formatting improvements on DynamicIsland and LockScreen notifications. - Smarter wrapping for long subjects. - *I forgot to add a line break when there is a break, so I added it.* --- refilc/ios/livecard/livecard.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/refilc/ios/livecard/livecard.swift b/refilc/ios/livecard/livecard.swift index 851e446..0271d1c 100644 --- a/refilc/ios/livecard/livecard.swift +++ b/refilc/ios/livecard/livecard.swift @@ -164,10 +164,10 @@ struct LiveCardWidget: Widget { Text("Az első órád:") .font(.body) .bold() - .padding(.leading, 15) - MultilineTextView(text: "\(context.state.index) \(context.state.title)", limit: 25) + .padding(.trailing, -15) + MultilineTextView(text: "\(context.state.nextSubject)", limit: 25) .font(.body) - .padding(.leading, 15) + .padding(.trailing, -25) Text("Ebben a teremben:") .font(.body)