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.
		
		
		
		
		
			
		
			
	
	
		
			31 lines
		
	
	
		
			897 B
		
	
	
	
		
			TypeScript
		
	
		
		
			
		
	
	
			31 lines
		
	
	
		
			897 B
		
	
	
	
		
			TypeScript
		
	
| 
								 
											6 years ago
										 
									 | 
							
								import { SignalService } from '../../../../../protobuf';
							 | 
						||
| 
								 
											6 years ago
										 
									 | 
							
								import { MessageParams } from '../../Message';
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								import { ContentMessage } from '../..';
							 | 
						||
| 
								 
											6 years ago
										 
									 | 
							
								
							 | 
						||
| 
								 
											6 years ago
										 
									 | 
							
								interface ReceiptMessageParams extends MessageParams {
							 | 
						||
| 
								 | 
							
								  timestamps: Array<number>;
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 
											6 years ago
										 
									 | 
							
								export abstract class ReceiptMessage extends ContentMessage {
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								  public readonly timestamps: Array<number>;
							 | 
						||
| 
								 
											6 years ago
										 
									 | 
							
								
							 | 
						||
| 
								 
											6 years ago
										 
									 | 
							
								  constructor({ timestamp, identifier, timestamps }: ReceiptMessageParams) {
							 | 
						||
| 
								 | 
							
								    super({ timestamp, identifier });
							 | 
						||
| 
								 
											6 years ago
										 
									 | 
							
								    this.timestamps = timestamps;
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  public abstract getReceiptType(): SignalService.ReceiptMessage.Type;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								  public contentProto(): SignalService.Content {
							 | 
						||
| 
								 
											6 years ago
										 
									 | 
							
								    return new SignalService.Content({
							 | 
						||
| 
								 | 
							
								      receiptMessage: this.receiptProto(),
							 | 
						||
| 
								 | 
							
								    });
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  protected receiptProto(): SignalService.ReceiptMessage {
							 | 
						||
| 
								 | 
							
								    return new SignalService.ReceiptMessage({
							 | 
						||
| 
								 | 
							
								      type: this.getReceiptType(),
							 | 
						||
| 
								 | 
							
								      timestamp: this.timestamps,
							 | 
						||
| 
								 | 
							
								    });
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								}
							 |