Skip to content

Commit 1a7f70b

Browse files
authored
Fix no/wrong default timezone registry factory set (#105)
* Add test to assert presence of AndroidCompatTimeZoneRegistry * Add r8 proguard keep rule * Use is to assert timezone registry * Keep both the tz registry and its inner factory class as well * Use explicit statements for keeping both the tz registry and its inner factory class
1 parent 10e8cd9 commit 1a7f70b

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

lib/consumer-rules.pro

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
-dontwarn org.codehaus.groovy.**
1111
-dontwarn org.jparsec.**
1212

13+
# keep to be used by ical4j
14+
-keep class at.bitfire.ical4android.AndroidCompatTimeZoneRegistry { *; }
15+
-keep class at.bitfire.ical4android.AndroidCompatTimeZoneRegistry$Factory { *; }
16+
1317
# keep all vCard properties/parameters (used via reflection)
1418
-keep class ezvcard.io.scribe.** { *; }
1519
-keep class ezvcard.property.** { *; }
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* This file is part of bitfireAT/synctools which is released under GPLv3.
3+
* Copyright © All Contributors. See the LICENSE and AUTHOR files in the root directory for details.
4+
* SPDX-License-Identifier: GPL-3.0-or-later
5+
*/
6+
7+
package at.bitfire.ical4android
8+
9+
import net.fortuna.ical4j.model.TimeZoneRegistryFactory
10+
import org.junit.Assert
11+
import org.junit.Assert.assertEquals
12+
import org.junit.Assert.assertNotNull
13+
import org.junit.Assert.assertTrue
14+
15+
import org.junit.Test
16+
17+
class Ical4jConfigurationTest {
18+
19+
@Test
20+
fun testTimeZoneRegistryFactoryConfigured() {
21+
val registry = TimeZoneRegistryFactory.getInstance().createRegistry()
22+
assertTrue(registry is AndroidCompatTimeZoneRegistry)
23+
}
24+
25+
}

0 commit comments

Comments
 (0)