Skip to content

Commit 605855e

Browse files
committed
Debug log: turn always on, replace setting with link, note in changelog
1 parent 4430160 commit 605855e

File tree

7 files changed

+28
-61
lines changed

7 files changed

+28
-61
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ Releases marked with 🧪 (or previously with the "beta" suffix) were released o
1010

1111
## Version 2025.3
1212

13+
### Next release
14+
15+
* 🔧 Debug log: change to always on, keep messages on app restarts and up to 3 days.
16+
1317
### 2025.3.2 - 2025-11-06 🧪
1418

1519
* 🔧 If the screen is wide enough, display a more compact bottom navigation bar.

app/src/main/java/com/battlelancer/seriesguide/SgApp.kt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: Apache-2.0
2-
// Copyright 2011-2025 Uwe Trottmann
3-
// Copyright 2013 Andrew Neal
2+
// SPDX-FileCopyrightText: Copyright © 2011 Uwe Trottmann <[email protected]>
3+
// SPDX-FileCopyrightText: Copyright © 2013 Andrew Neal
44

55
package com.battlelancer.seriesguide
66

@@ -193,10 +193,8 @@ class SgApp : Application() {
193193
// logcat logging
194194
Timber.plant(Timber.DebugTree())
195195
}
196-
if (AppSettings.isUserDebugModeEnabled(this)) {
197-
// debug log
198-
appContainer.debugLogBuffer.enable()
199-
}
196+
// Enable persistent debug log
197+
appContainer.debugLogBuffer.enable()
200198

201199
// Note: Firebase Crashlytics is automatically initialized through its content provider.
202200
// Pass current enabled state to Crashlytics (e.g. in case app was restored from backup).

app/src/main/java/com/battlelancer/seriesguide/preferences/MoreOptionsActivity.kt

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: Apache-2.0
2-
// Copyright 2020-2025 Uwe Trottmann
2+
// SPDX-FileCopyrightText: Copyright © 2020 Uwe Trottmann <[email protected]>
33

44
package com.battlelancer.seriesguide.preferences
55

@@ -19,8 +19,6 @@ import com.battlelancer.seriesguide.billing.BillingTools
1919
import com.battlelancer.seriesguide.databinding.ActivityMoreOptionsBinding
2020
import com.battlelancer.seriesguide.dataliberation.BackupSettings
2121
import com.battlelancer.seriesguide.dataliberation.DataLiberationActivity
22-
import com.battlelancer.seriesguide.diagnostics.DebugLogActivity
23-
import com.battlelancer.seriesguide.settings.AppSettings
2422
import com.battlelancer.seriesguide.sync.SyncProgress
2523
import com.battlelancer.seriesguide.traktapi.ConnectTraktActivity
2624
import com.battlelancer.seriesguide.traktapi.TraktCredentials
@@ -91,9 +89,6 @@ class MoreOptionsActivity : BaseTopActivity() {
9189
startActivity(getFeedbackEmailIntent(this))
9290
}
9391
binding.buttonTranslations.openUriOnClick(getString(R.string.url_translations))
94-
binding.buttonDebugLog.setOnClickListener {
95-
startActivity(DebugLogActivity.intent(this))
96-
}
9792
binding.buttonDebugView.apply {
9893
setOnClickListener {
9994
DebugViewFragment().safeShow(supportFragmentManager, "debugViewDialog")
@@ -134,9 +129,6 @@ class MoreOptionsActivity : BaseTopActivity() {
134129

135130
// Update supporter status.
136131
binding.textViewThankYouSupporters.isGone = !BillingTools.hasAccessToPaidFeatures()
137-
138-
// Show debug log button if debug mode is on.
139-
binding.buttonDebugLog.isGone = !AppSettings.isUserDebugModeEnabled(this)
140132
}
141133

142134

app/src/main/java/com/battlelancer/seriesguide/preferences/SgPreferencesFragment.kt

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@ import androidx.preference.ListPreference
2323
import androidx.preference.Preference
2424
import androidx.preference.PreferenceManager
2525
import androidx.preference.SwitchPreferenceCompat
26-
import com.battlelancer.seriesguide.BuildConfig
2726
import com.battlelancer.seriesguide.R
2827
import com.battlelancer.seriesguide.appwidget.ListWidgetProvider
2928
import com.battlelancer.seriesguide.billing.BillingTools
30-
import com.battlelancer.seriesguide.getSgAppContainer
29+
import com.battlelancer.seriesguide.diagnostics.DebugLogActivity
3130
import com.battlelancer.seriesguide.notifications.NotificationService
3231
import com.battlelancer.seriesguide.provider.SgRoomDatabase
3332
import com.battlelancer.seriesguide.settings.AppSettings
@@ -101,11 +100,9 @@ class SgPreferencesFragment : BasePreferencesFragment(),
101100
}
102101
}
103102

104-
if (BuildConfig.DEBUG) {
105-
findPreference<SwitchPreferenceCompat>(AppSettings.KEY_USER_DEBUG_MODE_ENABLED)!!.apply {
106-
isEnabled = false
107-
isChecked = true
108-
}
103+
findPreference<Preference>(KEY_LINK_DEBUG_LOG)!!.setOnPreferenceClickListener {
104+
startActivity(DebugLogActivity.intent(requireActivity()))
105+
true
109106
}
110107
}
111108

@@ -445,17 +442,6 @@ class SgPreferencesFragment : BasePreferencesFragment(),
445442
val switchPref = pref as SwitchPreferenceCompat
446443
AppSettings.setSendErrorReports(switchPref.context, switchPref.isChecked, false)
447444
}
448-
449-
// Enable or disable debug log
450-
if (AppSettings.KEY_USER_DEBUG_MODE_ENABLED == key) {
451-
val switchPref = pref as SwitchPreferenceCompat
452-
val debugLogBuffer = requireActivity().getSgAppContainer().debugLogBuffer
453-
if (switchPref.isChecked) {
454-
debugLogBuffer.enable()
455-
} else {
456-
debugLogBuffer.disable()
457-
}
458-
}
459445
}
460446

461447
// pref changes that require the notification service to be reset
@@ -564,6 +550,7 @@ class SgPreferencesFragment : BasePreferencesFragment(),
564550

565551
// Keys that are not actual preferences, but links
566552
private const val KEY_LINK_CLEAR_CACHE = "seriesguide.settings.link.clearcache"
553+
private const val KEY_LINK_DEBUG_LOG = "seriesguide.settings.link.debuglog"
567554
private const val KEY_LINK_NOTIFICATION_SETTINGS =
568555
"seriesguide.settings.link.notifications"
569556
private const val KEY_LINK_BATTERY_SETTINGS =

app/src/main/java/com/battlelancer/seriesguide/settings/AppSettings.kt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: Apache-2.0
2-
// Copyright 2013-2025 Uwe Trottmann
2+
// SPDX-FileCopyrightText: Copyright © 2013 Uwe Trottmann <[email protected]>
33

44
package com.battlelancer.seriesguide.settings
55

@@ -17,16 +17,15 @@ object AppSettings {
1717

1818
const val KEY_VERSION = "oldversioncode"
1919

20-
@Deprecated("")
21-
const val KEY_GOOGLEANALYTICS = "enableGAnalytics"
22-
23-
@Deprecated("")
24-
const val KEY_HAS_SEEN_NAV_DRAWER = "hasSeenNavDrawer"
2520
const val KEY_ASKED_FOR_FEEDBACK = "askedForFeedback"
2621
const val KEY_SEND_ERROR_REPORTS = "com.battlelancer.seriesguide.sendErrorReports"
27-
const val KEY_USER_DEBUG_MODE_ENABLED = "com.battlelancer.seriesguide.userDebugModeEnabled"
2822
const val KEY_DEMO_MODE_ENABLED = "com.uwetrottmann.seriesguide.demoMode"
2923

24+
// Previously used keys, don't use them as preferences file might contain values for them
25+
// const val KEY_GOOGLEANALYTICS = "enableGAnalytics"
26+
// const val KEY_HAS_SEEN_NAV_DRAWER = "hasSeenNavDrawer"
27+
// const val KEY_USER_DEBUG_MODE_ENABLED = "com.battlelancer.seriesguide.userDebugModeEnabled"
28+
3029
/**
3130
* Returns the version code of the previously installed version. Is the current version on fresh
3231
* installs.
@@ -87,14 +86,15 @@ object AppSettings {
8786
Errors.getReporter()?.setCrashlyticsCollectionEnabled(isEnabled)
8887
}
8988

89+
// Currently not used, but leaving this here for future use.
9090
/**
9191
* Returns if debug components for users, which might have a performance impact, should be
9292
* enabled (for ex. debug log). Always true for debug builds.
9393
*/
94-
fun isUserDebugModeEnabled(context: Context): Boolean {
95-
return BuildConfig.DEBUG || PreferenceManager.getDefaultSharedPreferences(context)
96-
.getBoolean(KEY_USER_DEBUG_MODE_ENABLED, false)
97-
}
94+
// fun isUserDebugModeEnabled(context: Context): Boolean {
95+
// return BuildConfig.DEBUG || PreferenceManager.getDefaultSharedPreferences(context)
96+
// .getBoolean(KEY_USER_DEBUG_MODE_ENABLED, false)
97+
// }
9898

9999
fun setDemoModeState(context: Context, isEnabled: Boolean) {
100100
if (!BuildConfig.DEBUG) {

app/src/main/res/layout/activity_more_options.xml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -238,18 +238,6 @@
238238
app:layout_constraintStart_toStartOf="parent"
239239
app:layout_constraintTop_toBottomOf="@+id/buttonFeedback" />
240240

241-
<Button
242-
android:id="@+id/buttonDebugLog"
243-
style="@style/Widget.SeriesGuide.Button.Borderless.Sheet"
244-
android:layout_width="0dp"
245-
android:layout_height="48dp"
246-
android:text="@string/title_debug_log"
247-
app:icon="@drawable/ic_extension_black_24dp"
248-
app:iconGravity="start"
249-
app:layout_constraintEnd_toEndOf="parent"
250-
app:layout_constraintStart_toStartOf="parent"
251-
app:layout_constraintTop_toBottomOf="@+id/buttonTranslations" />
252-
253241
<Button
254242
android:id="@+id/buttonDebugView"
255243
style="@style/Widget.SeriesGuide.Button.Borderless.Sheet"
@@ -260,7 +248,7 @@
260248
app:iconGravity="start"
261249
app:layout_constraintEnd_toEndOf="parent"
262250
app:layout_constraintStart_toStartOf="parent"
263-
app:layout_constraintTop_toBottomOf="@+id/buttonDebugLog" />
251+
app:layout_constraintTop_toBottomOf="@+id/buttonTranslations" />
264252

265253
<Button
266254
android:id="@+id/buttonMoreWhatsNew"

app/src/main/res/xml/settings_root.xml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,9 @@
7272
app:key="com.battlelancer.seriesguide.sendErrorReports"
7373
app:title="@string/pref_error_reports" />
7474

75-
<!-- AppSettings -->
76-
<SwitchPreferenceCompat
77-
app:defaultValue="False"
75+
<Preference
7876
app:iconSpaceReserved="false"
79-
app:key="com.battlelancer.seriesguide.userDebugModeEnabled"
77+
app:key="seriesguide.settings.link.debuglog"
8078
app:title="@string/title_debug_log" />
8179

8280
</PreferenceCategory>

0 commit comments

Comments
 (0)