This commit is contained in:
Peter Maquiran
2022-02-07 15:51:21 +01:00
parent fe2bd52be3
commit 2caaad7f2b
7 changed files with 20 additions and 22 deletions
+2
View File
@@ -17,10 +17,12 @@ export class AuthGuard implements CanActivate {
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
// if user not active
if(!SessionStore.user.Inactivity) {
this.router.navigate(['/']);
return false
}
// if session doesn't exit
else if(!SessionStore.exist) {
this.router.navigate(['/']);
return false
+1
View File
@@ -80,6 +80,7 @@ export interface Message {
editedAt: EditedAt;
editedBy: EditedBy;
urls: any[];
temporaryData: object
}
+7 -12
View File
@@ -1,6 +1,5 @@
import { Injectable } from '@angular/core';
import { Message } from 'src/app/models/chatMethod';
import { chatHistory, ChatMessage, File } from 'src/app/models/chatMethod'
import { Storage } from '@ionic/storage';
import { SessionStore } from 'src/app/store/session.service';
import { capitalizeTxt } from 'src/plugin/text'
@@ -24,11 +23,12 @@ export class MessageService {
attachments
offline = true
displayType = ''
temporaryData = {}
constructor(private storage: Storage) {
}
setData({customFields, channels, mentions, msg ,rid ,ts, u, t, _id, _updatedAt, file, attachments}:Message) {
setData({customFields, channels, mentions, msg ,rid ,ts, u, t, _id, _updatedAt, file, attachments, temporaryData}:Message) {
this.customFields = customFields
this.channels = channels || []
this.mentions = mentions || []
@@ -41,6 +41,7 @@ export class MessageService {
this._updatedAt = _updatedAt || new Date().getTime()
this.file = file
this.attachments = attachments
this,temporaryData = {}
if(!this.ts) {
this.offline = true
@@ -62,15 +63,6 @@ export class MessageService {
}
delete() {}
showDateDuration() {}
resend() {
}
private usernameToDisplayName(username) {
const firstName = capitalizeTxt(username.split('.')[0])
@@ -78,7 +70,6 @@ export class MessageService {
return firstName + ' ' + lastName
}
getFileFromDb() {
if (this.file) {
if (this.file.guid) {
@@ -92,4 +83,8 @@ export class MessageService {
}
}
sendFile() {
}
}
@@ -1,13 +1,13 @@
import { TestBed } from '@angular/core/testing';
import { ChatUserService } from './chat-user.service';
import { NfService } from './nf.service';
describe('ChatUserService', () => {
let service: ChatUserService;
describe('NfService', () => {
let service: NfService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(ChatUserService);
service = TestBed.inject(NfService);
});
it('should be created', () => {
@@ -3,7 +3,7 @@ import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class ChatUserService {
export class NfService {
constructor() { }
}
+3 -4
View File
@@ -1,7 +1,6 @@
import { Injectable } from '@angular/core';
import { WsChatService } from 'src/app/services/chat/ws-chat.service';
import { MessageService } from 'src/app/services/chat/message.service';
import { ChatUserService } from 'src/app/services/chat/chat-user.service';
import { showDateDuration } from 'src/plugin/showDateDuration';
import { ToastsService } from '../toast.service';
import { chatHistory, ChatMessage } from 'src/app/models/chatMethod';
@@ -24,8 +23,7 @@ export class RoomService {
messages: MessageService[] = []
storageMessage: any[] = [];
lastMessage: MessageService;
chatUser: ChatUserService[] = []
customFields: any;
id = ''
t = ''
@@ -205,7 +203,7 @@ export class RoomService {
/**
* @description sen text message
*/
send({file = null, attachments = null}) {
send({file = null, attachments = null, temporary= {}}) {
let offlineChatMessage = {
@@ -213,6 +211,7 @@ export class RoomService {
msg: this.message,
attachments,
file,
temporary
}
this.addMessageDB(offlineChatMessage)
@@ -542,7 +542,8 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
//"thumb_url": "assets/images/webtrix-logo.png",
// "message_link": url_no_options,
"type": "webtrix"
}]
}],
temporary: res
})
let url = await this.processesService.GetDocumentUrl(res.data.selected.Id, res.data.selected.ApplicationType).toPromise();