You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			33 lines
		
	
	
		
			875 B
		
	
	
	
		
			JavaScript
		
	
			
		
		
	
	
			33 lines
		
	
	
		
			875 B
		
	
	
	
		
			JavaScript
		
	
| /* global Whisper, SignalProtocolStore, ConversationController, _ */
 | |
| 
 | |
| /* eslint-disable more/no-then */
 | |
| 
 | |
| // eslint-disable-next-line func-names
 | |
| (function() {
 | |
|   'use strict';
 | |
| 
 | |
|   window.Whisper = window.Whisper || {};
 | |
| 
 | |
|   Whisper.KeyChangeListener = {
 | |
|     init(signalProtocolStore) {
 | |
|       if (!(signalProtocolStore instanceof SignalProtocolStore)) {
 | |
|         throw new Error('KeyChangeListener requires a SignalProtocolStore');
 | |
|       }
 | |
| 
 | |
|       signalProtocolStore.on('keychange', id => {
 | |
|         ConversationController.getOrCreateAndWait(id, 'private').then(
 | |
|           conversation => {
 | |
|             conversation.addKeyChange(id);
 | |
| 
 | |
|             ConversationController.getAllGroupsInvolvingId(id).then(groups => {
 | |
|               _.forEach(groups, group => {
 | |
|                 group.addKeyChange(id);
 | |
|               });
 | |
|             });
 | |
|           }
 | |
|         );
 | |
|       });
 | |
|     },
 | |
|   };
 | |
| })();
 |