1
0
Fork 1

Code cleanup

This commit is contained in:
Arne 2024-10-03 16:45:06 +02:00
parent b031df5e75
commit 06fb90706e
2 changed files with 3 additions and 5 deletions

1
proguard-rules.pro vendored
View file

@ -7,6 +7,7 @@
-keep class com.kyleduo.switchbutton.Configuration -keep class com.kyleduo.switchbutton.Configuration
# Needed for proper GSON deserialization
-keep class com.google.gson.reflect.TypeToken -keep class com.google.gson.reflect.TypeToken
-keep class * extends com.google.gson.reflect.TypeToken -keep class * extends com.google.gson.reflect.TypeToken
-keep public class * implements java.lang.reflect.Type -keep public class * implements java.lang.reflect.Type

View file

@ -21,8 +21,6 @@ import com.google.gson.stream.JsonWriter;
import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.Jid;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
@ -76,9 +74,8 @@ public class Reaction {
return Collections.emptyList(); return Collections.emptyList();
} }
try { try {
Type type = new TypeToken<ArrayList<Reaction>>() {}.getType(); return GSON.fromJson(asString, new TypeToken<List<Reaction>>() {}.getType());
return GSON.fromJson(asString, type); } catch (final IllegalArgumentException | JsonSyntaxException e) {
} catch (final JsonSyntaxException e) {
return Collections.emptyList(); return Collections.emptyList();
} }
} }