-
-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
removed email catcher on crashes due to abuse
Signed-off-by: Jonas Kalderstam <[email protected]>
- Loading branch information
1 parent
30b678e
commit 2fbd336
Showing
8 changed files
with
0 additions
and
138 deletions.
There are no files selected for viewing
38 changes: 0 additions & 38 deletions
38
app/src/androidTest/java/com/nononsenseapps/feeder/util/BugReportKTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,16 @@ | ||
package com.nononsenseapps.feeder.util | ||
|
||
import android.content.Intent.ACTION_SENDTO | ||
import android.content.Intent.ACTION_VIEW | ||
import android.content.Intent.EXTRA_EMAIL | ||
import android.content.Intent.EXTRA_SUBJECT | ||
import android.content.Intent.EXTRA_TEXT | ||
import android.net.Uri | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
import androidx.test.filters.MediumTest | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import kotlin.test.assertEquals | ||
import kotlin.test.assertTrue | ||
|
||
@RunWith(AndroidJUnit4::class) | ||
@MediumTest | ||
class BugReportKTest { | ||
@Test | ||
fun bugIntentIsCorrect() { | ||
val intent = emailBugReportIntent() | ||
|
||
assertEquals(ACTION_SENDTO, intent.action) | ||
assertEquals(Uri.parse("mailto:[email protected]"), intent.data) | ||
assertEquals("Bug report for Feeder", intent.getStringExtra(EXTRA_SUBJECT)) | ||
assertEquals("[email protected]", intent.getStringExtra(EXTRA_EMAIL)) | ||
|
||
assertTrue(intent.getStringExtra(EXTRA_TEXT)) { | ||
"Application: " in intent.getStringExtra(EXTRA_TEXT)!! | ||
} | ||
} | ||
|
||
@Test | ||
fun crashIntentIsCorrect() { | ||
try { | ||
@Suppress("DIVISION_BY_ZERO") | ||
1 / 0 | ||
} catch (e: Exception) { | ||
val intent = emailCrashReportIntent(e) | ||
|
||
assertEquals(ACTION_SENDTO, intent.action) | ||
assertEquals(Uri.parse("mailto:[email protected]"), intent.data) | ||
assertEquals("Crash report for Feeder", intent.getStringExtra(EXTRA_SUBJECT)) | ||
assertEquals("[email protected]", intent.getStringExtra(EXTRA_EMAIL)) | ||
|
||
assertTrue(intent.getStringExtra(EXTRA_TEXT)) { | ||
"java.lang.ArithmeticException: divide by zero" in intent.getStringExtra(EXTRA_TEXT)!! | ||
} | ||
} | ||
} | ||
|
||
@Test | ||
fun issuesIntentIsCorrect() { | ||
val intent = openGithubIssues() | ||
|
32 changes: 0 additions & 32 deletions
32
app/src/main/java/com/nononsenseapps/feeder/ui/ActivityExceptionHandler.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 0 additions & 52 deletions
52
app/src/main/java/com/nononsenseapps/feeder/util/BugReport.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,8 @@ | ||
package com.nononsenseapps.feeder.util | ||
|
||
import android.content.Intent | ||
import android.content.Intent.ACTION_SENDTO | ||
import android.content.Intent.ACTION_VIEW | ||
import android.content.Intent.EXTRA_EMAIL | ||
import android.content.Intent.EXTRA_SUBJECT | ||
import android.net.Uri | ||
import android.os.Build | ||
import com.nononsenseapps.feeder.BuildConfig | ||
|
||
private fun deviceInfoBlock(): String = | ||
""" | ||
Application: ${BuildConfig.APPLICATION_ID} (flavor ${BuildConfig.BUILD_TYPE.ifBlank { "None" }}) | ||
Version: ${BuildConfig.VERSION_NAME} (code ${BuildConfig.VERSION_CODE}) | ||
Android: ${Build.VERSION.RELEASE} (SDK ${Build.VERSION.SDK_INT}) | ||
Device: ${Build.MANUFACTURER} ${Build.MODEL} | ||
""".trimIndent() | ||
|
||
private fun bugBody(): String = | ||
""" | ||
${deviceInfoBlock()} | ||
Hello. | ||
I'd like to report an issue: | ||
""".trimIndent() | ||
|
||
private const val EMAIL_REPORT_ADDRESS: String = "[email protected]" | ||
|
||
fun emailBugReportIntent(): Intent = | ||
Intent(ACTION_SENDTO).apply { | ||
data = Uri.parse("mailto:$EMAIL_REPORT_ADDRESS") | ||
putExtra(EXTRA_SUBJECT, "Bug report for Feeder") | ||
putExtra(EXTRA_EMAIL, EMAIL_REPORT_ADDRESS) | ||
putExtra(Intent.EXTRA_TEXT, bugBody()) | ||
} | ||
|
||
private const val CRASH_REPORT_ADDRESS: String = "[email protected]" | ||
|
||
private fun crashBody(throwable: Throwable): String = | ||
""" | ||
${deviceInfoBlock()} | ||
Unhandled exception: | ||
${throwable.stackTraceToString()} | ||
""".trimIndent() | ||
|
||
fun emailCrashReportIntent(throwable: Throwable): Intent = | ||
Intent(ACTION_SENDTO).apply { | ||
data = Uri.parse("mailto:$CRASH_REPORT_ADDRESS") | ||
putExtra(EXTRA_SUBJECT, "Crash report for Feeder") | ||
putExtra(EXTRA_EMAIL, CRASH_REPORT_ADDRESS) | ||
putExtra(Intent.EXTRA_TEXT, crashBody(throwable)) | ||
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) | ||
} | ||
|
||
fun openGithubIssues(): Intent = | ||
Intent(ACTION_VIEW).also { | ||
|