1
0
mirror of https://github.com/AllanWang/Frost-for-Facebook.git synced 2024-11-08 20:12:39 +01:00

Restrict reportable image errorss

This commit is contained in:
Allan Wang 2019-05-19 19:43:26 +08:00
parent 51588778a3
commit 17a6a36279
No known key found for this signature in database
GPG Key ID: C93E3F9C679D7A56

View File

@ -53,7 +53,6 @@ import com.pitchedapps.frost.services.LocalService
import com.pitchedapps.frost.utils.ARG_COOKIE import com.pitchedapps.frost.utils.ARG_COOKIE
import com.pitchedapps.frost.utils.ARG_IMAGE_URL import com.pitchedapps.frost.utils.ARG_IMAGE_URL
import com.pitchedapps.frost.utils.ARG_TEXT import com.pitchedapps.frost.utils.ARG_TEXT
import com.pitchedapps.frost.utils.L
import com.pitchedapps.frost.utils.Prefs import com.pitchedapps.frost.utils.Prefs
import com.pitchedapps.frost.utils.frostSnackbar import com.pitchedapps.frost.utils.frostSnackbar
import com.pitchedapps.frost.utils.frostUriFromFile import com.pitchedapps.frost.utils.frostUriFromFile
@ -71,6 +70,7 @@ import kotlinx.coroutines.async
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import java.io.File import java.io.File
import java.io.FileNotFoundException
import java.io.IOException import java.io.IOException
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Date import java.util.Date
@ -294,16 +294,18 @@ internal enum class FabStates(
) { ) {
ERROR(GoogleMaterial.Icon.gmd_error, Color.WHITE, Color.RED) { ERROR(GoogleMaterial.Icon.gmd_error, Color.WHITE, Color.RED) {
override fun onClick(activity: ImageActivity) { override fun onClick(activity: ImageActivity) {
val err =
activity.errorRef?.takeIf { it !is FileNotFoundException && it.message != "Image failed to decode using JPEG decoder" }
?: return
activity.materialDialogThemed { activity.materialDialogThemed {
title(R.string.kau_error) title(R.string.kau_error)
content(R.string.bad_image_overlay) content(R.string.bad_image_overlay)
positiveText(R.string.kau_yes) positiveText(R.string.kau_yes)
onPositive { _, _ -> onPositive { _, _ ->
if (activity.errorRef != null)
L.e(activity.errorRef) { "ImageActivity error report" }
activity.sendFrostEmail(R.string.debug_image_link_subject) { activity.sendFrostEmail(R.string.debug_image_link_subject) {
addItem("Url", activity.imageUrl) addItem("Url", activity.imageUrl)
addItem("Message", activity.errorRef?.message ?: "Null") addItem("Type", err.javaClass.name)
addItem("Message", err.message ?: "Null")
} }
} }
negativeText(R.string.kau_no) negativeText(R.string.kau_no)
@ -356,11 +358,6 @@ internal enum class FabStates(
fab.show() fab.show()
} }
}) })
// fab.fadeScaleTransition {
// setIcon(iicon, color = iconColor)
//// backgroundTintList = ColorStateList.valueOf(tint)
// }
} }
} }