Skip to content

Commit

Permalink
Chore: Update Protos to v0.9.2 (#294)
Browse files Browse the repository at this point in the history
Co-authored-by: Jakob Körber <[email protected]>
  • Loading branch information
CommanderStorm and jakobkoerber authored Oct 30, 2024
1 parent cb6ea5b commit 1368b83
Show file tree
Hide file tree
Showing 37 changed files with 121 additions and 170 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ To update the generated stubs for the Campus, you need protoc installed, then ac
dart pub global activate protoc_plugin
export PATH="$PATH:$HOME/.pub-cache/bin"
curl -o protos/tumdev/campus_backend.proto https://raw.githubusercontent.com/TUM-Dev/Campus-Backend/main/server/api/tumdev/campus_backend.proto
protoc --dart_out=grpc:lib/base/networking/apis -I./protos google/protobuf/timestamp.proto google/protobuf/empty.proto protos/tumdev/campus_backend.proto
protoc --dart_out=grpc:lib/base/networking/apis -I./protos google/protobuf/timestamp.proto google/protobuf/empty.proto tumdev/campus_backend.proto
```

### Current needed Forks
Expand Down
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ android {

defaultConfig {
applicationId "de.tum.in.tumcampus"
minSdkVersion 26
minSdkVersion 29
targetSdkVersion flutter.targetSdkVersion
ndkVersion "26.1.10909125"
versionCode flutterVersionCode.toInteger()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ fun LocalDateTime.timeAgo(context: Context): String {
val now = LocalDateTime.now()
val duration = Duration.between(this, now)

val years = duration.toDays() / 365
val months = duration.toDays() / 30
val days = duration.toDays()
val hours = duration.toHours()
val minutes = duration.toMinutes()
val years = (duration.toDays() / 365).toInt()
val months = (duration.toDays() / 30).toInt()
val days = duration.toDays().toInt()
val hours = duration.toHours().toInt()
val minutes = duration.toMinutes().toInt()

return when {
years > 0 -> context.resources.getQuantityString(R.plurals.yearsAgo, years.toInt())
months > 0 -> context.resources.getQuantityString(R.plurals.monthsAgo, months.toInt())
days > 0 -> context.resources.getQuantityString(R.plurals.daysAgo, days.toInt())
hours > 0 -> context.resources.getQuantityString(R.plurals.hoursAgo, hours.toInt())
minutes > 0 -> context.resources.getQuantityString(R.plurals.minutesAgo, minutes.toInt())
years > 0 -> context.resources.getQuantityString(R.plurals.yearsAgo, years, years)
months > 0 -> context.resources.getQuantityString(R.plurals.monthsAgo, months, months)
days > 0 -> context.resources.getQuantityString(R.plurals.daysAgo, days, days)
hours > 0 -> context.resources.getQuantityString(R.plurals.hoursAgo, hours, hours)
minutes > 0 -> context.resources.getQuantityString(R.plurals.minutesAgo, minutes, minutes)
else -> context.resources.getString(R.string.just_now)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ data class WidgetCalendarItem(
val endDate: LocalDateTime,
val location: String? = null,
val color: Long? = null,
val isVisible: Boolean? = null,
var isFirstOnDay: Boolean = false
) {
fun getEventColor(context: Context): Int {
Expand Down
5 changes: 0 additions & 5 deletions android/app/src/main/res/color/widget_header_color.xml

This file was deleted.

10 changes: 0 additions & 10 deletions android/app/src/main/res/drawable-v21/app_widget_background.xml

This file was deleted.

This file was deleted.

9 changes: 0 additions & 9 deletions android/app/src/main/res/drawable/ic_filter_list.xml

This file was deleted.

This file was deleted.

This file was deleted.

13 changes: 7 additions & 6 deletions android/app/src/main/res/layout/calendar_widget.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/calendar_widget"
style="@style/Widget.AppWidget.AppWidget.Container"
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">
android:padding="@dimen/widget_margin"
android:theme="@style/Theme.AppWidget.AppWidgetContainer">

<LinearLayout
android:id="@+id/calendar_widget_header"
Expand All @@ -24,7 +25,7 @@
android:layout_weight="1"
android:fontFamily="sans-serif-medium"
android:textAlignment="viewStart"
android:textColor="@color/text_primary"
android:textColor="?android:attr/textColorPrimary"
android:textSize="16sp"
tools:text="Date" />

Expand All @@ -34,7 +35,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:textAlignment="viewEnd"
android:textColor="@color/text_primary"
android:textColor="?android:attr/textColorPrimary"
android:textSize="14sp"
tools:text="Date" />

Expand All @@ -58,7 +59,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/calendar_widget_no_lectures"
android:textColor="@color/text_dark_gray"
android:textColor="?android:attr/textColorPrimary"
android:visibility="gone"
tools:visibility="visible" />

Expand All @@ -69,7 +70,7 @@
android:layout_gravity="center"
android:text="@string/calendar_widget_old_data"
android:textAlignment="center"
android:textColor="@color/text_primary"
android:textColor="?android:attr/textColorPrimary"
android:visibility="gone"
tools:visibility="visible" />

Expand Down
3 changes: 3 additions & 0 deletions android/app/src/main/res/layout/calendar_widget_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="38dp"
android:textColor="?android:attr/textColorPrimary"
android:visibility="gone"
tools:text="Month"
tools:visibility="visible" />
Expand All @@ -28,6 +29,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@android:color/transparent"
android:textColor="?android:attr/textColorPrimary"
android:textSize="18sp"
android:textStyle="bold"
tools:text="8" />
Expand All @@ -39,6 +41,7 @@
android:layout_marginTop="-6dp"
android:layout_weight="1"
android:background="@android:color/transparent"
android:textColor="?android:attr/textColorPrimary"
android:textSize="13sp"
tools:text="Do." />

Expand Down
10 changes: 5 additions & 5 deletions android/app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@
<string name="just_now">Gerade eben</string>
<string name="yesterday">Gestern</string>
<plurals name="yearsAgo">
<item quantity="one">Vor 1 Jahr</item>
<item quantity="one">Vor %d Jahr</item>
<item quantity="other">Vor %d Jahren</item>
</plurals>
<plurals name="monthsAgo">
<item quantity="one">Vor 1 Monaten</item>
<item quantity="one">Vor %d Monaten</item>
<item quantity="other">Vor %d Monaten</item>
</plurals>
<plurals name="daysAgo">
<item quantity="one">Vor 1 Tag</item>
<item quantity="one">Vor %d Tag</item>
<item quantity="other">Vor %d Tagen</item>
</plurals>
<plurals name="hoursAgo">
<item quantity="one">Vor 1 Stunde</item>
<item quantity="one">Vor %d Stunde</item>
<item quantity="other">Vor %d Stunden</item>
</plurals>
<plurals name="minutesAgo">
<item quantity="one">Vor 1 Minute</item>
<item quantity="one">Vor %d Minute</item>
<item quantity="other">Vor %d Minuten</item>
</plurals>
</resources>
10 changes: 0 additions & 10 deletions android/app/src/main/res/values-night-v31/themes.xml

This file was deleted.

14 changes: 0 additions & 14 deletions android/app/src/main/res/values-v21/styles.xml

This file was deleted.

16 changes: 0 additions & 16 deletions android/app/src/main/res/values-v31/styles.xml

This file was deleted.

19 changes: 11 additions & 8 deletions android/app/src/main/res/values-v31/themes.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2019 Google LLC.
SPDX-License-Identifier: Apache-2.0 -->
<resources>
<!--
Having themes.xml for v31 variant because @android:dimen/system_app_widget_background_radius
and @android:dimen/system_app_widget_internal_padding requires API level 31
-->
<style name="Theme.Android.AppWidgetContainerParent" parent="@android:style/Theme.DeviceDefault.DayNight">
<item name="appWidgetRadius">@android:dimen/system_app_widget_background_radius</item>
<item name="appWidgetInnerRadius">@android:dimen/system_app_widget_inner_radius</item>

<style name="Theme.AppWidget.AppWidgetContainerParent" parent="@android:style/Theme.DeviceDefault.DayNight">
<item name="appWidgetRadius">
@android:dimen/system_app_widget_background_radius
</item>
<item name="appWidgetInnerRadius">
@android:dimen/system_app_widget_inner_radius
</item>
</style>

</resources>
10 changes: 5 additions & 5 deletions android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@
<string name="yesterday">Yesterday</string>
<string name="event_start_end_format_string" translatable="false">%1$s–%2$s</string>
<plurals name="yearsAgo">
<item quantity="one">1 year ago</item>
<item quantity="one">%d year ago</item>
<item quantity="other">%d years ago</item>
</plurals>
<plurals name="monthsAgo">
<item quantity="one">1 month ago</item>
<item quantity="one">%d month ago</item>
<item quantity="other">%d months ago</item>
</plurals>
<plurals name="daysAgo">
<item quantity="one">1 day ago</item>
<item quantity="one">%d day ago</item>
<item quantity="other">%d days ago</item>
</plurals>
<plurals name="hoursAgo">
<item quantity="one">1 hour ago</item>
<item quantity="one">%d hour ago</item>
<item quantity="other">%d hours ago</item>
</plurals>
<plurals name="minutesAgo">
<item quantity="one">1 minute ago</item>
<item quantity="one">%d minute ago</item>
<item quantity="other">%d minutes ago</item>
</plurals>
</resources>
6 changes: 3 additions & 3 deletions android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
<item name="android:windowBackground">?android:colorBackground</item>
</style>

<style name="Widget.Android.AppWidget.Container" parent="android:Widget">
<style name="Widget.AppWidget.AppWidget.Container" parent="android:Widget">
<item name="android:id">@android:id/background</item>
<item name="android:background">?android:attr/colorBackground</item>
</style>

<style name="Widget.Android.AppWidget.InnerView" parent="android:Widget">
<style name="Widget.AppWidget.AppWidget.InnerView" parent="android:Widget">
<item name="android:padding">?attr/appWidgetPadding</item>
<item name="android:background">?android:attr/colorBackground</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
</style>
</resources>
14 changes: 7 additions & 7 deletions android/app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<!-- Copyright 2019 Google LLC.
SPDX-License-Identifier: Apache-2.0 -->
<resources>

<style name="Theme.Android.AppWidgetContainerParent" parent="@android:style/Theme.DeviceDefault">
<!-- Radius of the outer bound of widgets to make the rounded corners -->
<style name="Theme.AppWidget.AppWidgetContainerParent" parent="@android:style/Theme.DeviceDefault">
<!-- Radius of the outer bound of widgets to make the rounded
corners -->
<item name="appWidgetRadius">16dp</item>
<!--
Radius of the inner view's bound of widgets to make the rounded corners.
It needs to be 8dp or less than the value of appWidgetRadius
-->
<!-- Radius of the inner view's bound of widgets to make the rounded corners. It needs to be 8dp or less than the value of appWidgetRadius -->
<item name="appWidgetInnerRadius">8dp</item>
</style>

<style name="Theme.Android.AppWidgetContainer" parent="Theme.Android.AppWidgetContainerParent">
<style name="Theme.AppWidget.AppWidgetContainer" parent="Theme.AppWidget.AppWidgetContainerParent">
<!-- Apply padding to avoid the content of the widget colliding with the rounded corners -->
<item name="appWidgetPadding">16dp</item>
</style>
Expand Down
13 changes: 13 additions & 0 deletions android/app/src/main/res/xml-v31/calendar_widget_info.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
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:previewImage="@drawable/appwidget_preview"
android:resizeMode="horizontal|vertical"
android:updatePeriodMillis="600000"
android:widgetCategory="home_screen" />
6 changes: 2 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 @@ -8,8 +8,6 @@
android:minResizeWidth="270dp"
android:minResizeHeight="110dp"
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:targetCellHeight="1" -->
android:updatePeriodMillis="600000"
android:widgetCategory="home_screen" />
3 changes: 2 additions & 1 deletion lib/base/enums/user_preference.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ enum UserPreference {
browser(bool),
failedGrades(bool),
weekends(bool),
hiddenCalendarEntries(bool);
hiddenCalendarEntries(bool),
calendarTab(int);

final Type type;

Expand Down
Loading

0 comments on commit 1368b83

Please sign in to comment.