fix go back

This commit is contained in:
Peter Maquiran
2024-04-11 09:13:30 +01:00
parent fe29ee3bc5
commit 91a5a8796f
10 changed files with 87 additions and 25 deletions
@@ -39,6 +39,7 @@ import { PublicationFromMvService } from "src/app/shared/publication/upload/publ
import { File } from '../../../models/chatMethod';
import { CropImagePage } from 'src/app/modals/crop-image/crop-image.page';
const config = {
quality: 0.5,
maxWidth: 800,
@@ -142,6 +143,8 @@ export class NewPublicationPage implements OnInit {
private router: Router,
private videoconvertService: VideoconvertService,
public PublicationFromMvService: PublicationFromMvService,
public publicationFolderService: PublicationFolderService,
) {
this.PublicationFromMvService.clear()
@@ -407,9 +410,37 @@ export class NewPublicationPage implements OnInit {
close() {
this.modalController.dismiss(this.PublicationFromMvService.form).then(() => {
this.showLoader = true;
});
if (window["sharedContent"]) {
if (this.platform.is('android')) {
window["sharedContent"] = null;
this.publicationFolderService.gotoAction = this.folderId;
this.modalController.dismiss({}).then(() => {
if(this.platform.is('tablet')) {
this.router.navigate(['/home/publications'])
} else {
this.router.navigate(['/home/publications', this.folderId])
}
});
} else {
window["sharedContent"] = null;
this.publicationFolderService.gotoAction = this.folderId;
this.modalController.dismiss({}).then(() => {
if(this.platform.is('tablet')) {
this.router.navigate(['/home/publications'])
} else {
this.router.navigate(['/home/publications', this.folderId])
}
});
}
} else {
this.modalController.dismiss({}).then(() => {});
}
}
cancel() {
@@ -694,6 +725,8 @@ export class NewPublicationPage implements OnInit {
}
)
newAttachment.needUpload()
this.PublicationFromMvService.form.Files.push(newAttachment)
const deleteSecretFile = async () => {
@@ -741,6 +774,8 @@ export class NewPublicationPage implements OnInit {
OriginalFileName: 'load video'
}
)
newAttachment.needUpload()
this.PublicationFromMvService.form.Files.push(newAttachment)
@@ -18,6 +18,7 @@ import { NewPublicationPage } from './new-publication/new-publication.page';
import { ChunkService } from 'src/app/services/stream/chunk.service'
import { StreamService } from 'src/app/services/stream/stream.service'
import { HttpClient, HttpHeaders, HttpEventType } from '@angular/common/http';
import { PublicationFolderService } from 'src/app/store/publication-folder.service';
// import { ActionModel } from 'src/app/models/beast-orm';
@@ -77,6 +78,7 @@ export class PublicationsPage implements OnInit {
private ChunkService: ChunkService,
private StreamService:StreamService,
private http: HttpClient,
public publicationFolderService: PublicationFolderService,
) {
@@ -86,19 +88,21 @@ export class PublicationsPage implements OnInit {
console.log('shared recived', this.intent)
window['goToPublicationsList'] = this.goToPublicationsList
}
checkQueryParameter() {
var urlSearchParams = new URLSearchParams(window.location.search);
var folderId = urlSearchParams.get('folderId');
// var urlSearchParams = new URLSearchParams(window.location.search);
if (folderId !== null && window["openFolder"]) {
window["openFolder"] = false
// var folderId = urlSearchParams.get('folderId');
if (this.publicationFolderService.gotoAction) {
const folderId = this.publicationFolderService.gotoAction
this.goToPublicationsList(folderId)
this.publicationFolderService.gotoAction = false
} else {
console.log('Folder ID::', folderId);
}
}
@@ -110,6 +114,7 @@ export class PublicationsPage implements OnInit {
this.router.events.forEach((event) => {
if (event instanceof NavigationEnd && event.url == pathname) {
console.log('=================', this.publicationFolderService.gotoAction)
this.getActions();
this.checkQueryParameter()
}
@@ -377,11 +382,13 @@ export class PublicationsPage implements OnInit {
modal.onDidDismiss().then(() => {
this.doRefresh(event);
this.checkQueryParameter();
});
await modal.present();
}
goToPublicationsList(folderId: string) {
goToPublicationsList = (folderId: string) => {
console.log('nice', folderId)
if(window["sharedContent"]){
this.AddPublication('2',folderId,window["sharedContent"])
return