mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
add file chuck upload, file validation, redirect to home page incase route doesnt exist and refresh token interceptor
This commit is contained in:
@@ -33,6 +33,7 @@ import { Howl } from 'howler';
|
||||
import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page';
|
||||
import { ChatMessageDebuggingPage } from 'src/app/shared/popover/chat-message-debugging/chat-message-debugging.page';
|
||||
import { PermissionService } from 'src/app/services/permission.service';
|
||||
import { FileValidatorService } from "src/app/services/file/file-validator.service"
|
||||
|
||||
|
||||
const IMAGE_DIR = 'stored-images';
|
||||
@@ -100,7 +101,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
roomName: any;
|
||||
isAdmin = false;
|
||||
roomCountDownDate: string;
|
||||
|
||||
|
||||
|
||||
constructor(
|
||||
public popoverController: PopoverController,
|
||||
@@ -122,6 +123,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
private platform: Platform,
|
||||
private fileOpener: FileOpener,
|
||||
public p: PermissionService,
|
||||
private FileValidatorService: FileValidatorService
|
||||
) {
|
||||
// update
|
||||
this.checkAudioPermission()
|
||||
@@ -172,8 +174,8 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
this.audioPermissionStatus = permissionStatus.state
|
||||
|
||||
permissionStatus.onchange = (data: any) => {
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
}
|
||||
|
||||
}
|
||||
@@ -510,7 +512,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
}
|
||||
|
||||
getChatMembers() {
|
||||
//
|
||||
//
|
||||
|
||||
// this.showLoader = true;
|
||||
// this.chatService.getMembers(this.roomId).subscribe(res => {
|
||||
@@ -835,11 +837,12 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
const roomId = this.roomId
|
||||
|
||||
const file: any = await this.fileService.getFileFromDevice(types);
|
||||
console.log(file.type)
|
||||
|
||||
const fileName = file.name
|
||||
|
||||
const validation = this.FileValidatorService.fileNameValidation(fileName)
|
||||
|
||||
if (file.type != "application/img" && file.type != "image/png" && file.type != "image/jpeg" && file.type != "image/gif") {
|
||||
if(validation.isOk) {
|
||||
|
||||
const encodedData = btoa(JSON.stringify(await this.getBase64(file).catch((error) => {
|
||||
console.error(error);
|
||||
@@ -886,12 +889,12 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
fileBase64: fileBase64,
|
||||
}
|
||||
})
|
||||
|
||||
} else {
|
||||
|
||||
this.toastService._badRequest("ficheiro invalido")
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
_getBase64(file) {
|
||||
|
||||
Reference in New Issue
Block a user