Skip to content

Commit

Permalink
Remove unsafe send error email for EmbraceAutomaticVerification (#1049)
Browse files Browse the repository at this point in the history
(cherry picked from commit 612354b)
  • Loading branch information
priettt committed Jul 10, 2024
1 parent fd143e7 commit 61c97ef
Showing 1 changed file with 0 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import android.app.Activity
import android.app.AlertDialog
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Handler
import android.os.Looper
import android.widget.Toast
Expand Down Expand Up @@ -54,7 +53,6 @@ internal class EmbraceAutomaticVerification(
companion object {
internal const val TAG = "[EmbraceVerification]"
private const val ON_FOREGROUND_DELAY = 5000L
private const val EMBRACE_CONTACT_EMAIL = "support@embrace.io"
private const val VERIFY_INTEGRATION_DELAY = 200L
private const val ON_FOREGROUND_TIMEOUT = 5000L
internal val instance = EmbraceAutomaticVerification()
Expand Down Expand Up @@ -292,10 +290,6 @@ internal class EmbraceAutomaticVerification(
.setTitle(activity.getString(R.string.automatic_verification_error_title))
.setMessage(errorString)
.setCancelable(true)
.setNegativeButton(activity.getString(R.string.send_error_log)) { dialog, _ ->
sendErrorLog(activity, errorString)
dialog.dismiss()
}
.setPositiveButton(activity.getString(R.string.close)) { dialog, _ ->
dialog.dismiss()
}
Expand All @@ -305,28 +299,6 @@ internal class EmbraceAutomaticVerification(
}
}

private fun sendErrorLog(activity: Activity, errorMessage: String) {
val errorLog = generateErrorLog(errorMessage)
val selectorIntent = Intent(Intent.ACTION_SENDTO).setData(Uri.parse("mailto:$EMBRACE_CONTACT_EMAIL"))

val emailIntent = Intent(Intent.ACTION_SEND).apply {
putExtra(Intent.EXTRA_EMAIL, arrayOf(EMBRACE_CONTACT_EMAIL))
putExtra(Intent.EXTRA_SUBJECT, "Android Verification Log")
putExtra(Intent.EXTRA_TEXT, errorLog)
selector = selectorIntent
}

activity.startActivity(Intent.createChooser(emailIntent, "Send Email"))
}

private fun generateErrorLog(errorMessage: String): String {
var errorLog = "App ID: ${Embrace.getImpl().metadataService?.getAppId()}\n" +
"App Version: ${Embrace.getImpl().metadataService?.getAppVersionName()}"
errorLog += "\n\n-----------------\n\n"
errorLog += errorMessage
return errorLog
}

private fun logInfo(message: String) {
Embrace.getInstance().internalInterface.logInfo("$TAG $message", null)
}
Expand Down

0 comments on commit 61c97ef

Please sign in to comment.