performace

This commit is contained in:
Peter Maquiran
2023-09-29 16:40:50 +01:00
parent 7f1dbf13aa
commit 93ad41eab9
12 changed files with 175 additions and 106 deletions
+15 -13
View File
@@ -33,7 +33,7 @@ export class AuthService {
opts:any;
tabIsActive = true
constructor(
private http: HttpClient,
private storageService:StorageService,
@@ -62,7 +62,7 @@ export class AuthService {
if(!this.tabIsActive) {
this.tabIsActive = true
const data = SessionStore.getDataFromLocalStorage();
if(!data?.user?.Authorization && SessionStore?.user?.Authorization) {
window.location.reload();
}
@@ -72,7 +72,7 @@ export class AuthService {
}
}
});
window.addEventListener('blur', (event) => {
this.tabIsActive = false
});
@@ -91,7 +91,7 @@ export class AuthService {
try {
response = await this.http.post<LoginUserRespose>(environment.apiURL + "UserAuthentication/Login", '', this.opts).toPromise();
if(saveSession) {
this.SetSession(response, user)
@@ -152,7 +152,7 @@ export class AuthService {
}else {
session.Profile = 'Unknown'
}
session.Password = user.password
session.BasicAuthKey = user.BasicAuthKey
SessionStore.reset(session)
@@ -165,11 +165,11 @@ export class AuthService {
loginToChatWs() {
setTimeout(() => {
if(SessionStore.user.ChatData?.data) {
this.RochetChatConnectorService.connect();
this.RochetChatConnectorService.login().then((message: any) => {
SessionStore.user.RochetChatUserId = message.result.id
SessionStore.save()
@@ -179,13 +179,13 @@ export class AuthService {
this.ChatSystemService.getAllRooms();
this.RochetChatConnectorService.setStatus('online')
}, 200);
}).catch((error) => {
// console.error(SessionStore.user.ChatData, 'web socket login',error)
})
}
// before sending a message with a attachment
@@ -200,6 +200,7 @@ export class AuthService {
message.file.guid = guid.path
message.downloadFileMsg()
message.uploadingFile = false
return true
} catch(e) {
@@ -219,10 +220,11 @@ export class AuthService {
message.attachments[0].title_link = url_no_options
message.attachments[0].message_link = url_no_options
return true
message.uploadingFile = false
return true
} catch(e) {
window['e'] = e
window['e'] = e
console.error('BeforesendAtachment', e)
message.uploadingFile = false
return false
@@ -235,7 +237,7 @@ export class AuthService {
this.NfService.downloadFileMsg = async (message: MessageService, room?: RoomService) => {
//
//
let downloadFile = "";
if (message.file.type == "application/img") {
const event: any = await this.AttachmentsService.downloadFile(message.file.guid).toPromise();
@@ -279,7 +281,7 @@ export class AuthService {
logoutChat() {
}
async presentAlert(message: string) {
const alert = await this.alertController.create({
cssClass: 'my-custom-class',