mirror of
				https://github.com/cinnyapp/cinny.git
				synced 2025-11-04 06:20:28 +03:00 
			
		
		
		
	Add sound on incoming invites (#400)
* Add invite sound Signed-off-by: Ajay Bura <ajbura@gmail.com> * Add credits Signed-off-by: Ajay Bura <ajbura@gmail.com> * Change invite sound to google material
This commit is contained in:
		
							parent
							
								
									ae71a99aa4
								
							
						
					
					
						commit
						36da3d3cba
					
				
					 2 changed files with 14 additions and 3 deletions
				
			
		
							
								
								
									
										
											BIN
										
									
								
								public/sound/invite.ogg
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								public/sound/invite.ogg
									
										
									
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -7,6 +7,7 @@ import navigation from './navigation';
 | 
			
		|||
import settings from './settings';
 | 
			
		||||
 | 
			
		||||
import NotificationSound from '../../../public/sound/notification.ogg';
 | 
			
		||||
import InviteSound from '../../../public/sound/invite.ogg';
 | 
			
		||||
 | 
			
		||||
function isNotifEvent(mEvent) {
 | 
			
		||||
  const eType = mEvent.getType();
 | 
			
		||||
| 
						 | 
				
			
			@ -222,21 +223,28 @@ class Notifications extends EventEmitter {
 | 
			
		|||
        silent: settings.isNotificationSounds,
 | 
			
		||||
      });
 | 
			
		||||
      if (settings.isNotificationSounds) {
 | 
			
		||||
        noti.onshow = () => this._playNotiSounds();
 | 
			
		||||
        noti.onshow = () => this._playNotiSound();
 | 
			
		||||
      }
 | 
			
		||||
      noti.onclick = () => selectRoom(room.roomId, mEvent.getId());
 | 
			
		||||
    } else {
 | 
			
		||||
      this._playNotiSounds();
 | 
			
		||||
      this._playNotiSound();
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  _playNotiSounds() {
 | 
			
		||||
  _playNotiSound() {
 | 
			
		||||
    if (!this._notiAudio) {
 | 
			
		||||
      this._notiAudio = new Audio(NotificationSound);
 | 
			
		||||
    }
 | 
			
		||||
    this._notiAudio.play();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  _playInviteSound() {
 | 
			
		||||
    if (!this._inviteAudio) {
 | 
			
		||||
      this._inviteAudio = new Audio(InviteSound);
 | 
			
		||||
    }
 | 
			
		||||
    this._inviteAudio.play();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  _listenEvents() {
 | 
			
		||||
    this.matrixClient.on('Room.timeline', (mEvent, room) => {
 | 
			
		||||
      if (room.isSpaceRoom()) return;
 | 
			
		||||
| 
						 | 
				
			
			@ -316,6 +324,9 @@ class Notifications extends EventEmitter {
 | 
			
		|||
      if (membership === 'leave' && this.hasNoti(room.roomId)) {
 | 
			
		||||
        this.deleteNoti(room.roomId);
 | 
			
		||||
      }
 | 
			
		||||
      if (membership === 'invite') {
 | 
			
		||||
        this._playInviteSound();
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue