mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
Merge branch 'developer' of bitbucket.org:equilibriumito/gabinete-digital into developer
This commit is contained in:
@@ -108,12 +108,17 @@ export class AuthService {
|
||||
}
|
||||
}
|
||||
|
||||
//Login to rocketChat server
|
||||
async loginChat(user: UserForm) {
|
||||
const expireDate = new Date(new Date().getTime() + 60*1000);
|
||||
//Login to rocketChat server2
|
||||
//user: UserForm
|
||||
async loginChat() {
|
||||
|
||||
const expirationMinutes = 60;
|
||||
let date = new Date().getTime();
|
||||
let expirationDate = new Date(new Date().getTime() + expirationMinutes*60*1000);
|
||||
|
||||
let postData = {
|
||||
"user": user.username,
|
||||
"password": user.password,
|
||||
"user": SessionStore.user.RochetChatUser,
|
||||
"password": SessionStore.user.Password,
|
||||
}
|
||||
|
||||
let responseChat = await this.httpService.post('login', postData).toPromise();
|
||||
@@ -126,17 +131,19 @@ export class AuthService {
|
||||
this.ValidatedUserChat = responseChat;
|
||||
localStorage.setItem('userChat', JSON.stringify(responseChat));
|
||||
this.storageService.store(AuthConnstants.AUTH, responseChat);
|
||||
|
||||
/* this.autologout(10000); */
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
else{
|
||||
console.log('Network error');
|
||||
this.presentAlert('Network error');
|
||||
return false;
|
||||
}
|
||||
|
||||
this.autoLoginChat(expirationDate.getTime() - date);
|
||||
}
|
||||
|
||||
async autoLoginChat(expirationDate:number){
|
||||
setTimeout(()=>{
|
||||
this.loginChat();
|
||||
}, expirationDate)
|
||||
}
|
||||
|
||||
private loginToChatWs() {
|
||||
@@ -151,8 +158,8 @@ export class AuthService {
|
||||
})
|
||||
|
||||
|
||||
this.NfService.beforeSendAttachment = async (message: MessageService, room?: RoomService) => {
|
||||
|
||||
this.NfService.beforeSendAttachment = async (message: MessageService, room?: RoomService) => {
|
||||
|
||||
if(message.hasFile) {
|
||||
if(message.file.type != 'application/webtrix') {
|
||||
const formData = message.temporaryData
|
||||
@@ -164,14 +171,14 @@ export class AuthService {
|
||||
console.log('add picture to chat IMAGE SAVED')
|
||||
message.getFileFromDb()
|
||||
});
|
||||
|
||||
|
||||
return true
|
||||
} catch(e) {
|
||||
return false
|
||||
}
|
||||
|
||||
} else {
|
||||
try {
|
||||
try {
|
||||
const res = message.temporaryData
|
||||
let url = await this.processesService.GetDocumentUrl(res.data.selected.Id, res.data.selected.ApplicationType).toPromise();
|
||||
let url_no_options: string = url.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
|
||||
@@ -182,7 +189,7 @@ export class AuthService {
|
||||
} catch(e) {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -214,12 +214,12 @@ export class WsChatMethodsService {
|
||||
*/
|
||||
private defaultSubtribe(id: any) {
|
||||
this.WsChatService.streamRoomMessages(id).then((subscription)=>{
|
||||
console.log('streamRoomMessages', subscription)
|
||||
//console.log('streamRoomMessages', subscription)
|
||||
})
|
||||
|
||||
this.WsChatService.subStreamNotifyRoom(id, 'typing', false)
|
||||
this.WsChatService.streamNotifyRoomDeleteMessage(id).then((subscription)=>{
|
||||
console.log('streamNotifyRoomDeleteMessage', subscription);
|
||||
//console.log('streamNotifyRoomDeleteMessage', subscription);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -657,11 +657,11 @@ updateRoomEventss(roomId, collection:string, funx: Function, ) {
|
||||
for (const [key, item] of Object.entries(this.wsMsgQueue)) {
|
||||
|
||||
if(item.loginRequired == true && this.isLogin == true) {
|
||||
console.log('run msgQueue ', key)
|
||||
//console.log('run msgQueue ', key)
|
||||
this.ws.send(item);
|
||||
delete this.wsMsgQueue[key]
|
||||
} else if(item.loginRequired == false) {
|
||||
console.log('run msgQueue ', key)
|
||||
//console.log('run msgQueue ', key)
|
||||
this.ws.send(item);
|
||||
delete this.wsMsgQueue[key]
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ export class FileService {
|
||||
data: base64Data,
|
||||
directory: Directory.Data
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
//new method 3
|
||||
@@ -160,7 +160,7 @@ export class FileService {
|
||||
return new Promise((resolve, reject)=>{
|
||||
input.onchange = async () => {
|
||||
const file = this.fileLoaderService.getFirstFile(input)
|
||||
|
||||
|
||||
resolve(file);
|
||||
};
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user