From c8d08e21a819d24a60ff949b5bda2130441ffe08 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 26 Oct 2022 12:36:58 +0200 Subject: [PATCH] Small refactor --- .../internal/session/content/ImageExifTagRemover.kt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/ImageExifTagRemover.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/ImageExifTagRemover.kt index 274a2a85e3..1531d70083 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/ImageExifTagRemover.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/ImageExifTagRemover.kt @@ -50,10 +50,7 @@ internal class ImageExifTagRemover @Inject constructor( } ?: return@withContext jpegImageFile tryOrNull("Unable to remove ExifData") { - outputSet.removeField(ExifTagConstants.EXIF_TAG_GPSINFO) - outputSet.removeField(ExifTagConstants.EXIF_TAG_SUBJECT_LOCATION) - outputSet.removeField(ExifTagConstants.EXIF_TAG_USER_COMMENT) - GpsTagConstants.ALL_GPS_TAGS.forEach { tagInfo -> + tagsToRemove.forEach { tagInfo -> outputSet.removeField(tagInfo) } } ?: return@withContext jpegImageFile @@ -74,4 +71,12 @@ internal class ImageExifTagRemover @Inject constructor( } ) } + + private val tagsToRemove + get() = GpsTagConstants.ALL_GPS_TAGS + + listOf( + ExifTagConstants.EXIF_TAG_GPSINFO, + ExifTagConstants.EXIF_TAG_SUBJECT_LOCATION, + ExifTagConstants.EXIF_TAG_USER_COMMENT, + ) }