A lot of logs to clean after solving an issue.

This commit is contained in:
Amine Bou 2018-01-11 21:21:40 +01:00
parent b126fc32da
commit b51ae58a97

View File

@ -163,41 +163,103 @@ class ArticleFragment : Fragment() {
call: Call<ParsedContent>, call: Call<ParsedContent>,
response: Response<ParsedContent> response: Response<ParsedContent>
) { ) {
// TODO: clean all the following after finding the mercury content issue
try { try {
if (response.body() != null && response.body()!!.content != null && !response.body()!!.content.isNullOrEmpty()) { if (response.body() != null && response.body()!!.content != null && !response.body()!!.content.isNullOrEmpty()) {
rootView.source.text = response.body()!!.domain try {
rootView.titleView.text = response.body()!!.title rootView.source.text = response.body()!!.domain
url = response.body()!!.url rootView.titleView.text = response.body()!!.title
url = response.body()!!.url
htmlToWebview(response.body()!!.content.orEmpty(), prefs) } catch (e: Exception) {
Crashlytics.setUserIdentifier(prefs.getString("unique_id", ""))
if (response.body()!!.lead_image_url != null && !response.body()!!.lead_image_url.isNullOrEmpty()) { Crashlytics.log(
rootView.imageView.visibility = View.VISIBLE 100,
Glide "MERCURY_CONTENT_EXCEPTION",
.with(activity!!.baseContext) "source titleView or url issues"
.asBitmap() )
.load(response.body()!!.lead_image_url) Crashlytics.logException(e)
.apply(RequestOptions.fitCenterTransform())
.into(rootView.imageView)
} else {
rootView.imageView.visibility = View.GONE
} }
rootView.nestedScrollView.scrollTo(0, 0) try {
htmlToWebview(response.body()!!.content.orEmpty(), prefs)
} catch (e: Exception) {
Crashlytics.setUserIdentifier(prefs.getString("unique_id", ""))
Crashlytics.log(
100,
"MERCURY_CONTENT_EXCEPTION",
"Webview issue"
)
Crashlytics.logException(e)
}
rootView.progressBar.visibility = View.GONE try {
if (response.body()!!.lead_image_url != null && !response.body()!!.lead_image_url.isNullOrEmpty()) {
rootView.imageView.visibility = View.VISIBLE
try {
Glide
.with(activity!!.baseContext)
.asBitmap()
.load(response.body()!!.lead_image_url)
.apply(RequestOptions.fitCenterTransform())
.into(rootView.imageView)
} catch (e: Exception) {
Crashlytics.setUserIdentifier(prefs.getString("unique_id", ""))
Crashlytics.log(
100,
"MERCURY_CONTENT_EXCEPTION",
"Glide issue"
)
Crashlytics.logException(e)
}
} else {
rootView.imageView.visibility = View.GONE
}
} catch (e: Exception) {
Crashlytics.setUserIdentifier(prefs.getString("unique_id", ""))
Crashlytics.log(
100,
"MERCURY_CONTENT_EXCEPTION",
"Glide or image issue"
)
Crashlytics.logException(e)
}
try {
rootView.nestedScrollView.scrollTo(0, 0)
rootView.progressBar.visibility = View.GONE
} catch (e: Exception) {
Crashlytics.setUserIdentifier(prefs.getString("unique_id", ""))
Crashlytics.log(
100,
"MERCURY_CONTENT_EXCEPTION",
"Scroll or visibility issues"
)
Crashlytics.logException(e)
}
} else { } else {
openInBrowserAfterFailing(customTabsIntent) try {
openInBrowserAfterFailing(customTabsIntent)
} catch (e: Exception) {
Crashlytics.setUserIdentifier(prefs.getString("unique_id", ""))
Crashlytics.log(
100,
"MERCURY_CONTENT_EXCEPTION",
"Browser after failing issue"
)
Crashlytics.logException(e)
}
} }
} catch (e: Exception) { } catch (e: Exception) {
Crashlytics.setUserIdentifier(prefs.getString("unique_id", "")) Crashlytics.setUserIdentifier(prefs.getString("unique_id", ""))
Crashlytics.log( Crashlytics.log(
100, 100,
"MERCURY_CONTENT_EXCEPTION", "MERCURY_CONTENT_EXCEPTION",
"Fatal Exception on mercury response" "UNCAUGHT (?) Fatal Exception on mercury response"
) )
Crashlytics.logException(e) Crashlytics.logException(e)
} }
} }
override fun onFailure( override fun onFailure(