mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-03 18:56:44 -04:00
Attaching the device logs in the email body instead of as a file.
* We cannot attach a file to the email when using the `ACTION_SENDTO` action in the intent. However, we must use this intent action because it is the only one handled exclusively by email apps. This ensures that only email apps appear in the suggestions.
This commit is contained in:
parent
e12387e256
commit
61dd97ce9a
@ -25,7 +25,6 @@ import android.os.Bundle
|
|||||||
import android.os.Process
|
import android.os.Process
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.core.content.FileProvider
|
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import org.kiwix.kiwixmobile.core.CoreApp.Companion.coreComponent
|
import org.kiwix.kiwixmobile.core.CoreApp.Companion.coreComponent
|
||||||
@ -102,12 +101,7 @@ open class ErrorActivity : BaseActivity() {
|
|||||||
if (activities.isNotEmpty()) {
|
if (activities.isNotEmpty()) {
|
||||||
sendEmailLauncher.launch(Intent.createChooser(emailIntent, "Send email..."))
|
sendEmailLauncher.launch(Intent.createChooser(emailIntent, "Send email..."))
|
||||||
} else {
|
} else {
|
||||||
toast(
|
toast(getString(R.string.no_email_application_installed))
|
||||||
getString(
|
|
||||||
R.string.no_email_application_installed,
|
|
||||||
CRASH_AND_FEEDBACK_EMAIL_ADDRESS
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -124,20 +118,11 @@ open class ErrorActivity : BaseActivity() {
|
|||||||
data = Uri.parse("mailto:")
|
data = Uri.parse("mailto:")
|
||||||
putExtra(Intent.EXTRA_EMAIL, arrayOf(CRASH_AND_FEEDBACK_EMAIL_ADDRESS))
|
putExtra(Intent.EXTRA_EMAIL, arrayOf(CRASH_AND_FEEDBACK_EMAIL_ADDRESS))
|
||||||
putExtra(Intent.EXTRA_SUBJECT, subject)
|
putExtra(Intent.EXTRA_SUBJECT, subject)
|
||||||
putExtra(Intent.EXTRA_TEXT, emailBody)
|
|
||||||
val file = fileLogger.writeLogFile(
|
val file = fileLogger.writeLogFile(
|
||||||
this@ErrorActivity,
|
this@ErrorActivity,
|
||||||
activityKiwixErrorBinding?.allowLogs?.isChecked == true
|
activityKiwixErrorBinding?.allowLogs?.isChecked == true
|
||||||
)
|
)
|
||||||
file.appendText(emailBody)
|
putExtra(Intent.EXTRA_TEXT, "$emailBody\n\nDevice Logs:\n$${file.readText()}")
|
||||||
val path =
|
|
||||||
FileProvider.getUriForFile(
|
|
||||||
this@ErrorActivity,
|
|
||||||
applicationContext.packageName + ".fileprovider",
|
|
||||||
file
|
|
||||||
)
|
|
||||||
addFlags(android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
|
||||||
putExtra(android.content.Intent.EXTRA_STREAM, path)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,6 +68,7 @@
|
|||||||
<string name="pref_credits_title">Credits</string>
|
<string name="pref_credits_title">Credits</string>
|
||||||
<string name="tts_lang_not_supported">The language of this page is not supported. The article may not be properly read.</string>
|
<string name="tts_lang_not_supported">The language of this page is not supported. The article may not be properly read.</string>
|
||||||
<string name="no_reader_application_installed">Could not find an installed application for this type of file</string>
|
<string name="no_reader_application_installed">Could not find an installed application for this type of file</string>
|
||||||
|
<string name="no_email_application_installed">Please install an email client</string>
|
||||||
<string name="no_app_found_to_select_bookmark_file">No app found to select a bookmark file</string>
|
<string name="no_app_found_to_select_bookmark_file">No app found to select a bookmark file</string>
|
||||||
<string name="no_section_info">No Content Headers Found</string>
|
<string name="no_section_info">No Content Headers Found</string>
|
||||||
<string name="request_storage">To access offline content we need access to your storage</string>
|
<string name="request_storage">To access offline content we need access to your storage</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user