mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
add contact page
This commit is contained in:
@@ -19,7 +19,7 @@ import { Haptics, ImpactStyle } from '@capacitor/haptics';
|
||||
import { ViewEventPage } from 'src/app/modals/view-event/view-event.page';
|
||||
import { SearchPage } from 'src/app/pages/search/search.page';
|
||||
import { Storage } from '@ionic/storage';
|
||||
import { Camera, CameraResultType } from '@capacitor/camera';
|
||||
import { Camera, CameraResultType, CameraSource } from '@capacitor/camera';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page';
|
||||
@@ -147,24 +147,16 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
private gestureController: GestureController,
|
||||
public ThemeService: ThemeService,
|
||||
private platform: Platform,
|
||||
// public ChatSystemService: ChatSystemService,
|
||||
private storage: Storage,
|
||||
//private fileOpener: FileOpener,
|
||||
private sanitiser: DomSanitizer,
|
||||
// private document: DocumentViewer
|
||||
private file: File,
|
||||
private fileOpener: FileOpener,
|
||||
private router: Router,
|
||||
// public RochetChatConnectorService: RochetChatConnectorService,
|
||||
private FileValidatorService: FileValidatorService,
|
||||
///
|
||||
private roomRepositoryService: RoomRepositoryService,
|
||||
private messageRepositoryService: MessageRepositoryService,
|
||||
private userTypingServiceRepository: UserTypingServiceRepository,
|
||||
private chatServiceService: ChatServiceService,
|
||||
private CameraService: CameraService,
|
||||
private FilePickerService: FilePickerService,
|
||||
private FilePickerMobileService: FilePickerMobileService
|
||||
) {
|
||||
|
||||
|
||||
@@ -184,16 +176,6 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.roomMembers$ = this.roomRepositoryService.getRoomMemberByIdLive(this.roomId) as any
|
||||
this.roomStatus$ = this.roomRepositoryService.getRoomStatus(this.roomId)
|
||||
this.roomRepositoryService.getRoomById(this.roomId)
|
||||
// this.messageRepositoryService.listAllMessagesByRoomId(this.roomId)
|
||||
|
||||
this.userTypingServiceRepository.getUserTypingLive().subscribe((e) => {
|
||||
const arrayNames = e.map(e => e.userName)
|
||||
this.userTyping$ = e as any
|
||||
|
||||
const uniqueArray = [...new Set(arrayNames)];
|
||||
|
||||
//(this.myInputRef.nativeElement as HTMLDivElement).innerHTML = '::'+ uniqueArray
|
||||
})
|
||||
|
||||
this.newMessagesStream?.unsubscribe()
|
||||
this.newMessagesStream = this.messageRepositoryService.subscribeToNewMessages(this.roomId).subscribe((e) => {
|
||||
@@ -255,23 +237,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
try {
|
||||
// console.log(this.router.url);
|
||||
this.createDirectoryImage()
|
||||
// this.chatService.refreshtoken();
|
||||
// this.ChatSystemService.getUserOfRoom(this.roomId).then((value) => {
|
||||
|
||||
// }).catch((error) => {
|
||||
// console.error(error)
|
||||
// })
|
||||
|
||||
this.getChatMembers();
|
||||
} catch (error) {
|
||||
//alert(error)
|
||||
}
|
||||
|
||||
}
|
||||
ngOnInit() {}
|
||||
|
||||
|
||||
ngAfterViewInit() {
|
||||
@@ -495,10 +461,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.selectedMsgId = "";
|
||||
}
|
||||
|
||||
deleteMessage(msgId: string) {
|
||||
// const room = this.ChatSystemService.getDmRoom(this.roomId)
|
||||
// this.alertService.confirmDeleteMessage(msgId, room);
|
||||
}
|
||||
deleteMessage(msgId: string) {}
|
||||
|
||||
|
||||
notImplemented() {
|
||||
@@ -598,20 +561,6 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.textField = ''
|
||||
}
|
||||
|
||||
/* sendMessage(msg) {
|
||||
let lastMsg = msg.pop();
|
||||
console.log(msg)
|
||||
console.log(lastMsg._id,lastMsg.u.username,lastMsg.msg)
|
||||
this.ChatSystemService.getDmRoom(this.roomId).send({}).then(() => {
|
||||
if(lastMsg.u.username == this.members[1].username) {
|
||||
this.notificationService.ChatSendMessageNotification(this.members[0].username,this.members[1].name,lastMsg.msg,this.roomId)
|
||||
} else if (msg.u.username == this.members[0].username) {
|
||||
this.notificationService.ChatSendMessageNotification(this.members[1].username,this.members[1].name,lastMsg.msg,this.roomId)
|
||||
}
|
||||
|
||||
})
|
||||
} */
|
||||
|
||||
async sendAudio(fileName) {
|
||||
const roomId = this.roomId
|
||||
let audioFile;
|
||||
@@ -644,12 +593,15 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
fileName: "audio",
|
||||
source: MessageAttachmentSource.Device,
|
||||
fileType: MessageAttachmentFileType.Audio,
|
||||
mimeType: audioMimeType
|
||||
mimeType: audioMimeType,
|
||||
safeFile: this.sanitiser.bypassSecurityTrustResourceUrl(this.audioRecorded)
|
||||
}]
|
||||
|
||||
this.messages1[this.roomId].push(message)
|
||||
this.chatServiceService.sendMessage(message)
|
||||
|
||||
setTimeout(() => {
|
||||
this.scrollToBottomClicked()
|
||||
}, 100)
|
||||
|
||||
});
|
||||
this.deleteRecording();
|
||||
@@ -721,17 +673,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
await modal.present();
|
||||
}
|
||||
|
||||
getChatMembers() {
|
||||
// this.showLoader = true;
|
||||
// this.chatService.getMembers(this.roomId).subscribe(res => {
|
||||
// this.members = res['members'];
|
||||
// this.dmUsers = res['members'].filter(data => data.username != this.sessionStore.user.UserName)
|
||||
// this.showLoader = false;
|
||||
// });
|
||||
|
||||
// this.members = this.ChatSystemService.getDmRoom(this.roomId).members
|
||||
// this.dmUsers = this.ChatSystemService.getDmRoom(this.roomId).membersExcludeMe
|
||||
}
|
||||
getChatMembers() {}
|
||||
|
||||
showDateDuration(start: any) {
|
||||
let end;
|
||||
@@ -801,47 +743,8 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
async takePictureMobile() {
|
||||
|
||||
const picture = await this.CameraService.takePicture({
|
||||
cameraResultType: CameraResultType.DataUrl,
|
||||
quality: 90
|
||||
})
|
||||
this.addFileToChatMobile()
|
||||
|
||||
if(picture.isOk()) {
|
||||
const file = picture.value
|
||||
|
||||
const compressedImage = await compressImageBase64(
|
||||
file.dataUrl,
|
||||
800, // maxWidth
|
||||
800, // maxHeight
|
||||
0.9 // quality
|
||||
)
|
||||
|
||||
if(compressedImage.isOk()) {
|
||||
|
||||
const message = new MessageEntity();
|
||||
message.roomId = this.roomId
|
||||
|
||||
message.sender = {
|
||||
userPhoto: '',
|
||||
wxeMail: SessionStore.user.Email,
|
||||
wxFullName: SessionStore.user.FullName,
|
||||
wxUserId: SessionStore.user.UserId
|
||||
}
|
||||
|
||||
message.attachments = [{
|
||||
file: compressedImage.value.split(',')[1],
|
||||
fileName: "foto",
|
||||
source: MessageAttachmentSource.Device,
|
||||
fileType: MessageAttachmentFileType.Image,
|
||||
mimeType: 'image/'+picture.value.format
|
||||
}]
|
||||
|
||||
this.messages1[this.roomId].push(message)
|
||||
this.chatServiceService.sendMessage(message)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -969,59 +872,59 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
}
|
||||
|
||||
// async addFileToChatMobile() {
|
||||
// const roomId = this.roomId
|
||||
async addFileToChatMobile() {
|
||||
const roomId = this.roomId
|
||||
|
||||
// const file = await Camera.getPhoto({
|
||||
// quality: 90,
|
||||
// // allowEditing: true,
|
||||
// resultType: CameraResultType.Base64,
|
||||
// source: CameraSource.Photos
|
||||
// });
|
||||
const file = await Camera.getPhoto({
|
||||
quality: 90,
|
||||
// allowEditing: true,
|
||||
resultType: CameraResultType.Base64,
|
||||
source: CameraSource.Photos
|
||||
});
|
||||
|
||||
// //const imageData = await this.fileToBase64Service.convert(file)
|
||||
// //
|
||||
//const imageData = await this.fileToBase64Service.convert(file)
|
||||
//
|
||||
|
||||
// var imageBase64 = 'data:image/jpeg;base64,' + file.base64String
|
||||
var imageBase64 = 'data:image/jpeg;base64,' + file.base64String
|
||||
|
||||
|
||||
// const compressedImage = await this.compressImageBase64(
|
||||
// imageBase64,
|
||||
// 800, // maxWidth
|
||||
// 800, // maxHeight
|
||||
// 0.9 // quality
|
||||
// ).then((picture) => {
|
||||
// console.log('Selected: ', picture)
|
||||
// imageBase64 = picture
|
||||
// });
|
||||
const compressedImage = await this.compressImageBase64(
|
||||
imageBase64,
|
||||
800, // maxWidth
|
||||
800, // maxHeight
|
||||
0.9 // quality
|
||||
).then((picture) => {
|
||||
console.log('Selected: ', picture)
|
||||
imageBase64 = picture
|
||||
});
|
||||
|
||||
// //console.log(imageBase64)
|
||||
//console.log(imageBase64)
|
||||
|
||||
// const response = await fetch(imageBase64);
|
||||
// const blob = await response.blob();
|
||||
const response = await fetch(imageBase64);
|
||||
const blob = await response.blob();
|
||||
|
||||
// const formData = new FormData();
|
||||
// //console.log('add file', formData)
|
||||
// formData.append("blobFile", blob);
|
||||
// //console.log('add file', formData)
|
||||
const formData = new FormData();
|
||||
//console.log('add file', formData)
|
||||
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,
|
||||
// }
|
||||
// })
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
getFileReader(): FileReader {
|
||||
const fileReader = new FileReader();
|
||||
|
||||
Reference in New Issue
Block a user