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