This commit is contained in:
tiago.kayaya
2022-02-18 19:00:07 +01:00
11 changed files with 98 additions and 29 deletions
+4 -4
View File
@@ -16457,11 +16457,11 @@
"integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=" "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw="
}, },
"ng-lazyload-image": { "ng-lazyload-image": {
"version": "9.1.0", "version": "9.1.2",
"resolved": "https://registry.npmjs.org/ng-lazyload-image/-/ng-lazyload-image-9.1.0.tgz", "resolved": "https://registry.npmjs.org/ng-lazyload-image/-/ng-lazyload-image-9.1.2.tgz",
"integrity": "sha512-ZdfCXMTaehfzxcSRRThpz9YZbEA+8LPA086Od6JiylrGj0yNM7Aq830A1x6NE/M8o2VuVq93emH9m8T6SFBHlA==", "integrity": "sha512-E5oz5HdTRtYW/TH+jceT4VMcRXKdX9Ut82eEwt2K0/bFAXKU14HluCFa8cMidPBgSa08Mlf+gmoKCTvAfUPgag==",
"requires": { "requires": {
"tslib": "^2.0.0" "tslib": "^2.3.0"
} }
}, },
"ng2-pdf-viewer": { "ng2-pdf-viewer": {
+1 -1
View File
@@ -132,7 +132,7 @@
"jetifier": "^1.6.8", "jetifier": "^1.6.8",
"lite-server": "^2.6.1", "lite-server": "^2.6.1",
"moment": "^2.29.1", "moment": "^2.29.1",
"ng-lazyload-image": "^9.1.0", "ng-lazyload-image": "^9.1.2",
"ng2-pdf-viewer": "^7.0.1", "ng2-pdf-viewer": "^7.0.1",
"ngx-cookie-service": "^12.0.3", "ngx-cookie-service": "^12.0.3",
"ngx-image-compress": "^11.0.3", "ngx-image-compress": "^11.0.3",
+2 -1
View File
@@ -5,7 +5,7 @@ import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular'; import { IonicModule } from '@ionic/angular';
import { HomePageRoutingModule } from './home-routing.module'; import { HomePageRoutingModule } from './home-routing.module';
import { LazyLoadImageModule } from 'ng-lazyload-image';
import { HomePage } from './home.page'; import { HomePage } from './home.page';
/* import { IonicSelectableModule } from 'ionic-selectable'; */ /* import { IonicSelectableModule } from 'ionic-selectable'; */
@@ -15,6 +15,7 @@ import { HomePage } from './home.page';
FormsModule, FormsModule,
IonicModule, IonicModule,
HomePageRoutingModule, HomePageRoutingModule,
LazyLoadImageModule
], ],
declarations: [HomePage], declarations: [HomePage],
}) })
@@ -10,8 +10,16 @@ import { ViewPublicationsPage } from './view-publications.page';
import { HeaderPageModule } from 'src/app/shared/header/header.module'; 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({ @NgModule({
imports: [ imports: [
@@ -24,6 +32,7 @@ import { LazyLoadImageModule } from 'ng-lazyload-image'; // <-- import it
LazyLoadImageModule LazyLoadImageModule
], ],
exports: [ViewPublicationsPage], exports: [ViewPublicationsPage],
declarations: [ViewPublicationsPage] declarations: [ViewPublicationsPage],
providers: [{provide: LAZYLOAD_IMAGE_HOOKS, useClass: LazyLoadImageHooks}]
}) })
export class ViewPublicationsPageModule {} export class ViewPublicationsPageModule {}
@@ -26,25 +26,44 @@
</ion-header> </ion-header>
<ion-content class="background-white"> <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-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
<ion-refresher-content> <ion-refresher-content>
</ion-refresher-content> </ion-refresher-content>
</ion-refresher> </ion-refresher> -->
<div class="main-container background-white height-100 overflow-y-auto"> <div class="main-container background-white height-100 overflow-y-auto">
<ion-list> <ion-content>
<!-- [routerLink]="['/home/publications/view-publications/publication-detail', publication.publicationId]" --> <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" <div class="post-item cursor-pointer"
*ngFor="let publication of getpublication" *ngFor="let publication of getpublication"
(click)="goToPublicationDetail(publication.DocumentId)" (click)="goToPublicationDetail(publication.DocumentId)"
> >
<div *ngIf="publication.FileBase64 != null">
<div *ngIf="publication.FileBase64.length < 30; else imageLoaded" class="post-img"> <div class="post-img">
<img src="/assets/icon/icon-no-image.svg"> <img [defaultImage]=defaultImage [lazyLoad]="publication.FileBase64">
</div>
<ng-template #imageLoaded> <ng-template #imageLoaded>
<div *ngIf="publication.FileBase64.length > 30" class="post-img"> <div *ngIf="publication.FileBase64.length > 30" class="post-img">
<img src="{{publication.FileBase64}}" alt=""> <img [defaultImage]=defaultImage [lazyLoad]="publication.FileBase64">
</div> </div>
</ng-template> </ng-template>
</div> </div>
@@ -92,6 +111,6 @@
</div> </div>
</div> </div>
</div> </div>
</ion-list> </ion-list> -->
</div> </div>
</ion-content> </ion-content>
@@ -11,6 +11,7 @@ import { SqliteService } from 'src/app/services/sqlite.service';
import { BackgroundService } from 'src/app/services/background.service'; import { BackgroundService } from 'src/app/services/background.service';
import { ThemeService } from 'src/app/services/theme.service' import { ThemeService } from 'src/app/services/theme.service'
import { forkJoin } from 'rxjs'; import { forkJoin } from 'rxjs';
import { ToastService } from 'src/app/services/toast.service';
@Component({ @Component({
selector: 'app-view-publications', selector: 'app-view-publications',
@@ -23,7 +24,7 @@ export class ViewPublicationsPage implements OnInit {
publicationList: Publication[] = new Array(); publicationList: Publication[] = new Array();
item: PublicationFolder; 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; folderId: string;
id: string; id: string;
error: any; error: any;
@@ -40,7 +41,8 @@ export class ViewPublicationsPage implements OnInit {
private router: Router, private router: Router,
private sqliteservice: SqliteService, private sqliteservice: SqliteService,
private backgroundservice: BackgroundService, private backgroundservice: BackgroundService,
public ThemeService: ThemeService) { public ThemeService: ThemeService,
private toastService: ToastService,) {
this.item = new PublicationFolder(); this.item = new PublicationFolder();
this.activatedRoute.paramMap.subscribe(params => { this.activatedRoute.paramMap.subscribe(params => {
@@ -64,7 +66,7 @@ export class ViewPublicationsPage implements OnInit {
this.getPublicationDetail(); this.getPublicationDetail();
this.getPublicationsIds(); this.getPublicationsIds();
/* setTimeout(() => { /* setTimeout(() => {
this.getPublicationsIds(); this.getPublications();
}, 1000); */ }, 1000); */
this.backgroundservice.registerBackService('Online', () => { this.backgroundservice.registerBackService('Online', () => {
@@ -86,7 +88,7 @@ export class ViewPublicationsPage implements OnInit {
// } // }
//this.testForkJoin() //this.testForkJoin()
//this.getPublicationDetail(); //this.getPublicationDetail();
// this.getPublicationsIds(); // this.getPublications();
} }
doRefresh = (event) => { doRefresh = (event) => {
@@ -258,7 +260,7 @@ export class ViewPublicationsPage implements OnInit {
}); });
this.getpublication = publicationArray; this.publicationList = publicationArray;
}) })
} }
+5
View File
@@ -79,6 +79,10 @@ export class MessageService {
} }
} }
// if(typeof(this.file?.type)) {
// this.hasFile = true
// }
if(this.hasFile) { if(this.hasFile) {
this.getFileFromDb() this.getFileFromDb()
if(this.file.type != 'application/webtrix') { if(this.file.type != 'application/webtrix') {
@@ -178,6 +182,7 @@ export class MessageService {
} }
} }
} }
redefinedMessage(ChatMessage) { redefinedMessage(ChatMessage) {
@@ -6,15 +6,27 @@ import { IonicModule } from '@ionic/angular';
import { ViewPublicationsPageRoutingModule } from './view-publications-routing.module'; import { ViewPublicationsPageRoutingModule } from './view-publications-routing.module';
import { ViewPublicationsPage } from './view-publications.page'; import { ViewPublicationsPage } from './view-publications.page';
import { Attributes, IntersectionObserverHooks, LazyLoadImageModule, LAZYLOAD_IMAGE_HOOKS } from 'ng-lazyload-image';
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({ @NgModule({
imports: [ imports: [
CommonModule, CommonModule,
FormsModule, FormsModule,
IonicModule, IonicModule,
ViewPublicationsPageRoutingModule ViewPublicationsPageRoutingModule,
LazyLoadImageModule
], ],
exports: [ViewPublicationsPage], exports: [ViewPublicationsPage],
declarations: [ViewPublicationsPage] declarations: [ViewPublicationsPage],
providers: [{provide: LAZYLOAD_IMAGE_HOOKS, useClass: LazyLoadImageHooks}]
}) })
export class ViewPublicationsPageModule {} export class ViewPublicationsPageModule {}
@@ -39,7 +39,27 @@
</ion-refresher-content> </ion-refresher-content>
</ion-refresher> </ion-refresher>
<div class="main-container px-20"> <div class="main-container px-20">
<ion-list> <ion-content>
<ion-card *ngFor="let publication of publicationList 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 d-md-block mb-10 cursor-pointer" <div class="post-item d-md-block mb-10 cursor-pointer"
*ngFor="let publication of publicationList" *ngFor="let publication of publicationList"
(click)="viewPublicationDetail(publication.DocumentId)"> (click)="viewPublicationDetail(publication.DocumentId)">
@@ -65,7 +85,7 @@
<div class="center height-100" *ngIf="!publicationList"> <div class="center height-100" *ngIf="!publicationList">
<p>{{error}}</p> <p>{{error}}</p>
</div> </div>
</ion-list> </ion-list> -->
</div> </div>
<!-- fab placed to the bottom end --> <!-- fab placed to the bottom end -->
<ion-fab vertical="bottom" horizontal="end"> <ion-fab vertical="bottom" horizontal="end">
@@ -137,7 +137,7 @@ export class ViewPublicationsPage implements OnInit {
getFromDB() { getFromDB() {
this.storage.get('view_publications').then((viewPublications) => { this.storage.get('view_publications').then((viewPublications) => {
this.getpublication = viewPublications; this.publicationList = viewPublications;
}) })
} }
+1
View File
@@ -116,6 +116,7 @@ $app-theme: mat-light-theme(
--ion-color-expediente: #dae3f3; --ion-color-expediente: #dae3f3;
} }
// dark-mode
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
/* /*
* Dark Colors * Dark Colors