mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
fix message and and updload
This commit is contained in:
@@ -78,6 +78,8 @@ export class PublicationFromMvService {
|
||||
this.form.send = true
|
||||
const upload = await this.uploadVideosFiles()
|
||||
|
||||
console.log('release chunks')
|
||||
|
||||
|
||||
const needChunk = this.needToUploadChunk()
|
||||
if(needChunk.length == 0 ) {
|
||||
@@ -120,7 +122,6 @@ export class PublicationFromMvService {
|
||||
this.httpErroHandle.httpStatusHandle(error)
|
||||
if (error.status == 404) {
|
||||
this.PublicationFolderService.deletePost(this.form.ProcessId, this.form.DocumentId)
|
||||
// this.goBack();
|
||||
} else {
|
||||
window['upload-header-set-retry'](this.id)
|
||||
}
|
||||
@@ -130,7 +131,6 @@ export class PublicationFromMvService {
|
||||
|
||||
|
||||
} else {
|
||||
window['upload-header-set-retry'](this.id)
|
||||
this.toastService._badRequest("É necessário adicionar uma imagem ou vídeo")
|
||||
}
|
||||
|
||||
@@ -152,6 +152,8 @@ export class PublicationFromMvService {
|
||||
window['upload-header-set-percentage'](this.id, 100)
|
||||
}
|
||||
|
||||
console.log('release chunk')
|
||||
|
||||
if(upload) {
|
||||
this.form.Files = this.form.Files.map((e:PublicationAttachmentEntity) => {
|
||||
if(e.FileType == 'video' && e.toUpload) {
|
||||
@@ -167,6 +169,12 @@ export class PublicationFromMvService {
|
||||
|
||||
return e
|
||||
})
|
||||
} else {
|
||||
window['upload-header-set-retry'](this.id)
|
||||
this.toastService._badRequest("ocorreu um erro ao enviar o ficheiro")
|
||||
return true
|
||||
// loader.remove()
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -181,14 +189,12 @@ export class PublicationFromMvService {
|
||||
publication.DocumentId = null;
|
||||
publication.ProcessId = this.folderId
|
||||
|
||||
|
||||
|
||||
try {
|
||||
|
||||
await this.publications.CreatePublication(publication.ProcessId, publication).toPromise()
|
||||
this.closeApp()
|
||||
if (this.publicationType == '1') {
|
||||
|
||||
if (this.publicationType == '1') {
|
||||
this.httpErroHandle.httpsSucessMessagge('Criar publicação')
|
||||
} else if (this.publicationType == '2') {
|
||||
this.httpErroHandle.httpsSucessMessagge('Criar publicação')
|
||||
} else if (this.publicationType == '3') {
|
||||
@@ -197,6 +203,7 @@ export class PublicationFromMvService {
|
||||
|
||||
// this.goBackToViewPublications.emit();
|
||||
window['upload-header-set-remove'](this.id);
|
||||
this.closeApp()
|
||||
this.publicationFolderService.getPublicationsIds(this.folderId)
|
||||
} catch (error) {
|
||||
window['upload-header-set-retry'](this.id)
|
||||
@@ -205,14 +212,6 @@ export class PublicationFromMvService {
|
||||
// loader.remove()
|
||||
}
|
||||
|
||||
} else {
|
||||
window['upload-header-set-retry'](this.id)
|
||||
this.toastService._badRequest("ocorreu um erro ao enviar o ficheiro")
|
||||
// loader.remove()
|
||||
}
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
this.toastService._badRequest("É necessário adicionar uma imagem ou vídeo")
|
||||
@@ -230,6 +229,7 @@ export class PublicationFromMvService {
|
||||
|
||||
closeApp() {
|
||||
if (window["sharedContent"]) {
|
||||
alert('close android')
|
||||
|
||||
if (this.platform.is('android')) {
|
||||
App.exitApp()
|
||||
@@ -275,7 +275,7 @@ export class PublicationFromMvService {
|
||||
if(PublicationAttachmentEntity.hasBlob) {
|
||||
|
||||
const fileBlob = PublicationAttachmentEntity.blobFile;
|
||||
const fileChunks = new Chunks({chunkSize: 1000 })
|
||||
const fileChunks = new Chunks({chunkSize: 50 })
|
||||
fileChunks.setFile(fileBlob)
|
||||
PublicationAttachmentEntity.setChunkManger(fileChunks)
|
||||
} else {
|
||||
@@ -322,6 +322,7 @@ export class PublicationFromMvService {
|
||||
|
||||
} else {
|
||||
console.log('already uploading')
|
||||
resolve(true)
|
||||
}
|
||||
|
||||
})
|
||||
@@ -347,6 +348,8 @@ export class PublicationFromMvService {
|
||||
Promises.push(promise)
|
||||
}
|
||||
|
||||
console.log('Promises', Promises)
|
||||
|
||||
// Use Promise.all to wait for all promises to resolve
|
||||
Promise.all(Promises)
|
||||
.then((results) => {
|
||||
|
||||
Reference in New Issue
Block a user