This commit is contained in:
Peter Maquiran
2022-02-16 15:55:29 +01:00
15 changed files with 100 additions and 227 deletions
+3 -3
View File
@@ -235,7 +235,7 @@ export class ChatPage implements OnInit {
this.idSelected = '';
this.groupRoomId = data;
this.closeAllDesktopComponents();
if (window.innerWidth < 801) {
if (window.innerWidth < 701) {
}
else {
@@ -270,7 +270,7 @@ export class ChatPage implements OnInit {
}
openNewGroupPage() {
this.idSelected = '';
if (window.innerWidth < 801) {
if (window.innerWidth < 701) {
this.newGroup();
}
else {
@@ -280,7 +280,7 @@ export class ChatPage implements OnInit {
}
openEditGroupPage(rid) {
if (window.innerWidth < 801) {
if (window.innerWidth < 701) {
this.editGroup(rid);
}
else {
@@ -820,7 +820,7 @@ downloadFileMsg(msg) {
async openPreview(msg) {
if (msg.file.image_url === null || msg.file.image_url === '' ) {
if (msg.attachments[0].image_url === null || msg.attachments[0].image_url === '' ) {
this.downloadFileMsg(msg)
} else {
@@ -828,7 +828,7 @@ async openPreview(msg) {
component: ViewMediaPage,
cssClass: 'modal modal-desktop',
componentProps: {
image: msg.file.image_url,
image: msg.attachments[0].image_url,
username: msg.u.name,
_updatedAt: msg._updatedAt
}
+2 -2
View File
@@ -809,7 +809,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
async openPreview(msg) {
if (msg.file.image_url === null || msg.file.image_url === '' ) {
if (msg.attachments[0].image_url === null || msg.attachments[0].image_url === '' ) {
this.downloadFileMsg(msg)
} else {
@@ -817,7 +817,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
component: ViewMediaPage,
cssClass: 'modal modal-desktop',
componentProps: {
image: msg.file.image_url,
image: msg.attachments[0].image_url,
username: msg.u.name,
_updatedAt: msg._updatedAt
}
@@ -87,62 +87,6 @@ export class NewGroupPage implements OnInit {
this.wsChatMethodsService.subscribeToRoomUpdate(res.result.rid, res.result);
//this.addGroupMessage.emit(res.result.rid);
/*
let body = { "name":name, }
this.chatService.addGroup(body).subscribe(res=>{
console.log('group created');
console.log(res['group']);
//this.addGroupMessage.emit(res['group']._id);
if(this.thedate){
let countDownBody = {
"roomId": res['group']._id,
"customFields":{"countDownDate":this.thedate}
}
this.chatService.setGroupCustomFields(countDownBody).subscribe(res=>{
console.log(res);
});
}
this.isGroupCreated = true;
this.addContacts(res['group']);
if(this.documents.length > 0){
//If there is documents add
this.documents.forEach(async document => {
let url = await this.processesService.GetDocumentUrl(document.DocId, document.ApplicationId).toPromise();
let url_no_options: string = url.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
let body = {
"message":
{
"rid": res['group']._id,
"msg": "",
"attachments": [{
"title": document.Assunto,
"description": document.DocTypeDesc,
"title_link": url_no_options,
"title_link_download": true,
//"thumb_url": "assets/images/webtrix-logo.png",
"message_link": url_no_options,
"type": "webtrix"
}],
"file":{
"name": document.Assunto,
"type": "application/webtrix",
"ApplicationId": document.ApplicationType,
"DocId": document.Id,
"Assunto": document.Assunto,
}
}
}
this.chatService.sendMessage(body).toPromise();
});
}
}); */
}
async addContacts(room){
@@ -132,22 +132,21 @@ export class ViewPublicationsPage implements OnInit {
this.showLoader = true;
const folderId = this.folderId
this.getFromDB()
this.publications.GetPublicationsImages(this.folderId).subscribe(res => {
console.log('publications ids', res)
this.publicationList = new Array();
for(let i = 0; i < res.length; i++) {
/* for(let i = 0; i < res.length; i++) {
this.publications.GetPublicationById(res[i]).subscribe(ress => {
console.log('publications by ids', ress)
let item: Publication = this.publicationPipe.itemList(ress)
console.log('publications by ids 2', item)
this.publicationList.push(item);
})
}
} */
/* res.forEach(element => {
res.forEach(element => {
console.log('publications elements', element)
this.publications.GetPublicationById(element).subscribe(ress => {
console.log('publications by ids', ress)
@@ -156,7 +155,7 @@ export class ViewPublicationsPage implements OnInit {
this.publicationList.push(item);
})
}); */
});
console.log('PUBLICATIONS IMAGEs',this.publicationList)
this.sqliteservice.updateactions(this.folderId, JSON.stringify(this.publicationList));
console.log('PUBLICATIONS IMAGEs',this.publicationList)
@@ -175,6 +174,8 @@ export class ViewPublicationsPage implements OnInit {
this.publicationListStorage.add(folderId, this.publicationList)
this.getpublication = this.publicationList; */
}, (error) => {
this.getFromDB()
});
}
+1 -1
View File
@@ -83,8 +83,8 @@ export class ChatService {
params: params
}
return this.http.get(environment.apiChatUrl+'rooms.info', opts);
}
customsRooms(params:any){
let opts = {
headers: this.headers,
@@ -284,6 +284,7 @@ export class WsChatMethodsService {
room.sortRoomList = this.sortRoomList
// create individual room
if(this.isIndividual(roomData)) {
this.dm[roomId] = room
@@ -379,12 +380,29 @@ export class WsChatMethodsService {
return this.WsChatService.leaveRoom(id);
}
async hideRoom(id) {
this._dm.forEach((md, index)=>{
if(md.id == id) {
this._dm.splice(index, 1)
delete this.dm[id]
}
});
this._group.forEach((group, index)=>{
if(group.id == id) {
this._group.splice(index, 1)
delete this.group[id]
}
})
}
hidingRoom(id?) {
return this.WsChatService.hidingRoom(id).then(()=>{
// this.hideRoom(id)
})
return this.WsChatService.hidingRoom(id);
}
addRoomOwner(roomid, userId){
+2
View File
@@ -277,6 +277,8 @@ export class WsChatService {
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
if(message.id == requestId ) { // same request send
resolve(message)
console.log(message);
return true
}
}})
@@ -367,9 +367,9 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
console.log(res);
if (res.data == 'leave') {
this.getRoomInfo();
this.wsChatMethodsService.hidingRoom(this.roomId);
this.closeAllDesktopComponents.emit();
this.showEmptyContainer.emit();
this.wsChatMethodsService.hidingRoom(this.roomId);
}
else if (res.data == 'delete') {
this.closeAllDesktopComponents.emit();
@@ -833,7 +833,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
async openPreview(msg) {
if (msg.file.image_url === null || msg.file.image_url === '' ) {
if (msg.attachments[0].image_url === null || msg.attachments[0].image_url === '' ) {
this.downloadFileMsg(msg)
} else {
@@ -841,7 +841,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
component: ViewMediaPage,
cssClass: 'modal modal-desktop',
componentProps: {
image: msg.file.image_url,
image: msg.attachments[0].image_url,
username: msg.u.name,
_updatedAt: msg._updatedAt
}
@@ -755,8 +755,9 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}
async openPreview(msg) {
console.log(msg);
if (msg.file.image_url === null || msg.file.image_url === '' ) {
if (msg.attachments[0].image_url === null || msg.attachments[0].image_url === '' ) {
this.downloadFileMsg(msg)
} else {
@@ -764,7 +765,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
component: ViewMediaPage,
cssClass: 'modal modal-desktop',
componentProps: {
image: msg.file.image_url,
image: msg.attachments[0].image_url,
username: msg.u.name,
_updatedAt: msg._updatedAt
}
@@ -113,64 +113,6 @@ export class NewGroupPage implements OnInit{
this.wsChatMethodsService.subscribeToRoomUpdate(res.result.rid, res.result);
this.addGroupMessage.emit(res.result.rid);
/*
let body = { "name":name, }
this.chatService.addGroup(body).subscribe(res=>{
console.log('group created');
console.log(res['group']);
this.addGroupMessage.emit(res['group']._id); */
/* this.addGroupMessage.emit(res['group']._id);
if(this.thedate){
let countDownBody = {
"roomId": res['group']._id,
"customFields":{"countDownDate":this.thedate}
}
this.chatService.setGroupCustomFields(countDownBody).subscribe(res=>{
console.log(res);
});
}
if(this.documents.length > 0){
//If there is documents add
this.documents.forEach(async document => {
let url = await this.processesService.GetDocumentUrl(document.DocId, document.ApplicationId).toPromise();
let url_no_options: string = url.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
let body = {
"message":
{
"rid": res['group']._id,
"msg": "",
"attachments": [{
"title": document.Assunto,
"description": document.DocTypeDesc,
"title_link": url_no_options,
"title_link_download": true,
//"thumb_url": "assets/images/webtrix-logo.png",
"message_link": url_no_options,
"type": "webtrix"
}],
"file":{
"name": document.Assunto,
"type": "application/webtrix",
"ApplicationId": document.ApplicationType,
"DocId": document.Id,
"Assunto": document.Assunto,
}
}
}
this.chatService.sendMessage(body).toPromise();
});
} */
//});
}
async addContacts(){
@@ -35,7 +35,7 @@ export class ChatPopoverPage implements OnInit {
}
close(action:any){
if( window.innerWidth <= 701){
if( window.innerWidth < 701){
this.popoverController.dismiss(action);
this.modalController.dismiss(action);
}
@@ -50,7 +50,7 @@ export class ChatPopoverPage implements OnInit {
async setRoomOwner(){
let classs;
if (window.innerWidth <= 800) {
if (window.innerWidth < 701) {
classs = 'modal modal-desktop'
} else {
classs = 'centered-rounded-modal'
@@ -68,6 +68,7 @@ export class ChatPopoverPage implements OnInit {
modal.onDidDismiss().then((res)=>{
if(res.data == 'success'){
this.leaveGroup();
//this.wsChatMethodsService.hidingRoom(this.roomId);
}
});
}
@@ -94,65 +94,26 @@ export class NewPublicationPage implements OnInit {
const capturedImage = await Camera.getPhoto({
quality: 90,
// allowEditing: true,
resultType: CameraResultType.Uri,
resultType: CameraResultType.Base64,
source: CameraSource.Camera
});
const response = await fetch(capturedImage.webPath!);
const blob = await response.blob();
this.photos.unshift({
filepath: "soon...",
webviewPath: capturedImage.webPath
});
this.capturedImage = await this.convertBlobToBase64(blob);
this.capturedImageTitle = new Date().getTime() + '.jpeg';
this.capturedImage = 'data:image/jpeg;base64,' +capturedImage.base64String;
this.capturedImageTitle = capturedImage.path;
//console.log(this.capturedImage);
}
convertBlobToBase64 = (blob: Blob) => new Promise((resolve, reject) => {
const reader = new FileReader;
reader.onerror = reject;
reader.onload = () => {
resolve(reader.result);
};
reader.readAsDataURL(blob);
});
async laodPicture() {
const capturedImage = await Camera.getPhoto({
resultType: CameraResultType.Uri,
source: CameraSource.Photos,
quality: 90,
width: 1080,
height: 720,
resultType: CameraResultType.Base64,
source: CameraSource.Photos
});
const response = await fetch(capturedImage.webPath!);
const blob = await response.blob();
this.photos.unshift({
filepath: "soon...",
webviewPath: capturedImage.webPath
});
this.capturedImage = await this.convertBlobToBase64(blob);
this.capturedImageTitle = new Date().getTime() + '.jpeg';
this.capturedImage = 'data:image/jpeg;base64,' +capturedImage.base64String;
this.capturedImageTitle = capturedImage.path;
}
/* laodPicture() {
const input = this.fileLoaderService.createInput({
accept: ['image/apng', 'image/jpeg', 'image/png']
})
input.onchange = async () => {
const file = this.fileLoaderService.getFirstFile(input)
const imageData = await this.fileToBase64Service.convert(file)
this.capturedImage = imageData;
this.capturedImageTitle = file.name
};
} */
runValidation() {
this.validateFrom = true
@@ -41,7 +41,7 @@
<div class="main-container px-20">
<ion-list>
<div class="post-item d-md-block mb-10 cursor-pointer"
*ngFor="let publication of getpublication"
*ngFor="let publication of publicationList"
(click)="viewPublicationDetail(publication.DocumentId)">
<div *ngIf="publication.FileBase64.length > 30" class="mb-10 post-img width-md-100">
<img src="{{publication.FileBase64}}" alt="image">
@@ -53,7 +53,7 @@ export class ViewPublicationsPage implements OnInit {
this.folderId = this.folderId['ProcessId']
}
this.getPublications();
this.getPublicationsIds();
this.getPublicationDetail();
window['app-view-publications-page-doRefresh'] = this.doRefresh
@@ -67,15 +67,16 @@ export class ViewPublicationsPage implements OnInit {
console.log('change view to ',this.folderId)
//setTimeout(()=>{
this.getPublications();
this.getPublicationDetail();
this.getPublicationsIds();
//}, 100)
}
doRefresh =(event) => {
this.getPublications();
this.getPublicationsIds();
setTimeout(() => {
this.getPublicationDetail();
@@ -97,22 +98,22 @@ export class ViewPublicationsPage implements OnInit {
this.showLoader = true;
const folderId = this.folderId
this.getFromDB()
//this.getFromDB()
this.publications.GetPublicationsImages(this.folderId).subscribe(res => {
console.log('publications ids', res)
this.publicationList = new Array();
for(let i = 0; i < res.length; i++) {
/* for(let i = 0; i < res.length; i++) {
this.publications.GetPublicationById(res[i]).subscribe(ress => {
console.log('publications by ids', ress)
let item: Publication = this.publicationPipe.itemList(ress)
console.log('publications by ids 2', item)
this.publicationList.push(item);
})
}
} */
/* res.forEach(element => {
res.forEach(element => {
console.log('publications elements', element)
this.publications.GetPublicationById(element).subscribe(ress => {
console.log('publications by ids', ress)
@@ -121,7 +122,7 @@ export class ViewPublicationsPage implements OnInit {
this.publicationList.push(item);
})
}); */
});
console.log('PUBLICATIONS IMAGEs',this.publicationList)
this.storage.remove('view_publications');
this.storage.set('view_publications', this.publicationList);
@@ -129,6 +130,8 @@ export class ViewPublicationsPage implements OnInit {
this.getpublication = this.publicationList;
this.showLoader = false;
},() => {
this.getFromDB();
});
}
@@ -142,7 +145,7 @@ export class ViewPublicationsPage implements OnInit {
this.showLoader = true;
const folderId = this.folderId
this.publicationList = new Array();
this.getFromDB();
//this.getFromDB();
this.publications.GetPublications(folderId).subscribe(async res=> {
res.forEach(element => {