mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
fix chat open modal
This commit is contained in:
@@ -118,39 +118,50 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
private router: Router,
|
||||
public RochetChatConnectorService: RochetChatConnectorService,
|
||||
) {
|
||||
this.loggedUser = SessionStore.user.ChatData['data'];
|
||||
this.roomId = this.navParams.get('roomId');
|
||||
|
||||
try {
|
||||
|
||||
this.loggedUser = SessionStore.user.ChatData['data'];
|
||||
this.roomId = this.navParams.get('roomId');
|
||||
|
||||
|
||||
window.onresize = (event) => {
|
||||
if (window.innerWidth > 701) {
|
||||
this.modalController.dismiss();
|
||||
window.onresize = (event) => {
|
||||
if (window.innerWidth > 701) {
|
||||
this.modalController.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.ChatSystemService.getDmRoom(this.roomId).loadHistory({})
|
||||
this.ChatSystemService.getDmRoom(this.roomId).scrollDown = this.scrollToBottomClicked
|
||||
this.ChatSystemService.openRoom(this.roomId)
|
||||
|
||||
setTimeout(() => {
|
||||
this.scrollToBottomClicked()
|
||||
}, 150)
|
||||
} catch (error) {
|
||||
//alert(error)
|
||||
}
|
||||
|
||||
|
||||
this.ChatSystemService.getDmRoom(this.roomId).loadHistory({})
|
||||
this.ChatSystemService.getDmRoom(this.roomId).scrollDown = this.scrollToBottomClicked
|
||||
this.ChatSystemService.openRoom(this.roomId)
|
||||
|
||||
setTimeout(() => {
|
||||
this.scrollToBottomClicked()
|
||||
}, 150)
|
||||
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
console.log(this.router.url);
|
||||
this.createDirectoryImage()
|
||||
// this.chatService.refreshtoken();
|
||||
this.ChatSystemService.getUserOfRoom(this.roomId).then((value) => {
|
||||
try {
|
||||
console.log(this.router.url);
|
||||
this.createDirectoryImage()
|
||||
// this.chatService.refreshtoken();
|
||||
this.ChatSystemService.getUserOfRoom(this.roomId).then((value) => {
|
||||
|
||||
}).catch((error) => {
|
||||
console.error(error)
|
||||
})
|
||||
}).catch((error) => {
|
||||
console.error(error)
|
||||
})
|
||||
|
||||
this.getChatMembers();
|
||||
} catch (error) {
|
||||
//alert(error)
|
||||
}
|
||||
|
||||
this.getChatMembers();
|
||||
}
|
||||
|
||||
|
||||
@@ -175,8 +186,8 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
longpress.enable();
|
||||
}
|
||||
|
||||
onDragOver(e?) {}
|
||||
onDragLeave(e?) {}
|
||||
onDragOver(e?) { }
|
||||
onDragLeave(e?) { }
|
||||
|
||||
calculateDuration() {
|
||||
if (!this.recording) {
|
||||
@@ -668,7 +679,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
}
|
||||
|
||||
dataURItoBlob(dataURI) {
|
||||
dataURItoBlob(dataURI) {
|
||||
// convert base64 to raw binary data held in a string
|
||||
// doesn't handle URLEncoded DataURIs - see SO answer #6850276 for code that does this
|
||||
var byteString = atob(dataURI.split(',')[1]);
|
||||
@@ -684,11 +695,11 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
// set the bytes of the buffer to the correct values
|
||||
for (var i = 0; i < byteString.length; i++) {
|
||||
ia[i] = byteString.charCodeAt(i);
|
||||
ia[i] = byteString.charCodeAt(i);
|
||||
}
|
||||
|
||||
// write the ArrayBuffer to a blob, and you're done
|
||||
var blob = new Blob([ab], {type: mimeString});
|
||||
var blob = new Blob([ab], { type: mimeString });
|
||||
return blob;
|
||||
|
||||
}
|
||||
@@ -810,7 +821,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
|
||||
_getBase64(file) {
|
||||
return new Promise((resolve, reject)=>{
|
||||
return new Promise((resolve, reject) => {
|
||||
var reader = new FileReader();
|
||||
reader.readAsDataURL(file);
|
||||
reader.onload = function () {
|
||||
@@ -820,7 +831,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
console.log('Error: ', error);
|
||||
};
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async addFileToChat(types: typeof FileType[]) {
|
||||
console.log('add file')
|
||||
@@ -844,18 +855,18 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
|
||||
if (file.type != "application/img" && file.type != "image/png" && file.type != "image/jpeg" && file.type != "image/gif") {
|
||||
console.log('TYPE',file.type)
|
||||
console.log('TYPE', file.type)
|
||||
|
||||
const encodedData = btoa(JSON.stringify(await this.getBase64(file).catch ((error) => {
|
||||
const encodedData = btoa(JSON.stringify(await this.getBase64(file).catch((error) => {
|
||||
console.error(error);
|
||||
})));
|
||||
console.log(encodedData)
|
||||
const blob = this.fileService.base64toBlob(encodedData, file.type)
|
||||
console.log('BLOB BLOB',blob)
|
||||
console.log('BLOB BLOB', blob)
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('blobFile', blob);
|
||||
/* console.log('add file', fileBase64) */
|
||||
/* console.log('add file', fileBase64) */
|
||||
|
||||
this.ChatSystemService.getDmRoom(roomId).send({
|
||||
file: {
|
||||
@@ -1065,9 +1076,9 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
}).then((dir) => {
|
||||
console.log('DIR ', dir)
|
||||
this.fileOpener
|
||||
.open(dir.uri, type)
|
||||
.then(() => console.log())
|
||||
.catch(e => console.error(e))
|
||||
.open(dir.uri, type)
|
||||
.then(() => console.log())
|
||||
.catch(e => console.error(e))
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user