Skip to content

Commit

Permalink
Respond promptly to enabling/disabling the debug menu.
Browse files Browse the repository at this point in the history
  • Loading branch information
io7m committed Nov 20, 2024
1 parent ed635fb commit 92ead52
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import org.nypl.simplified.books.borrowing.subtasks.BorrowSubtaskException.Borro
import org.nypl.simplified.books.borrowing.subtasks.BorrowSubtaskFactoryType
import org.nypl.simplified.books.borrowing.subtasks.BorrowSubtaskType
import org.nypl.simplified.books.formats.api.StandardFormatNames
import org.nypl.simplified.books.formats.api.StandardFormatNames.genericEPUBFiles
import org.nypl.simplified.books.formats.api.StandardFormatNames.lcpLicenseFiles
import org.readium.r2.lcp.license.model.LicenseDocument
import org.readium.r2.shared.util.ErrorException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import io.reactivex.disposables.CompositeDisposable
import org.librarysimplified.ui.settings.R
import org.nypl.simplified.listeners.api.FragmentListenerType
import org.nypl.simplified.listeners.api.fragmentListeners
import org.nypl.simplified.profiles.api.ProfileEvent
import org.nypl.simplified.profiles.api.ProfileUpdated
import org.slf4j.LoggerFactory

class SettingsMainFragment3 : PreferenceFragmentCompat() {
Expand Down Expand Up @@ -35,13 +37,24 @@ class SettingsMainFragment3 : PreferenceFragmentCompat() {
override fun onStart() {
super.onStart()

this.subscriptions = CompositeDisposable()
this.subscriptions.add(
SettingsModel.profileEvents.subscribe(this::onProfileEvent)
)

try {
this.configureDebug(this.settingsDebug)
} catch (e: Throwable) {
this.logger.debug("Error configuring debug menu: ", e)
}
}

private fun onProfileEvent(e: ProfileEvent) {
if (e is ProfileUpdated) {
this.configureDebug(this.settingsDebug)
}
}

override fun onStop() {
super.onStop()

Expand Down

0 comments on commit 92ead52

Please sign in to comment.