Skip to content

Commit

Permalink
fix(SpeakingWhileMutedWarner): show toast message instead of removed …
Browse files Browse the repository at this point in the history
…tooltip

Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>

[skip ci]
  • Loading branch information
Antreesy authored and backportbot[bot] committed Dec 19, 2024
1 parent 1a87b78 commit ea7da71
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
7 changes: 1 addition & 6 deletions src/components/TopBar/TopBarMediaControls.vue
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ export default {

data() {
return {
speakingWhileMutedNotification: null,
screenSharingMenuOpen: false,
boundaryElement: document.querySelector('.main-view'),
mouseover: false,
Expand Down Expand Up @@ -414,7 +413,7 @@ export default {
},

mounted() {
this.speakingWhileMutedWarner = new SpeakingWhileMutedWarner(this.model, this)
this.speakingWhileMutedWarner = new SpeakingWhileMutedWarner(this.model)
},

beforeDestroy() {
Expand Down Expand Up @@ -446,10 +445,6 @@ export default {

},

setSpeakingWhileMutedNotification(message) {
this.speakingWhileMutedNotification = message
},

toggleVirtualBackground() {
if (this.model.attributes.virtualBackgroundEnabled) {
this.model.disableVirtualBackground()
Expand Down
24 changes: 14 additions & 10 deletions src/utils/webrtc/SpeakingWhileMutedWarner.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,11 @@
*
* @param {object} LocalMediaModel the model that emits "speakingWhileMuted"
* events.
* @param {object} view the view that provides the
* "setSpeakingWhileMutedNotification" method.
*/
export default function SpeakingWhileMutedWarner(LocalMediaModel, view) {
export default function SpeakingWhileMutedWarner(LocalMediaModel) {
this._model = LocalMediaModel
this._view = view
this._toast = null

this._handleSpeakingWhileMutedChangeBound = this._handleSpeakingWhileMutedChange.bind(this)

Expand Down Expand Up @@ -103,12 +102,19 @@ SpeakingWhileMutedWarner.prototype = {
},

_showNotification(message) {
if (this._notification) {
if (this._toast) {
return
}

this._view.setSpeakingWhileMutedNotification(message)
this._notification = true
this._toast = showWarning(message, {
timeout: TOAST_PERMANENT_TIMEOUT,
onClick: () => {
this._toast.hideToast()
},
onRemove: () => {
this._toast = null
}
})
},

_showBrowserNotification(message) {
Expand Down Expand Up @@ -157,10 +163,8 @@ SpeakingWhileMutedWarner.prototype = {
_hideWarning() {
this._pendingBrowserNotification = false

if (this._notification) {
this._view.setSpeakingWhileMutedNotification(null)

this._notification = false
if (this._toast) {
this._toast.hideToast()
}

if (this._browserNotification) {
Expand Down

0 comments on commit ea7da71

Please sign in to comment.