Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: server-side rendering compatibility #654

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions projects/stream-chat-angular/src/lib/is-safari.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export const isSafari = /^((?!chrome|android).)*safari/i.test(
navigator.userAgent
);
export const isSafari = () =>
/^((?!chrome|android).)*safari/i.test(navigator.userAgent);
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ export class MessageListComponent
private forceRepaintSubject = new Subject<void>();
private messageIdToAnchorTo?: string;
private anchorMessageTopOffset?: number;
private isSafari = isSafari();

@HostBinding('class')
private get class() {
Expand Down Expand Up @@ -468,7 +469,7 @@ export class MessageListComponent
scrollToBottom(): void {
this.scrollContainer.nativeElement.scrollTop =
this.scrollContainer.nativeElement.scrollHeight + 0.1;
if (isSafari) {
if (this.isSafari) {
this.forceRepaintSubject.next();
}
}
Expand Down Expand Up @@ -609,7 +610,7 @@ export class MessageListComponent
(messageToAlignTo?.getBoundingClientRect()?.top || 0) -
(this.anchorMessageTopOffset || 0);
this.anchorMessageTopOffset = undefined;
if (isSafari) {
if (this.isSafari) {
this.forceRepaintSubject.next();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class AudioRecorderService extends MultimediaRecorder<
* - For all other browsers we use audio/webm (which is then transcoded to wav)
*/
config: MediaRecorderConfig = {
mimeType: isSafari ? 'audio/mp4;codecs=mp4a.40.2' : 'audio/webm',
mimeType: isSafari() ? 'audio/mp4;codecs=mp4a.40.2' : 'audio/webm',
};

constructor(
Expand Down
Loading