Skip to content

Commit

Permalink
Merge branch 'master' into cleanCode
Browse files Browse the repository at this point in the history
  • Loading branch information
Kakar21 authored Sep 16, 2024
2 parents 111de1f + 50fee4b commit fef9e2f
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export class DialogAddChannelAddMemberComponent {
.filter(user => user.id !== this.currentUser.currentUser.id) // Hier filtern wir den currentUser nach der ID
),
);

}


Expand Down Expand Up @@ -133,6 +134,9 @@ export class DialogAddChannelAddMemberComponent {

this.showChannel(newChannel.id);
}





remove(user: UsersList): void {
Expand Down
2 changes: 1 addition & 1 deletion src/app/firestore.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export class FirestoreService {
.catch((error) => {
console.error("Fehler beim Ausloggen: ", error);
});
}
}


async saveUser(item: User, uid: string) {
Expand Down
2 changes: 1 addition & 1 deletion src/app/main/chat/chat.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ <h5 (click)="openProfileById(message.value.id)">{{ message.value.name}}</h5>
</div>
}
<div class="emoji-picker" *ngIf="isPickerVisible && pickerContext === 'reaction'" [ngStyle]="{ top: pickerPosition.top, left: pickerPosition.left }">
<emoji-mart [perLine]="8" (emojiClick)="addEmoji($event)"></emoji-mart>
<emoji-mart [exclude]="['skintones']" [perLine]="8" (emojiClick)="addEmoji($event)"></emoji-mart>
</div>
</div>
} @else {
Expand Down
4 changes: 2 additions & 2 deletions src/app/main/chat/chat.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { DialogAddMemberToChnlComponent } from "../../dialog-add-member-to-chnl/
import { MatMenuModule } from "@angular/material/menu";
import { DialogChannelInfoComponent } from "../../dialog-channel-info/dialog-channel-info.component";
import { DialogShowChannelMemberComponent } from "../../dialog-show-channel-member/dialog-show-channel-member.component";
import { PickerComponent } from "@ctrl/ngx-emoji-mart";
import { EmojiSearch, PickerComponent } from "@ctrl/ngx-emoji-mart";
import { DialogEditMessageComponent } from "../../dialog-edit-message/dialog-edit-message.component";
import { ChatService } from "./chat.service";
import { MainComponent } from "../main.component";
Expand All @@ -23,7 +23,7 @@ import { UsersList } from "../../interfaces/users-list";
import { MatInputModule } from "@angular/material/input";
import { HighlightMentionsPipe } from "../../pipes/highlist-mentions.pipe";
import { PofileInfoCardComponent } from "../../pofile-info-card/pofile-info-card.component";
import { EmojiModule } from "@ctrl/ngx-emoji-mart/ngx-emoji";
import { EmojiModule, EmojiService } from "@ctrl/ngx-emoji-mart/ngx-emoji";
import { ImageService } from "../../image.service";
import { DialogImageComponent } from "../../dialog-image/dialog-image.component";
import { CommonFnService } from "../../common-fn.service";
Expand Down
25 changes: 24 additions & 1 deletion src/app/main/chat/chat.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export class ChatService {
openChannel(channelId: string) {
this.selectedChannel = channelId;
this.selectedDirectmessage = "";

this.loadChannel(channelId);
if (this.isMobileDevice()) {
this.mobileOpen = "chat";
Expand Down Expand Up @@ -258,7 +259,29 @@ export class ChatService {
this.usersList = users;
this.loadOnlineStatus();
});
}
}

// Funktion zum Überwachen des Online-Status aus der Realtime Database
loadOnlineStatus() {
this.usersList.forEach((user) => {
const statusRef = ref(this.firestore.db, `status/${user.id}`);

// Überwache den Online-Status in der Realtime Database
onValue(statusRef, (snapshot) => {
if (snapshot.exists()) {
const statusData = snapshot.val();

if (typeof statusData.online !== 'undefined') {
user.online = statusData.online;
} else {
user.online = false;
}
} else {
user.online = false;
}
});
});
}


loadOnlineStatus() {
Expand Down
4 changes: 2 additions & 2 deletions src/app/main/chat/direct-message/direct-message.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { CurrentuserService } from "../../../currentuser.service";
import { ImageService } from "../../../image.service";
import { MatAutocompleteModule, MatAutocompleteSelectedEvent } from "@angular/material/autocomplete";
import { map, Observable, startWith } from "rxjs";
import { EmojiModule } from "@ctrl/ngx-emoji-mart/ngx-emoji";
import { EmojiModule, EmojiService } from "@ctrl/ngx-emoji-mart/ngx-emoji";
import { DialogEditMessageComponent } from "../../../dialog-edit-message/dialog-edit-message.component";
import { HighlightMentionsPipe } from "../../../pipes/highlist-mentions.pipe";
import { DialogImageComponent } from "../../../dialog-image/dialog-image.component";
Expand Down Expand Up @@ -61,6 +61,7 @@ export class DirectMessageComponent implements OnInit {
currentMessagePadnumber: string = "";
previewUrl: string | ArrayBuffer | null = null;
perLineCount = 9;
recentEmojis: string[] = [];


constructor(
Expand Down Expand Up @@ -112,7 +113,6 @@ export class DirectMessageComponent implements OnInit {
}



objectKeys(obj: any): string[] {
return Object.keys(obj);
}
Expand Down

0 comments on commit fef9e2f

Please sign in to comment.