Update mime type and file extension constants for clarity

This commit is contained in:
Ensar Sarajčić 2023-07-15 16:24:32 +02:00
parent 0ad178fddb
commit a6b97698bf
3 changed files with 8 additions and 9 deletions

View File

@ -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)

View File

@ -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

View File

@ -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"