mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
Merge with developer branch
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<app-header></app-header>
|
||||
</ion-header>
|
||||
|
||||
<ion-content class="height-100">
|
||||
<ion-content class="height-100 container-wrapper">
|
||||
<ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh($event)">
|
||||
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
|
||||
<ion-refresher-content>
|
||||
@@ -123,7 +123,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</ion-item-sliding>
|
||||
|
||||
|
||||
</ion-list>
|
||||
</div>
|
||||
<!-- <button (click)="sendMsg()" style="height: 41px;">Send message</button> -->
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
ComponentFactoryResolver,
|
||||
ComponentRef,
|
||||
ComponentFactory,
|
||||
Output
|
||||
Output,
|
||||
} from '@angular/core';
|
||||
import { ModalController, Platform } from '@ionic/angular';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
@@ -17,7 +17,6 @@ import { ContactsPage } from './messages/contacts/contacts.page';
|
||||
import { MessagesPage } from './messages/messages.page';
|
||||
import { NewGroupPage } from './new-group/new-group.page';
|
||||
import { Storage } from '@ionic/storage';
|
||||
import { AlertService } from 'src/app/services/alert.service';
|
||||
import { EditGroupPage } from 'src/app/shared/chat/edit-group/edit-group.page';
|
||||
import * as Rx from "rxjs/Rx";
|
||||
import { Message } from 'src/app/models/message.model';
|
||||
@@ -138,6 +137,7 @@ export class ChatPage implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
console.log(this.loggedUserChat);
|
||||
|
||||
this.segment = "Contactos";
|
||||
@@ -168,19 +168,23 @@ export class ChatPage implements OnInit {
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationStart && event.url.startsWith('/home/chat')) {
|
||||
if (window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/chat')) {
|
||||
//alert('OIII')
|
||||
} else {
|
||||
if (this.dataService.get("newGroup")) {
|
||||
this.openNewGroupPage();
|
||||
}
|
||||
if (this.dataService.get("newGroup")) {
|
||||
this.openNewGroupPage();
|
||||
}
|
||||
else{
|
||||
this.closeAllDesktopComponents();
|
||||
this.showEmptyComponent = true;
|
||||
}
|
||||
}
|
||||
else{
|
||||
this.dataService.set("newGroup", false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.setStatus('offline');
|
||||
this.dataService.set("newGroup", false);
|
||||
console.log('On Destroy')
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
<ion-label>A conversa original mantêm-se como chat individual</ion-label>
|
||||
</div>
|
||||
<div class="messages-list-item-wrapper container-width-100" *ngFor="let msg of messages; let last = last" [class.messages-list-item-wrapper-active]="msg._id == selectedMsgId">
|
||||
<div *ngIf="msg.t != 'r' && msg.t != 'ul' && msg.t != 'ru'" (press)="handlePress(msg._id)" class='message-container incoming-{{msg.u.username!=loggedUser.me.username}}' (click)="openPreview(msg)">
|
||||
<div *ngIf="msg.t != 'r' && msg.t != 'ul' && msg.t != 'ru'" (press)="handlePress(msg._id)" class='message-container incoming-{{msg.u.username!=loggedUser.me.username}}'>
|
||||
<div class="title">
|
||||
<ion-label>{{msg.u.name}}</ion-label>
|
||||
<span class="time">{{showDateDuration(msg._updatedAt)}}</span>
|
||||
@@ -66,7 +66,9 @@
|
||||
<ion-label>{{msg.msg}}</ion-label>
|
||||
<div *ngIf="msg.attachments" class="message-attachments">
|
||||
<div *ngFor="let file of msg.attachments">
|
||||
<img *ngIf="file.image_url" src="{{file.image_url}}" alt="image" >
|
||||
<div (click)="openPreview(msg)">
|
||||
<img *ngIf="file.image_url" src="{{file.image_url}}" alt="image" >
|
||||
</div>
|
||||
<div>
|
||||
<div>
|
||||
<div class="file">
|
||||
|
||||
@@ -21,6 +21,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 { PreviewCameraPage } from 'src/app/modals/preview-camera/preview-camera.page';
|
||||
import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page';
|
||||
|
||||
@Component({
|
||||
selector: 'app-group-messages',
|
||||
@@ -29,7 +30,7 @@ import { PreviewCameraPage } from 'src/app/modals/preview-camera/preview-camera.
|
||||
})
|
||||
export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
|
||||
|
||||
|
||||
showLoader: boolean;
|
||||
isGroupCreated:boolean;
|
||||
@@ -593,7 +594,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
};
|
||||
zoomActive = false;
|
||||
zoomScale = 1;
|
||||
|
||||
|
||||
sliderZoomOpts = {
|
||||
allowSlidePrev: false,
|
||||
allowSlideNext: false,
|
||||
@@ -601,40 +602,40 @@ sliderZoomOpts = {
|
||||
maxRatio: 5
|
||||
},
|
||||
on: {
|
||||
zoomChange: (scale, imageEl, slideEl) => {
|
||||
zoomChange: (scale, imageEl, slideEl) => {
|
||||
this.zoomActive = true;
|
||||
this.zoomScale = scale/5;
|
||||
this.changeDetectorRef.detectChanges();
|
||||
this.changeDetectorRef.detectChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async touchEnd(zoomslides: IonSlides, card) {
|
||||
// Zoom back to normal
|
||||
const slider = await zoomslides.getSwiper();
|
||||
const zoom = slider.zoom;
|
||||
zoom.out();
|
||||
|
||||
|
||||
// Card back to normal
|
||||
card.el.style['z-index'] = 9;
|
||||
|
||||
|
||||
this.zoomActive = false;
|
||||
this.changeDetectorRef.detectChanges();
|
||||
}
|
||||
|
||||
|
||||
touchStart(card) {
|
||||
// Make card appear above backdrop
|
||||
card.el.style['z-index'] = 11;
|
||||
}
|
||||
|
||||
async openPreview(img) {
|
||||
async openPreview(msg) {
|
||||
const modal = await this.modalController.create({
|
||||
component: PreviewCameraPage,
|
||||
cssClass: 'transparent-modal',
|
||||
component: ViewMediaPage,
|
||||
cssClass: 'modal modal-desktop',
|
||||
componentProps: {
|
||||
image: img.attachments[0].image_url,
|
||||
username: img.u.name,
|
||||
_updatedAt: img._updatedAt
|
||||
image: msg.attachments[0].image_url,
|
||||
username: msg.u.name,
|
||||
_updatedAt: msg._updatedAt,
|
||||
}
|
||||
});
|
||||
modal.present();
|
||||
|
||||
@@ -112,7 +112,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.load();
|
||||
this.setStatus('online');
|
||||
|
||||
this.loadFiles();
|
||||
//this.loadFiles();
|
||||
VoiceRecorder.requestAudioRecordingPermission();
|
||||
Filesystem.mkdir({
|
||||
path: IMAGE_DIR,
|
||||
|
||||
@@ -5,6 +5,7 @@ import { GroupDurationPage } from 'src/app/shared/popover/group-duration/group-d
|
||||
import { GroupContactsPage } from '../group-messages/group-contacts/group-contacts.page';
|
||||
import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { ChatService } from 'src/app/services/chat.service';
|
||||
import { ProcessesService } from 'src/app/services/processes.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-new-group',
|
||||
@@ -19,6 +20,7 @@ export class NewGroupPage implements OnInit {
|
||||
selectedDuration = ['','',''];
|
||||
thedate:any;
|
||||
groupName:string;
|
||||
documents:any;
|
||||
|
||||
constructor(
|
||||
private pickerController: PickerController,
|
||||
@@ -27,15 +29,18 @@ export class NewGroupPage implements OnInit {
|
||||
private navParams: NavParams,
|
||||
public ThemeService: ThemeService,
|
||||
private chatService: ChatService,
|
||||
private processesService: ProcessesService,
|
||||
)
|
||||
{
|
||||
this.isGroupCreated = false;
|
||||
this.groupName = this.navParams.get('name');
|
||||
this.documents = this.navParams.get('documents');
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
console.log(this.documents);
|
||||
}
|
||||
|
||||
_ionChange(event){
|
||||
this.showDuration = event.detail.checked;
|
||||
|
||||
@@ -52,6 +57,7 @@ export class NewGroupPage implements OnInit {
|
||||
|
||||
createGroup(){
|
||||
let name = this.groupName.split(' ').join('-');
|
||||
//Take out all special characters in string
|
||||
name = name.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
|
||||
let body = { "name":name, }
|
||||
this.chatService.addGroup(body).subscribe(res=>{
|
||||
@@ -73,6 +79,39 @@ export class NewGroupPage implements OnInit {
|
||||
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();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user