Skip to content

Commit

Permalink
Various User Interface Enhancements (#276)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobkoerber authored Oct 6, 2024
1 parent d9047ec commit c204498
Show file tree
Hide file tree
Showing 22 changed files with 244 additions and 230 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy_beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
deploy:
runs-on: macos-14
runs-on: macos-15

strategy:
matrix:
Expand Down
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ flutter {

dependencies {
implementation 'com.android.support:multidex'
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3'
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3'
}

apply plugin: 'com.google.firebase.crashlytics'
49 changes: 19 additions & 30 deletions android/app/src/main/res/layout/calendar_widget.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,57 +4,46 @@
android:id="@+id/calendar_widget"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/widget_content_rounded_corners_background"
android:orientation="vertical"
android:padding="@dimen/widget_margin">

<LinearLayout
android:id="@+id/calendar_widget_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/widget_header_rounded_corners_background"
android:gravity="center_vertical"
android:baselineAligned="false"
android:gravity="center_horizontal|center_vertical"
android:orientation="horizontal"
android:padding="@dimen/material_small_padding">

<LinearLayout
<TextView
android:id="@+id/calendar_widget_date"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">

<TextView
android:id="@+id/calendar_widget_date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-medium"
android:textColor="@android:color/white"
android:textSize="16sp"
tools:text="Date" />

<TextView
android:id="@+id/calendar_widget_updated_on"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:textSize="14sp"
tools:text="Date" />

</LinearLayout>
android:fontFamily="sans-serif-medium"
android:textAlignment="viewStart"
android:textColor="@color/text_primary"
android:textSize="16sp"
tools:text="Date" />

<!-- <ImageView
android:id="@+id/calendar_widget_setting"
android:layout_width="wrap_content"
<TextView
android:id="@+id/calendar_widget_updated_on"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:padding="@dimen/material_tiny_padding"
android:src="@drawable/ic_filter_list" /> -->
android:layout_weight="1"
android:textAlignment="viewEnd"
android:textColor="@color/text_primary"
android:textSize="14sp"
tools:text="Date" />

</LinearLayout>

<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@drawable/widget_content_rounded_corners_background">
android:layout_weight="1">

<ListView
android:id="@+id/calendar_widget_listview"
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="widget_margin">0dp</dimen>
<dimen name="widget_margin">10dp</dimen>
<dimen name="material_small_padding">8dp</dimen>
<dimen name="material_tiny_padding">4dp</dimen>
<dimen name="card_view_corner_radius">2dp</dimen>
Expand Down
7 changes: 3 additions & 4 deletions android/app/src/main/res/xml/calendar_widget_info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
android:description="@string/app_widget_description"
android:initialKeyguardLayout="@layout/calendar_widget"
android:initialLayout="@layout/calendar_widget"
android:minWidth="270dp"
android:minHeight="110dp"
android:minResizeWidth="270dp"
android:minResizeHeight="110dp"
android:minWidth="180dp"
android:minResizeWidth="180dp"
android:previewImage="@drawable/appwidget_preview"
android:previewLayout="@layout/calendar_widget"
android:resizeMode="horizontal|vertical"
android:updatePeriodMillis="86400000"
android:widgetCategory="home_screen" />
<!-- android:targetCellWidth="1"
android:widgetCategory="home_screen" /><!-- android:targetCellWidth="1"
android:targetCellHeight="1" -->
2 changes: 1 addition & 1 deletion android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pluginManagement {

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version '8.6.0' apply false
id "com.android.application" version '8.6.1' apply false
id "org.jetbrains.kotlin.android" version "1.9.20" apply false
id "org.jetbrains.kotlin.plugin.serialization" version "2.0.20" apply false
id "com.google.gms.google-services" version "4.4.2" apply false
Expand Down
4 changes: 2 additions & 2 deletions ios/CalendarWidget/CalendarEventView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ struct CalendarEventView: View {
.foregroundStyle(.white)
.frame(minWidth: 0, maxWidth: .infinity, alignment: .leading)
.background(ContainerRelativeShape()
.fill(color).widgetAccentable(true))
.fill(color).widgetAccentable(true)
.clipShape(RoundedRectangle(cornerRadius: 10)))
}
.padding(EdgeInsets(top: 0, leading: 12, bottom: 0, trailing: 12))
}
}
2 changes: 1 addition & 1 deletion ios/CalendarWidget/CalendarWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ struct CalendarWidget: Widget {
.widgetURL(URL(string: "tumCampusApp://message?homeWidget=calendar"))
}
}
.contentMarginsDisabled()
.supportedFamilies([.systemMedium, .systemLarge, .systemExtraLarge])
.configurationDisplayName("Calendar Widget")
.description("An Overview About Your Upcoming Events.")
}
Expand Down
9 changes: 3 additions & 6 deletions ios/CalendarWidget/CalendarWidgetContent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,16 @@ struct CalendarWidgetContent: View {

var body: some View {
VStack {
VStack(alignment: .leading) {
HStack {
Text(dateFormatter.string(from: Date()))
.fontWeight(.semibold)
.font(.callout)
Spacer()
Text(updatedAt.timeAgo != nil ? "\(updatedAt.timeAgo!) ago" : "moments ago")
.font(.footnote)
}
.padding(EdgeInsets(top: 8, leading: 12, bottom: 8, trailing: 12))
.frame(minWidth: 0, maxWidth: .infinity, alignment: .leading)
.padding(EdgeInsets(top: 8, leading: 0, bottom: 8, trailing: 0))
.widgetAccentable(false)
.foregroundStyle(.white)
.background(Color.accent.widgetAccentable(true))
.padding(EdgeInsets(top: 0, leading: 0, bottom: 2, trailing: 0))

if (events.isEmpty) {
Spacer()
Expand Down
72 changes: 36 additions & 36 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
PODS:
- device_info_plus (0.0.1):
- Flutter
- Firebase/CoreOnly (11.0.0):
- FirebaseCore (= 11.0.0)
- Firebase/Crashlytics (11.0.0):
- Firebase/CoreOnly (11.2.0):
- FirebaseCore (= 11.2.0)
- Firebase/Crashlytics (11.2.0):
- Firebase/CoreOnly
- FirebaseCrashlytics (~> 11.0.0)
- Firebase/RemoteConfig (11.0.0):
- FirebaseCrashlytics (~> 11.2.0)
- Firebase/RemoteConfig (11.2.0):
- Firebase/CoreOnly
- FirebaseRemoteConfig (~> 11.0.0)
- firebase_core (3.5.0):
- Firebase/CoreOnly (= 11.0.0)
- FirebaseRemoteConfig (~> 11.2.0)
- firebase_core (3.6.0):
- Firebase/CoreOnly (= 11.2.0)
- Flutter
- firebase_crashlytics (4.1.2):
- Firebase/Crashlytics (= 11.0.0)
- firebase_crashlytics (4.1.3):
- Firebase/Crashlytics (= 11.2.0)
- firebase_core
- Flutter
- firebase_remote_config (5.1.2):
- Firebase/RemoteConfig (= 11.0.0)
- firebase_remote_config (5.1.3):
- Firebase/RemoteConfig (= 11.2.0)
- firebase_core
- Flutter
- FirebaseABTesting (11.2.0):
- FirebaseABTesting (11.3.0):
- FirebaseCore (~> 11.0)
- FirebaseCore (11.0.0):
- FirebaseCore (11.2.0):
- FirebaseCoreInternal (~> 11.0)
- GoogleUtilities/Environment (~> 8.0)
- GoogleUtilities/Logger (~> 8.0)
- FirebaseCoreExtension (11.2.0):
- FirebaseCoreExtension (11.3.0):
- FirebaseCore (~> 11.0)
- FirebaseCoreInternal (11.2.0):
- FirebaseCoreInternal (11.3.0):
- "GoogleUtilities/NSData+zlib (~> 8.0)"
- FirebaseCrashlytics (11.0.0):
- FirebaseCrashlytics (11.2.0):
- FirebaseCore (~> 11.0)
- FirebaseInstallations (~> 11.0)
- FirebaseRemoteConfigInterop (~> 11.0)
Expand All @@ -39,21 +39,21 @@ PODS:
- GoogleUtilities/Environment (~> 8.0)
- nanopb (~> 3.30910.0)
- PromisesObjC (~> 2.4)
- FirebaseInstallations (11.2.0):
- FirebaseInstallations (11.3.0):
- FirebaseCore (~> 11.0)
- GoogleUtilities/Environment (~> 8.0)
- GoogleUtilities/UserDefaults (~> 8.0)
- PromisesObjC (~> 2.4)
- FirebaseRemoteConfig (11.0.0):
- FirebaseRemoteConfig (11.2.0):
- FirebaseABTesting (~> 11.0)
- FirebaseCore (~> 11.0)
- FirebaseInstallations (~> 11.0)
- FirebaseRemoteConfigInterop (~> 11.0)
- FirebaseSharedSwift (~> 11.0)
- GoogleUtilities/Environment (~> 8.0)
- "GoogleUtilities/NSData+zlib (~> 8.0)"
- FirebaseRemoteConfigInterop (11.2.0)
- FirebaseSessions (11.2.0):
- FirebaseRemoteConfigInterop (11.3.0)
- FirebaseSessions (11.3.0):
- FirebaseCore (~> 11.0)
- FirebaseCoreExtension (~> 11.0)
- FirebaseInstallations (~> 11.0)
Expand All @@ -62,7 +62,7 @@ PODS:
- GoogleUtilities/UserDefaults (~> 8.0)
- nanopb (~> 3.30910.0)
- PromisesSwift (~> 2.1)
- FirebaseSharedSwift (11.2.0)
- FirebaseSharedSwift (11.3.0)
- Flutter (1.0.0)
- flutter_native_splash (0.0.1):
- Flutter
Expand Down Expand Up @@ -234,20 +234,20 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
device_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d
Firebase: 9f574c08c2396885b5e7e100ed4293d956218af9
firebase_core: 2ec6b789859c7c24766344ec71fdf78639402d56
firebase_crashlytics: 60630a0f91ee432275fa1660fd8593079761448a
firebase_remote_config: e9540adfc076899bf326f934a9dc722dd7795310
FirebaseABTesting: 2104d957ce33888a3d6f3bde298cdee376dde8f1
FirebaseCore: 3cf438f431f18c12cdf2aaf64434648b63f7e383
FirebaseCoreExtension: cda74ddfb001224bd8fd1d6e74698b4ed07803de
FirebaseCoreInternal: 0c569513412da9f3b31bd0b340013bbee8f295c5
FirebaseCrashlytics: 745d8f0221fe49c62865391d1bf56f5a12eeec0b
FirebaseInstallations: 771177d89d6c451dc6e50085ec82e2fc77ed0a4a
FirebaseRemoteConfig: fe8b7e6d6770fefbde27b0cac3f3deffba6e7326
FirebaseRemoteConfigInterop: 477b26fdeb8fb5fbaf22fa9db5343b42289dc7db
FirebaseSessions: adcec8b72d0066a385e3affcd1bcb1ebb3908ce6
FirebaseSharedSwift: 7a0d78d155ede78407f0fdc89fbc914014c7c540
Firebase: 98e6bf5278170668a7983e12971a66b2cd57fc8c
firebase_core: 2bedc3136ec7c7b8561c6123ed0239387b53f2af
firebase_crashlytics: 37d104d457b51760b48504a93a12b3bf70995d77
firebase_remote_config: d522653d828836503715498f1662901a6efcd809
FirebaseABTesting: c4559fcd2eba9f6bdaf0599e2c37ded01c343e4c
FirebaseCore: a282032ae9295c795714ded2ec9c522fc237f8da
FirebaseCoreExtension: 30bb063476ef66cd46925243d64ad8b2c8ac3264
FirebaseCoreInternal: ac26d09a70c730e497936430af4e60fb0c68ec4e
FirebaseCrashlytics: cfc69af5b53565dc6a5e563788809b5778ac4eac
FirebaseInstallations: 58cf94dabf1e2bb2fa87725a9be5c2249171cda0
FirebaseRemoteConfig: fca0b2d017fc1de52b28a4e5bcf2007c1a840457
FirebaseRemoteConfigInterop: c3a5c31b3c22079f41ba1dc645df889d9ce38cb9
FirebaseSessions: 655ff17f3cc1a635cbdc2d69b953878001f9e25b
FirebaseSharedSwift: d39c2ad64a11a8d936ce25a42b00df47078bb59c
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_native_splash: edf599c81f74d093a4daf8e17bd7a018854bc778
flutter_secure_storage: d33dac7ae2ea08509be337e775f6b59f1ff45f12
Expand Down
24 changes: 16 additions & 8 deletions lib/base/networking/cache/cache.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import 'package:drift/drift.dart';
class Cache {
final CacheDatabase cacheDatabase;

final Duration onlineTtl = const Duration(minutes: 10);

final Duration onlineTtl = Duration(minutes: 10);
final Duration onlineStudentCardTtl = Duration(hours: 3);
final Duration offlineTtl = const Duration(days: 30);

Cache({required this.cacheDatabase});
Expand Down Expand Up @@ -39,13 +39,21 @@ class Cache {

if (entry != null) {
final today = DateTime.now();
if (getIt<ConnectionService>().hasInternet() &&
!key.contains("tumCard")) {
if (entry.saved.isAfter(today.subtract(onlineTtl))) {
return entry;
if (getIt<ConnectionService>().hasInternet()) {
if (!key.contains("tumCard")) {
if (entry.saved.isAfter(today.subtract(onlineTtl))) {
return entry;
} else {
delete(key);
return null;
}
} else {
delete(key);
return null;
if (entry.saved.isAfter(today.subtract(onlineStudentCardTtl))) {
return entry;
} else {
delete(key);
return null;
}
}
} else {
if (entry.validUntil.isAfter(today)) {
Expand Down
6 changes: 3 additions & 3 deletions lib/base/util/string_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ class StringParser {
).format(dateTime);
}

static double stringToDouble(String? number) {
static double? stringToDouble(String? number) {
if (number != null) {
number = number.replaceAll(",", ".");
return double.tryParse(number) ?? 0.0;
return double.tryParse(number);
} else {
return 0.0;
return null;
}
}

Expand Down
5 changes: 4 additions & 1 deletion lib/calendarComponent/model/calendar_event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ class CalendarEvent extends Searchable {
}

Color getColor() {
if (color == null) {
if (description != null &&
description!.toLowerCase().contains("prüfungstermin")) {
return Colors.orange;
} else if (color == null) {
return primaryLightColor;
} else {
return Color(color!);
Expand Down
Loading

0 comments on commit c204498

Please sign in to comment.