From 6b9fb19edf7639c2539ee293e55436b1a111e53d Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Wed, 15 Jan 2025 17:46:19 +0000 Subject: [PATCH 1/6] More debugging info --- app/lib/features/calendar_sync/calendar_sync.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/features/calendar_sync/calendar_sync.dart b/app/lib/features/calendar_sync/calendar_sync.dart index 8f3c844d6a8a..e3cc867311c5 100644 --- a/app/lib/features/calendar_sync/calendar_sync.dart +++ b/app/lib/features/calendar_sync/calendar_sync.dart @@ -162,7 +162,7 @@ Future _refreshCalendar( final currentLinkKeys = currentLinks.values; List foundEvents = []; if (currentLinkKeys.isNotEmpty) { - _log.info('Current links: $calendarId: ${currentLinkKeys.length}'); + _log.info('Current links: $calendarId: ${currentLinkKeys}'); final foundEventsResult = await deviceCalendar.retrieveEvents( calendarId, RetrieveEventsParams(eventIds: currentLinks.values.toList()), From 072657bba5bb19dca63ecd28fc69d480126a89ca Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Wed, 15 Jan 2025 17:46:43 +0000 Subject: [PATCH 2/6] Add Proguard Rules to fix retrieveCalendars on Android --- app/android/app/build.gradle | 6 ++++++ app/android/app/proguard-rules.pro | 14 ++++++++++++++ app/android/gradle.properties | 3 ++- 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 app/android/app/proguard-rules.pro diff --git a/app/android/app/build.gradle b/app/android/app/build.gradle index 0465d732ab23..c011cd9f3d28 100644 --- a/app/android/app/build.gradle +++ b/app/android/app/build.gradle @@ -64,6 +64,12 @@ android { buildTypes { release { signingConfig signingConfigs.release + + minifyEnabled true + useProguard true + + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } } namespace 'global.acter.app' diff --git a/app/android/app/proguard-rules.pro b/app/android/app/proguard-rules.pro new file mode 100644 index 000000000000..8647a9da9d17 --- /dev/null +++ b/app/android/app/proguard-rules.pro @@ -0,0 +1,14 @@ +# Flutter Wrapper +-keep class io.flutter.app.** { *; } +-keep class io.flutter.plugin.** { *; } +-keep class io.flutter.util.** { *; } +-keep class io.flutter.view.** { *; } +-keep class io.flutter.** { *; } +-keep class io.flutter.plugins.** { *; } + +# ---- Specific plugins: +# Firebase for notifications +-keep class com.google.firebase.** { *; } +# Device Calendar fix +# see https://github.com/builttoroam/device_calendar/issues/99 +-keep class com.builttoroam.devicecalendar.** { *; } \ No newline at end of file diff --git a/app/android/gradle.properties b/app/android/gradle.properties index a79a25885781..b623eb8d0afd 100644 --- a/app/android/gradle.properties +++ b/app/android/gradle.properties @@ -3,4 +3,5 @@ android.enableJetifier=true org.gradle.jvmargs= -Xmx8g -Xms512M -XX:ReservedCodeCacheSize=2048m -XX:+UseCompressedOops -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 android.defaults.buildfeatures.buildconfig=true android.nonTransitiveRClass=false -android.nonFinalResIds=false \ No newline at end of file +android.nonFinalResIds=false +android.enableR8=true \ No newline at end of file From 5c494d44fc57943b82c4a7fbb656b7d666384106 Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Wed, 15 Jan 2025 17:55:44 +0000 Subject: [PATCH 3/6] add Changelog --- .changes/2503-fix-calendar-on-android.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 .changes/2503-fix-calendar-on-android.md diff --git a/.changes/2503-fix-calendar-on-android.md b/.changes/2503-fix-calendar-on-android.md new file mode 100644 index 000000000000..804ebc9d35c4 --- /dev/null +++ b/.changes/2503-fix-calendar-on-android.md @@ -0,0 +1 @@ +- Fix App generating too many device calendars on some devices \ No newline at end of file From b7c0385ee89baf999912c1e4be5519b5fb541a96 Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Thu, 16 Jan 2025 14:56:52 +0000 Subject: [PATCH 4/6] Not needed on newer version --- app/android/app/build.gradle | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/android/app/build.gradle b/app/android/app/build.gradle index c011cd9f3d28..370b58bd639f 100644 --- a/app/android/app/build.gradle +++ b/app/android/app/build.gradle @@ -66,8 +66,6 @@ android { signingConfig signingConfigs.release minifyEnabled true - useProguard true - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } From 37a29eabad005a29b6714b54dcd80a0c07a98856 Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Fri, 17 Jan 2025 14:23:25 +0000 Subject: [PATCH 5/6] fixing R8 build error --- app/android/app/proguard-rules.pro | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/android/app/proguard-rules.pro b/app/android/app/proguard-rules.pro index 8647a9da9d17..89f666a5591f 100644 --- a/app/android/app/proguard-rules.pro +++ b/app/android/app/proguard-rules.pro @@ -1,11 +1,21 @@ # Flutter Wrapper --keep class io.flutter.app.** { *; } -keep class io.flutter.plugin.** { *; } -keep class io.flutter.util.** { *; } -keep class io.flutter.view.** { *; } --keep class io.flutter.** { *; } -keep class io.flutter.plugins.** { *; } +# FIX for: ERROR: R8: Library class android.content.res.XmlResourceParser implements program class org.xmlpull.v1.XmlPullParser +-dontwarn org.xmlpull.v1.** +-dontwarn org.kxml2.io.** +-dontwarn android.content.res.** +-dontwarn org.slf4j.impl.StaticLoggerBinder +-keep class org.xmlpull.** { *; } +-keepclassmembers class org.xmlpull.** { *; } + +# -keep class io.flutter.app.** { *; } +# -keep class io.flutter.** { *; } +# --- /end fix + # ---- Specific plugins: # Firebase for notifications -keep class com.google.firebase.** { *; } From cb561f7c4296ac914395d1ed9967d91e633878ae Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Sun, 19 Jan 2025 11:03:48 +0000 Subject: [PATCH 6/6] Fix flutter analyze --- app/lib/features/calendar_sync/calendar_sync.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/features/calendar_sync/calendar_sync.dart b/app/lib/features/calendar_sync/calendar_sync.dart index e3cc867311c5..4ff6a2370683 100644 --- a/app/lib/features/calendar_sync/calendar_sync.dart +++ b/app/lib/features/calendar_sync/calendar_sync.dart @@ -162,7 +162,7 @@ Future _refreshCalendar( final currentLinkKeys = currentLinks.values; List foundEvents = []; if (currentLinkKeys.isNotEmpty) { - _log.info('Current links: $calendarId: ${currentLinkKeys}'); + _log.info('Current links: $calendarId: $currentLinkKeys'); final foundEventsResult = await deviceCalendar.retrieveEvents( calendarId, RetrieveEventsParams(eventIds: currentLinks.values.toList()),