mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
Merge branch 'developer' of https://bitbucket.org/equilibriumito/gabinete-digital into bugfix
This commit is contained in:
@@ -72,8 +72,9 @@
|
||||
<div *ngIf="dm.lastMessage" class="item-description" [class.item-description-active]="dm._id == idSelected">
|
||||
<ion-label *ngIf="dm.lastMessage">{{dm.lastMessage.msg}}</ion-label>
|
||||
<ion-label *ngIf="dm.lastMessage.file">
|
||||
<fa-icon icon="file-alt" class="file-icon" [class.set-active-item-font-to-white]="dm._id == idSelected"></fa-icon>
|
||||
<span> {{dm.lastMessage.file.name}}</span>
|
||||
<fa-icon *ngIf="dm.lastMessage.file.type != 'application/meeting'" icon="file-alt" class="file-icon" [class.set-active-item-font-to-white]="dm._id == idSelected"></fa-icon>
|
||||
<fa-icon *ngIf="dm.lastMessage.file.type == 'application/meeting'" icon="calendar-alt" class="file-icon" [class.set-active-item-font-to-white]="dm._id == idSelected"></fa-icon>
|
||||
<span> {{dm.lastMessage.file.name || dm.lastMessage.file.subject }}</span>
|
||||
</ion-label>
|
||||
<ion-label *ngIf="dm.lastMessage.attachments">
|
||||
<div *ngIf="dm.lastMessage.attachments[0].image_url">
|
||||
@@ -124,9 +125,10 @@
|
||||
</div>
|
||||
<div *ngIf="group.lastMessage" class="item-description d-flex align-items-center" [class.item-description-active]="group._id ==idSelected">
|
||||
<div class="item-message">{{group.lastMessage.u.name}}: {{group.lastMessage.msg}} </div>
|
||||
<div class="item-files" *ngIf="group.lastMessage.file">
|
||||
<fa-icon icon="file-alt" class="file-icon" [class.set-active-item-font-to-white]="group._id == idSelected"></fa-icon>
|
||||
<span> {{group.lastMessage.file.name}}</span>
|
||||
<div class="item-files add-ellipsis" *ngIf="group.lastMessage.file">
|
||||
<fa-icon *ngIf="group.lastMessage.file.type != 'application/meeting'" icon="file-alt" class="file-icon" [class.set-active-item-font-to-white]="group._id == idSelected"></fa-icon>
|
||||
<fa-icon *ngIf="group.lastMessage.file.type == 'application/meeting'" icon="calendar-alt" class="file-icon" [class.set-active-item-font-to-white]="group._id == idSelected"></fa-icon>
|
||||
<span class="item-files-title"> {{group.lastMessage.file.name || group.lastMessage.file.subject}}</span>
|
||||
</div>
|
||||
<div class="item-files" *ngIf="group.lastMessage.attachments">
|
||||
<div *ngIf="group.lastMessage.attachments[0].image_url">
|
||||
@@ -162,11 +164,13 @@
|
||||
</div>
|
||||
<!-- Aside right -->
|
||||
<div class="aside-content d-none flex-column height-100">
|
||||
|
||||
<app-empty-chat [texto]="emptyTextDescription"
|
||||
class="height-100 flex-column"
|
||||
[style.display]="showEmptyComponent ? 'flex' : 'none'"
|
||||
#messagecontainer>
|
||||
</app-empty-chat>
|
||||
|
||||
<app-messages class=" height-100 flex-column"
|
||||
*ngIf="showMessages"
|
||||
[style.display]="showMessages ? 'flex' : 'none'"
|
||||
@@ -226,6 +230,7 @@
|
||||
|
||||
<app-new-event
|
||||
[profile]=""
|
||||
[roomId]="groupRoomId"
|
||||
[selectedSegment]=segment
|
||||
[taskParticipants]="taskParticipants"
|
||||
[taskParticipantsCc]="taskParticipantsCc"
|
||||
@@ -235,7 +240,6 @@
|
||||
(openAttendeesComponent)="openAttendeesComponent($event)"
|
||||
(cloneAllmobileComponent)="closeNewEventComponent()"
|
||||
[style.display]="showNewEvent ? 'flex' : 'none'"
|
||||
[roomId]="groupRoomId"
|
||||
class=" height-100 flex-column">
|
||||
</app-new-event>
|
||||
|
||||
|
||||
@@ -126,6 +126,11 @@ ion-content{
|
||||
}
|
||||
.item-files{
|
||||
float: left;
|
||||
overflow: auto;
|
||||
|
||||
.item-files-title{
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
.item-description-active{
|
||||
|
||||
+192
-16
@@ -30,6 +30,7 @@ import { TimeService } from 'src/app/services/functions/time.service';
|
||||
import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { DataService } from 'src/app/services/data.service';
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { StorageService } from 'src/app/services/storage.service';
|
||||
|
||||
|
||||
|
||||
@@ -121,7 +122,8 @@ export class ChatPage implements OnInit {
|
||||
private dataService: DataService,
|
||||
private router: Router,
|
||||
private sqlservice: SqliteService,
|
||||
private platform: Platform
|
||||
private platform: Platform,
|
||||
private storageservice: StorageService
|
||||
|
||||
) {
|
||||
this.loggedUserChat = authService.ValidatedUserChat['data'];
|
||||
@@ -144,6 +146,8 @@ export class ChatPage implements OnInit {
|
||||
this.loggedUser = res;
|
||||
console.log(this.loggedUser);
|
||||
this.load();
|
||||
|
||||
this.getDirectMessagesDB();
|
||||
});
|
||||
|
||||
/* websocket functions */
|
||||
@@ -329,6 +333,7 @@ export class ChatPage implements OnInit {
|
||||
IsRequired: "true",
|
||||
}
|
||||
});
|
||||
this.groupRoomId = data.roomId;
|
||||
this.closeAllDesktopComponents();
|
||||
if (window.innerWidth < 701) {
|
||||
console.log('Mobile');
|
||||
@@ -408,20 +413,39 @@ export class ChatPage implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
getDirectMessagesDB() {
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
this.storageservice.get("rooms").then((rooms) =>{
|
||||
|
||||
this.userDirectMessages = rooms.sort((a, b) => {
|
||||
var dateA = new Date(a._updatedAt).getTime();
|
||||
var dateB = new Date(b._updatedAt).getTime();
|
||||
return dateB - dateA;
|
||||
});
|
||||
console.log('DIRECTMESSAGE FROM DB', this.userDirectMessages);
|
||||
|
||||
console.log('ROOMS FROM DB', rooms)
|
||||
})
|
||||
|
||||
this.storageservice.get('chatusers').then((users) => {
|
||||
this.dmUsers = users.filter(data => data.username != this.loggedUserChat.me.username);
|
||||
})
|
||||
} else {
|
||||
this.sqlservice.getAllChatRoom().then((rooms: any) => {
|
||||
console.log('ROOMS FROM DB', rooms)
|
||||
let roomsArray = [];
|
||||
rooms.forEach(element => {
|
||||
let roomListDB = {
|
||||
_id: element.Id,
|
||||
uids: JSON.parse(element.Uids),
|
||||
usernames: JSON.parse(element.Usernames),
|
||||
lastMessage: JSON.parse(element.LastMessage),
|
||||
uids: this.isJson(element.Uids),
|
||||
usernames: this.isJson(element.Usernames),
|
||||
lastMessage: this.isJson(element.LastMessage),
|
||||
_updatedAt: element.UpdatedAt
|
||||
}
|
||||
roomsArray.push(roomListDB)
|
||||
if(element.customFields == "undefined") {
|
||||
roomsArray.push(roomListDB)
|
||||
}
|
||||
});
|
||||
|
||||
this.userDirectMessages = roomsArray.sort((a, b) => {
|
||||
@@ -456,6 +480,22 @@ export class ChatPage implements OnInit {
|
||||
|
||||
transformDataRoomList(data) {
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
let roomsArray = [];
|
||||
data.forEach(element => {
|
||||
let roomList = {
|
||||
_id: element._id,
|
||||
uids: element.uids,
|
||||
usernames: element.usernames,
|
||||
lastMessage: element.lastMessage,
|
||||
_updatedAt: element._updatedAt
|
||||
}
|
||||
|
||||
console.log(' Web TRANSFORM ROOM LIST', roomList)
|
||||
roomsArray.push(roomList)
|
||||
});
|
||||
|
||||
this.storageservice.store('rooms', roomsArray);
|
||||
|
||||
} else {
|
||||
data.forEach(element => {
|
||||
let roomList = {
|
||||
@@ -474,6 +514,18 @@ export class ChatPage implements OnInit {
|
||||
|
||||
transformDataUserList(users) {
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
let usersArray = [];
|
||||
users.forEach(element => {
|
||||
console.log('TRANSFORM USER CHAT 1', element)
|
||||
let chatusers = {
|
||||
_id: element._id,
|
||||
name: element.name,
|
||||
username: element.username
|
||||
}
|
||||
console.log('TRANSFORM USER CHAT 2', chatusers)
|
||||
usersArray.push(chatusers);
|
||||
});
|
||||
this.storageservice.store('chatusers',usersArray);
|
||||
} else {
|
||||
users.forEach(element => {
|
||||
console.log('TRANSFORM USER CHAT 1', element)
|
||||
@@ -496,13 +548,16 @@ export class ChatPage implements OnInit {
|
||||
console.log('Chat list', res);
|
||||
|
||||
if (res != 200) {
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
/* if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
this.userDirectMessages = res.ims.sort((a, b) => {
|
||||
var dateA = new Date(a._updatedAt).getTime();
|
||||
var dateB = new Date(b._updatedAt).getTime();
|
||||
return dateB - dateA;
|
||||
var dateA = new Date(a._updatedAt).getTime();
|
||||
var dateB = new Date(b._updatedAt).getTime();
|
||||
return dateB - dateA;
|
||||
});
|
||||
}
|
||||
} */
|
||||
//console.log(res.ims);
|
||||
|
||||
//console.log(this.userDirectMessages);
|
||||
|
||||
if (this.route.url != "/home/chat") {
|
||||
//console.log("Timer message stop")
|
||||
@@ -539,24 +594,136 @@ export class ChatPage implements OnInit {
|
||||
this.chatService.getAllUsers().subscribe(res => {
|
||||
console.log('chatusers', res);
|
||||
this.transformDataUserList(res['users'])
|
||||
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
this.dmUsers = res['users'].filter(data => data.username != this.loggedUserChat.me.username);
|
||||
this.dmUsers = res['users'].filter(data => data.username != this.loggedUserChat.me.username);
|
||||
console.log(this.dmUsers);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
getGroupsDB() {
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
this.storageservice.get("grouprooms").then((rooms) =>{
|
||||
|
||||
|
||||
this.allGroups = rooms.sort((a, b) => {
|
||||
var dateA = new Date(a._updatedAt).getTime();
|
||||
var dateB = new Date(b._updatedAt).getTime();
|
||||
return dateB - dateA;
|
||||
});
|
||||
|
||||
console.log('GROUPS FROM DB', this.allGroups)
|
||||
})
|
||||
|
||||
this.storageservice.get('chatusers').then((users) => {
|
||||
this.dmUsers = users.filter(data => data.username != this.loggedUserChat.me.username);
|
||||
})
|
||||
} else {
|
||||
this.sqlservice.getAllChatRoom().then((rooms: any) => {
|
||||
|
||||
let roomsArray = [];
|
||||
rooms.forEach(element => {
|
||||
let fddf = this.isJson(element.LastMessage);
|
||||
let roomListDB = {
|
||||
_id: element.Id,
|
||||
customFields: this.isJson(element.customFields),
|
||||
name: element.name,
|
||||
lastMessage: this.isJson(element.LastMessage),
|
||||
_updatedAt: element.UpdatedAt
|
||||
}
|
||||
if(element.customFields != "undefined") {
|
||||
roomsArray.push(roomListDB)
|
||||
}
|
||||
});
|
||||
|
||||
this.allGroups = roomsArray.sort((a, b) => {
|
||||
var dateA = new Date(a._updatedAt).getTime();
|
||||
var dateB = new Date(b._updatedAt).getTime();
|
||||
return dateB - dateA;
|
||||
});
|
||||
console.log('Group FROM DB', this.allGroups);
|
||||
|
||||
})
|
||||
|
||||
/* this.sqlservice.getAllChatUsers().then((userslist: any) => {
|
||||
console.log('USERS FOM DB 1', userslist)
|
||||
let chatusersArray = [];
|
||||
userslist.forEach(element => {
|
||||
console.log('USERS FOM DB 2', element)
|
||||
let userListDB = {
|
||||
_id: element.Id,
|
||||
name: element.Name,
|
||||
username: element.Username
|
||||
}
|
||||
|
||||
chatusersArray.push(userListDB);
|
||||
});
|
||||
|
||||
this.dmUsers = chatusersArray.filter(data => data.username != this.loggedUserChat.me.username);
|
||||
|
||||
}) */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
transformGroups(data) {
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
let groupsArray = [];
|
||||
data.forEach(element => {
|
||||
let roomList = {
|
||||
_id: element._id,
|
||||
uids: element.uids,
|
||||
usernames: element.usernames,
|
||||
name: element.name,
|
||||
customFields: element.customFields,
|
||||
lastMessage: element.lastMessage,
|
||||
_updatedAt: element._updatedAt
|
||||
}
|
||||
|
||||
console.log(' Web TRANSFORM ROOM LIST', roomList)
|
||||
groupsArray.push(roomList)
|
||||
});
|
||||
|
||||
this.storageservice.store('grouprooms', groupsArray);
|
||||
|
||||
} else {
|
||||
data.forEach(element => {
|
||||
let roomList = {
|
||||
id: element._id,
|
||||
uids: element.uids,
|
||||
usernames: element.usernames,
|
||||
customFields: element.customFields,
|
||||
name: element.name,
|
||||
lastMessage: element.lastMessage,
|
||||
updatedat: element._updatedAt
|
||||
}
|
||||
|
||||
console.log('TRANSFORM ROOM LIST', roomList)
|
||||
this.sqlservice.addChatListRoom(roomList);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async getGroups(event?) {
|
||||
this.result = this.chatService.getAllPrivateGroups().subscribe(async (res: any) => {
|
||||
//console.log(res);
|
||||
this.showLoader = false;
|
||||
if (res.groups != 200) {
|
||||
|
||||
this.transformGroups(res.groups);
|
||||
this.getGroupsDB();
|
||||
|
||||
/* this.privateGroups = res.groups;
|
||||
this.transformGroups(res.groups);
|
||||
this.getGroupsDB();
|
||||
|
||||
this.privateGroups = res.groups;
|
||||
this.allGroups = this.privateGroups.sort((a, b) => {
|
||||
var dateA = new Date(a._updatedAt).getTime();
|
||||
var dateB = new Date(b._updatedAt).getTime();
|
||||
return dateB - dateA;
|
||||
});
|
||||
console.log('Chat list group' , res); */
|
||||
//console.log(this.allGroups);
|
||||
/* }); */
|
||||
if (this.route.url != "/home/chat") {
|
||||
console.log("Timer message stop")
|
||||
}
|
||||
@@ -574,6 +741,15 @@ export class ChatPage implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
isJson(str) {
|
||||
try {
|
||||
JSON.parse(str);
|
||||
} catch (e) {
|
||||
return str;
|
||||
}
|
||||
return JSON.parse(str);
|
||||
}
|
||||
|
||||
async selectContact() {
|
||||
const modal = await this.modalController.create({
|
||||
component: ContactsPage,
|
||||
|
||||
@@ -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}}'>
|
||||
<div *ngIf="msg.t != 'r' && msg.t != 'ul' && msg.t != 'ru' && msg.msg !=''" (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>
|
||||
@@ -119,6 +119,15 @@
|
||||
</div>
|
||||
{{last ? scrollToBottom() : ''}}
|
||||
</div>
|
||||
<div *ngIf="msg.file" class="info-meeting">
|
||||
<div *ngIf="msg.file.type == 'application/meeting'">
|
||||
<ion-label class="info-meeting-small">{{msg.u.name}} criou esta reunião</ion-label><br />
|
||||
<button (click)="goToEvent(msg.file.id)" class="btn-no-color info-meeting-normal"><ion-label class="info-meeting-normal">{{msg.file.subject}}</ion-label></button><br />
|
||||
<ion-label class="info-meeting-medium"><ion-icon name="calendar-outline"></ion-icon> De {{showDateDuration(msg.file.start_date)}} a {{showDateDuration(msg.file.end_date)}}</ion-label><br />
|
||||
<ion-label class="info-meeting-medium"><ion-icon></ion-icon><ion-icon name="location-outline"></ion-icon> {{msg.file.venue}}</ion-label><br />
|
||||
</div>
|
||||
{{last ? scrollToBottom() : ''}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ion-fab horizontal="end" vertical="bottom" slot="fixed">
|
||||
|
||||
@@ -235,6 +235,37 @@
|
||||
}
|
||||
}
|
||||
|
||||
.info-meeting{
|
||||
/* width: 322px; */
|
||||
width: em(422px);
|
||||
background: var(--chat-alert-msg-color);
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
color: #262420;
|
||||
padding: 10px;
|
||||
margin: 10px auto;
|
||||
line-height: 1.2rem;
|
||||
/* margin: 15px 0px 15px 0px; */
|
||||
border-radius: 8px;
|
||||
|
||||
.info-meeting-small{
|
||||
font-size: 10px;
|
||||
font-style: italic;
|
||||
}
|
||||
.info-meeting-medium{
|
||||
font-size: 12px;
|
||||
}
|
||||
.info-meeting-normal{
|
||||
color: #0782c9;
|
||||
font-weight: 700;
|
||||
text-decoration: underline;
|
||||
}
|
||||
.info-meeting-normal:hover{
|
||||
text-decoration: underline;
|
||||
color: #0782c9;
|
||||
}
|
||||
}
|
||||
|
||||
ion-footer{
|
||||
padding-top: 7.5px;
|
||||
padding-bottom: 7.5px;
|
||||
@@ -281,7 +312,7 @@
|
||||
.preview-slides {
|
||||
margin-top: 20%;
|
||||
background: #e6e6e6;
|
||||
|
||||
|
||||
img {
|
||||
padding-top: 20px;
|
||||
padding-bottom: 20px;
|
||||
@@ -299,15 +330,15 @@
|
||||
.image-card {
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
|
||||
.image-card {
|
||||
z-index: 9;
|
||||
}
|
||||
|
||||
|
||||
.backdrop {
|
||||
height: 200%;
|
||||
width: 100%;
|
||||
background: black;
|
||||
position: absolute;
|
||||
z-index: 10;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.pag
|
||||
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';
|
||||
import { ViewEventPage } from 'src/app/modals/view-event/view-event.page';
|
||||
|
||||
@Component({
|
||||
selector: 'app-group-messages',
|
||||
@@ -166,6 +167,27 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.currentPosition = scroll;
|
||||
}
|
||||
|
||||
async goToEvent(eventId: any) {
|
||||
let classs;
|
||||
if (window.innerWidth < 701) {
|
||||
classs = 'modal modal-desktop'
|
||||
} else {
|
||||
classs = 'modal modal-desktop showAsideOptions'
|
||||
}
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: ViewEventPage,
|
||||
componentProps: {
|
||||
eventId: eventId,
|
||||
},
|
||||
cssClass: classs,
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then((res) => {
|
||||
console.log(res);
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
window.removeEventListener('scroll', this.scrollChangeCallback, true);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
<div (click)="handleClick()" class="messages" #scrollMe>
|
||||
<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 (press)="handlePress(msg._id)" class='message-container incoming-{{msg.u.username!=loggedUser.me.username}}' (click)="openPreview(msg)">
|
||||
<div (press)="handlePress(msg._id)" class='message-container incoming-{{msg.u.username!=loggedUser.me.username}}' (click)="openPreview(msg)" *ngIf="msg.msg !=''">
|
||||
<div class="title">
|
||||
<ion-label>{{msg.u.name}}</ion-label>
|
||||
<span class="time">{{showDateDuration(msg._updatedAt)}}</span>
|
||||
@@ -91,6 +91,15 @@
|
||||
{{last ? scrollToBottom() : ''}}
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="msg.file" class="info-meeting">
|
||||
<div *ngIf="msg.file.type == 'application/meeting'">
|
||||
<ion-label class="info-meeting-small">{{msg.u.name}} criou esta reunião</ion-label><br />
|
||||
<button (click)="goToEvent(msg.file.id)" class="btn-no-color info-meeting-normal"><ion-label class="info-meeting-normal">{{msg.file.subject}}</ion-label></button><br />
|
||||
<ion-label class="info-meeting-medium"><ion-icon name="calendar-outline"></ion-icon> De {{showDateDuration(msg.file.start_date)}} a {{showDateDuration(msg.file.end_date)}}</ion-label><br />
|
||||
<ion-label class="info-meeting-medium"><ion-icon></ion-icon><ion-icon name="location-outline"></ion-icon> {{msg.file.venue}}</ion-label><br />
|
||||
</div>
|
||||
{{last ? scrollToBottom() : ''}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ion-fab horizontal="end" vertical="bottom" slot="fixed">
|
||||
|
||||
@@ -190,6 +190,37 @@
|
||||
}
|
||||
}
|
||||
|
||||
.info-meeting{
|
||||
/* width: 322px; */
|
||||
width: em(422px);
|
||||
background: var(--chat-alert-msg-color);
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
color: #262420;
|
||||
padding: 10px;
|
||||
margin: 10px auto;
|
||||
line-height: 1.2rem;
|
||||
/* margin: 15px 0px 15px 0px; */
|
||||
border-radius: 8px;
|
||||
|
||||
.info-meeting-small{
|
||||
font-size: 10px;
|
||||
font-style: italic;
|
||||
}
|
||||
.info-meeting-medium{
|
||||
font-size: 12px;
|
||||
}
|
||||
.info-meeting-normal{
|
||||
color: #0782c9;
|
||||
font-weight: 700;
|
||||
text-decoration: underline;
|
||||
}
|
||||
.info-meeting-normal:hover{
|
||||
text-decoration: underline;
|
||||
color: #0782c9;
|
||||
}
|
||||
}
|
||||
|
||||
ion-footer{
|
||||
padding-top: 7.5px;
|
||||
padding-bottom: 7.5px;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AfterViewChecked, AfterViewInit, ChangeDetectorRef, Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core';
|
||||
import {ActivatedRoute, Router} from '@angular/router'
|
||||
import { ActivatedRoute, Router } from '@angular/router'
|
||||
import { GestureController, Gesture, ModalController, NavParams, PopoverController, IonSlides, Platform } from '@ionic/angular';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
|
||||
@@ -27,6 +27,7 @@ import { PreviewCameraPage } from 'src/app/modals/preview-camera/preview-camera.
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { elementAt } from 'rxjs-compat/operator/elementAt';
|
||||
import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page';
|
||||
import { ViewEventPage } from 'src/app/modals/view-event/view-event.page';
|
||||
|
||||
const IMAGE_DIR = 'stored-images';
|
||||
|
||||
@@ -39,20 +40,20 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
showLoader: boolean;
|
||||
|
||||
@ViewChild('scrollMe') private myScrollContainer: ElementRef;
|
||||
/* @ViewChild('messageContainer') messageContainer: ElementRef; */
|
||||
/* @ViewChild('messageContainer') messageContainer: ElementRef; */
|
||||
@ViewChild('rectangle') private rectangle: ElementRef;
|
||||
|
||||
canvas: any
|
||||
ctx: any
|
||||
loggedUser: any;
|
||||
message = '';
|
||||
messages:any;
|
||||
userPresence='';
|
||||
dmUsers:any;
|
||||
roomId:string;
|
||||
el:any;
|
||||
members:any;
|
||||
scrollingOnce:boolean = true;
|
||||
messages: any;
|
||||
userPresence = '';
|
||||
dmUsers: any;
|
||||
roomId: string;
|
||||
el: any;
|
||||
members: any;
|
||||
scrollingOnce: boolean = true;
|
||||
|
||||
chatMessageStore = ChatMessageStore;
|
||||
chatUserStorage = ChatUserStorage;
|
||||
@@ -64,11 +65,11 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
attendees: EventPerson[] = [];
|
||||
longPressActive = false;
|
||||
showMessageOptions = false;
|
||||
selectedMsgId:string;
|
||||
selectedMsgId: string;
|
||||
|
||||
dicIndex = 0;
|
||||
task: ExpedientTaskModalPageNavParamsTask;
|
||||
LoadedDocument:any = null;
|
||||
LoadedDocument: any = null;
|
||||
|
||||
recording = false;
|
||||
storedFileNames = [];
|
||||
@@ -100,7 +101,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
console.log('ROOM ID', this.roomId)
|
||||
|
||||
window.onresize = (event) => {
|
||||
if( window.innerWidth > 701){
|
||||
if (window.innerWidth > 701) {
|
||||
this.modalController.dismiss();
|
||||
}
|
||||
};
|
||||
@@ -133,7 +134,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.startRecording();
|
||||
this.calculateDuration();
|
||||
},
|
||||
onEnd: ev =>{
|
||||
onEnd: ev => {
|
||||
Haptics.impact({ style: ImpactStyle.Light })
|
||||
this.stopRecording();
|
||||
}
|
||||
@@ -141,51 +142,51 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
longpress.enable();
|
||||
}
|
||||
|
||||
calculateDuration(){
|
||||
if(!this.recording){
|
||||
calculateDuration() {
|
||||
if (!this.recording) {
|
||||
this.duration = 0;
|
||||
this.durationDisplay = '';
|
||||
return;
|
||||
}
|
||||
this.duration += 1;
|
||||
const minutes = Math.floor(this.duration / 60);
|
||||
const seconds = (this.duration % 60).toString().padStart(2,'0');
|
||||
const seconds = (this.duration % 60).toString().padStart(2, '0');
|
||||
this.durationDisplay = `${minutes}:${seconds}`;
|
||||
|
||||
setTimeout(()=>{
|
||||
setTimeout(() => {
|
||||
this.calculateDuration();
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
async loadFiles(){
|
||||
async loadFiles() {
|
||||
Filesystem.readdir({
|
||||
path: '',
|
||||
directory: Directory.Data
|
||||
}).then(result =>{
|
||||
}).then(result => {
|
||||
console.log(result);
|
||||
const temp:any[] = result.files.reverse();
|
||||
const temp: any[] = result.files.reverse();
|
||||
this.storedFileNames = temp[0];
|
||||
console.log(this.storedFileNames);
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
startRecording(){
|
||||
if(this.recording){
|
||||
startRecording() {
|
||||
if (this.recording) {
|
||||
return;
|
||||
}
|
||||
this.recording = true;
|
||||
VoiceRecorder.startRecording();
|
||||
}
|
||||
|
||||
stopRecording(){
|
||||
if(!this.recording){
|
||||
stopRecording() {
|
||||
if (!this.recording) {
|
||||
return;
|
||||
}
|
||||
this.recording = false;
|
||||
VoiceRecorder.stopRecording().then(async (result: RecordingData) =>{
|
||||
VoiceRecorder.stopRecording().then(async (result: RecordingData) => {
|
||||
this.recording = false;
|
||||
if(result.value && result.value.recordDataBase64){
|
||||
if (result.value && result.value.recordDataBase64) {
|
||||
const recordData = result.value.recordDataBase64;
|
||||
console.log(recordData);
|
||||
this.myAudio = recordData;
|
||||
@@ -200,7 +201,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
}
|
||||
|
||||
async playFile(fileName?:any){
|
||||
async playFile(fileName?: any) {
|
||||
const audioFile = await Filesystem.readFile({
|
||||
path: fileName,
|
||||
directory: Directory.Data
|
||||
@@ -214,33 +215,33 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
}
|
||||
|
||||
handlePress(id?:string){
|
||||
handlePress(id?: string) {
|
||||
this.selectedMsgId = id;
|
||||
this.showMessageOptions = true;
|
||||
}
|
||||
|
||||
handleClick(){
|
||||
handleClick() {
|
||||
this.showMessageOptions = false;
|
||||
this.selectedMsgId = "";
|
||||
}
|
||||
|
||||
deleteMessage(msgId:string){
|
||||
deleteMessage(msgId: string) {
|
||||
let body = {
|
||||
"roomId": this.roomId,
|
||||
"msgId": msgId,
|
||||
"asUser": false,
|
||||
}
|
||||
if(msgId){
|
||||
if (msgId) {
|
||||
this.alertService.confirmDeleteMessage(body);
|
||||
}
|
||||
else{
|
||||
else {
|
||||
this.toastService.badRequest('Não foi possível apagar');
|
||||
}
|
||||
this.showMessageOptions = false;
|
||||
this.selectedMsgId = "";
|
||||
}
|
||||
|
||||
setStatus(status:string){
|
||||
setStatus(status: string) {
|
||||
let body = {
|
||||
message: '',
|
||||
status: status,
|
||||
@@ -250,40 +251,58 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
})
|
||||
}
|
||||
|
||||
notImplemented(){
|
||||
notImplemented() {
|
||||
this.alertService.presentAlert('Funcionalidade em desenvolvimento');
|
||||
}
|
||||
|
||||
close(){
|
||||
close() {
|
||||
this.modalController.dismiss();
|
||||
}
|
||||
|
||||
load(){
|
||||
load() {
|
||||
this.serverLongPull();
|
||||
this.getChatMembers();
|
||||
}
|
||||
|
||||
doRefresh(ev:any){
|
||||
doRefresh(ev: any) {
|
||||
this.load();
|
||||
ev.target.complete();
|
||||
}
|
||||
|
||||
scrollToBottom(): void {
|
||||
try {
|
||||
if(this.scrollingOnce){
|
||||
if (this.scrollingOnce) {
|
||||
this.myScrollContainer.nativeElement.scrollTop = this.myScrollContainer.nativeElement.scrollHeight;
|
||||
//this.scrollingOnce = false;
|
||||
}
|
||||
} catch(err) { }
|
||||
} catch (err) { }
|
||||
}
|
||||
|
||||
scrollToBottomClicked(): void {
|
||||
try {
|
||||
this.myScrollContainer.nativeElement.scrollTop = this.myScrollContainer.nativeElement.scrollHeight;
|
||||
} catch(err) { }
|
||||
} catch (err) { }
|
||||
}
|
||||
|
||||
|
||||
async goToEvent(eventId: any) {
|
||||
let classs;
|
||||
if (window.innerWidth < 701) {
|
||||
classs = 'modal modal-desktop'
|
||||
} else {
|
||||
classs = 'modal modal-desktop showAsideOptions'
|
||||
}
|
||||
const modal = await this.modalController.create({
|
||||
component: ViewEventPage,
|
||||
componentProps: {
|
||||
eventId: eventId,
|
||||
},
|
||||
cssClass: classs,
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then((res) => {
|
||||
console.log(res);
|
||||
});
|
||||
}
|
||||
|
||||
onContentScrolled(e) {
|
||||
this.startPosition = e.srcElement.scrollTop;
|
||||
@@ -297,10 +316,10 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
//alert('UP');
|
||||
this.scrollingOnce = false;
|
||||
}
|
||||
if((containerHeight - 100) > scroll){
|
||||
if ((containerHeight - 100) > scroll) {
|
||||
this.scrollToBottomBtn = true;
|
||||
}
|
||||
else{
|
||||
else {
|
||||
this.scrollToBottomBtn = false;
|
||||
}
|
||||
this.currentPosition = scroll;
|
||||
@@ -320,7 +339,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
"rid": this.roomId, "msg": this.message
|
||||
}
|
||||
}
|
||||
this.chatService.sendMessage(body).subscribe(res=> {
|
||||
this.chatService.sendMessage(body).subscribe(res => {
|
||||
//this.loadMessages();
|
||||
this.scrollingOnce = true;
|
||||
});
|
||||
@@ -340,23 +359,23 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
})
|
||||
}
|
||||
|
||||
viewDocument(file:any, url?:string){
|
||||
viewDocument(file: any, url?: string) {
|
||||
console.log(file);
|
||||
|
||||
if(file.type == "application/webtrix") {
|
||||
if (file.type == "application/webtrix") {
|
||||
this.openViewDocumentModal(file);
|
||||
}
|
||||
else{
|
||||
else {
|
||||
let fullUrl = "https://www.tabularium.pt" + url;
|
||||
this.fileService.viewDocumentByUrl(fullUrl);
|
||||
}
|
||||
}
|
||||
|
||||
docIndex(index: number){
|
||||
docIndex(index: number) {
|
||||
this.dicIndex = index
|
||||
}
|
||||
|
||||
async openViewDocumentModal(file:any){
|
||||
async openViewDocumentModal(file: any) {
|
||||
|
||||
let task = {
|
||||
serialNumber: '',
|
||||
@@ -373,17 +392,17 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
let doc = {
|
||||
"Id": "",
|
||||
"ParentId": "",
|
||||
"Source": 1,
|
||||
"ApplicationId": file.ApplicationId,
|
||||
"CreateDate": "",
|
||||
"Data": null,
|
||||
"Description":"",
|
||||
"Link": null,
|
||||
"SourceId": file.DocId,
|
||||
"SourceName": file.Assunto,
|
||||
"Stakeholders": "",
|
||||
"Id": "",
|
||||
"ParentId": "",
|
||||
"Source": 1,
|
||||
"ApplicationId": file.ApplicationId,
|
||||
"CreateDate": "",
|
||||
"Data": null,
|
||||
"Description": "",
|
||||
"Link": null,
|
||||
"SourceId": file.DocId,
|
||||
"SourceName": file.Assunto,
|
||||
"Stakeholders": "",
|
||||
}
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
@@ -408,7 +427,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
getChatMembers() {
|
||||
this.showLoader = true;
|
||||
this.chatService.getMembers(this.roomId).subscribe(res=> {
|
||||
this.chatService.getMembers(this.roomId).subscribe(res => {
|
||||
this.members = res['members'];
|
||||
this.dmUsers = res['members'].filter(data => data.username != this.loggedUser.me.username)
|
||||
console.log(res);
|
||||
@@ -417,32 +436,32 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
});
|
||||
}
|
||||
|
||||
showDateDuration(start:any){
|
||||
showDateDuration(start: any) {
|
||||
let end;
|
||||
end = new Date();
|
||||
start = new Date(start);
|
||||
let customizedDate;
|
||||
|
||||
const totalSeconds = Math.floor((end - (start))/1000);;
|
||||
const totalMinutes = Math.floor(totalSeconds/60);
|
||||
const totalHours = Math.floor(totalMinutes/60);
|
||||
const totalDays = Math.floor(totalHours/24);
|
||||
const totalSeconds = Math.floor((end - (start)) / 1000);;
|
||||
const totalMinutes = Math.floor(totalSeconds / 60);
|
||||
const totalHours = Math.floor(totalMinutes / 60);
|
||||
const totalDays = Math.floor(totalHours / 24);
|
||||
|
||||
const hours = totalHours - ( totalDays * 24 );
|
||||
const minutes = totalMinutes - ( totalDays * 24 * 60 ) - ( hours * 60 );
|
||||
const seconds = totalSeconds - ( totalDays * 24 * 60 * 60 ) - ( hours * 60 * 60 ) - ( minutes * 60 );
|
||||
const hours = totalHours - (totalDays * 24);
|
||||
const minutes = totalMinutes - (totalDays * 24 * 60) - (hours * 60);
|
||||
const seconds = totalSeconds - (totalDays * 24 * 60 * 60) - (hours * 60 * 60) - (minutes * 60);
|
||||
|
||||
if(totalDays == 0){
|
||||
if(start.getDate() == new Date().getDate()){
|
||||
if (totalDays == 0) {
|
||||
if (start.getDate() == new Date().getDate()) {
|
||||
let time = start.getHours() + ":" + this.addZero(start.getUTCMinutes());
|
||||
return time;
|
||||
}
|
||||
else{
|
||||
else {
|
||||
return 'Ontem';
|
||||
}
|
||||
}
|
||||
else{
|
||||
let date = start.getDate() + "/" + (start.getMonth()+1) + "/" + start.getFullYear();
|
||||
else {
|
||||
let date = start.getDate() + "/" + (start.getMonth() + 1) + "/" + start.getFullYear();
|
||||
return date;
|
||||
}
|
||||
}
|
||||
@@ -467,7 +486,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
return await popover.present();
|
||||
}
|
||||
|
||||
async addContacts(){
|
||||
async addContacts() {
|
||||
const modal = await this.modalController.create({
|
||||
component: ContactsPage,
|
||||
componentProps: {},
|
||||
@@ -481,19 +500,19 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
async bookMeeting() {
|
||||
this.attendees = this.members.map((val)=>{
|
||||
this.attendees = this.members.map((val) => {
|
||||
return {
|
||||
Name: val.name,
|
||||
EmailAddress: val.username+"@"+environment.domain,
|
||||
EmailAddress: val.username + "@" + environment.domain,
|
||||
IsRequired: "true",
|
||||
}
|
||||
});
|
||||
console.log(this.attendees);
|
||||
this.popoverController.dismiss();
|
||||
if( window.innerWidth <= 1024){
|
||||
if (window.innerWidth <= 1024) {
|
||||
const modal = await this.modalController.create({
|
||||
component: NewEventPage,
|
||||
componentProps:{
|
||||
componentProps: {
|
||||
attendees: this.attendees,
|
||||
},
|
||||
cssClass: 'modal modal-desktop',
|
||||
@@ -501,7 +520,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then((data) => {
|
||||
if(data){
|
||||
if (data) {
|
||||
|
||||
}
|
||||
});
|
||||
@@ -524,24 +543,24 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
translucent: true
|
||||
});
|
||||
await popover.present();
|
||||
popover.onDidDismiss().then((res)=>{
|
||||
popover.onDidDismiss().then((res) => {
|
||||
console.log(res['data']);
|
||||
if(res['data'] == 'meeting'){
|
||||
if (res['data'] == 'meeting') {
|
||||
this.bookMeeting();
|
||||
}
|
||||
else if(res['data'] == 'take-picture'){
|
||||
else if (res['data'] == 'take-picture') {
|
||||
this.fileService.addCameraPictureToChat(roomId);
|
||||
//this.loadPicture();
|
||||
}
|
||||
else if(res['data'] == 'add-picture'){
|
||||
else if (res['data'] == 'add-picture') {
|
||||
this.fileService.addPictureToChatMobile(roomId);
|
||||
//this.loadPicture();
|
||||
}
|
||||
else if(res['data'] == 'add-document'){
|
||||
else if (res['data'] == 'add-document') {
|
||||
this.fileService.addDocumentToChat(this.roomId);
|
||||
//this.loadDocument();
|
||||
}
|
||||
else if(res['data'] == 'documentoGestaoDocumental'){
|
||||
else if (res['data'] == 'documentoGestaoDocumental') {
|
||||
|
||||
this.fileService.addDocGestaoDocumentalToChat(this.roomId);
|
||||
//this.addDocGestaoDocumental();
|
||||
@@ -558,19 +577,19 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
let chatmsgArray = [];
|
||||
let array = []
|
||||
msg.forEach(element => {
|
||||
console.log('CHANNEL ELEMENT',element.channels)
|
||||
console.log('CHANNEL ELEMENT', element.channels)
|
||||
|
||||
let msgChat = {
|
||||
_id: element.Id,
|
||||
attachments: this.isJson(element.Attachments),
|
||||
channels: this.isJson(element.Channels),
|
||||
file: this.isJson(element.File),
|
||||
mentions: this.isJson(element.Mentions),
|
||||
msg: element.Msg,
|
||||
rid: element.Rid,
|
||||
ts: element.Ts,
|
||||
u: this.isJson(element.U),
|
||||
_updatedAt: element.UpdatedAt
|
||||
_id: element.Id,
|
||||
attachments: this.isJson(element.Attachments),
|
||||
channels: this.isJson(element.Channels),
|
||||
file: this.isJson(element.File),
|
||||
mentions: this.isJson(element.Mentions),
|
||||
msg: element.Msg,
|
||||
rid: element.Rid,
|
||||
ts: element.Ts,
|
||||
u: this.isJson(element.U),
|
||||
_updatedAt: element.UpdatedAt
|
||||
}
|
||||
|
||||
chatmsgArray.push(msgChat)
|
||||
@@ -584,12 +603,12 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
isJson(str) {
|
||||
try {
|
||||
JSON.parse(str);
|
||||
JSON.parse(str);
|
||||
} catch (e) {
|
||||
return "";
|
||||
return "";
|
||||
}
|
||||
return JSON.parse(str);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -627,47 +646,47 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
|
||||
this.chatService.getRoomMessages(roomId).subscribe(async res => {
|
||||
console.log("Chat message",res)
|
||||
console.log("Chat message", res)
|
||||
|
||||
this.transformDataMSG(res['messages'])
|
||||
this.transformDataMSG(res['messages'])
|
||||
this.getRoomMessageDB(this.roomId);
|
||||
|
||||
|
||||
if (res == 502) {
|
||||
// Connection timeout
|
||||
// happens when the synchro was pending for too long
|
||||
// let's reconnect
|
||||
await this.serverLongPull();
|
||||
}
|
||||
else if (res != 200) {
|
||||
// Show Error
|
||||
//showMessage(response.statusText);
|
||||
//this.loadMessages()
|
||||
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
this.messages = res['messages'].reverse();
|
||||
this.chatMessageStore.add(roomId, this.messages)
|
||||
if (res == 502) {
|
||||
// Connection timeout
|
||||
// happens when the synchro was pending for too long
|
||||
// let's reconnect
|
||||
await this.serverLongPull();
|
||||
}
|
||||
|
||||
//console.log(this.messages);
|
||||
// Reconnect in one second
|
||||
if(this.route.url != "/home/chat"){
|
||||
console.log("Timer message stop")
|
||||
} else {
|
||||
//Check if modal is opened
|
||||
if(document.querySelector('.isMessagesChatOpened')){
|
||||
await new Promise(resolve => setTimeout(resolve, 5000));
|
||||
await this.serverLongPull();
|
||||
//console.log('Timer message running')
|
||||
else if (res != 200) {
|
||||
// Show Error
|
||||
//showMessage(response.statusText);
|
||||
//this.loadMessages()
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
this.messages = res['messages'].reverse();
|
||||
this.chatMessageStore.add(roomId, this.messages)
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// Got message
|
||||
//let message = await response.text();
|
||||
//this.loadMessages()
|
||||
await this.serverLongPull();
|
||||
}
|
||||
|
||||
//console.log(this.messages);
|
||||
// Reconnect in one second
|
||||
if (this.route.url != "/home/chat") {
|
||||
console.log("Timer message stop")
|
||||
} else {
|
||||
//Check if modal is opened
|
||||
if (document.querySelector('.isMessagesChatOpened')) {
|
||||
await new Promise(resolve => setTimeout(resolve, 5000));
|
||||
await this.serverLongPull();
|
||||
//console.log('Timer message running')
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// Got message
|
||||
//let message = await response.text();
|
||||
//this.loadMessages()
|
||||
await this.serverLongPull();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -679,45 +698,45 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
centeredSlides: true
|
||||
};
|
||||
zoomActive = false;
|
||||
zoomScale = 1;
|
||||
zoomScale = 1;
|
||||
|
||||
sliderZoomOpts = {
|
||||
allowSlidePrev: false,
|
||||
allowSlideNext: false,
|
||||
zoom: {
|
||||
maxRatio: 5
|
||||
},
|
||||
on: {
|
||||
zoomChange: (scale, imageEl, slideEl) => {
|
||||
this.zoomActive = true;
|
||||
this.zoomScale = scale/5;
|
||||
this.changeDetectorRef.detectChanges();
|
||||
sliderZoomOpts = {
|
||||
allowSlidePrev: false,
|
||||
allowSlideNext: false,
|
||||
zoom: {
|
||||
maxRatio: 5
|
||||
},
|
||||
on: {
|
||||
zoomChange: (scale, imageEl, slideEl) => {
|
||||
this.zoomActive = true;
|
||||
this.zoomScale = scale / 5;
|
||||
this.changeDetectorRef.detectChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async touchEnd(zoomslides: IonSlides, card) {
|
||||
// Zoom back to normal
|
||||
const slider = await zoomslides.getSwiper();
|
||||
const zoom = slider.zoom;
|
||||
zoom.out();
|
||||
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;
|
||||
// Card back to normal
|
||||
card.el.style['z-index'] = 9;
|
||||
|
||||
this.zoomActive = false;
|
||||
this.changeDetectorRef.detectChanges();
|
||||
}
|
||||
this.zoomActive = false;
|
||||
this.changeDetectorRef.detectChanges();
|
||||
}
|
||||
|
||||
touchStart(card) {
|
||||
// Make card appear above backdrop
|
||||
card.el.style['z-index'] = 11;
|
||||
}
|
||||
touchStart(card) {
|
||||
// Make card appear above backdrop
|
||||
card.el.style['z-index'] = 11;
|
||||
}
|
||||
|
||||
|
||||
async openPreview(msg) {
|
||||
const modal = await this.modalController.create({
|
||||
component: ViewMediaPage,
|
||||
component: ViewMediaPage,
|
||||
cssClass: 'modal modal-desktop',
|
||||
componentProps: {
|
||||
image: msg.attachments[0].image_url,
|
||||
@@ -729,22 +748,22 @@ touchStart(card) {
|
||||
}
|
||||
|
||||
|
||||
imageSize(img){
|
||||
imageSize(img) {
|
||||
var canvas = document.createElement('canvas');
|
||||
var ctx = canvas.getContext('2d');
|
||||
canvas.width=300
|
||||
canvas.height=234
|
||||
canvas.width = 300
|
||||
canvas.height = 234
|
||||
ctx.drawImage(img.attachments[0].image_url, 0, 0, 300, 234);
|
||||
document.body.appendChild(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
getPicture(img){
|
||||
var canvas = document.createElement('canvas');
|
||||
var ctx = canvas.getContext('2d');
|
||||
canvas.width=300
|
||||
canvas.height=234
|
||||
ctx.drawImage(img.attachments[0].image_url, 0, 0, 300, 234);
|
||||
document.body.appendChild(canvas);
|
||||
getPicture(img) {
|
||||
var canvas = document.createElement('canvas');
|
||||
var ctx = canvas.getContext('2d');
|
||||
canvas.width = 300
|
||||
canvas.height = 234
|
||||
ctx.drawImage(img.attachments[0].image_url, 0, 0, 300, 234);
|
||||
document.body.appendChild(canvas);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user