Skip to content

Commit

Permalink
Hide settings button from rageshake dialog is there is no session
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Renaud committed Mar 28, 2022
1 parent 3cf7765 commit 6a05d6e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/4445.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hide settings button from rageshake dialog is there is no session
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import androidx.fragment.app.FragmentActivity
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.squareup.seismic.ShakeDetector
import im.vector.app.R
import im.vector.app.core.di.ActiveSessionHolder
import im.vector.app.core.hardware.vibrate
import im.vector.app.features.navigation.Navigator
import im.vector.app.features.settings.VectorPreferences
Expand All @@ -33,6 +34,7 @@ import javax.inject.Inject
class RageShake @Inject constructor(private val activity: FragmentActivity,
private val bugReporter: BugReporter,
private val navigator: Navigator,
private val sessionHolder: ActiveSessionHolder,
private val vectorPreferences: VectorPreferences) : ShakeDetector.Listener {

private var shakeDetector: ShakeDetector? = null
Expand Down Expand Up @@ -75,7 +77,11 @@ class RageShake @Inject constructor(private val activity: FragmentActivity,
MaterialAlertDialogBuilder(activity)
.setMessage(R.string.send_bug_report_alert_message)
.setPositiveButton(R.string.yes) { _, _ -> openBugReportScreen() }
.setNeutralButton(R.string.settings) { _, _ -> openSettings() }
.also {
if (sessionHolder.hasActiveSession()) {
it.setNeutralButton(R.string.settings) { _, _ -> openSettings() }
}
}
.setOnDismissListener { dialogDisplayed = false }
.setNegativeButton(R.string.no, null)
.show()
Expand Down

0 comments on commit 6a05d6e

Please sign in to comment.