mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
improve chat
This commit is contained in:
@@ -102,7 +102,7 @@ export class HomePage implements OnInit {
|
|||||||
|
|
||||||
window['inactivity/function'] = () => {
|
window['inactivity/function'] = () => {
|
||||||
|
|
||||||
if (window.location.pathname != '/inactivity') {
|
if (window.location.pathname != '/inactivity' && window.location.pathname != '/') {
|
||||||
|
|
||||||
document.querySelectorAll('ion-modal').forEach((e: any) => e.remove());
|
document.querySelectorAll('ion-modal').forEach((e: any) => e.remove());
|
||||||
document.querySelectorAll('.popover-viewport').forEach((e: any) => e.remove());
|
document.querySelectorAll('.popover-viewport').forEach((e: any) => e.remove());
|
||||||
@@ -112,9 +112,11 @@ export class HomePage implements OnInit {
|
|||||||
SessionStore.setUrlBeforeInactivity(pathname)
|
SessionStore.setUrlBeforeInactivity(pathname)
|
||||||
|
|
||||||
if (this.platform.is('mobileweb')) {
|
if (this.platform.is('mobileweb')) {
|
||||||
this.router.navigate(['/inactivity']);
|
// this.router.navigate(['/inactivity']);
|
||||||
|
window.location.pathname = '/inactivity'
|
||||||
} else {
|
} else {
|
||||||
this.router.navigate(['/']);
|
// this.router.navigate(['/']);
|
||||||
|
window.location.pathname = '/'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,6 @@ export class ProfilePage implements OnInit {
|
|||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||||
// console.log('Notifications not supported')
|
|
||||||
this.getNotificationData();
|
this.getNotificationData();
|
||||||
} else {
|
} else {
|
||||||
this.getNotificationData();
|
this.getNotificationData();
|
||||||
@@ -78,8 +77,6 @@ export class ProfilePage implements OnInit {
|
|||||||
|
|
||||||
async getNotificationData() {
|
async getNotificationData() {
|
||||||
|
|
||||||
console.log('profile',this.storageservice.key("Notifications"))
|
|
||||||
|
|
||||||
const keyExist = await this.storageservice.keyExist("Notifications")
|
const keyExist = await this.storageservice.keyExist("Notifications")
|
||||||
|
|
||||||
if(keyExist) {
|
if(keyExist) {
|
||||||
@@ -225,9 +222,8 @@ export class ProfilePage implements OnInit {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
// alert('logout')
|
// alert('logout')
|
||||||
this.router.navigateByUrl('/auth', { replaceUrl: true });
|
this.router.navigateByUrl('/auth', { replaceUrl: true });
|
||||||
this.router.navigate(['/auth']);
|
|
||||||
|
|
||||||
setTimeout(() =>{
|
setTimeout(() => {
|
||||||
if(this.logoutOut == false) {
|
if(this.logoutOut == false) {
|
||||||
window.location.pathname = '/auth'
|
window.location.pathname = '/auth'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import { environment } from 'src/environments/environment'
|
|||||||
const { ArrayField, JsonField} = models.indexedDB.fields
|
const { ArrayField, JsonField} = models.indexedDB.fields
|
||||||
|
|
||||||
export class MessageModel extends models.Model {
|
export class MessageModel extends models.Model {
|
||||||
|
|
||||||
channels = ArrayField()
|
channels = ArrayField()
|
||||||
mentions = ArrayField()
|
mentions = ArrayField()
|
||||||
msg = models.CharField()
|
msg = models.CharField()
|
||||||
@@ -17,27 +16,33 @@ export class MessageModel extends models.Model {
|
|||||||
offline = models.BooleanField()
|
offline = models.BooleanField()
|
||||||
viewed = ArrayField({blank:true})
|
viewed = ArrayField({blank:true})
|
||||||
received = ArrayField({blank:true})
|
received = ArrayField({blank:true})
|
||||||
localReference = models.CharField({blank:true})
|
localReference = models.CharField({blank:true, unique: true})
|
||||||
attachments = ArrayField({blank:true})
|
attachments = ArrayField({blank:true})
|
||||||
file = JsonField({blank:true})
|
file = JsonField({blank:true})
|
||||||
|
|
||||||
|
async getAttachments() {
|
||||||
|
const _attachments = await attachments.filter({id: this['id']})
|
||||||
|
return _attachments
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class attachments extends models.Model {
|
||||||
|
message = models.OneToOneField({model:MessageModel})
|
||||||
|
attachments = ArrayField({default:[]})
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DeleteMessageModel extends models.Model {
|
export class DeleteMessageModel extends models.Model {
|
||||||
|
|
||||||
messageId = models.CharField()
|
messageId = models.CharField()
|
||||||
rid = models.CharField()
|
rid = models.CharField()
|
||||||
u = JsonField()
|
u = JsonField()
|
||||||
needToReceiveBy = ArrayField()
|
needToReceiveBy = ArrayField()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
models.register({
|
models.register({
|
||||||
databaseName: 'chat-storage'+environment.version.lastCommitNumber,
|
databaseName: 'chat-storage'+environment.version.lastCommitNumber,
|
||||||
type: 'indexedDB',
|
type: 'indexedDB',
|
||||||
version: 5,
|
version: 10,
|
||||||
models: [MessageModel, DeleteMessageModel]
|
models: [MessageModel, DeleteMessageModel, attachments]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@
|
|||||||
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
||||||
|
|
||||||
<ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0 && msg.viewed.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||||
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
||||||
@@ -103,7 +103,7 @@
|
|||||||
<ion-icon *ngIf="msg.attachments[0].image_url == null" name="download-outline"></ion-icon>
|
<ion-icon *ngIf="msg.attachments[0].image_url == null" name="download-outline"></ion-icon>
|
||||||
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
||||||
<ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0 && msg.viewed.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||||
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
||||||
@@ -157,7 +157,7 @@
|
|||||||
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
||||||
|
|
||||||
<ion-icon *ngIf="msg.messageSend == false" src="assets/images/clock-regular.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend == false" src="assets/images/clock-regular.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0 && msg.viewed.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||||
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
||||||
|
|||||||
@@ -61,7 +61,7 @@
|
|||||||
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
||||||
|
|
||||||
<ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0 && msg.viewed.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||||
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
||||||
@@ -98,7 +98,7 @@
|
|||||||
|
|
||||||
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
||||||
<ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0 && msg.viewed.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||||
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
||||||
@@ -164,7 +164,7 @@
|
|||||||
<ion-icon *ngIf="msg.messageSend == false" src="assets/images/clock-regular.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend == false" src="assets/images/clock-regular.svg"></ion-icon>
|
||||||
|
|
||||||
<ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0 && msg.viewed.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||||
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ export class GabineteDigitalPage implements OnInit {
|
|||||||
})
|
})
|
||||||
|
|
||||||
this.backgroundservice.registerBackService('Online', () => {
|
this.backgroundservice.registerBackService('Online', () => {
|
||||||
this.loadAllProcesses();
|
// this.loadAllProcesses();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -116,9 +116,10 @@ export class AuthService {
|
|||||||
SessionStore.save()
|
SessionStore.save()
|
||||||
|
|
||||||
this.RochetChatConnectorService.setStatus('online')
|
this.RochetChatConnectorService.setStatus('online')
|
||||||
|
window['RochetChatConnectorService'] = this.RochetChatConnectorService
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.ChatSystemService.getAllRooms();
|
this.ChatSystemService.getAllRooms();
|
||||||
|
this.RochetChatConnectorService.setStatus('online')
|
||||||
}, 200);
|
}, 200);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -395,21 +395,27 @@ export class ChatService {
|
|||||||
|
|
||||||
if(this.NetworkServiceService.getCurrentNetworkStatus() == ConnectionStatus.Offline) {
|
if(this.NetworkServiceService.getCurrentNetworkStatus() == ConnectionStatus.Offline) {
|
||||||
this.RochetChatConnectorService.registerCallback({
|
this.RochetChatConnectorService.registerCallback({
|
||||||
|
requestId: 'refreshtoken',
|
||||||
type: 'reConnect',
|
type: 'reConnect',
|
||||||
funx: async ()=> {
|
funx: async () => {
|
||||||
|
|
||||||
this.resetTimer();
|
this.resetTimer();
|
||||||
await this.refreshtoken();
|
await this.refreshtoken();
|
||||||
|
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.resetTimer();
|
|
||||||
await this.refreshtoken();
|
setTimeout(async () => {
|
||||||
|
this.resetTimer();
|
||||||
|
await this.refreshtoken();
|
||||||
|
}, 60000)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} else if(!SessionStore.user.ChatData) {
|
} else if(!SessionStore.user.ChatData) {
|
||||||
// do nothing
|
// do nothing
|
||||||
} else if (!this.headers) {
|
} else if (!this.headers) {
|
||||||
@@ -437,7 +443,6 @@ export class ChatService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
functionTimer = null;
|
functionTimer = null;
|
||||||
timerEventTriggerDate = null
|
timerEventTriggerDate = null
|
||||||
timerEventTriggerDateLastUpdate = null
|
timerEventTriggerDateLastUpdate = null
|
||||||
@@ -447,8 +452,15 @@ export class ChatService {
|
|||||||
this.timerEventTriggerDate = new Date(+new Date() + 60000*15);
|
this.timerEventTriggerDate = new Date(+new Date() + 60000*15);
|
||||||
|
|
||||||
this.functionTimer = setTimeout(() => {
|
this.functionTimer = setTimeout(() => {
|
||||||
this.refreshtoken();
|
|
||||||
}, 60000 * 5); // time is in milliseconds
|
if(this.NetworkServiceService.getCurrentNetworkStatus() == ConnectionStatus.Online) {
|
||||||
|
this.refreshtoken();
|
||||||
|
} else {
|
||||||
|
this.resetTimer()
|
||||||
|
}
|
||||||
|
|
||||||
|
}, 60000 * 15); // time is in milliseconds
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -283,11 +283,12 @@ export class ChatSystemService {
|
|||||||
this.loadingWholeList = false
|
this.loadingWholeList = false
|
||||||
await this.storage.set('Rooms', rooms);
|
await this.storage.set('Rooms', rooms);
|
||||||
|
|
||||||
|
this.sortRoomList()
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.sortRoomList()
|
this.sortRoomList()
|
||||||
}, 1000)
|
}, 1000)
|
||||||
|
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.sortRoomList()
|
this.sortRoomList()
|
||||||
}, 10000)
|
}, 10000)
|
||||||
@@ -480,19 +481,19 @@ export class ChatSystemService {
|
|||||||
*/
|
*/
|
||||||
private getUserStatus(id?:string) {
|
private getUserStatus(id?:string) {
|
||||||
|
|
||||||
this.RochetChatConnectorService.getUserStatus((d) => {
|
this.RochetChatConnectorService.getUserStatus(async (d) => {
|
||||||
|
|
||||||
|
const userId = d.fields.args[0][0]
|
||||||
const username = d.fields.args[0][1]
|
const username = d.fields.args[0][1]
|
||||||
const statusNum = d.fields.args[0][2]
|
const statusNum = d.fields.args[0][2]
|
||||||
|
|
||||||
|
|
||||||
const statusText = this.statusNumberToText(statusNum)
|
const statusText = this.statusNumberToText(statusNum)
|
||||||
|
|
||||||
this.users.forEach((user, index) => {
|
for ( const user of this.users) {
|
||||||
if(user.username == username) {
|
if(user._id == userId) {
|
||||||
this.users[index].status = statusText
|
user.status = statusText
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ import { HttpEventType } from '@angular/common/http';
|
|||||||
import { AttachmentsService } from 'src/app/services/attachments.service';
|
import { AttachmentsService } from 'src/app/services/attachments.service';
|
||||||
import { NetworkServiceService , ConnectionStatus} from 'src/app/services/network-service.service';
|
import { NetworkServiceService , ConnectionStatus} from 'src/app/services/network-service.service';
|
||||||
import { ChatSystemService } from './chat-system.service';
|
import { ChatSystemService } from './chat-system.service';
|
||||||
import { resolve } from 'dns';
|
import { v4 as uuidv4 } from 'uuid'
|
||||||
import { async } from '@angular/core/testing';
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
@@ -38,7 +38,6 @@ export class MessageService {
|
|||||||
_updatedAt
|
_updatedAt
|
||||||
file
|
file
|
||||||
attachments
|
attachments
|
||||||
offline = true
|
|
||||||
displayType = ''
|
displayType = ''
|
||||||
temporaryData: any = {}
|
temporaryData: any = {}
|
||||||
hasFile = false
|
hasFile = false
|
||||||
@@ -50,8 +49,8 @@ export class MessageService {
|
|||||||
from: 'Offline'|'History'|'stream'| 'send'
|
from: 'Offline'|'History'|'stream'| 'send'
|
||||||
duration = ''
|
duration = ''
|
||||||
localReference = null
|
localReference = null
|
||||||
viewed = []
|
viewed: string[] = []
|
||||||
received = []
|
received: string[]= []
|
||||||
addToDb = false
|
addToDb = false
|
||||||
|
|
||||||
messageSend = false
|
messageSend = false
|
||||||
@@ -73,7 +72,7 @@ export class MessageService {
|
|||||||
private ChatSystemService: ChatSystemService) {
|
private ChatSystemService: ChatSystemService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
setData({customFields = {}, channels, mentions, msg ,rid ,ts, u, t, _id, id, _updatedAt, file, attachments, temporaryData, localReference , viewed = [], received = [], delate = false, delateRequest =false, from, sendAttempt = 0 }:Message) {
|
setData({customFields = {}, channels, mentions, msg ,rid ,ts, u, t, _id, id, _updatedAt, file, attachments, temporaryData, localReference = 'out-'+uuidv4() , viewed = [], received = [], delate = false, delateRequest =false, from, sendAttempt = 0 }:Message) {
|
||||||
|
|
||||||
this.channels = channels || []
|
this.channels = channels || []
|
||||||
this.mentions = mentions || []
|
this.mentions = mentions || []
|
||||||
@@ -102,11 +101,9 @@ export class MessageService {
|
|||||||
this.received = [...new Set([...received,...this.received])];
|
this.received = [...new Set([...received,...this.received])];
|
||||||
|
|
||||||
if(!this.ts) {
|
if(!this.ts) {
|
||||||
this.offline = true
|
|
||||||
this.messageSend = false
|
this.messageSend = false
|
||||||
} else {
|
} else {
|
||||||
this.messageSend = true
|
this.messageSend = true
|
||||||
this.offline = false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.file) {
|
if (this.file) {
|
||||||
@@ -137,6 +134,34 @@ export class MessageService {
|
|||||||
this.calDateDuration()
|
this.calDateDuration()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
get offline () {
|
||||||
|
if(!this._id) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!this.ts) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Message is on the server
|
||||||
|
*/
|
||||||
|
get online() {
|
||||||
|
return !this.offline
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* if Message is already saved on database
|
||||||
|
*/
|
||||||
|
get save() {
|
||||||
|
return this.id != ''
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private usernameToDisplayName(username) {
|
private usernameToDisplayName(username) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -150,7 +175,6 @@ export class MessageService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async send(): Promise<any> {
|
async send(): Promise<any> {
|
||||||
|
|
||||||
if(this.messageSend) {
|
if(this.messageSend) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
resolve('solve')
|
resolve('solve')
|
||||||
@@ -183,7 +207,7 @@ export class MessageService {
|
|||||||
|
|
||||||
this.RochetChatConnectorService.registerCallback({
|
this.RochetChatConnectorService.registerCallback({
|
||||||
type: 'reConnect',
|
type: 'reConnect',
|
||||||
funx: async ()=> {
|
funx: async () => {
|
||||||
this.send().catch((error) =>{
|
this.send().catch((error) =>{
|
||||||
console.error(error)
|
console.error(error)
|
||||||
})
|
})
|
||||||
@@ -250,7 +274,6 @@ export class MessageService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(this.NetworkServiceService.getCurrentNetworkStatus() == ConnectionStatus.Online) {
|
if(this.NetworkServiceService.getCurrentNetworkStatus() == ConnectionStatus.Online) {
|
||||||
// console.log('online send')
|
|
||||||
|
|
||||||
if(this.msg == '<script></script>') {
|
if(this.msg == '<script></script>') {
|
||||||
if(this.sendAttempt >= 4) {
|
if(this.sendAttempt >= 4) {
|
||||||
@@ -259,7 +282,6 @@ export class MessageService {
|
|||||||
ChatMessage = ChatMessage.message.result
|
ChatMessage = ChatMessage.message.result
|
||||||
clearTimeout(this.functionTimer);
|
clearTimeout(this.functionTimer);
|
||||||
|
|
||||||
this.messageSend = true
|
|
||||||
this.redefinedMessage(ChatMessage)
|
this.redefinedMessage(ChatMessage)
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -270,12 +292,12 @@ export class MessageService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
this.RochetChatConnectorService.send(params).then(
|
this.RochetChatConnectorService.send(params).then(
|
||||||
(ChatMessage: any) => {
|
(ChatMessage: any) => {
|
||||||
ChatMessage = ChatMessage.message.result
|
ChatMessage = ChatMessage.message.result
|
||||||
clearTimeout(this.functionTimer);
|
clearTimeout(this.functionTimer);
|
||||||
|
|
||||||
this.messageSend = true
|
|
||||||
this.redefinedMessage(ChatMessage)
|
this.redefinedMessage(ChatMessage)
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -286,7 +308,6 @@ export class MessageService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.functionTimer = setTimeout(() => {
|
this.functionTimer = setTimeout(() => {
|
||||||
|
|
||||||
this.RochetChatConnectorService.registerCallback({
|
this.RochetChatConnectorService.registerCallback({
|
||||||
type:'Onmessage',
|
type:'Onmessage',
|
||||||
key:'ping-pong-message',
|
key:'ping-pong-message',
|
||||||
@@ -300,7 +321,7 @@ export class MessageService {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
this.save()
|
this.saveChanges()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -312,7 +333,6 @@ export class MessageService {
|
|||||||
this.RochetChatConnectorService.registerCallback({
|
this.RochetChatConnectorService.registerCallback({
|
||||||
type: 'reConnect',
|
type: 'reConnect',
|
||||||
funx: async ()=> {
|
funx: async ()=> {
|
||||||
|
|
||||||
this.send().catch((error) =>{
|
this.send().catch((error) =>{
|
||||||
console.error(error)
|
console.error(error)
|
||||||
})
|
})
|
||||||
@@ -329,11 +349,18 @@ export class MessageService {
|
|||||||
const message = this.getChatObj()
|
const message = this.getChatObj()
|
||||||
|
|
||||||
this.manualRetry = false
|
this.manualRetry = false
|
||||||
|
this.messageSend = true
|
||||||
|
|
||||||
ChatMessage = Object.assign(message, ChatMessage)
|
ChatMessage = Object.assign(message, ChatMessage)
|
||||||
this.setData(ChatMessage)
|
this.setData(ChatMessage)
|
||||||
|
|
||||||
await this.save()
|
const roomObject = this.ChatSystemService.getRoomById(this.rid)
|
||||||
|
const users = roomObject.getUsersByStatus('online')
|
||||||
|
for(const user of users) {
|
||||||
|
this.addReceived(user._id)
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.saveChanges()
|
||||||
}
|
}
|
||||||
|
|
||||||
downloadFileMsg() {
|
downloadFileMsg() {
|
||||||
@@ -363,7 +390,7 @@ export class MessageService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// save the changes to the storage
|
// save the changes to the storage
|
||||||
this.save()
|
this.saveChanges()
|
||||||
this.downloadLoader = false;
|
this.downloadLoader = false;
|
||||||
this.downloadAttachments = true
|
this.downloadAttachments = true
|
||||||
this.downloadAttachmentsTemp++;
|
this.downloadAttachmentsTemp++;
|
||||||
@@ -384,30 +411,55 @@ export class MessageService {
|
|||||||
|
|
||||||
async delateStatusFalse() {
|
async delateStatusFalse() {
|
||||||
this.delate = true
|
this.delate = true
|
||||||
this.save()
|
this.saveChanges()
|
||||||
|
}
|
||||||
|
|
||||||
|
addViewed(id: string) {
|
||||||
|
if(this.messageOwner()) {
|
||||||
|
let found = this.viewed.find((UserId) => UserId == id)
|
||||||
|
|
||||||
|
if(!found) {
|
||||||
|
this.viewed.push(id)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
addReceived(id: string) {
|
||||||
|
if(this.messageOwner()) {
|
||||||
|
let found = this.received.find((UserId) => UserId == id)
|
||||||
|
|
||||||
|
if(!found) {
|
||||||
|
this.received.push(id)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
async delateDB() {
|
async delateDB() {
|
||||||
|
|
||||||
const message = await MessageModel.get({_id: this._id})
|
const message = await MessageModel.get({id: this.id})
|
||||||
await message.delete()
|
await message.delete()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
isSenderIsNotMe(ChatMessage) {
|
isSenderIsNotMe(ChatMessage) {
|
||||||
return SessionStore.user.UserName != ChatMessage.u.username
|
return SessionStore.user.ChatData.data.userId != ChatMessage.u._id
|
||||||
}
|
}
|
||||||
|
|
||||||
messageOwnerById(id) {
|
messageOwner() {
|
||||||
return SessionStore.user.UserName != this.u.username
|
return SessionStore.user.ChatData.data.userId == this.u._id
|
||||||
}
|
}
|
||||||
|
|
||||||
private getChatObj() {
|
private getChatObj() {
|
||||||
return {
|
return {
|
||||||
channels: this.channels,
|
channels: this.channels,
|
||||||
mentions: this.mentions,
|
mentions: this.mentions,
|
||||||
//msg: this.AESEncrypt.encrypt(this.msg, SessionStore.user.UserName),
|
// msg: this.AESEncrypt.encrypt(this.msg, SessionStore.user.UserName),
|
||||||
sendAttempt: this.sendAttempt,
|
sendAttempt: this.sendAttempt,
|
||||||
msg:this.msg,
|
msg:this.msg,
|
||||||
rid: this.rid,
|
rid: this.rid,
|
||||||
@@ -427,8 +479,10 @@ export class MessageService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
earlySave = false
|
||||||
|
|
||||||
async addMessageDB() {
|
async addMessageDB() {
|
||||||
if(!this.addToDb) {
|
if(!this.addToDb && this.save) {
|
||||||
this.addToDb = true
|
this.addToDb = true
|
||||||
const message = this.getChatObj()
|
const message = this.getChatObj()
|
||||||
|
|
||||||
@@ -436,15 +490,39 @@ export class MessageService {
|
|||||||
const createdMessage = await MessageModel.create(message)
|
const createdMessage = await MessageModel.create(message)
|
||||||
|
|
||||||
this.id = createdMessage.id
|
this.id = createdMessage.id
|
||||||
|
|
||||||
|
if(this.earlySave) {
|
||||||
|
this.saveChanges();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async save() {
|
async saveChanges() {
|
||||||
const message = this.getChatObj()
|
|
||||||
|
|
||||||
|
if(this.save) {
|
||||||
|
const message = this.getChatObj()
|
||||||
|
let a
|
||||||
|
|
||||||
|
if (this.localReference) {
|
||||||
|
a = await MessageModel.get({localReference: this.localReference})
|
||||||
|
} else if (this._id) {
|
||||||
|
a = await MessageModel.get({id: this.id})
|
||||||
|
} else if(this.id) {
|
||||||
|
a = await MessageModel.get({_id: this._id})
|
||||||
|
}
|
||||||
|
|
||||||
|
for( const [name, value] of Object.entries(message)) {
|
||||||
|
a[name] = value
|
||||||
|
}
|
||||||
|
|
||||||
|
await a.save()
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this.earlySave = true
|
||||||
|
console.log('save change to early')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
await MessageModel.update(message)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
decryptMessage() {
|
decryptMessage() {
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import { AttachmentsService } from 'src/app/services/attachments.service';
|
|||||||
import { ConnectionStatus, NetworkServiceService} from 'src/app/services/network-service.service';
|
import { ConnectionStatus, NetworkServiceService} from 'src/app/services/network-service.service';
|
||||||
import { ChatSystemService } from './chat-system.service';
|
import { ChatSystemService } from './chat-system.service';
|
||||||
import { ViewedMessageService } from './viewed-message.service'
|
import { ViewedMessageService } from './viewed-message.service'
|
||||||
|
import * as FIFOProcessQueue from 'fifo-process-queue';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@@ -47,9 +48,9 @@ export class RoomService {
|
|||||||
message = ''
|
message = ''
|
||||||
lastMessageTxt = ''
|
lastMessageTxt = ''
|
||||||
userThatIsTyping = ''
|
userThatIsTyping = ''
|
||||||
messagesLocalReference = []
|
messagesLocalReference: string[] = []
|
||||||
members = []
|
members: chatUser[] = []
|
||||||
membersExcludeMe = []
|
membersExcludeMe: chatUser[] = []
|
||||||
u
|
u
|
||||||
sessionStore = SessionStore
|
sessionStore = SessionStore
|
||||||
countDownTime = ''
|
countDownTime = ''
|
||||||
@@ -186,9 +187,13 @@ export class RoomService {
|
|||||||
|
|
||||||
if(!this.isGroup) {
|
if(!this.isGroup) {
|
||||||
for(let user of this.ChatSystemService.users) {
|
for(let user of this.ChatSystemService.users) {
|
||||||
if(this.membersExcludeMe[0]._id == user._id) {
|
|
||||||
return user.status
|
for (const members of this.membersExcludeMe) {
|
||||||
|
if(members._id == user._id) {
|
||||||
|
return user.status
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,71 +265,7 @@ export class RoomService {
|
|||||||
"stream-room-messages",
|
"stream-room-messages",
|
||||||
async (IncomingChatMessage:IncomingChatMessage) => {
|
async (IncomingChatMessage:IncomingChatMessage) => {
|
||||||
|
|
||||||
let IncomingChatMessageArgs = IncomingChatMessage.fields.args[0]
|
this.appendReceiveMessage.push(IncomingChatMessage)
|
||||||
let ChatMessage : ChatMessageInterface = this.fix_updatedAt(IncomingChatMessageArgs)
|
|
||||||
|
|
||||||
const allMessageIds = this.messages.map((e)=> e._id);
|
|
||||||
|
|
||||||
if(!this.messagesLocalReference.includes(ChatMessage.localReference) && !allMessageIds.includes(ChatMessage?._id)) {
|
|
||||||
|
|
||||||
this.messagesLocalReference.push(ChatMessage.localReference);
|
|
||||||
|
|
||||||
const message = await this.prepareCreate({message: ChatMessage, save: true});
|
|
||||||
message.messageSend = true
|
|
||||||
message.from = 'stream'
|
|
||||||
message.loadHistory = this.hasLoadHistory
|
|
||||||
|
|
||||||
this.lastMessage = message;
|
|
||||||
this.calDateDuration(ChatMessage._updatedAt);
|
|
||||||
|
|
||||||
if (message.t == 'r') {
|
|
||||||
this.name = message.msg;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this.isSenderIsNotMe(ChatMessage)) {
|
|
||||||
this.NativeNotificationService.sendNotificationChat({
|
|
||||||
message: message.msg,
|
|
||||||
title: this.name
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this.hasLoadHistory == true) {
|
|
||||||
await message.addMessageDB()
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this.chatOpen == false) {
|
|
||||||
this.messageUnread = true
|
|
||||||
}
|
|
||||||
|
|
||||||
setTimeout(()=>{
|
|
||||||
this.scrollDown()
|
|
||||||
}, 50)
|
|
||||||
} else {
|
|
||||||
|
|
||||||
this.messages.forEach((message, index)=> {
|
|
||||||
if(message.localReference == ChatMessage.localReference) {
|
|
||||||
|
|
||||||
const membersIds = this.membersExcludeMe.map((user)=> user._id)
|
|
||||||
|
|
||||||
this.getAllUsers().forEach( async (users) => {
|
|
||||||
|
|
||||||
if(membersIds.includes(users._id)) {
|
|
||||||
|
|
||||||
if(users.status != 'offline') {
|
|
||||||
|
|
||||||
this.messages[index].received.push(users._id)
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
message.save()
|
|
||||||
}, 150)
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -334,9 +275,7 @@ export class RoomService {
|
|||||||
if(message.fields.eventName == this.id+'/'+'typing') {
|
if(message.fields.eventName == this.id+'/'+'typing') {
|
||||||
|
|
||||||
const args = message.fields.args
|
const args = message.fields.args
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (typeof args[1] != 'object') {
|
if (typeof args[1] != 'object') {
|
||||||
this.userThatIsTyping = this.usernameToDisplayName(args[0])
|
this.userThatIsTyping = this.usernameToDisplayName(args[0])
|
||||||
|
|
||||||
@@ -350,7 +289,6 @@ export class RoomService {
|
|||||||
this.readAllMessage()
|
this.readAllMessage()
|
||||||
} else if(args[0]?.method == 'deleteMessage' || args[1]?.method == 'deleteMessage') {
|
} else if(args[0]?.method == 'deleteMessage' || args[1]?.method == 'deleteMessage') {
|
||||||
|
|
||||||
|
|
||||||
this.deleteMessage(args[1]?.method?._id)
|
this.deleteMessage(args[1]?.method?._id)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -363,6 +301,68 @@ export class RoomService {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
appendReceiveMessage = FIFOProcessQueue(async (IncomingChatMessage:IncomingChatMessage, done) => {
|
||||||
|
|
||||||
|
let IncomingChatMessageArgs = IncomingChatMessage.fields.args[0]
|
||||||
|
let ChatMessage : ChatMessageInterface = this.fix_updatedAt(IncomingChatMessageArgs)
|
||||||
|
|
||||||
|
|
||||||
|
let found = this.findMessageBy_id(ChatMessage._id) ||
|
||||||
|
this.findMessageBy_localReference(ChatMessage?.localReference)
|
||||||
|
// || await this.findMessageInDBByData({_id:ChatMessage._id, localReference:ChatMessage.localReference })
|
||||||
|
|
||||||
|
if(!found) {
|
||||||
|
|
||||||
|
const message = await this.prepareCreate({message: ChatMessage, save: true});
|
||||||
|
this.registerSendMessage(message)
|
||||||
|
|
||||||
|
message.from = 'stream'
|
||||||
|
message.loadHistory = this.hasLoadHistory
|
||||||
|
|
||||||
|
this.lastMessage = message;
|
||||||
|
this.calDateDuration(ChatMessage._updatedAt);
|
||||||
|
|
||||||
|
if (message.t == 'r') {
|
||||||
|
this.name = message.msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.isSenderIsNotMe(ChatMessage)) {
|
||||||
|
this.NativeNotificationService.sendNotificationChat({
|
||||||
|
message: message.msg,
|
||||||
|
title: this.name
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.hasLoadHistory == true) {
|
||||||
|
await message.addMessageDB()
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.chatOpen == false) {
|
||||||
|
this.messageUnread = true
|
||||||
|
}
|
||||||
|
|
||||||
|
setTimeout(()=>{
|
||||||
|
this.scrollDown()
|
||||||
|
}, 50)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
done()
|
||||||
|
}, 5)
|
||||||
|
})
|
||||||
|
|
||||||
|
getUsersByStatus(status: 'offline' | 'online') {
|
||||||
|
|
||||||
|
return this.getAllUsers().filter((user => {
|
||||||
|
for(const member of this.membersExcludeMe) {
|
||||||
|
if(user._id == member._id && user.status == status) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
getRoomMembersIds(): string[] {
|
getRoomMembersIds(): string[] {
|
||||||
try {
|
try {
|
||||||
@@ -528,7 +528,7 @@ export class RoomService {
|
|||||||
|
|
||||||
this.RochetChatConnectorService.deleteMessage(msgId).then(async() => {
|
this.RochetChatConnectorService.deleteMessage(msgId).then(async() => {
|
||||||
message.delateRequest = true
|
message.delateRequest = true
|
||||||
await message.save();
|
await message.saveChanges();
|
||||||
this.deleteMessage(msgId);
|
this.deleteMessage(msgId);
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -564,8 +564,8 @@ export class RoomService {
|
|||||||
|
|
||||||
this.message= ''
|
this.message= ''
|
||||||
|
|
||||||
this.messagesLocalReference.push(localReference)
|
|
||||||
const message: MessageService = await this.prepareCreate({message:offlineChatMessage, save: environment.chatOffline})
|
const message: MessageService = await this.prepareCreate({message:offlineChatMessage, save: environment.chatOffline})
|
||||||
|
this.registerSendMessage(message)
|
||||||
|
|
||||||
if(this.hasLoadHistory == true) {
|
if(this.hasLoadHistory == true) {
|
||||||
await message.addMessageDB()
|
await message.addMessageDB()
|
||||||
@@ -574,7 +574,6 @@ export class RoomService {
|
|||||||
message.send()
|
message.send()
|
||||||
message.from = 'send'
|
message.from = 'send'
|
||||||
message.loadHistory = this.hasLoadHistory
|
message.loadHistory = this.hasLoadHistory
|
||||||
|
|
||||||
|
|
||||||
if (environment.chatOffline) {
|
if (environment.chatOffline) {
|
||||||
|
|
||||||
@@ -589,6 +588,24 @@ export class RoomService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register all send message so that
|
||||||
|
* the incoming message wont be confuse to
|
||||||
|
* other user the localReference is the identifier
|
||||||
|
*/
|
||||||
|
registerSendMessage(message: MessageService) {
|
||||||
|
this.messagesLocalReference.push(message.localReference)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
localReferenceExist(message: MessageService) {
|
||||||
|
for( const localReference of this.messagesLocalReference) {
|
||||||
|
if(localReference == message?.localReference) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
sendTyping(text:string = this.message) {
|
sendTyping(text:string = this.message) {
|
||||||
|
|
||||||
@@ -660,8 +677,11 @@ export class RoomService {
|
|||||||
return JSON.parse(str);
|
return JSON.parse(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
restoreOnce = false
|
||||||
async restoreMessageFromDB() {
|
async restoreMessageFromDB() {
|
||||||
if(environment.chatOffline) {
|
if(environment.chatOffline && this.restoreOnce == false) {
|
||||||
|
this.restoreOnce = true
|
||||||
|
|
||||||
const messages = await MessageModel.filter({rid:this.id}).execute()
|
const messages = await MessageModel.filter({rid:this.id}).execute()
|
||||||
|
|
||||||
@@ -669,31 +689,24 @@ export class RoomService {
|
|||||||
const wewMessage = await this.simplePrepareMessage(ChatMessage)
|
const wewMessage = await this.simplePrepareMessage(ChatMessage)
|
||||||
wewMessage.from = 'Offline'
|
wewMessage.from = 'Offline'
|
||||||
wewMessage.loadHistory = this.hasLoadHistory
|
wewMessage.loadHistory = this.hasLoadHistory
|
||||||
|
|
||||||
|
|
||||||
if(wewMessage.offline == false) {
|
if(wewMessage.offline == false) {
|
||||||
const message = await this.prepareMessageCreateIfNotExist_iD({message:ChatMessage})
|
|
||||||
|
|
||||||
if(message) {
|
const message = await this.prepareCreate({message:ChatMessage})
|
||||||
message.from = 'Offline'
|
message.from = 'Offline'
|
||||||
message.loadHistory = this.hasLoadHistory
|
message.loadHistory = this.hasLoadHistory
|
||||||
message?.decryptMessage()
|
message?.decryptMessage()
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
const offlineMessage = await this.prepareCreate({message:ChatMessage})
|
||||||
|
|
||||||
const offlineMessage = await this.prepareMessageCreateIfNotExist({message:ChatMessage})
|
offlineMessage.from = 'Offline'
|
||||||
|
offlineMessage.loadHistory = this.hasLoadHistory
|
||||||
if(offlineMessage) {
|
this.registerSendMessage(offlineMessage)
|
||||||
offlineMessage.from = 'Offline'
|
offlineMessage?.decryptMessage()
|
||||||
offlineMessage.loadHistory = this.hasLoadHistory
|
offlineMessage.send()
|
||||||
|
// console.log('send offline', ChatMessage)
|
||||||
this.messagesLocalReference.push(offlineMessage.localReference)
|
|
||||||
|
|
||||||
offlineMessage?.decryptMessage()
|
|
||||||
offlineMessage.send()
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -710,6 +723,7 @@ export class RoomService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// runs onces only
|
// runs onces only
|
||||||
|
|
||||||
async loadHistory({limit = 1000, forceUpdate = false }) {
|
async loadHistory({limit = 1000, forceUpdate = false }) {
|
||||||
|
|
||||||
if(forceUpdate == false) {
|
if(forceUpdate == false) {
|
||||||
@@ -718,23 +732,27 @@ export class RoomService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.restoreFromOffline == false) {
|
|
||||||
this.restoreFromOffline = true
|
|
||||||
await this.restoreMessageFromDB()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const chatHistory: chatHistory = await this.RochetChatConnectorService.loadHistory(this.id, limit)
|
const chatHistory: chatHistory = await this.RochetChatConnectorService.loadHistory(this.id, limit)
|
||||||
|
|
||||||
if(chatHistory?.result?.messages) {
|
if(chatHistory?.result?.messages) {
|
||||||
const messagesId = this.messages.map((message)=> message._id)
|
const messagesId = this.messages.map((message)=> message._id)
|
||||||
|
|
||||||
|
const users = this.getUsersByStatus('online')
|
||||||
|
|
||||||
for(let message of chatHistory.result.messages.reverse()) {
|
for(let message of chatHistory.result.messages.reverse()) {
|
||||||
if (!messagesId.includes(message._id)) {
|
if (!messagesId.includes(message._id)) {
|
||||||
const messagesToSave = await this.prepareMessageCreateIfNotExist_iD({message: message});
|
const messagesToSave = await this.prepareMessageCreateIfNotExist({message: message});
|
||||||
if(messagesToSave) {
|
if(messagesToSave != null) {
|
||||||
|
|
||||||
|
messagesToSave.received = users.map((user) => user._id)
|
||||||
messagesToSave.addMessageDB()
|
messagesToSave.addMessageDB()
|
||||||
|
|
||||||
|
// console.log('add history', message)
|
||||||
|
} else {
|
||||||
|
// console.log('exit')
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// console.log('exit')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -744,28 +762,6 @@ export class RoomService {
|
|||||||
}, 50)
|
}, 50)
|
||||||
|
|
||||||
this.hasLoadHistory = true
|
this.hasLoadHistory = true
|
||||||
this.messageReorder();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
async messageReorder() {
|
|
||||||
const reorderMessage: MessageService[] = this.messages.filter((message) =>
|
|
||||||
message.from == 'send' && !message.loadHistory || message.from == 'stream' && !message.loadHistory
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
let i = 0
|
|
||||||
for(let message of this.messages) {
|
|
||||||
if(message.from == 'send' && !message.loadHistory || message.from == 'stream' && !message.loadHistory) {
|
|
||||||
this.messages.splice(i, 1)
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(let message of reorderMessage) {
|
|
||||||
this.messages.push(message)
|
|
||||||
message.addMessageDB()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -774,60 +770,11 @@ export class RoomService {
|
|||||||
|
|
||||||
async readAllMessage() {
|
async readAllMessage() {
|
||||||
|
|
||||||
|
this.ViewedMessageService.requestReadAll(this)
|
||||||
const membersIds = this.membersExcludeMe.map((user)=> user._id)
|
|
||||||
|
|
||||||
|
|
||||||
await this.messages.forEach( async (message, index) => {
|
|
||||||
if(message._id) {
|
|
||||||
if(message.viewed.length == 0) {
|
|
||||||
this.messages[index].viewed = membersIds;
|
|
||||||
this.messages[index].received = membersIds;
|
|
||||||
|
|
||||||
await this.messages[index].save()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @description find or create message
|
|
||||||
* @param message
|
|
||||||
* @param save
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
async prepareMessage({message, save = true, redefined = false}): Promise<MessageService> {
|
|
||||||
message = this.fix_updatedAt(message)
|
|
||||||
|
|
||||||
|
|
||||||
const wewMessage = new MessageService(this.NfService, this.RochetChatConnectorService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService, this.ChatSystemService)
|
|
||||||
wewMessage.setData(message)
|
|
||||||
wewMessage.loadHistory = this.hasLoadHistory
|
|
||||||
|
|
||||||
let foundIndex;
|
|
||||||
|
|
||||||
const found = this.messages.find((MessageService, index) => {
|
|
||||||
if (MessageService._id == message._id) {
|
|
||||||
foundIndex = index
|
|
||||||
return true
|
|
||||||
} else {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
if(save) {
|
|
||||||
if (!found) {
|
|
||||||
this.messages.push(wewMessage)
|
|
||||||
return wewMessage
|
|
||||||
}
|
|
||||||
} else if(foundIndex) {
|
|
||||||
return this.messages[foundIndex]
|
|
||||||
} else {
|
|
||||||
return wewMessage
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
async ChatMessageIsPresentInTheView(ChatMessage:ChatMessageInterface) {
|
async ChatMessageIsPresentInTheView(ChatMessage:ChatMessageInterface) {
|
||||||
let foundIndex;
|
let foundIndex;
|
||||||
@@ -849,48 +796,18 @@ export class RoomService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description find or create message
|
|
||||||
* @param message
|
async prepareCreate({message, save = true}): Promise<MessageService> {
|
||||||
* @param save
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
async prepareCreate({message, save = true}): Promise<MessageService> {
|
|
||||||
message = this.fix_updatedAt(message)
|
message = this.fix_updatedAt(message)
|
||||||
|
|
||||||
const wewMessage = new MessageService(this.NfService, this.RochetChatConnectorService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService, this.ChatSystemService)
|
const wewMessage = new MessageService(this.NfService, this.RochetChatConnectorService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService, this.ChatSystemService)
|
||||||
wewMessage.setData(message)
|
wewMessage.setData(message)
|
||||||
wewMessage.loadHistory = this.hasLoadHistory
|
wewMessage.loadHistory = this.hasLoadHistory
|
||||||
|
|
||||||
|
|
||||||
let found;
|
|
||||||
|
|
||||||
if(wewMessage.localReference != null) {
|
|
||||||
found = this.messages.find((MessageService, index) => {
|
|
||||||
if ( MessageService.localReference == wewMessage.localReference ) {
|
|
||||||
return true
|
|
||||||
} else {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
found = this.messages.find((MessageService, index) => {
|
|
||||||
if ( MessageService._id == wewMessage._id) {
|
|
||||||
return true
|
|
||||||
} else {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
this.messages.push(wewMessage)
|
||||||
if (!found) {
|
|
||||||
this.messages.push(wewMessage)
|
|
||||||
return wewMessage
|
|
||||||
}
|
|
||||||
|
|
||||||
return wewMessage
|
return wewMessage
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -903,40 +820,62 @@ export class RoomService {
|
|||||||
return wewMessage
|
return wewMessage
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private findMessageBy_id (id) {
|
||||||
|
for( let m of this.messages) {
|
||||||
|
if(m._id == id) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
private findMessageBy_localReference (localReference) {
|
||||||
|
for( let m of this.messages) {
|
||||||
|
if(m.localReference == localReference) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
private async findMessageInDBByLocalReference({localReference}) {
|
||||||
|
const a = await MessageModel.get({localReference: localReference})
|
||||||
|
|
||||||
|
return typeof a.id == 'number'
|
||||||
|
}
|
||||||
|
|
||||||
|
private async findMessageInDBByLocalId({_id}) {
|
||||||
|
const a = await MessageModel.get({_id: _id})
|
||||||
|
return typeof a.id == 'number'
|
||||||
|
}
|
||||||
|
|
||||||
|
private async findMessageInDBByData({localReference, _id}) {
|
||||||
|
|
||||||
|
// console.log('look')
|
||||||
|
const a = await MessageModel.filter({localReference: localReference})
|
||||||
|
if(a.length >= 1) {
|
||||||
|
// console.log('localReference', localReference)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
const c = await MessageModel.filter({_id: _id})
|
||||||
|
if(c.length >= 1) {
|
||||||
|
// console.log('_id', _id)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// console.log('look not found')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
async prepareMessageCreateIfNotExist({message}) {
|
async prepareMessageCreateIfNotExist({message}) {
|
||||||
message = this.fix_updatedAt(message)
|
message = this.fix_updatedAt(message)
|
||||||
|
|
||||||
let foundIndex;
|
let found = await this.findMessageBy_id(message._id) || this.findMessageBy_localReference(message.localReference)
|
||||||
const found = this.messages.find((MessageService, index) => {
|
// || await this.findMessageInDBByData({_id:message._id, localReference:message.localReference })
|
||||||
if (MessageService._id == message._id ||
|
|
||||||
MessageService.localReference == message.localReference ) {
|
|
||||||
foundIndex = index
|
|
||||||
return true
|
|
||||||
} else {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
if (!found) {
|
|
||||||
const wewMessage = this.simplePrepareMessage(message)
|
|
||||||
this.messages.push(wewMessage)
|
|
||||||
return wewMessage
|
|
||||||
} else {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
async prepareMessageCreateIfNotExist_iD({message}) {
|
|
||||||
message = this.fix_updatedAt(message)
|
|
||||||
|
|
||||||
const found = this.messages.find((MessageService, index) => {
|
|
||||||
if (MessageService._id == message._id) {
|
|
||||||
return true
|
|
||||||
} else {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
const wewMessage = this.simplePrepareMessage(message)
|
const wewMessage = this.simplePrepareMessage(message)
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ import { RoomService } from './room.service';
|
|||||||
})
|
})
|
||||||
export class ViewedMessageService {
|
export class ViewedMessageService {
|
||||||
|
|
||||||
constructor() { }
|
constructor() {
|
||||||
|
}
|
||||||
|
|
||||||
viewQueue = FIFOProcessQueue(async ({room, userId, statusNum, statusText}, callback) => {
|
viewQueue = FIFOProcessQueue(async ({room, userId, statusNum, statusText}, callback) => {
|
||||||
|
|
||||||
@@ -20,25 +21,15 @@ export class ViewedMessageService {
|
|||||||
room.deleteMessageToReceive(userId)
|
room.deleteMessageToReceive(userId)
|
||||||
}
|
}
|
||||||
|
|
||||||
await room.messages.forEach(async (message, index) => {
|
for (const message of room.messages) {
|
||||||
if(!message.messageOwnerById(userId)) {
|
if(message.online) {
|
||||||
|
for(let id of membersIds) {
|
||||||
if(!room.messages[index]?.received?.includes(userId)) {
|
if(message.addReceived(id)) {
|
||||||
|
await message.saveChanges()
|
||||||
if(room.messages[index]._id) {
|
|
||||||
try {
|
|
||||||
if(!room.messages[index].received.includes(userId)) {
|
|
||||||
room.messages[index].received.push(userId)
|
|
||||||
}
|
|
||||||
} catch(e) {
|
|
||||||
room.messages[index].received = [userId]
|
|
||||||
}
|
|
||||||
room.messages[index].save()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
callback();
|
callback();
|
||||||
@@ -47,8 +38,35 @@ export class ViewedMessageService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
viewReadQueue = FIFOProcessQueue(async ({room}, callback) => {
|
||||||
|
|
||||||
|
const membersIds: string[] = room.membersExcludeMe.map((user)=> user._id)
|
||||||
|
|
||||||
|
for (const message of room.messages) {
|
||||||
|
if(message.online) {
|
||||||
|
for(let id of membersIds) {
|
||||||
|
|
||||||
|
if(message.addViewed(id)) {
|
||||||
|
message.addReceived(id)
|
||||||
|
await message.saveChanges()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
callback()
|
||||||
|
},100)
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
request(room:RoomService, userId, statusNum, statusText) {
|
request(room:RoomService, userId, statusNum, statusText) {
|
||||||
this.viewQueue.push({room, userId, statusNum, statusText})
|
this.viewQueue.push({room, userId, statusNum, statusText})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
requestReadAll(room:RoomService) {
|
||||||
|
this.viewReadQueue.push({room})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,28 +11,28 @@ export class InativityService {
|
|||||||
private router: Router,
|
private router: Router,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
// var time;
|
var time;
|
||||||
// window.onload = resetTimer;
|
window.onload = resetTimer;
|
||||||
// window.onmousemove = resetTimer;
|
window.onmousemove = resetTimer;
|
||||||
// window.onmousedown = resetTimer; // catches touchscreen presses as well
|
window.onmousedown = resetTimer; // catches touchscreen presses as well
|
||||||
// window.ontouchstart = resetTimer; // catches touchscreen swipes as well
|
window.ontouchstart = resetTimer; // catches touchscreen swipes as well
|
||||||
// window.onclick = resetTimer; // catches touchpad clicks as well
|
window.onclick = resetTimer; // catches touchpad clicks as well
|
||||||
// window.onkeydown = resetTimer;
|
window.onkeydown = resetTimer;
|
||||||
// window.addEventListener('scroll', resetTimer, true); // improved; see comments
|
window.addEventListener('scroll', resetTimer, true); // improved; see comments
|
||||||
|
|
||||||
// function userIsNotActive() {
|
function userIsNotActive() {
|
||||||
// // your function for too long inactivity goes here
|
// your function for too long inactivity goes here
|
||||||
// // SessionStore.setInativity(false)
|
SessionStore.setInativity(false)
|
||||||
// // alert('go out')
|
// alert('go out')
|
||||||
// try {
|
try {
|
||||||
// // window['inactivity/function']()
|
window['inactivity/function']()
|
||||||
// } catch (error) {}
|
} catch (error) {}
|
||||||
|
|
||||||
// }
|
}
|
||||||
|
|
||||||
// function resetTimer() {
|
function resetTimer() {
|
||||||
// clearTimeout(time);
|
clearTimeout(time);
|
||||||
// time = setTimeout(userIsNotActive, 60000 * 1); // time is in milliseconds
|
time = setTimeout(userIsNotActive, 60000 * 5); // time is in milliseconds
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@
|
|||||||
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
||||||
|
|
||||||
<ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0 && msg.viewed.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||||
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
||||||
@@ -106,7 +106,7 @@
|
|||||||
<ion-icon *ngIf="msg.attachments[0].image_url == null" name="download-outline"></ion-icon>
|
<ion-icon *ngIf="msg.attachments[0].image_url == null" name="download-outline"></ion-icon>
|
||||||
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
||||||
<ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0 && msg.viewed.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||||
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
||||||
@@ -161,7 +161,7 @@
|
|||||||
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
||||||
|
|
||||||
<ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0 && msg.viewed.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||||
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
</mat-menu>
|
</mat-menu>
|
||||||
</div>
|
</div>
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<ion-label>{{msg.u.name}}</ion-label>
|
<ion-label >{{msg.u.name}}</ion-label>
|
||||||
<span class="time">{{msg.duration}}</span>
|
<span class="time">{{msg.duration}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex justify-space-between">
|
<div class="d-flex justify-space-between">
|
||||||
@@ -59,9 +59,10 @@
|
|||||||
|
|
||||||
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0 && msg.viewed.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||||
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
||||||
@@ -81,7 +82,7 @@
|
|||||||
</mat-menu>
|
</mat-menu>
|
||||||
</div>
|
</div>
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<ion-label>{{msg.u.name}}</ion-label>
|
<ion-label >{{msg.u.name}}</ion-label>
|
||||||
<span class="time">{{msg.duration}}</span>
|
<span class="time">{{msg.duration}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@@ -103,9 +104,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<img *ngIf="msg.attachments[0].image_url" src={{msg.attachments[0].image_url}} alt="image">
|
<img *ngIf="msg.attachments[0].image_url" src={{msg.attachments[0].image_url}} alt="image">
|
||||||
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
||||||
|
{{ msg.viewed }}
|
||||||
<ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0 && msg.viewed.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||||
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
||||||
@@ -169,9 +170,9 @@
|
|||||||
|
|
||||||
</ion-label>
|
</ion-label>
|
||||||
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
||||||
|
{{ msg.viewed }}
|
||||||
<ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0 && msg.viewed.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||||
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
||||||
@@ -189,7 +190,7 @@
|
|||||||
<ion-label *ngIf="msg.delate == true" class="info-meeting-small">Apagou a mensagem</ion-label><br />
|
<ion-label *ngIf="msg.delate == true" class="info-meeting-small">Apagou a mensagem</ion-label><br />
|
||||||
|
|
||||||
|
|
||||||
<ion-label *ngIf="msg.delate == false" class="info-meeting-small">{{msg.u.name}} criou esta reunião</ion-label><br />
|
<ion-label *ngIf="msg.delate == false" class="info-meeting-small">{{msg.u.name}} criou esta reunião</ion-label><br />
|
||||||
<button *ngIf="msg.delate == false" (click)="goToEvent(msg.file)" class="btn-no-color info-meeting-normal">
|
<button *ngIf="msg.delate == false" (click)="goToEvent(msg.file)" class="btn-no-color info-meeting-normal">
|
||||||
<ion-label class="info-meeting-normal">{{msg.file.subject}}</ion-label>
|
<ion-label class="info-meeting-normal">{{msg.file.subject}}</ion-label>
|
||||||
</button><br />
|
</button><br />
|
||||||
|
|||||||
@@ -397,4 +397,11 @@ ion-footer {
|
|||||||
padding: 6px;
|
padding: 6px;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.red-top {
|
||||||
|
border-top: 1px solid red !important;
|
||||||
|
}
|
||||||
|
.red {
|
||||||
|
color: red !important;
|
||||||
}
|
}
|
||||||
@@ -144,6 +144,9 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
|||||||
|
|
||||||
this.deleteRecording()
|
this.deleteRecording()
|
||||||
|
|
||||||
|
|
||||||
|
// this.ChatSystemService.getDmRoom(this.roomId).deleteAll()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async ChatMessageDebuggingPage() {
|
async ChatMessageDebuggingPage() {
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 74 KiB |
@@ -1,19 +1,19 @@
|
|||||||
import { versionData } from '../../version/git-version'
|
import { versionData } from '../../version/git-version'
|
||||||
export const environment = {
|
export const environment = {
|
||||||
// apiURL: 'https://gabinetedigital.dyndns.info/GabineteDigital.Services/V5/api/',
|
// apiURL: 'https://gabinetedigital.dyndns.info/GabineteDigital.Services/V5/api/',
|
||||||
apiURL: 'https://gd-api.oapr.gov.ao/api/',
|
//apiURL: 'https://gd-api.oapr.gov.ao/api/',
|
||||||
//apiURL: 'https://gdapi-dev.dyndns.info/GabineteDigital.Services/V5/api/',
|
apiURL: 'https://gdapi-dev.dyndns.info/GabineteDigital.Services/V5/api/',
|
||||||
// apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V5/api/',
|
// apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V5/api/',
|
||||||
// apiChatUrl: 'http://192.168.0.29:3000/api/v1/',
|
// apiChatUrl: 'http://192.168.0.29:3000/api/v1/',
|
||||||
// apiWsChatUrl: 'wss://192.168.0.29:3000/websocket',
|
// apiWsChatUrl: 'wss://192.168.0.29:3000/websocket',
|
||||||
apiChatUrl: 'https://gd-chat.oapr.gov.ao/api/v1/',
|
//apiChatUrl: 'https://gd-chat.oapr.gov.ao/api/v1/',
|
||||||
apiWsChatUrl: 'wss://gd-chat.oapr.gov.ao/websocket',
|
//apiWsChatUrl: 'wss://gd-chat.oapr.gov.ao/websocket',
|
||||||
/* apiChatUrl: 'https://gdchat-dev.dyndns.info/api/v1/',
|
apiChatUrl: 'https://gdchat-dev.dyndns.info/api/v1/',
|
||||||
apiWsChatUrl: 'wss://gdchat-dev.dyndns.info/websocket', */
|
apiWsChatUrl: 'wss://gdchat-dev.dyndns.info/websocket',
|
||||||
production: true,
|
production: true,
|
||||||
domain: 'paulo.pinto@gabinetedigital.local',
|
domain: 'paulo.pinto@gabinetedigital.local',
|
||||||
defaultuser: 'paulo.pinto@gabinetedigital.local',//paulo.pinto@gabinetedigital.local
|
defaultuser: 'paulo.pinto@gabinetedigital.local',//paulo.pinto@gabinetedigital.local
|
||||||
defaultuserpwd: 'M@p2022', //tabteste@006,
|
defaultuserpwd: 'tabteste@006', //tabteste@006,
|
||||||
chatOffline: true,
|
chatOffline: true,
|
||||||
presidencia: false,
|
presidencia: false,
|
||||||
version: versionData,
|
version: versionData,
|
||||||
|
|||||||
+1
-1
@@ -56,7 +56,7 @@
|
|||||||
|
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" rel="stylesheet">
|
||||||
|
|
||||||
<link rel="icon" type="image/x-icon" href="assets/icon/favicon.png" />
|
<link rel="icon" type="image/x-icon" href="assets/icon/governoangola_A.png" />
|
||||||
<!-- <link rel="manifest" href="assets/json/manifest.json"> -->
|
<!-- <link rel="manifest" href="assets/json/manifest.json"> -->
|
||||||
|
|
||||||
<!-- add to homescreen for ios -->
|
<!-- add to homescreen for ios -->
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
export let versionData = {
|
export let versionData = {
|
||||||
"shortSHA": "572ab6db7",
|
"shortSHA": "56c173394",
|
||||||
"SHA": "572ab6db7b8cc05e5b32362f48dbad03cc948d52",
|
"SHA": "56c17339455d3377bd2bb274440cb502e780ff8d",
|
||||||
"branch": "develop_bitOut-fix",
|
"branch": "develop_bitOut-fix",
|
||||||
"lastCommitAuthor": "'Peter Maquiran'",
|
"lastCommitAuthor": "'Peter Maquiran'",
|
||||||
"lastCommitTime": "'Thu Jan 5 12:11:50 2023 +0100'",
|
"lastCommitTime": "'Thu Jan 5 12:18:21 2023 +0100'",
|
||||||
"lastCommitMessage": "save",
|
"lastCommitMessage": "merge",
|
||||||
"lastCommitNumber": "4613",
|
"lastCommitNumber": "4617",
|
||||||
"change": "",
|
"change": "",
|
||||||
"changeStatus": "On branch develop_bitOut-fix\nAll conflicts fixed but you are still merging.\n (use \"git commit\" to conclude merge)\n\nChanges to be committed:\n\tmodified: src/app/app.module.ts\n\tmodified: src/app/modals/profile/profile.page.html\n\tmodified: src/app/modals/profile/profile.page.ts\n\tmodified: src/app/pages/login/login.page.ts\n\tmodified: src/app/services/notifications.service.ts\n\tmodified: src/app/shared/header/header.page.ts\n\tmodified: src/environments/environment.ts\n\tmodified: src/main.ts",
|
"changeStatus": "On branch develop_bitOut-fix\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/app/home/home.page.ts\n\tmodified: src/app/modals/profile/profile.page.ts\n\tmodified: src/app/models/beast-orm.ts\n\tmodified: src/app/pages/chat/group-messages/group-messages.page.html\n\tmodified: src/app/pages/chat/messages/messages.page.html\n\tmodified: src/app/pages/gabinete-digital/gabinete-digital.page.ts\n\tmodified: src/app/services/auth.service.ts\n\tmodified: src/app/services/chat.service.ts\n\tmodified: src/app/services/chat/chat-system.service.ts\n\tmodified: src/app/services/chat/message.service.ts\n\tmodified: src/app/services/chat/room.service.ts\n\tmodified: src/app/services/chat/viewed-message.service.ts\n\tmodified: src/app/services/inativity.service.ts\n\tmodified: src/app/shared/chat/group-messages/group-messages.page.html\n\tmodified: src/app/shared/chat/messages/messages.page.html\n\tmodified: src/app/shared/chat/messages/messages.page.scss\n\tmodified: src/app/shared/chat/messages/messages.page.ts\n\tnew file: src/assets/icon/governoangola_A.png\n\tmodified: src/environments/environment.ts\n\tmodified: src/index.html\n\tmodified: version/git-version.ts",
|
||||||
"changeAuthor": "peter.maquiran"
|
"changeAuthor": "peter.maquiran"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user