This commit is contained in:
tiago.kayaya
2022-02-18 19:00:07 +01:00
11 changed files with 98 additions and 29 deletions
@@ -10,8 +10,16 @@ import { ViewPublicationsPage } from './view-publications.page';
import { HeaderPageModule } from 'src/app/shared/header/header.module';
import { LazyLoadImageModule } from 'ng-lazyload-image'; // <-- import it
import { Attributes, IntersectionObserverHooks, LazyLoadImageModule, LAZYLOAD_IMAGE_HOOKS } from 'ng-lazyload-image'; // <-- import it
export class LazyLoadImageHooks extends IntersectionObserverHooks {
setup(attributes: Attributes) {
attributes.offset = 10;
attributes.defaultImagePath = "/assets/icon/icon-no-image.svg";
attributes.errorImagePath = "/assets/icon/icon-no-image.svg";
return super.setup(attributes);
}
}
@NgModule({
imports: [
@@ -24,6 +32,7 @@ import { LazyLoadImageModule } from 'ng-lazyload-image'; // <-- import it
LazyLoadImageModule
],
exports: [ViewPublicationsPage],
declarations: [ViewPublicationsPage]
declarations: [ViewPublicationsPage],
providers: [{provide: LAZYLOAD_IMAGE_HOOKS, useClass: LazyLoadImageHooks}]
})
export class ViewPublicationsPageModule {}
@@ -26,25 +26,44 @@
</ion-header>
<ion-content class="background-white">
<ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh($event)">
<!-- <ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh($event)">
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
<ion-refresher-content>
</ion-refresher-content>
</ion-refresher>
<div class="main-container background-white height-100 overflow-y-auto">
<ion-list>
<!-- [routerLink]="['/home/publications/view-publications/publication-detail', publication.publicationId]" -->
</ion-refresher> -->
<div class="main-container background-white height-100 overflow-y-auto">
<ion-content>
<ion-card *ngFor="let publication of getpublication let i = index">
<ion-card-content>
<div class="post-img">
<img [lazyLoad]="publication.FileBase64">
</div>
<div class="post-content px-20">
<div class="post-title-time">
<div class="post-title">
<ion-label>{{publication.Title}}</ion-label>
</div>
<div class="post-data">{{publication.DatePublication | date: 'dd-MM-yy | HH:mm'}}</div>
</div>
<div class="post-description">
<p>{{publication.Message}}</p>
</div>
</div>
</ion-card-content>
</ion-card>
</ion-content>
<!-- <ion-list>
<div class="post-item cursor-pointer"
*ngFor="let publication of getpublication"
(click)="goToPublicationDetail(publication.DocumentId)"
>
<div *ngIf="publication.FileBase64 != null">
<div *ngIf="publication.FileBase64.length < 30; else imageLoaded" class="post-img">
<img src="/assets/icon/icon-no-image.svg">
</div>
<div class="post-img">
<img [defaultImage]=defaultImage [lazyLoad]="publication.FileBase64">
<ng-template #imageLoaded>
<div *ngIf="publication.FileBase64.length > 30" class="post-img">
<img src="{{publication.FileBase64}}" alt="">
<img [defaultImage]=defaultImage [lazyLoad]="publication.FileBase64">
</div>
</ng-template>
</div>
@@ -92,6 +111,6 @@
</div>
</div>
</div>
</ion-list>
</ion-list> -->
</div>
</ion-content>
@@ -11,6 +11,7 @@ import { SqliteService } from 'src/app/services/sqlite.service';
import { BackgroundService } from 'src/app/services/background.service';
import { ThemeService } from 'src/app/services/theme.service'
import { forkJoin } from 'rxjs';
import { ToastService } from 'src/app/services/toast.service';
@Component({
selector: 'app-view-publications',
@@ -23,7 +24,7 @@ export class ViewPublicationsPage implements OnInit {
publicationList: Publication[] = new Array();
item: PublicationFolder;
defaultImage = "https://governo.gov.ao/ao/noticias/presidente-joao-lourenco-ouviu-a-voz-da-igreja/"
defaultImage = "/assets/icon/icon-no-image.svg";
folderId: string;
id: string;
error: any;
@@ -40,7 +41,8 @@ export class ViewPublicationsPage implements OnInit {
private router: Router,
private sqliteservice: SqliteService,
private backgroundservice: BackgroundService,
public ThemeService: ThemeService) {
public ThemeService: ThemeService,
private toastService: ToastService,) {
this.item = new PublicationFolder();
this.activatedRoute.paramMap.subscribe(params => {
@@ -64,7 +66,7 @@ export class ViewPublicationsPage implements OnInit {
this.getPublicationDetail();
this.getPublicationsIds();
/* setTimeout(() => {
this.getPublicationsIds();
this.getPublications();
}, 1000); */
this.backgroundservice.registerBackService('Online', () => {
@@ -86,7 +88,7 @@ export class ViewPublicationsPage implements OnInit {
// }
//this.testForkJoin()
//this.getPublicationDetail();
// this.getPublicationsIds();
// this.getPublications();
}
doRefresh = (event) => {
@@ -258,7 +260,7 @@ export class ViewPublicationsPage implements OnInit {
});
this.getpublication = publicationArray;
this.publicationList = publicationArray;
})
}