Skip to content

Commit

Permalink
feat: show button to view crash log in settings for debug builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Bnyro committed Nov 20, 2024
1 parent 0585225 commit b7c0d98
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import androidx.lifecycle.lifecycleScope
import androidx.preference.Preference
import com.github.libretube.BuildConfig
import com.github.libretube.R
import com.github.libretube.helpers.PreferenceHelper
import com.github.libretube.ui.base.BasePreferenceFragment
import com.github.libretube.ui.dialogs.ErrorDialog
import com.github.libretube.util.UpdateChecker
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
Expand All @@ -27,5 +29,13 @@ class MainSettings : BasePreferenceFragment() {

true
}

val crashlog = findPreference<Preference>("crashlog")
crashlog?.isVisible = PreferenceHelper.getErrorLog().isNotEmpty() && BuildConfig.DEBUG
crashlog?.setOnPreferenceClickListener {
ErrorDialog().show(childFragmentManager, null)
crashlog.isVisible = false
true
}
}
}
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@
<string name="behavior_when_minimized">Behavior when minimized</string>
<string name="external_player">External player</string>
<string name="screenshot">Screenshot</string>
<string name="crashlog">Crashlog</string>

<!-- Backup & Restore Settings -->
<string name="import_subscriptions_from">Import subscriptions from</string>
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/xml/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@
app:summary="@string/version"
app:title="@string/update_summary" />

<Preference
android:icon="@drawable/ic_info"
app:key="crashlog"
app:title="@string/crashlog"/>

</PreferenceCategory>

</PreferenceScreen>

0 comments on commit b7c0d98

Please sign in to comment.