reconnect rocketchat socket

This commit is contained in:
Eudes Inácio
2023-09-14 11:58:24 +01:00
parent 9cc97dfc0f
commit 540750e0e9
10 changed files with 193 additions and 80 deletions
+52 -30
View File
@@ -18,9 +18,9 @@ export class AttachmentsService {
headers: HttpHeaders;
constructor(
private http: HttpClient,
private platform: Platform,
private file: File,
private http: HttpClient,
private platform: Platform,
private file: File,
private changeProfileService: ChangeProfileService) {
this.changeProfileService.registerCallback(() => {
@@ -36,9 +36,9 @@ export class AttachmentsService {
this.headers = this.headers.set('Authorization', SessionStore.user.BasicAuthKey);
}
uploadFile(formData:any) {
uploadFile(formData: any) {
//const geturl = environment.apiURL + 'Tasks/DelegateTask';
const geturl = environment.apiURL + 'ObjectServer/UploadFiles';
@@ -50,7 +50,7 @@ export class AttachmentsService {
return this.http.post(`${geturl}`, formData, options);
}
getFile(guid:any) {
getFile(guid: any) {
const geturl = environment.apiURL + 'lakefs/StreamFile';
let params = new HttpParams();
@@ -66,9 +66,9 @@ export class AttachmentsService {
return this.http.get<any>(`${geturl}`, options);
}
downloadFile(guid:any) {
downloadFile(guid: any) {
let downloadUrl = environment.apiURL +'objectserver/streamfiles?path='+guid;
let downloadUrl = environment.apiURL + 'objectserver/streamfiles?path=' + guid;
var name = new Date().getTime();
return this.http.get(downloadUrl, {
responseType: "arraybuffer",
@@ -77,30 +77,30 @@ export class AttachmentsService {
}
downloadFileAndStore(guid:any) {
downloadFileAndStore(guid: any) {
var name = new Date().getTime();
const downloadPath = (
this.platform.is('android')
) ? this.file.externalDataDirectory : this.file.documentsDirectory;
let vm = this;
/** HttpClient - @angular/common/http */
this.http.get(
environment.apiURL +'objectserver/streamfiles?path='+guid,
) ? this.file.externalDataDirectory : this.file.documentsDirectory;
let vm = this;
/** HttpClient - @angular/common/http */
this.http.get(
environment.apiURL + 'objectserver/streamfiles?path=' + guid,
{
responseType: 'arraybuffer',
responseType: 'arraybuffer',
}
).subscribe((fileBlob: Uint8Array) => {
).subscribe((fileBlob: Uint8Array) => {
/** File - @ionic-native/file/ngx */
vm.file.writeFile(downloadPath, "YourFileName.pdf", fileBlob, {replace: true});
});
}
getAttachmentsBySerial(serialNumber: string): Observable<Attachment[]>{
vm.file.writeFile(downloadPath, "YourFileName.pdf", fileBlob, { replace: true });
});
}
getAttachmentsBySerial(serialNumber: string): Observable<Attachment[]> {
let geturl = environment.apiURL + 'attachments/GetAttachments';
let params = new HttpParams();
@@ -110,7 +110,7 @@ export class AttachmentsService {
headers: this.headers,
params: params
};
return this.http.get<Attachment[]>(`${geturl}`, options);
}
@@ -150,7 +150,7 @@ export class AttachmentsService {
let options = {
headers: this.headers,
}
return this.http.post(`${geturl}`, body, options);
return this.http.post(`${geturl}`, body, options);
}
deleteEventAttachmentById(attachmentId) {
@@ -166,7 +166,7 @@ export class AttachmentsService {
params: params
}
return this.http.delete(`${geturl}`, options);
return this.http.delete(`${geturl}`, options);
}
AddAttachment(body: any) {
@@ -175,7 +175,29 @@ export class AttachmentsService {
let options = {
headers: this.headers,
}
return this.http.post(`${geturl}`, body, options);
return this.http.post(`${geturl}`, body, options);
}
addUserProfilePhoto(formData: any) {
const geturl = environment.apiURL + 'UserAuthentication/AddPhoto';
this.headers = this.headers.set('content-type', "application/json");
this.headers = this.headers.set('accept', "application/json");
let options = {
headers: this.headers
};
return this.http.post(`${geturl}`, formData, options);
}
getUserProfilePhoto() {
const geturl = environment.apiURL + 'UserAuthentication/GetPhoto';
let options = {
headers: this.headers
};
return this.http.get(`${geturl}`, options);
}
}