More details for silent reports.
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing

This commit is contained in:
aminecmi 2022-12-03 21:39:46 +01:00
parent 07e3710d44
commit 6947743ac0
5 changed files with 32 additions and 21 deletions

View File

@ -0,0 +1,9 @@
package bou.amine.apps.readerforselfossv2.android
import org.acra.ACRA
import org.acra.ktx.sendSilentlyWithAcra
fun Throwable.sendSilentlyWithAcraWithName(name: String) {
ACRA.errorReporter.putCustomData("error_source", name)
this.sendSilentlyWithAcra()
}

View File

@ -61,7 +61,6 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import org.acra.ACRA
import org.acra.ktx.sendSilentlyWithAcra
import org.acra.ktx.sendWithAcra
import org.kodein.di.DIAware
import org.kodein.di.android.closestDI
import org.kodein.di.instance
@ -513,7 +512,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener, DIAwar
val gdColor = try {
Color.parseColor(it.color)
} catch (e: IllegalArgumentException) {
e.sendSilentlyWithAcra()
e.sendSilentlyWithAcraWithName("color issue " + it.color)
resources.getColor(R.color.colorPrimary)
}
gd.setColor(gdColor)

View File

@ -25,6 +25,7 @@ import bou.amine.apps.readerforselfossv2.android.databinding.FragmentArticleBind
import bou.amine.apps.readerforselfossv2.android.model.ParecelableItem
import bou.amine.apps.readerforselfossv2.android.model.toModel
import bou.amine.apps.readerforselfossv2.android.model.toParcelable
import bou.amine.apps.readerforselfossv2.android.sendSilentlyWithAcraWithName
import bou.amine.apps.readerforselfossv2.android.utils.glide.getBitmapInputStream
import bou.amine.apps.readerforselfossv2.android.utils.openInBrowserAsNewTask
import bou.amine.apps.readerforselfossv2.android.utils.shareLink
@ -114,7 +115,7 @@ class ArticleFragment : Fragment(), DIAware {
typeface = try {
ResourcesCompat.getFont(requireContext(), resId)!!
} catch (e: java.lang.Exception) {
e.sendSilentlyWithAcra()
e.sendSilentlyWithAcraWithName("typeface")
// Just to be sure
null
}
@ -220,7 +221,7 @@ class ArticleFragment : Fragment(), DIAware {
)
} catch (e: InflateException) {
e.sendSilentlyWithAcra()
e.sendSilentlyWithAcraWithName("webview not available")
AlertDialog.Builder(requireContext())
.setMessage(requireContext().getString(R.string.webview_dialog_issue_message))
.setTitle(requireContext().getString(R.string.webview_dialog_issue_title))
@ -269,17 +270,17 @@ class ArticleFragment : Fragment(), DIAware {
url = response.data!!.url
} catch (e: MalformedURLException) {
// Mercury returned a relative url
e.sendSilentlyWithAcra()
e.sendSilentlyWithAcraWithName("getContentFromMercury > malformedurlexception")
}
} catch (e: Exception) {
e.sendSilentlyWithAcra()
e.sendSilentlyWithAcraWithName("getContentFromMercury > title or typeface")
}
try {
contentText = response.data!!.content.orEmpty()
htmlToWebview()
} catch (e: Exception) {
e.sendSilentlyWithAcra()
e.sendSilentlyWithAcraWithName("getContentFromMercury > contenttext or html")
}
try {
@ -295,13 +296,13 @@ class ArticleFragment : Fragment(), DIAware {
.apply(RequestOptions.fitCenterTransform())
.into(binding.imageView)
} catch (e: Exception) {
e.sendSilentlyWithAcra()
e.sendSilentlyWithAcraWithName("getContentFromMercury > glide lead image")
}
} else {
binding.imageView.visibility = View.GONE
}
} catch (e: Exception) {
e.sendSilentlyWithAcra()
e.sendSilentlyWithAcraWithName("getContentFromMercury > outside glide lead image")
}
try {
@ -309,17 +310,17 @@ class ArticleFragment : Fragment(), DIAware {
binding.progressBar.visibility = View.GONE
} catch (e: Exception) {
e.sendSilentlyWithAcra()
e.sendSilentlyWithAcraWithName("getContentFromMercury > scrollview")
}
} else {
try {
openInBrowserAfterFailing()
} catch (e: Exception) {
e.sendSilentlyWithAcra()
e.sendSilentlyWithAcraWithName("getContentFromMercury > open after fail")
}
}
} catch (e: Exception) {
e.sendSilentlyWithAcra()
e.sendSilentlyWithAcraWithName("getContentFromMercury > whole thing")
}
} else {
openInBrowserAfterFailing()
@ -364,7 +365,7 @@ class ArticleFragment : Fragment(), DIAware {
val image = Glide.with(view).asBitmap().apply(glideOptions).load(url).submit().get()
return WebResourceResponse("image/jpg", "UTF-8", getBitmapInputStream(image, Bitmap.CompressFormat.JPEG))
} catch ( e : ExecutionException) {
e.sendSilentlyWithAcra()
e.sendSilentlyWithAcraWithName("shouldInterceptRequest > jpeg")
}
}
else if (url.lowercase(Locale.US).contains(".png")) {
@ -372,7 +373,7 @@ class ArticleFragment : Fragment(), DIAware {
val image = Glide.with(view).asBitmap().apply(glideOptions).load(url).submit().get()
return WebResourceResponse("image/jpg", "UTF-8", getBitmapInputStream(image, Bitmap.CompressFormat.PNG))
} catch ( e : ExecutionException) {
e.sendSilentlyWithAcra()
e.sendSilentlyWithAcraWithName("shouldInterceptRequest > png")
}
}
else if (url.lowercase(Locale.US).contains(".webp")) {
@ -380,7 +381,7 @@ class ArticleFragment : Fragment(), DIAware {
val image = Glide.with(view).asBitmap().apply(glideOptions).load(url).submit().get()
return WebResourceResponse("image/jpg", "UTF-8", getBitmapInputStream(image, Bitmap.CompressFormat.WEBP))
} catch ( e : ExecutionException) {
e.sendSilentlyWithAcra()
e.sendSilentlyWithAcraWithName("shouldInterceptRequest > webp")
}
}
@ -405,7 +406,7 @@ class ArticleFragment : Fragment(), DIAware {
val itemUrl = URL(url)
baseUrl = itemUrl.protocol + "://" + itemUrl.host
} catch (e: MalformedURLException) {
e.sendSilentlyWithAcra()
e.sendSilentlyWithAcraWithName("htmlToWebview > item url")
}
val fontName = when (font) {

View File

@ -2,6 +2,7 @@ package bou.amine.apps.readerforselfossv2.android.model
import android.content.Context
import android.webkit.URLUtil
import bou.amine.apps.readerforselfossv2.android.sendSilentlyWithAcraWithName
import bou.amine.apps.readerforselfossv2.model.SelfossModel
import bou.amine.apps.readerforselfossv2.utils.getImages
import com.bumptech.glide.Glide
@ -24,7 +25,7 @@ fun SelfossModel.Item.preloadImages(context: Context) : Boolean {
}
}
} catch (e : Error) {
e.sendSilentlyWithAcra()
e.sendSilentlyWithAcraWithName("preloadImages")
return false
}
@ -37,7 +38,7 @@ fun String.toTextDrawableString(): String {
try {
textDrawable.append(s[0])
} catch (e: StringIndexOutOfBoundsException) {
e.sendSilentlyWithAcra()
e.sendSilentlyWithAcraWithName("toTextDrawableString")
}
}
return textDrawable.toString()

View File

@ -16,6 +16,7 @@ import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import bou.amine.apps.readerforselfossv2.android.R
import bou.amine.apps.readerforselfossv2.android.databinding.ActivitySettingsBinding
import bou.amine.apps.readerforselfossv2.android.sendSilentlyWithAcraWithName
import bou.amine.apps.readerforselfossv2.service.AppSettingsService
import org.acra.ktx.sendSilentlyWithAcra
import org.acra.ktx.sendWithAcra
@ -124,7 +125,7 @@ class SettingsActivity : AppCompatActivity(),
val input: Int = (dest.toString() + source.toString()).toInt()
if (input in 1..200) return@InputFilter null
} catch (nfe: NumberFormatException) {
nfe.sendSilentlyWithAcra()
nfe.sendSilentlyWithAcraWithName("GeneralPreferenceFragment")
Toast.makeText(activity, R.string.items_number_should_be_number, Toast.LENGTH_LONG).show()
}
""
@ -148,7 +149,7 @@ class SettingsActivity : AppCompatActivity(),
try {
editText.textSize = editable.toString().toInt().toFloat()
} catch (e: NumberFormatException) {
e.sendSilentlyWithAcra()
e.sendSilentlyWithAcraWithName("ArticleViewerPreferenceFragment > afterTextChanged")
}
}
} }
@ -158,7 +159,7 @@ class SettingsActivity : AppCompatActivity(),
val input = (dest.toString() + source.toString()).toInt()
if (input > 0) return@InputFilter null
} catch (nfe: NumberFormatException) {
nfe.sendSilentlyWithAcra()
nfe.sendSilentlyWithAcraWithName("ArticleViewerPreferenceFragment > filters")
}
""
}