From a6b97698bf0b42d2fde671be8be981825ccc3356 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Sat, 15 Jul 2023 16:24:32 +0200 Subject: [PATCH] Update mime type and file extension constants for clarity --- .../smsmessenger/activities/MainActivity.kt | 6 +++--- .../smsmessenger/dialogs/ExportMessagesDialog.kt | 4 ++-- .../simplemobiletools/smsmessenger/helpers/Constants.kt | 7 +++---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/MainActivity.kt index 6b87f3f9..df266d4f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/MainActivity.kt @@ -582,7 +582,7 @@ class MainActivity : SimpleActivity() { if (isQPlus()) { ExportMessagesDialog(this, config.lastExportPath, true) { file -> Intent(Intent.ACTION_CREATE_DOCUMENT).apply { - type = EXPORT_MIME_TYPE + type = JSON_MIME_TYPE putExtra(Intent.EXTRA_TITLE, file.name) addCategory(Intent.CATEGORY_OPENABLE) @@ -626,8 +626,8 @@ class MainActivity : SimpleActivity() { if (isQPlus()) { Intent(Intent.ACTION_GET_CONTENT).apply { addCategory(Intent.CATEGORY_OPENABLE) - type = JSON_IMPORT_MIME_TYPE - putExtra(Intent.EXTRA_MIME_TYPES, arrayOf(JSON_IMPORT_MIME_TYPE, XML_IMPORT_MIME_TYPE)) + type = JSON_MIME_TYPE + putExtra(Intent.EXTRA_MIME_TYPES, arrayOf(JSON_MIME_TYPE, XML_MIME_TYPE)) try { startActivityForResult(this, PICK_IMPORT_SOURCE_INTENT) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/ExportMessagesDialog.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/ExportMessagesDialog.kt index 56c9791d..fbc451e4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/ExportMessagesDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/ExportMessagesDialog.kt @@ -7,7 +7,7 @@ import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.smsmessenger.R import com.simplemobiletools.smsmessenger.activities.SimpleActivity import com.simplemobiletools.smsmessenger.extensions.config -import com.simplemobiletools.smsmessenger.helpers.EXPORT_FILE_EXT +import com.simplemobiletools.smsmessenger.helpers.JSON_FILE_EXT import kotlinx.android.synthetic.main.dialog_export_messages.view.* import java.io.File @@ -51,7 +51,7 @@ class ExportMessagesDialog( when { filename.isEmpty() -> activity.toast(R.string.empty_name) filename.isAValidFilename() -> { - val file = File(realPath, "$filename$EXPORT_FILE_EXT") + val file = File(realPath, "$filename$JSON_FILE_EXT") if (!hidePath && file.exists()) { activity.toast(R.string.name_taken) return@setOnClickListener diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Constants.kt index 3f9cdf93..cb22b91d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Constants.kt @@ -28,10 +28,9 @@ const val PINNED_CONVERSATIONS = "pinned_conversations" const val BLOCKED_KEYWORDS = "blocked_keywords" const val EXPORT_SMS = "export_sms" const val EXPORT_MMS = "export_mms" -const val EXPORT_MIME_TYPE = "application/json" -const val EXPORT_FILE_EXT = ".json" -const val JSON_IMPORT_MIME_TYPE = "application/json" -const val XML_IMPORT_MIME_TYPE = "text/xml" +const val JSON_FILE_EXT = ".json" +const val JSON_MIME_TYPE = "application/json" +const val XML_MIME_TYPE = "text/xml" const val IMPORT_SMS = "import_sms" const val IMPORT_MMS = "import_mms" const val WAS_DB_CLEARED = "was_db_cleared_2"