Last git pull made

This commit is contained in:
Eudes Inácio
2021-10-07 17:05:14 +01:00
41 changed files with 695 additions and 351 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,
+1 -2
View File
@@ -3,7 +3,7 @@
///<reference path="../../../plugins/cordova-plugin-mfp-push/typings/mfppush.d.ts" />
import { Injectable, NgZone } from '@angular/core';
import { ActivatedRoute } from '@angular/router'
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { HttpClient } from '@angular/common/http';
import { environment } from 'src/environments/environment';
import { StorageService } from 'src/app/services/storage.service';
import { AuthConnstants } from 'src/app/config/auth-constants';
@@ -11,7 +11,6 @@ import { Token } from '../models/token.model';
import { ModalController, AlertController, AnimationController, Platform } from '@ionic/angular';
import { NavigationExtras,Router } from '@angular/router';
import { ToastService } from '../services/toast.service';
import { Optional } from '@angular/core';
import { JsonStore } from './jsonStore.service';
import { synchro } from './socket/synchro.service';
import { v4 as uuidv4 } from 'uuid';
+4 -3
View File
@@ -50,7 +50,8 @@ export class SqliteService {
Category varchar(255),
EventRecurrence Text,
Attachments Text,
Body Text
Body Text,
Profile varchar(255)
)`, [])
.then((res) => {
console.log("Sucess Events Table created: ", res)
@@ -109,9 +110,9 @@ export class SqliteService {
//addEvent
public addEvent(data) {
this.dbInstance.executeSql(`
INSERT OR REPLACE INTO ${this.events} (EventId,Subject,HasAttachments,Location,CalendarId,CalendarName,StartDate,EndDate,EventType,Attendees,IsMeeting,IsRecurring,IsAllDayEvent,AppointmentState,TimeZone,Organizer,Category,EventRecurrence,Attachments,Body )
INSERT OR IGNORE INTO ${this.events} (EventId,Subject,HasAttachments,Location,CalendarId,CalendarName,StartDate,EndDate,EventType,Attendees,IsMeeting,IsRecurring,IsAllDayEvent,AppointmentState,TimeZone,Organizer,Category,EventRecurrence,Attachments,Body,Profile )
VALUES ('${data.EventId}','${data.Subject}', '${data.HasAttachments}','${data.Location}','${data.CalendarId}','${data.CalendarName}','${data.StartDate}','${data.EndDate}','${data.EventType}','${data.Attendees}','${data.IsMeeting}','${data.IsRecurring}',
'${data.IsAllDayEvent}','${data.AppointmentState}','${data.TimeZone}','${data.Organizer}','${data.Category}','${data.EventRecurrence}','${data.Attachments}','${data.Body}')`, [])
'${data.IsAllDayEvent}','${data.AppointmentState}','${data.TimeZone}','${data.Organizer}','${data.Category}','${data.EventRecurrence}','${data.Attachments}','${data.Body}','${data.Profile}')`, [])
.then(() => {
console.log("event add with Success");