Merge branch 'developer' of bitbucket.org:equilibriumito/gabinete-digital into pdfviewer

This commit is contained in:
Peter Maquiran
2021-10-07 09:43:31 +01:00
25 changed files with 414 additions and 90 deletions
+3 -1
View File
@@ -65,7 +65,7 @@ export class AuthService {
}
SetSession(response: LoginUserRespose, user:UserForm) {
const session: UserSession = Object.assign(SessionStore.user, response)
const session: UserSession = Object.assign(SessionStore.user, response)
if (response) {
if( session.RoleID == 100000014) {
@@ -102,6 +102,8 @@ export class AuthService {
console.log('Login to Rocket chat OK');
this.ValidatedUserChat = responseChat;
localStorage.setItem('userChat', JSON.stringify(responseChat));
localStorage.setItem('Meteor.loginToken', JSON.stringify(responseChat['data'].userId));
localStorage.setItem('Meteor.userId', JSON.stringify(responseChat['data'].authToken));
this.storageService.store(AuthConnstants.AUTH, responseChat);
return true;
}
+24
View File
@@ -49,6 +49,22 @@ export class ChatService {
}); */
}
getDocumentDetails(url:string){
let headersc = new HttpHeaders();
headersc = headersc.set('X-User-Id', this.loggedUserChat['data'].userId);
headersc = headersc.set('X-Auth-Token', this.loggedUserChat['data'].authToken);
// headersc = headersc.set("Host", "www.tabularium.pt");
// headersc = headersc.set("Origin", "http://localhost:8100");
// headersc = headersc.set("Referer", "http://localhost:8100/");
let optionsc = {
headers: headersc,
};
let fullUrl = "https://www.tabularium.pt/" + url;
return this.http.get(fullUrl, optionsc).subscribe(()=>{
//this.fileService.viewDocumentByUrl(url)
});
}
getAllChannels(){
return this.http.get(environment.apiChatUrl+'channels.list', this.options);
}
@@ -113,6 +129,14 @@ export class ChatService {
return this.http.post(environment.apiChatUrl+'chat.sendMessage', body, opts);
}
uploadFile(formData:any, rid:string){
let url = environment.apiChatUrl+'rooms.upload/'+rid;
let opts = {
headers: this.headers,
}
return this.http.post(url, formData, opts);
}
deleteMessage(body:any){
let opts = {
headers: this.headers,
+7 -25
View File
@@ -21,6 +21,8 @@ export class FileService {
documents:SearchList[] = [];
showLoader: boolean;
files: Set<File>;
constructor(
private camera: Camera,
private fileLoaderService: FileLoaderService,
@@ -160,33 +162,12 @@ export class FileService {
console.log(file);
const imageData = await this.fileToBase64Service.convert(file)
this.capturedImage = imageData;
this.capturedImageTitle = file.name;
const formData = new FormData();
formData.append('file', file, file.name);
let body = {
"message":
{
"rid": roomId,
"msg": "",
"attachments": [{
"title": this.capturedImageTitle,
"text": "",
"title_link": this.capturedImage,
"title_link_download": true,
"thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
"message_link": this.capturedImage,
}],
"file":{
"name": this.capturedImageTitle,
"type": "application/pdf",
}
}
}
this.chatService.sendMessage(body).subscribe(res=> {
this.chatService.uploadFile(formData, roomId).subscribe(res=> {
console.log(res);
loader.remove();
//console.log(res);
},(error) => {
loader.remove();
});
@@ -233,6 +214,7 @@ export class FileService {
"title_link_download": true,
//"thumb_url": "assets/images/webtrix-logo.png",
"message_link": url_no_options,
"type": "webtrix"
}],
"file":{
"name": res.data.selected.Assunto,