Settings for silent debug.
This commit is contained in:
parent
f8d3e1eefb
commit
eb02d1efad
@ -40,6 +40,7 @@ import apps.amine.bou.readerforselfoss.utils.customtabs.CustomTabActivityHelper
|
|||||||
import apps.amine.bou.readerforselfoss.utils.drawer.CustomUrlPrimaryDrawerItem
|
import apps.amine.bou.readerforselfoss.utils.drawer.CustomUrlPrimaryDrawerItem
|
||||||
import apps.amine.bou.readerforselfoss.utils.flattenTags
|
import apps.amine.bou.readerforselfoss.utils.flattenTags
|
||||||
import apps.amine.bou.readerforselfoss.utils.longHash
|
import apps.amine.bou.readerforselfoss.utils.longHash
|
||||||
|
import apps.amine.bou.readerforselfoss.utils.maybeHandleSilentException
|
||||||
import co.zsmb.materialdrawerkt.builders.accountHeader
|
import co.zsmb.materialdrawerkt.builders.accountHeader
|
||||||
import co.zsmb.materialdrawerkt.builders.drawer
|
import co.zsmb.materialdrawerkt.builders.drawer
|
||||||
import co.zsmb.materialdrawerkt.builders.footer
|
import co.zsmb.materialdrawerkt.builders.footer
|
||||||
@ -64,6 +65,7 @@ import com.mikepenz.materialdrawer.model.DividerDrawerItem
|
|||||||
import com.mikepenz.materialdrawer.model.PrimaryDrawerItem
|
import com.mikepenz.materialdrawer.model.PrimaryDrawerItem
|
||||||
import com.mikepenz.materialdrawer.model.SecondaryDrawerItem
|
import com.mikepenz.materialdrawer.model.SecondaryDrawerItem
|
||||||
import kotlinx.android.synthetic.main.activity_home.*
|
import kotlinx.android.synthetic.main.activity_home.*
|
||||||
|
import org.acra.ACRA
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
@ -162,13 +164,11 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
handleDrawer()
|
handleDrawer()
|
||||||
|
|
||||||
handleSwipeRefreshLayout()
|
handleSwipeRefreshLayout()
|
||||||
|
|
||||||
throw NullPointerException()
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleGDPRDialog(GDPRShown: Boolean) {
|
private fun handleGDPRDialog(GDPRShown: Boolean) {
|
||||||
if (!GDPRShown) {
|
if (!GDPRShown) {
|
||||||
|
val sharedEditor = sharedPref.edit()
|
||||||
val alertDialog = AlertDialog.Builder(this).create()
|
val alertDialog = AlertDialog.Builder(this).create()
|
||||||
alertDialog.setTitle(getString(R.string.gdpr_dialog_title))
|
alertDialog.setTitle(getString(R.string.gdpr_dialog_title))
|
||||||
alertDialog.setMessage(getString(R.string.gdpr_dialog_message))
|
alertDialog.setMessage(getString(R.string.gdpr_dialog_message))
|
||||||
@ -176,8 +176,8 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
AlertDialog.BUTTON_NEUTRAL,
|
AlertDialog.BUTTON_NEUTRAL,
|
||||||
"OK",
|
"OK",
|
||||||
{ dialog, _ ->
|
{ dialog, _ ->
|
||||||
editor.putBoolean("GDPR_shown", true)
|
sharedEditor.putBoolean("GDPR_shown", true)
|
||||||
editor.commit()
|
sharedEditor.commit()
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -20,6 +20,7 @@ import apps.amine.bou.readerforselfoss.api.selfoss.SuccessResponse
|
|||||||
import apps.amine.bou.readerforselfoss.themes.AppColors
|
import apps.amine.bou.readerforselfoss.themes.AppColors
|
||||||
import apps.amine.bou.readerforselfoss.utils.Config
|
import apps.amine.bou.readerforselfoss.utils.Config
|
||||||
import apps.amine.bou.readerforselfoss.utils.isBaseUrlValid
|
import apps.amine.bou.readerforselfoss.utils.isBaseUrlValid
|
||||||
|
import apps.amine.bou.readerforselfoss.utils.maybeHandleSilentException
|
||||||
import com.mikepenz.aboutlibraries.Libs
|
import com.mikepenz.aboutlibraries.Libs
|
||||||
import com.mikepenz.aboutlibraries.LibsBuilder
|
import com.mikepenz.aboutlibraries.LibsBuilder
|
||||||
import kotlinx.android.synthetic.main.activity_login.*
|
import kotlinx.android.synthetic.main.activity_login.*
|
||||||
@ -209,7 +210,7 @@ class LoginActivity : AppCompatActivity() {
|
|||||||
httpLoginView.error = getString(R.string.wrong_infos)
|
httpLoginView.error = getString(R.string.wrong_infos)
|
||||||
httpPasswordView.error = getString(R.string.wrong_infos)
|
httpPasswordView.error = getString(R.string.wrong_infos)
|
||||||
if (logErrors) {
|
if (logErrors) {
|
||||||
ACRA.getErrorReporter().handleSilentException(t)
|
ACRA.getErrorReporter().maybeHandleSilentException(t, this@LoginActivity)
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
this@LoginActivity,
|
this@LoginActivity,
|
||||||
t.message,
|
t.message,
|
||||||
|
@ -22,6 +22,7 @@ import apps.amine.bou.readerforselfoss.themes.AppColors
|
|||||||
import apps.amine.bou.readerforselfoss.themes.Toppings
|
import apps.amine.bou.readerforselfoss.themes.Toppings
|
||||||
import apps.amine.bou.readerforselfoss.transformers.DepthPageTransformer
|
import apps.amine.bou.readerforselfoss.transformers.DepthPageTransformer
|
||||||
import apps.amine.bou.readerforselfoss.utils.Config
|
import apps.amine.bou.readerforselfoss.utils.Config
|
||||||
|
import apps.amine.bou.readerforselfoss.utils.maybeHandleSilentException
|
||||||
import apps.amine.bou.readerforselfoss.utils.succeeded
|
import apps.amine.bou.readerforselfoss.utils.succeeded
|
||||||
import apps.amine.bou.readerforselfoss.utils.toggleStar
|
import apps.amine.bou.readerforselfoss.utils.toggleStar
|
||||||
import com.ftinc.scoop.Scoop
|
import com.ftinc.scoop.Scoop
|
||||||
@ -132,7 +133,7 @@ class ReaderActivity : AppCompatActivity() {
|
|||||||
"response errorBody: ${response.errorBody()?.string()} " +
|
"response errorBody: ${response.errorBody()?.string()} " +
|
||||||
"body success: ${response.body()?.success} " +
|
"body success: ${response.body()?.success} " +
|
||||||
"body isSuccess: ${response.body()?.isSuccess}"
|
"body isSuccess: ${response.body()?.isSuccess}"
|
||||||
ACRA.getErrorReporter().handleSilentException(Exception(message))
|
ACRA.getErrorReporter().maybeHandleSilentException(Exception(message), this@ReaderActivity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +142,7 @@ class ReaderActivity : AppCompatActivity() {
|
|||||||
t: Throwable
|
t: Throwable
|
||||||
) {
|
) {
|
||||||
if (debugReadingItems) {
|
if (debugReadingItems) {
|
||||||
ACRA.getErrorReporter().handleSilentException(t)
|
ACRA.getErrorReporter().maybeHandleSilentException(t, this@ReaderActivity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import apps.amine.bou.readerforselfoss.api.selfoss.Item
|
|||||||
import apps.amine.bou.readerforselfoss.api.selfoss.SelfossApi
|
import apps.amine.bou.readerforselfoss.api.selfoss.SelfossApi
|
||||||
import apps.amine.bou.readerforselfoss.api.selfoss.SuccessResponse
|
import apps.amine.bou.readerforselfoss.api.selfoss.SuccessResponse
|
||||||
import apps.amine.bou.readerforselfoss.themes.AppColors
|
import apps.amine.bou.readerforselfoss.themes.AppColors
|
||||||
|
import apps.amine.bou.readerforselfoss.utils.maybeHandleSilentException
|
||||||
import apps.amine.bou.readerforselfoss.utils.succeeded
|
import apps.amine.bou.readerforselfoss.utils.succeeded
|
||||||
import org.acra.ACRA
|
import org.acra.ACRA
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
@ -89,7 +90,7 @@ abstract class ItemsAdapter<VH : RecyclerView.ViewHolder?> : RecyclerView.Adapte
|
|||||||
"response errorBody: ${response.errorBody()?.string()} " +
|
"response errorBody: ${response.errorBody()?.string()} " +
|
||||||
"body success: ${response.body()?.success} " +
|
"body success: ${response.body()?.success} " +
|
||||||
"body isSuccess: ${response.body()?.isSuccess}"
|
"body isSuccess: ${response.body()?.isSuccess}"
|
||||||
ACRA.getErrorReporter().handleSilentException(Exception(message))
|
ACRA.getErrorReporter().maybeHandleSilentException(Exception(message), app)
|
||||||
Toast.makeText(app.baseContext, message, Toast.LENGTH_LONG).show()
|
Toast.makeText(app.baseContext, message, Toast.LENGTH_LONG).show()
|
||||||
}
|
}
|
||||||
doUnmark(i, position)
|
doUnmark(i, position)
|
||||||
@ -97,7 +98,7 @@ abstract class ItemsAdapter<VH : RecyclerView.ViewHolder?> : RecyclerView.Adapte
|
|||||||
|
|
||||||
override fun onFailure(call: Call<SuccessResponse>, t: Throwable) {
|
override fun onFailure(call: Call<SuccessResponse>, t: Throwable) {
|
||||||
if (debugReadingItems) {
|
if (debugReadingItems) {
|
||||||
ACRA.getErrorReporter().handleSilentException(t)
|
ACRA.getErrorReporter().maybeHandleSilentException(t, app)
|
||||||
Toast.makeText(app.baseContext, t.message, Toast.LENGTH_LONG).show()
|
Toast.makeText(app.baseContext, t.message, Toast.LENGTH_LONG).show()
|
||||||
}
|
}
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
|
@ -29,6 +29,7 @@ import apps.amine.bou.readerforselfoss.themes.AppColors
|
|||||||
import apps.amine.bou.readerforselfoss.utils.buildCustomTabsIntent
|
import apps.amine.bou.readerforselfoss.utils.buildCustomTabsIntent
|
||||||
import apps.amine.bou.readerforselfoss.utils.customtabs.CustomTabActivityHelper
|
import apps.amine.bou.readerforselfoss.utils.customtabs.CustomTabActivityHelper
|
||||||
import apps.amine.bou.readerforselfoss.utils.isEmptyOrNullOrNullString
|
import apps.amine.bou.readerforselfoss.utils.isEmptyOrNullOrNullString
|
||||||
|
import apps.amine.bou.readerforselfoss.utils.maybeHandleSilentException
|
||||||
import apps.amine.bou.readerforselfoss.utils.openItemUrl
|
import apps.amine.bou.readerforselfoss.utils.openItemUrl
|
||||||
import apps.amine.bou.readerforselfoss.utils.shareLink
|
import apps.amine.bou.readerforselfoss.utils.shareLink
|
||||||
import apps.amine.bou.readerforselfoss.utils.sourceAndDateText
|
import apps.amine.bou.readerforselfoss.utils.sourceAndDateText
|
||||||
@ -196,13 +197,13 @@ class ArticleFragment : Fragment() {
|
|||||||
rootView.titleView.text = response.body()!!.title
|
rootView.titleView.text = response.body()!!.title
|
||||||
url = response.body()!!.url
|
url = response.body()!!.url
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
ACRA.getErrorReporter().handleSilentException(e)
|
ACRA.getErrorReporter().maybeHandleSilentException(e, context)
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
htmlToWebview(response.body()!!.content.orEmpty(), prefs, context)
|
htmlToWebview(response.body()!!.content.orEmpty(), prefs, context)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
ACRA.getErrorReporter().handleSilentException(e)
|
ACRA.getErrorReporter().maybeHandleSilentException(e, context)
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -216,13 +217,13 @@ class ArticleFragment : Fragment() {
|
|||||||
.apply(RequestOptions.fitCenterTransform())
|
.apply(RequestOptions.fitCenterTransform())
|
||||||
.into(rootView.imageView)
|
.into(rootView.imageView)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
ACRA.getErrorReporter().handleSilentException(e)
|
ACRA.getErrorReporter().maybeHandleSilentException(e, context)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rootView.imageView.visibility = View.GONE
|
rootView.imageView.visibility = View.GONE
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
ACRA.getErrorReporter().handleSilentException(e)
|
ACRA.getErrorReporter().maybeHandleSilentException(e, context)
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -230,17 +231,17 @@ class ArticleFragment : Fragment() {
|
|||||||
|
|
||||||
rootView.progressBar.visibility = View.GONE
|
rootView.progressBar.visibility = View.GONE
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
ACRA.getErrorReporter().handleSilentException(e)
|
ACRA.getErrorReporter().maybeHandleSilentException(e, context)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
openInBrowserAfterFailing(customTabsIntent)
|
openInBrowserAfterFailing(customTabsIntent)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
ACRA.getErrorReporter().handleSilentException(e)
|
ACRA.getErrorReporter().maybeHandleSilentException(e, context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
ACRA.getErrorReporter().handleSilentException(e)
|
ACRA.getErrorReporter().maybeHandleSilentException(e, context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
package apps.amine.bou.readerforselfoss.utils
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.preference.PreferenceManager
|
||||||
|
import org.acra.ErrorReporter
|
||||||
|
|
||||||
|
fun ErrorReporter.maybeHandleSilentException(throwable: Throwable, ctx: Context) {
|
||||||
|
val sharedPref = PreferenceManager.getDefaultSharedPreferences(ctx)
|
||||||
|
if (sharedPref.getBoolean("acra_should_log", false)) {
|
||||||
|
this.handleSilentException(throwable)
|
||||||
|
}
|
||||||
|
}
|
@ -14,7 +14,7 @@ fun String.toTextDrawableString(c: Context): String {
|
|||||||
try {
|
try {
|
||||||
textDrawable.append(s[0])
|
textDrawable.append(s[0])
|
||||||
} catch (e: StringIndexOutOfBoundsException) {
|
} catch (e: StringIndexOutOfBoundsException) {
|
||||||
ACRA.getErrorReporter().handleSilentException(e)
|
ACRA.getErrorReporter().maybeHandleSilentException(e, c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return textDrawable.toString()
|
return textDrawable.toString()
|
||||||
|
@ -168,4 +168,5 @@
|
|||||||
<string name="pref_acra_alwaysaccept_disabled">Will ask everytime when sending crash reports.</string>
|
<string name="pref_acra_alwaysaccept_disabled">Will ask everytime when sending crash reports.</string>
|
||||||
<string name="pref_debug_crash_reports">Crash reports</string>
|
<string name="pref_debug_crash_reports">Crash reports</string>
|
||||||
<string name="pref_debug_debug_logs">Debug logging (these will be sent without a dialog)</string>
|
<string name="pref_debug_debug_logs">Debug logging (these will be sent without a dialog)</string>
|
||||||
|
<string name="acra_login">Enable logging</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -15,23 +15,31 @@
|
|||||||
android:title="@string/pref_acra_alwaysaccept" />
|
android:title="@string/pref_acra_alwaysaccept" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory>
|
<PreferenceCategory android:title="@string/pref_debug_debug_logs">
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="acra_should_log"
|
||||||
|
android:title="@string/acra_login" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="should_log_everything"
|
android:key="should_log_everything"
|
||||||
|
android:dependency="acra_should_log"
|
||||||
android:summaryOff="@string/login_everything_off"
|
android:summaryOff="@string/login_everything_off"
|
||||||
android:summaryOn="@string/login_everything_on"
|
android:summaryOn="@string/login_everything_on"
|
||||||
android:title="@string/login_everything_title" />
|
android:title="@string/login_everything_title" />
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="login_debug"
|
android:key="login_debug"
|
||||||
|
android:dependency="acra_should_log"
|
||||||
android:summaryOff="@string/login_debug_off"
|
android:summaryOff="@string/login_debug_off"
|
||||||
android:summaryOn="@string/login_debug_on"
|
android:summaryOn="@string/login_debug_on"
|
||||||
android:title="@string/login_debug_title" />
|
android:title="@string/login_debug_title" />
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="read_debug"
|
android:key="read_debug"
|
||||||
|
android:dependency="acra_should_log"
|
||||||
android:summaryOff="@string/read_debug_off"
|
android:summaryOff="@string/read_debug_off"
|
||||||
android:summaryOn="@string/read_debug_on"
|
android:summaryOn="@string/read_debug_on"
|
||||||
android:title="@string/read_debug_title" />
|
android:title="@string/read_debug_title" />
|
||||||
|
Loading…
Reference in New Issue
Block a user