Skip to content

Instantly share code, notes, and snippets.

@BrightnBubbly
Created May 4, 2020 05:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BrightnBubbly/1b12cfeaf395372a4d13587afa88d169 to your computer and use it in GitHub Desktop.
Save BrightnBubbly/1b12cfeaf395372a4d13587afa88d169 to your computer and use it in GitHub Desktop.
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { MessageResponse, Channel } from 'stream-chat';
import { StreamService } from '../stream.service';
import { StateService } from '../state.service';
declare const feather: any;
@Component({
selector: 'app-chat',
templateUrl: './chat.component.html',
styleUrls: ['./chat.component.scss'],
})
export class ChatComponent implements OnInit {
constructor(
public streamService: StreamService,
private stateService: StateService,
private router: Router
) {}
messages: MessageResponse[] = [];
message = '';
channel: Channel;
async sendMessage() {
...
}
getClasses(userId: string): { outgoing: boolean; incoming: boolean } {
const userIdMatches = userId === this.streamService.currentUser.me.id;
return {
outgoing: userIdMatches,
incoming: !userIdMatches,
};
}
async ngOnInit() {
...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment