mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
remove rocket chat
This commit is contained in:
@@ -10,7 +10,7 @@ import {
|
||||
import { ModalController, Platform } from '@ionic/angular';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
import { ChatService } from 'src/app/services/chat.service';
|
||||
import { ChatSystemService } from 'src/app/services/chat/chat-system.service'
|
||||
// import { ChatSystemService } from 'src/app/services/chat/chat-system.service'
|
||||
import { GroupMessagesPage } from './group-messages/group-messages.page';
|
||||
import { ContactsPage } from './messages/contacts/contacts.page';
|
||||
import { MessagesPage } from './messages/messages.page';
|
||||
@@ -117,7 +117,7 @@ export class ChatPage implements OnInit {
|
||||
public ThemeService: ThemeService,
|
||||
private dataService: DataService,
|
||||
private router: Router,
|
||||
public ChatSystemService: ChatSystemService,
|
||||
// public ChatSystemService: ChatSystemService,
|
||||
public RouteService: RouteService,
|
||||
private RoomRepositoryService: RoomRepositoryService,
|
||||
private messageLiveDataSourceService: MessageLiveDataSourceService,
|
||||
@@ -272,7 +272,7 @@ export class ChatPage implements OnInit {
|
||||
this.hideRefreshBtn = false;
|
||||
this.closeAllDesktopComponents()
|
||||
|
||||
this.ChatSystemService.getRoomById(this.roomId)?.roomLeave()
|
||||
// this.ChatSystemService.getRoomById(this.roomId)?.roomLeave()
|
||||
}
|
||||
else {
|
||||
this.hideRefreshBtn = true;
|
||||
@@ -446,19 +446,19 @@ export class ChatPage implements OnInit {
|
||||
async closeNewEventComponentAndOpenChat({ roomId }) {
|
||||
this.closeAllDesktopComponents();
|
||||
|
||||
this.ChatSystemService._group.forEach((room) => {
|
||||
if (room.id == roomId) {
|
||||
// this.ChatSystemService._group.forEach((room) => {
|
||||
// if (room.id == roomId) {
|
||||
|
||||
|
||||
this.openGroupMessagesPage(roomId)
|
||||
}
|
||||
})
|
||||
// this.openGroupMessagesPage(roomId)
|
||||
// }
|
||||
// })
|
||||
|
||||
this.ChatSystemService._dm.forEach((room) => {
|
||||
if (room.id == roomId) {
|
||||
this.openMessagesPage(roomId)
|
||||
}
|
||||
})
|
||||
// this.ChatSystemService._dm.forEach((room) => {
|
||||
// if (room.id == roomId) {
|
||||
// this.openMessagesPage(roomId)
|
||||
// }
|
||||
// })
|
||||
|
||||
}
|
||||
|
||||
@@ -582,7 +582,7 @@ export class ChatPage implements OnInit {
|
||||
});
|
||||
|
||||
modal.onDidDismiss().then(() => {
|
||||
this.ChatSystemService.currentRoom.roomLeave()
|
||||
// this.ChatSystemService.currentRoom.roomLeave()
|
||||
});
|
||||
await modal.present();
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import { ChatService } from 'src/app/services/chat.service';
|
||||
import { GroupMessagesPage } from '../group-messages.page';
|
||||
import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
|
||||
// import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-group-contacts',
|
||||
@@ -44,7 +44,7 @@ export class GroupContactsPage implements OnInit {
|
||||
private authService: AuthService,
|
||||
private navParams: NavParams,
|
||||
public ThemeService: ThemeService,
|
||||
public ChatSystemService: ChatSystemService,
|
||||
// public ChatSystemService: ChatSystemService,
|
||||
)
|
||||
{
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import { SearchPage } from 'src/app/pages/search/search.page';
|
||||
import { VoiceRecorder, RecordingData, GenericResponse } from 'capacitor-voice-recorder';
|
||||
import { Filesystem, Directory } from '@capacitor/filesystem';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
import { MessageService } from 'src/app/services/chat/message.service';
|
||||
// import { MessageService } from 'src/app/services/chat/message.service';
|
||||
import { File } from '@awesome-cordova-plugins/file/ngx';
|
||||
import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
@@ -1186,7 +1186,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
});
|
||||
}
|
||||
|
||||
downloadFileMsg(msg: MessageService) {
|
||||
downloadFileMsg(msg: any) {
|
||||
msg.downloadFileMsg()
|
||||
}
|
||||
|
||||
@@ -1198,7 +1198,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
downloadLink.click();
|
||||
}
|
||||
|
||||
async openPreview(msg: MessageService) {
|
||||
async openPreview(msg: any) {
|
||||
|
||||
if (msg?.file?.type === "application/webtrix") {
|
||||
this.viewDocument(msg.file, msg.attachments.image_url)
|
||||
|
||||
@@ -5,7 +5,7 @@ import { AuthService } from 'src/app/services/auth.service';
|
||||
import { ChatService } from 'src/app/services/chat.service';
|
||||
import { MessagesPage } from '../messages.page';
|
||||
import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { ChatSystemService} from 'src/app/services/chat/chat-system.service'
|
||||
// import { ChatSystemService} from 'src/app/services/chat/chat-system.service'
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
|
||||
@Component({
|
||||
@@ -23,7 +23,7 @@ export class ContactsPage implements OnInit {
|
||||
room:any;
|
||||
dm:any;
|
||||
sessionStore = SessionStore
|
||||
userList = this.ChatSystemService.users
|
||||
userList = []
|
||||
|
||||
constructor(
|
||||
private modalController: ModalController,
|
||||
@@ -31,7 +31,7 @@ export class ContactsPage implements OnInit {
|
||||
private chatService: ChatService,
|
||||
private authService: AuthService,
|
||||
public ThemeService: ThemeService,
|
||||
public ChatSystemService: ChatSystemService,
|
||||
// public ChatSystemService: ChatSystemService,
|
||||
)
|
||||
{
|
||||
this.loggedUser = SessionStore.user.ChatData['data'];
|
||||
@@ -44,7 +44,7 @@ export class ContactsPage implements OnInit {
|
||||
ngOnInit() {
|
||||
// this.chatService.refreshtoken();
|
||||
// this.loadUsers();
|
||||
this.ChatSystemService.getUser()
|
||||
// this.ChatSystemService.getUser()
|
||||
|
||||
}
|
||||
|
||||
@@ -52,10 +52,10 @@ export class ContactsPage implements OnInit {
|
||||
|
||||
this.textSearch = event.detail.value.toLowerCase();
|
||||
|
||||
this.userList = this.ChatSystemService.users.filter((e) => {
|
||||
const username = e.name.toLowerCase()
|
||||
return username.includes(this.textSearch)
|
||||
})
|
||||
// this.userList = this.ChatSystemService.users.filter((e) => {
|
||||
// const username = e.name.toLowerCase()
|
||||
// return username.includes(this.textSearch)
|
||||
// })
|
||||
|
||||
}
|
||||
|
||||
@@ -97,10 +97,10 @@ export class ContactsPage implements OnInit {
|
||||
this.chatService.createRoom(body).subscribe(async(res) => {
|
||||
this.room = res['room'];
|
||||
|
||||
this.ChatSystemService.getAllRooms(() => {
|
||||
this.getDirectMessage(this.room._id);
|
||||
this.loading = false
|
||||
}, this.room._id);
|
||||
// this.ChatSystemService.getAllRooms(() => {
|
||||
// this.getDirectMessage(this.room._id);
|
||||
// this.loading = false
|
||||
// }, this.room._id);
|
||||
|
||||
|
||||
}, ()=> {
|
||||
|
||||
@@ -19,8 +19,8 @@ import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { VoiceRecorder, RecordingData, GenericResponse } from 'capacitor-voice-recorder';
|
||||
import { Haptics, ImpactStyle } from '@capacitor/haptics';
|
||||
import { ViewEventPage } from 'src/app/modals/view-event/view-event.page';
|
||||
import { ChatSystemService } from 'src/app/services/chat/chat-system.service'
|
||||
import { MessageService } from 'src/app/services/chat/message.service';
|
||||
// import { ChatSystemService } from 'src/app/services/chat/chat-system.service'
|
||||
// import { MessageService } from 'src/app/services/chat/message.service';
|
||||
import { FileType } from 'src/app/models/fileType';
|
||||
import { SearchPage } from 'src/app/pages/search/search.page';
|
||||
import { Storage } from '@ionic/storage';
|
||||
@@ -33,7 +33,7 @@ import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
|
||||
import { Filesystem, Directory, Encoding } from '@capacitor/filesystem';
|
||||
import { NewEventPage } from '../../agenda/new-event/new-event.page';
|
||||
import { NotificationsService } from 'src/app/services/notifications.service';
|
||||
import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service'
|
||||
// import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service'
|
||||
import { FileValidatorService } from "src/app/services/file/file-validator.service"
|
||||
import { sanitize } from "sanitize-filename-ts";
|
||||
import { FilePicker } from '@capawesome/capacitor-file-picker';
|
||||
@@ -141,7 +141,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
private gestureController: GestureController,
|
||||
public ThemeService: ThemeService,
|
||||
private platform: Platform,
|
||||
public ChatSystemService: ChatSystemService,
|
||||
// public ChatSystemService: ChatSystemService,
|
||||
private storage: Storage,
|
||||
//private fileOpener: FileOpener,
|
||||
private sanitiser: DomSanitizer,
|
||||
@@ -149,7 +149,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
private file: File,
|
||||
private fileOpener: FileOpener,
|
||||
private router: Router,
|
||||
public RochetChatConnectorService: RochetChatConnectorService,
|
||||
// public RochetChatConnectorService: RochetChatConnectorService,
|
||||
private FileValidatorService: FileValidatorService,
|
||||
///
|
||||
private roomRepositoryService: RoomRepositoryService,
|
||||
@@ -208,11 +208,11 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
// console.log(this.router.url);
|
||||
this.createDirectoryImage()
|
||||
// this.chatService.refreshtoken();
|
||||
this.ChatSystemService.getUserOfRoom(this.roomId).then((value) => {
|
||||
// this.ChatSystemService.getUserOfRoom(this.roomId).then((value) => {
|
||||
|
||||
}).catch((error) => {
|
||||
console.error(error)
|
||||
})
|
||||
// }).catch((error) => {
|
||||
// console.error(error)
|
||||
// })
|
||||
|
||||
this.getChatMembers();
|
||||
} catch (error) {
|
||||
@@ -354,8 +354,8 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
deleteMessage(msgId: string) {
|
||||
const room = this.ChatSystemService.getDmRoom(this.roomId)
|
||||
this.alertService.confirmDeleteMessage(msgId, room);
|
||||
// const room = this.ChatSystemService.getDmRoom(this.roomId)
|
||||
// this.alertService.confirmDeleteMessage(msgId, room);
|
||||
}
|
||||
|
||||
|
||||
@@ -439,8 +439,8 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
sendMessage() {
|
||||
this.ChatSystemService.getDmRoom(this.roomId).send({}).then(() => {
|
||||
})
|
||||
// this.ChatSystemService.getDmRoom(this.roomId).send({}).then(() => {
|
||||
// })
|
||||
}
|
||||
|
||||
/* sendMessage(msg) {
|
||||
@@ -480,22 +480,22 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
const formData = new FormData();
|
||||
formData.append("blobFile", blob);
|
||||
|
||||
this.ChatSystemService.getDmRoom(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.getDmRoom(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();
|
||||
@@ -575,8 +575,8 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
// this.showLoader = false;
|
||||
// });
|
||||
|
||||
this.members = this.ChatSystemService.getDmRoom(this.roomId).members
|
||||
this.dmUsers = this.ChatSystemService.getDmRoom(this.roomId).membersExcludeMe
|
||||
// this.members = this.ChatSystemService.getDmRoom(this.roomId).members
|
||||
// this.dmUsers = this.ChatSystemService.getDmRoom(this.roomId).membersExcludeMe
|
||||
}
|
||||
|
||||
showDateDuration(start: any) {
|
||||
@@ -644,20 +644,20 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
async bookMeeting() {
|
||||
let attendees = this.ChatSystemService.getDmRoom(this.roomId).members.map((val) => {
|
||||
return {
|
||||
Name: val.name,
|
||||
EmailAddress: val.username + "@" + environment.domain,
|
||||
IsRequired: "true",
|
||||
}
|
||||
});
|
||||
// let attendees = this.ChatSystemService.getDmRoom(this.roomId).members.map((val) => {
|
||||
// return {
|
||||
// Name: val.name,
|
||||
// EmailAddress: val.username + "@" + environment.domain,
|
||||
// IsRequired: "true",
|
||||
// }
|
||||
// });
|
||||
|
||||
this.popoverController.dismiss();
|
||||
if (window.innerWidth <= 1024) {
|
||||
const modal = await this.modalController.create({
|
||||
component: NewEventPage,
|
||||
componentProps: {
|
||||
attendees: attendees,
|
||||
// attendees: attendees,
|
||||
roomId: this.roomId
|
||||
},
|
||||
cssClass: 'modal modal-desktop',
|
||||
@@ -719,21 +719,21 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
const formData = new FormData();
|
||||
formData.append("blobFile", blob);
|
||||
|
||||
this.ChatSystemService.getDmRoom(roomId).send({
|
||||
file: {
|
||||
"type": "application/img",
|
||||
"guid": ''
|
||||
},
|
||||
attachments: [{
|
||||
"title": "file.jpg",
|
||||
"text": "description",
|
||||
"title_link_download": false,
|
||||
}],
|
||||
temporaryData: formData,
|
||||
attachmentsModelData: {
|
||||
fileBase64: imageBase64,
|
||||
}
|
||||
})
|
||||
// this.ChatSystemService.getDmRoom(roomId).send({
|
||||
// file: {
|
||||
// "type": "application/img",
|
||||
// "guid": ''
|
||||
// },
|
||||
// attachments: [{
|
||||
// "title": "file.jpg",
|
||||
// "text": "description",
|
||||
// "title_link_download": false,
|
||||
// }],
|
||||
// temporaryData: formData,
|
||||
// attachmentsModelData: {
|
||||
// fileBase64: imageBase64,
|
||||
// }
|
||||
// })
|
||||
|
||||
}
|
||||
|
||||
@@ -791,26 +791,26 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
if (data.selected) {
|
||||
|
||||
this.ChatSystemService.getDmRoom(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": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
|
||||
// "message_link": url_no_options,
|
||||
"text": res.data.selected.DocTypeDesc,
|
||||
"type": "webtrix"
|
||||
}],
|
||||
})
|
||||
// this.ChatSystemService.getDmRoom(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": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
|
||||
// // "message_link": url_no_options,
|
||||
// "text": res.data.selected.DocTypeDesc,
|
||||
// "type": "webtrix"
|
||||
// }],
|
||||
// })
|
||||
|
||||
}
|
||||
});
|
||||
@@ -852,21 +852,21 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
formData.append("blobFile", blob);
|
||||
//console.log('add file', formData)
|
||||
|
||||
this.ChatSystemService.getDmRoom(roomId).send({
|
||||
file: {
|
||||
"type": "application/img",
|
||||
"guid": ''
|
||||
},
|
||||
temporaryData: formData,
|
||||
attachments: [{
|
||||
"title": file.path,
|
||||
"text": "description",
|
||||
"title_link_download": false,
|
||||
}],
|
||||
attachmentsModelData: {
|
||||
fileBase64: imageBase64,
|
||||
}
|
||||
})
|
||||
// this.ChatSystemService.getDmRoom(roomId).send({
|
||||
// file: {
|
||||
// "type": "application/img",
|
||||
// "guid": ''
|
||||
// },
|
||||
// temporaryData: formData,
|
||||
// attachments: [{
|
||||
// "title": file.path,
|
||||
// "text": "description",
|
||||
// "title_link_download": false,
|
||||
// }],
|
||||
// attachmentsModelData: {
|
||||
// fileBase64: imageBase64,
|
||||
// }
|
||||
// })
|
||||
|
||||
}
|
||||
|
||||
@@ -913,22 +913,22 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
formDataa.append('blobFile', blobb);
|
||||
/* console.log('add file', fileBase64) */
|
||||
|
||||
this.ChatSystemService.getDmRoom(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.getDmRoom(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
|
||||
|
||||
}
|
||||
@@ -964,22 +964,22 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
formData.append('blobFile', blob);
|
||||
/* console.log('add file', fileBase64) */
|
||||
|
||||
this.ChatSystemService.getDmRoom(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.getDmRoom(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 {
|
||||
this.toastService._badRequest("Ficheiro inválido")
|
||||
}
|
||||
@@ -1120,7 +1120,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
} */
|
||||
|
||||
|
||||
downloadFileMsg(msg: MessageService) {
|
||||
downloadFileMsg(msg: any) {
|
||||
msg.downloadFileMsg();
|
||||
}
|
||||
|
||||
@@ -1387,11 +1387,10 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
|
||||
messageDelete({messageId}) {
|
||||
messageDelete(message: MessageEntity) {
|
||||
// this.messageRepositoryService.sendMessageDelete()
|
||||
console.log('messageId', messageId)
|
||||
this.chatServiceService.messageDelete({
|
||||
messageId: messageId,
|
||||
messageId: message.id,
|
||||
roomId: this.roomId,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ import { ModalController, NavParams, PickerController, PopoverController } from
|
||||
import { GroupDurationPage } from 'src/app/shared/popover/group-duration/group-duration.page';
|
||||
import { GroupContactsPage } from '../group-messages/group-contacts/group-contacts.page';
|
||||
import { ThemeService } from 'src/app/services/theme.service';
|
||||
import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
@@ -30,7 +29,7 @@ export class NewGroupPage implements OnInit {
|
||||
private modalController: ModalController,
|
||||
private navParams: NavParams,
|
||||
public ThemeService: ThemeService,
|
||||
public ChatSystemService: ChatSystemService,
|
||||
// public ChatSystemService: ChatSystemService,
|
||||
private toastService: ToastService,
|
||||
) {
|
||||
this.loggedUserChat = SessionStore.user.ChatData['data'];
|
||||
@@ -60,133 +59,133 @@ export class NewGroupPage implements OnInit {
|
||||
|
||||
async createGroup() {
|
||||
|
||||
let name = this.groupName.split(' ').join('-');
|
||||
//Take out all special characters in string
|
||||
name = name.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
|
||||
// let name = this.groupName.split(' ').join('-');
|
||||
// //Take out all special characters in string
|
||||
// name = name.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
|
||||
|
||||
let customFields = {}
|
||||
let res: any;
|
||||
// let customFields = {}
|
||||
// let res: any;
|
||||
|
||||
if(!SessionStore.user?.ChatData?.data) {
|
||||
this.toastService._successMessage("Chat temporariamente indisponível")
|
||||
}
|
||||
// if(!SessionStore.user?.ChatData?.data) {
|
||||
// this.toastService._successMessage("Chat temporariamente indisponível")
|
||||
// }
|
||||
|
||||
try {
|
||||
// try {
|
||||
|
||||
if (this.thedate) {
|
||||
let customFields = {
|
||||
"countDownDate": this.thedate
|
||||
}
|
||||
res = await this.ChatSystemService.createPrivateRoom(name, SessionStore.user.UserName, customFields);
|
||||
}
|
||||
else {
|
||||
res = await this.ChatSystemService.createPrivateRoom(name, SessionStore.user.UserName, customFields);
|
||||
}
|
||||
// if (this.thedate) {
|
||||
// let customFields = {
|
||||
// "countDownDate": this.thedate
|
||||
// }
|
||||
// res = await this.ChatSystemService.createPrivateRoom(name, SessionStore.user.UserName, customFields);
|
||||
// }
|
||||
// else {
|
||||
// res = await this.ChatSystemService.createPrivateRoom(name, SessionStore.user.UserName, customFields);
|
||||
// }
|
||||
|
||||
try {
|
||||
this.isGroupCreated = true;
|
||||
this.addContacts(res.result);
|
||||
this.ChatSystemService.getRoom([res.result]);
|
||||
// try {
|
||||
// this.isGroupCreated = true;
|
||||
// this.addContacts(res.result);
|
||||
// this.ChatSystemService.getRoom([res.result]);
|
||||
|
||||
setTimeout(() => {
|
||||
this.ChatSystemService.subscribeToRoomUpdate(res.result.rid, res.result);
|
||||
}, 10)
|
||||
// setTimeout(() => {
|
||||
// this.ChatSystemService.subscribeToRoomUpdate(res.result.rid, res.result);
|
||||
// }, 10)
|
||||
|
||||
} catch (error) {
|
||||
await this.ChatSystemService.getUser();
|
||||
await this.ChatSystemService.getAllRooms();
|
||||
await this.ChatSystemService.subscribeToRoom();
|
||||
// } catch (error) {
|
||||
// await this.ChatSystemService.getUser();
|
||||
// await this.ChatSystemService.getAllRooms();
|
||||
// await this.ChatSystemService.subscribeToRoom();
|
||||
|
||||
this.isGroupCreated = true;
|
||||
this.addContacts(res.result);
|
||||
this.ChatSystemService.getRoom([res.result]);
|
||||
// this.isGroupCreated = true;
|
||||
// this.addContacts(res.result);
|
||||
// this.ChatSystemService.getRoom([res.result]);
|
||||
|
||||
setTimeout(() => {
|
||||
this.ChatSystemService.subscribeToRoomUpdate(res.result.rid, res.result);
|
||||
}, 10)
|
||||
// setTimeout(() => {
|
||||
// this.ChatSystemService.subscribeToRoomUpdate(res.result.rid, res.result);
|
||||
// }, 10)
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
|
||||
if (res?.result?.rid) {
|
||||
// if (res?.result?.rid) {
|
||||
|
||||
this.ChatSystemService.getAllRooms(() => {
|
||||
if (!this.ChatSystemService.getGroupRoom(res.result.rid)) {
|
||||
this.createGroupWithAttachmentsCath(res)
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
// this.ChatSystemService.getAllRooms(() => {
|
||||
// if (!this.ChatSystemService.getGroupRoom(res.result.rid)) {
|
||||
// this.createGroupWithAttachmentsCath(res)
|
||||
// } else {
|
||||
// setTimeout(() => {
|
||||
|
||||
this.createGroupWithAttachments(res)
|
||||
// this.createGroupWithAttachments(res)
|
||||
|
||||
}, 500)
|
||||
}
|
||||
}, res.result.rid);
|
||||
// }, 500)
|
||||
// }
|
||||
// }, res.result.rid);
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
// } else {
|
||||
|
||||
this.toastService._badRequest('Existe um grupo com este nome!');
|
||||
// this.toastService._badRequest('Existe um grupo com este nome!');
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
} catch(error) {
|
||||
this.toastService._successMessage("Chat temporariamente indisponível")
|
||||
}
|
||||
// } catch(error) {
|
||||
// this.toastService._successMessage("Chat temporariamente indisponível")
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
createGroupWithAttachmentsCath(res: any) {
|
||||
if (!this.ChatSystemService.getGroupRoom(res.result.rid)) {
|
||||
setTimeout(() => {
|
||||
this.createGroupWithAttachmentsCath(res)
|
||||
}, 1500)
|
||||
} else {
|
||||
this.createGroupWithAttachments(res)
|
||||
}
|
||||
// if (!this.ChatSystemService.getGroupRoom(res.result.rid)) {
|
||||
// setTimeout(() => {
|
||||
// this.createGroupWithAttachmentsCath(res)
|
||||
// }, 1500)
|
||||
// } else {
|
||||
// this.createGroupWithAttachments(res)
|
||||
// }
|
||||
}
|
||||
|
||||
createGroupWithAttachments(res: any) {
|
||||
this.ChatSystemService.getGroupRoom(res.result.rid).hasLoadHistory = true;
|
||||
// this.ChatSystemService.getGroupRoom(res.result.rid).hasLoadHistory = true;
|
||||
|
||||
if (this.documents) {
|
||||
this.documents.forEach(element => {
|
||||
this.ChatSystemService.getGroupRoom(res.result.rid).send({
|
||||
file: {
|
||||
"name": element.Assunto,
|
||||
"type": "application/webtrix",
|
||||
"ApplicationId": element.ApplicationId,
|
||||
"DocId": element.DocId,
|
||||
"Assunto": element.Assunto,
|
||||
},
|
||||
temporaryData: {
|
||||
data: {
|
||||
selected: {
|
||||
Id: element.DocId,
|
||||
ApplicationType: element.ApplicationId
|
||||
}
|
||||
}
|
||||
},
|
||||
attachments: [{
|
||||
"title": element.Assunto,
|
||||
"description": element.Assunto,
|
||||
"title_link_download": true,
|
||||
"type": "webtrix",
|
||||
"text": element.Assunto,
|
||||
"thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
|
||||
}],
|
||||
})
|
||||
});
|
||||
}
|
||||
// if (this.documents) {
|
||||
// this.documents.forEach(element => {
|
||||
// this.ChatSystemService.getGroupRoom(res.result.rid).send({
|
||||
// file: {
|
||||
// "name": element.Assunto,
|
||||
// "type": "application/webtrix",
|
||||
// "ApplicationId": element.ApplicationId,
|
||||
// "DocId": element.DocId,
|
||||
// "Assunto": element.Assunto,
|
||||
// },
|
||||
// temporaryData: {
|
||||
// data: {
|
||||
// selected: {
|
||||
// Id: element.DocId,
|
||||
// ApplicationType: element.ApplicationId
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// attachments: [{
|
||||
// "title": element.Assunto,
|
||||
// "description": element.Assunto,
|
||||
// "title_link_download": true,
|
||||
// "type": "webtrix",
|
||||
// "text": element.Assunto,
|
||||
// "thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
|
||||
// }],
|
||||
// })
|
||||
// });
|
||||
// }
|
||||
|
||||
|
||||
this.ChatSystemService.getAllRooms();
|
||||
// this.ChatSystemService.getAllRooms();
|
||||
|
||||
setTimeout(() => {
|
||||
this.groupName = ""
|
||||
}, 150);
|
||||
// setTimeout(() => {
|
||||
// this.groupName = ""
|
||||
// }, 150);
|
||||
}
|
||||
|
||||
async addContacts(room) {
|
||||
|
||||
Reference in New Issue
Block a user