add error message

This commit is contained in:
Peter Maquiran
2024-06-11 11:46:04 +01:00
parent f3232c835d
commit fe51b38257
27 changed files with 675 additions and 478 deletions
+8 -15
View File
@@ -150,8 +150,16 @@
[roomId]="roomId"
(backToChat)="backToChat($event)"
(closeAllDesktopComponents)="closeAllDesktopComponents()"
(openGroupContacts)="openGroupContactsPage($event)"
(openEditGroupPage)="openEditGroupPage($event)"
(getGroups)="getGroups($event)"
*ngIf="showNewGroup"
class=" height-100 flex-column d-flex">
</app-new-group>
<app-edit-group [roomId]="roomId"
@@ -171,21 +179,6 @@
>
</app-group-contacts>
<app-new-event
*ngIf="showNewEvent"
[profile]=""
[roomId]="groupRoomId"
[selectedSegment]=segment
[taskParticipants]="taskParticipants"
[taskParticipantsCc]="taskParticipantsCc"
[selectedDate]="eventSelectedDate"
[eventAttendees]="contacts"
(onAddEvent)="closeNewEventComponentAndOpenChat($event)"
(openAttendeesComponent)="openAttendeesComponent($event)"
(backToChat)="backToChat($event)"
[style.display]="showNewEvent ? 'flex' : 'none'"
class=" height-100 flex-column">
</app-new-event>
<app-attendee-modal
[adding]="adding"
[taskParticipants]="taskParticipants"
+3 -5
View File
@@ -129,13 +129,9 @@ export class ChatPage implements OnInit {
public ThemeService: ThemeService,
private dataService: DataService,
private router: Router,
private sqlservice: SqliteService,
private platform: Platform,
private storageservice: StorageService,
public ChatSystemService: ChatSystemService,
private activatedRoute: ActivatedRoute,
private eventTriger: EventTrigger,
private RochetChatConnectorService: RochetChatConnectorService,
private zone: NgZone,
public RouteService: RouteService,
private store: Store<{ chat: RoomRemoteDataSourceState }>,
@@ -344,6 +340,8 @@ export class ChatPage implements OnInit {
this.showGroupContacts = true;
}
}
openMessagesPage(rid) {
console.log('rid', rid);
@@ -490,7 +488,7 @@ export class ChatPage implements OnInit {
}
onSegmentChange() {
this.ChatSystemService.getAllRooms();
// this.ChatSystemService.getAllRooms();
this.ChatSystemService._dm
}
@@ -48,13 +48,13 @@ export class GroupContactsPage implements OnInit {
)
{
this.textSearch="";
this.dm=null;
this.room=null;
this.isGroupCreated = this.navParams.get('isCreated');
this.groupName = this.navParams.get('name');
this.room = this.navParams.get('room');
this.members = this.navParams.get('members');
// this.textSearch="";
// this.dm=null;
// this.room=null;
// this.isGroupCreated = this.navParams.get('isCreated');
// this.groupName = this.navParams.get('name');
// this.room = this.navParams.get('room');
// this.members = this.navParams.get('members');
}
ngOnInit() {
@@ -66,59 +66,59 @@ export class GroupContactsPage implements OnInit {
}
loadUsers(){
this.options = {
headers: this.headers,
};
this.chatService.getAllUsers().subscribe((res:any)=>{
if(this.members) {
this.contacts = res.users.filter(f => !this.members.some(item => item._id === f._id));
}
else{
this.contacts = res.users.filter(data => data.username != this.sessionStore.user.UserName);
}
this.users = this.contacts.sort((a,b) => {
if(a.name < b.name){
return -1;
}
if(a.name > b.name){
return 1;
}
return 0;
});
// this.options = {
// headers: this.headers,
// };
// this.chatService.getAllUsers().subscribe((res:any)=>{
// if(this.members) {
// this.contacts = res.users.filter(f => !this.members.some(item => item._id === f._id));
// }
// else{
// this.contacts = res.users.filter(data => data.username != this.sessionStore.user.UserName);
// }
// this.users = this.contacts.sort((a,b) => {
// if(a.name < b.name){
// return -1;
// }
// if(a.name > b.name){
// return 1;
// }
// return 0;
// });
for( const user of this.users) {
// for( const user of this.users) {
const foundUser = this.objectUserSingleStone.find( e => e.name == user.name)
// const foundUser = this.objectUserSingleStone.find( e => e.name == user.name)
if(!foundUser) {
this.objectUserSingleStone.push(user)
} else {
'not found'
}
// if(!foundUser) {
// this.objectUserSingleStone.push(user)
// } else {
// 'not found'
// }
}
// }
const userContainer = {}
for(const user of this.objectUserSingleStone) {
const firstLetter = user.name.charAt(0)
// const userContainer = {}
// for(const user of this.objectUserSingleStone) {
// const firstLetter = user.name.charAt(0)
if(!userContainer[firstLetter]) {
userContainer[firstLetter] = [user]
} else {
userContainer[firstLetter].push(user)
}
// if(!userContainer[firstLetter]) {
// userContainer[firstLetter] = [user]
// } else {
// userContainer[firstLetter].push(user)
// }
}
// }
this.userContainer = userContainer
// this.userContainer = userContainer
this.showLoader = false;
});
// this.showLoader = false;
// });
}
getMembers(){
@@ -16,7 +16,7 @@ import { EventPerson } from 'src/app/models/eventperson.model';
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
import { ThemeService } from 'src/app/services/theme.service'
import { ViewEventPage } from 'src/app/modals/view-event/view-event.page';
import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
//import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
import { FileType } from 'src/app/models/fileType';
import { Storage } from '@ionic/storage';
@@ -101,7 +101,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
public ThemeService: ThemeService,
private changeDetectorRef: ChangeDetectorRef,
private platform: Platform,
public ChatSystemService: ChatSystemService,
//public ChatSystemService: ChatSystemService,
private storage: Storage,
private CameraService: CameraService,
private sanitiser: DomSanitizer,
@@ -110,60 +110,60 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
public RouteService: RouteService,
private FileValidatorService: FileValidatorService,
) {
this.ChatSystemService.getUser()
// this.ChatSystemService.getUser()
this.loggedUserChat = SessionStore.user.ChatData['data'];
this.isGroupCreated = true;
this.roomId = this.navParams.get('roomId');
window.onresize = (event) => {
if (window.innerWidth > 701) {
this.modalController.dismiss();
}
};
// this.loggedUserChat = SessionStore.user.ChatData['data'];
// this.isGroupCreated = true;
// this.roomId = this.navParams.get('roomId');
// window.onresize = (event) => {
// if (window.innerWidth > 701) {
// this.modalController.dismiss();
// }
// };
this.open();
// this.open();
setTimeout(() => {
this.scrollToBottomClicked()
}, 50)
// setTimeout(() => {
// this.scrollToBottomClicked()
// }, 50)
this.showAvatar = false
// this.showAvatar = false
setTimeout(() => {
this.scrollToBottomClicked()
this.showAvatar = true
}, 150)
// setTimeout(() => {
// this.scrollToBottomClicked()
// this.showAvatar = true
// }, 150)
}
open() {
try {
this.ChatSystemService.getGroupRoom(this.roomId).loadHistory({});
this.ChatSystemService.getGroupRoom(this.roomId).scrollDown = this.scrollToBottomClicked;
this.ChatSystemService.openRoom(this.roomId)
this.groupNameFormart = this.ChatSystemService.getGroupRoom(this.roomId).name.split('-').join(' ')
} catch (error) {
setTimeout(() => {
this.open()
}, 3000)
}
// try {
// this.ChatSystemService.getGroupRoom(this.roomId).loadHistory({});
// this.ChatSystemService.getGroupRoom(this.roomId).scrollDown = this.scrollToBottomClicked;
// this.ChatSystemService.openRoom(this.roomId)
// this.groupNameFormart = this.ChatSystemService.getGroupRoom(this.roomId).name.split('-').join(' ')
// } catch (error) {
// setTimeout(() => {
// this.open()
// }, 3000)
// }
}
ngOnInit() {
this.loggedUser = this.loggedUserChat;
this.getRoomInfo();
this.scrollToBottom();
this.serverLongPull();
this.setStatus('online');
this.getChatMembers();
// this.loggedUser = this.loggedUserChat;
// this.getRoomInfo();
// this.scrollToBottom();
// this.serverLongPull();
// this.setStatus('online');
// this.getChatMembers();
// this.getRoomMessageDB(this.roomId);
this.getGroupContacts({});
// // this.getRoomMessageDB(this.roomId);
// this.getGroupContacts({});
}
@@ -178,8 +178,8 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
}
deleteMessage(msgId: string) {
const room = this.ChatSystemService.getGroupRoom(this.roomId)
this.alertService.confirmDeleteMessage(msgId, room);
// const room = this.ChatSystemService.getGroupRoom(this.roomId)
// this.alertService.confirmDeleteMessage(msgId, room);
}
ngAfterViewInit() {
@@ -394,35 +394,35 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
// this.getGroupContacts(this.room);
// this.showLoader = false;
// });
this.ChatSystemService.getGroupRoom(this.roomId).loadHistory({});
let room = await this.chatService.getRoomInfo(this.roomId).toPromise();
// console.log('ROOM',room)
this.room = room['room'];
if (this.room.name) {
try {
this.roomName = this.room.name.split('-').join(' ');
} catch (error) {
this.roomName = this.room.name;
}
// this.ChatSystemService.getGroupRoom(this.roomId).loadHistory({});
// let room = await this.chatService.getRoomInfo(this.roomId).toPromise();
// // console.log('ROOM',room)
// this.room = room['room'];
// if (this.room.name) {
// try {
// this.roomName = this.room.name.split('-').join(' ');
// } catch (error) {
// this.roomName = this.room.name;
// }
}
// }
if (SessionStore.user.ChatData.data.userId == this.room.u._id) {
this.isAdmin = true
} else {
this.isAdmin = false
}
// if (SessionStore.user.ChatData.data.userId == this.room.u._id) {
// this.isAdmin = true
// } else {
// this.isAdmin = false
// }
if (this.room.customFields.countDownDate) {
this.roomCountDownDate = this.room.customFields.countDownDate;
}
// if (this.room.customFields.countDownDate) {
// this.roomCountDownDate = this.room.customFields.countDownDate;
// }
}
async getChatMembers() {
if(this.ChatSystemService.users.length == 0) {
this.ChatSystemService.getUser()
}
// if(this.ChatSystemService.users.length == 0) {
// this.ChatSystemService.getUser()
// }
}
/* load(){
@@ -459,7 +459,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
// });
// }
this.members = this.ChatSystemService.getGroupRoom(this.roomId).members
// this.members = this.ChatSystemService.getGroupRoom(this.roomId).members
}
@@ -479,7 +479,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
}
sendMessage() {
this.ChatSystemService.getGroupRoom(this.roomId).send({})
// this.ChatSystemService.getGroupRoom(this.roomId).send({})
}
@@ -504,22 +504,22 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
const formData = new FormData();
formData.append("blobFile", blob);
this.ChatSystemService.getGroupRoom(roomId).send({
file: {
"type": "application/audio",
"msDuration": audioFile.value.msDuration,
"mimeType": audioFile.value.mimeType,
},
attachments: [{
"title": sanitize(fileName),
"title_link_download": true,
"type": "audio"
}],
temporaryData: formData,
attachmentsModelData: {
fileBase64: encodedData,
}
})
// this.ChatSystemService.getGroupRoom(roomId).send({
// file: {
// "type": "application/audio",
// "msDuration": audioFile.value.msDuration,
// "mimeType": audioFile.value.mimeType,
// },
// attachments: [{
// "title": sanitize(fileName),
// "title_link_download": true,
// "type": "audio"
// }],
// temporaryData: formData,
// attachmentsModelData: {
// fileBase64: encodedData,
// }
// })
});
this.deleteRecording();
@@ -543,7 +543,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
modal.onDidDismiss().then(res => {
if (res.data == 'leave') {
this.close()
this.ChatSystemService.deleteRoom(this.roomId)
// this.ChatSystemService.deleteRoom(this.roomId)
//this.ChatSystemService.subscribeToRoomUpdate(this.roomId, this.room);
}
else if (res.data == 'cancel') {
@@ -556,7 +556,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
this.addContacts();
} else if (res.data == 'delete') {
this.close()
this.ChatSystemService.deleteRoom(this.roomId)
// this.ChatSystemService.deleteRoom(this.roomId)
}
});
}
@@ -685,21 +685,21 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
const formData = new FormData();
formData.append("blobFile", blob);
this.ChatSystemService.getGroupRoom(roomId).send({
file: {
"type": "application/img",
"guid": ''
},
attachments: [{
"title": "file.jpg",
"text": "description",
"title_link_download": false,
}],
temporaryData: formData,
attachmentsModelData: {
fileBase64: imageBase64,
}
})
// this.ChatSystemService.getGroupRoom(roomId).send({
// file: {
// "type": "application/img",
// "guid": ''
// },
// attachments: [{
// "title": "file.jpg",
// "text": "description",
// "title_link_download": false,
// }],
// temporaryData: formData,
// attachmentsModelData: {
// fileBase64: imageBase64,
// }
// })
}
@@ -750,21 +750,21 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
const formData = new FormData();
formData.append("blobFile", blob);
this.ChatSystemService.getGroupRoom(roomId).send({
file: {
"type": "application/img",
"guid": ''
},
temporaryData: formData,
attachments: [{
"title": file.path,
"text": "description",
"title_link_download": false,
}],
attachmentsModelData: {
fileBase64: imageBase64,
}
})
// this.ChatSystemService.getGroupRoom(roomId).send({
// file: {
// "type": "application/img",
// "guid": ''
// },
// temporaryData: formData,
// attachments: [{
// "title": file.path,
// "text": "description",
// "title_link_download": false,
// }],
// attachmentsModelData: {
// fileBase64: imageBase64,
// }
// })
}
@@ -784,28 +784,28 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
if (data.selected) {
this.ChatSystemService.getGroupRoom(this.roomId).send({
file: {
"name": res.data.selected.Assunto,
"type": "application/webtrix",
"ApplicationId": res.data.selected.ApplicationType,
"DocId": res.data.selected.Id,
"Assunto": res.data.selected.Assunto,
},
temporaryData: res,
attachments: [{
"title": res.data.selected.Assunto,
"description": res.data.selected.DocTypeDesc,
// "title_link": url_no_options,
"title_link_download": true,
//"thumb_url": "assets/images/webtrix-logo.png",
// "message_link": url_no_options,
"type": "webtrix",
//"thumb_url": "assets/images/webtrix-logo.png",
"text": res.data.selected.DocTypeDesc,
"thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
}]
})
// this.ChatSystemService.getGroupRoom(this.roomId).send({
// file: {
// "name": res.data.selected.Assunto,
// "type": "application/webtrix",
// "ApplicationId": res.data.selected.ApplicationType,
// "DocId": res.data.selected.Id,
// "Assunto": res.data.selected.Assunto,
// },
// temporaryData: res,
// attachments: [{
// "title": res.data.selected.Assunto,
// "description": res.data.selected.DocTypeDesc,
// // "title_link": url_no_options,
// "title_link_download": true,
// //"thumb_url": "assets/images/webtrix-logo.png",
// // "message_link": url_no_options,
// "type": "webtrix",
// //"thumb_url": "assets/images/webtrix-logo.png",
// "text": res.data.selected.DocTypeDesc,
// "thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
// }]
// })
}
});
@@ -848,22 +848,22 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
formDataa.append('blobFile', blobb);
/* console.log('add file', fileBase64) */
this.ChatSystemService.getGroupRoom(roomId).send({
file: {
"type": resultt.files[0].mimeType,
"guid": '',
},
attachments: [{
"title": sanitize(resultt.files[0].name),
"name": sanitize(resultt.files[0].name),
// "text": "description",
"title_link_download": false,
}],
temporaryData: formDataa,
attachmentsModelData: {
fileBase64: '',
}
})
// this.ChatSystemService.getGroupRoom(roomId).send({
// file: {
// "type": resultt.files[0].mimeType,
// "guid": '',
// },
// attachments: [{
// "title": sanitize(resultt.files[0].name),
// "name": sanitize(resultt.files[0].name),
// // "text": "description",
// "title_link_download": false,
// }],
// temporaryData: formDataa,
// attachmentsModelData: {
// fileBase64: '',
// }
// })
return
}
@@ -888,22 +888,22 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
formData.append('blobFile', blob);
this.ChatSystemService.getGroupRoom(roomId).send({
file: {
"type": file.type,
"guid": '',
},
attachments: [{
"title": sanitize(fileName),
"name": sanitize(fileName),
// "text": "description",
"title_link_download": false,
}],
temporaryData: formData,
attachmentsModelData: {
fileBase64: encodedData
}
});
// this.ChatSystemService.getGroupRoom(roomId).send({
// file: {
// "type": file.type,
// "guid": '',
// },
// attachments: [{
// "title": sanitize(fileName),
// "name": sanitize(fileName),
// // "text": "description",
// "title_link_download": false,
// }],
// temporaryData: formData,
// attachmentsModelData: {
// fileBase64: encodedData
// }
// });
} else {
@@ -980,7 +980,8 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
componentProps: {
isCreated: this.isGroupCreated,
room: this.room,
members: this.ChatSystemService.getGroupRoom(this.roomId).members,
//members: this.ChatSystemService.getGroupRoom(this.roomId).members,
members: [],
name: this.room.name,
},
cssClass: 'contacts',