Publications are better

This commit is contained in:
Eudes Inácio
2022-02-18 15:28:30 +01:00
parent 2618cd94ad
commit 2448100fb7
11 changed files with 98 additions and 35 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],
}) })
+4 -4
View File
@@ -102,8 +102,8 @@ export class LoginPage implements OnInit {
if (attempt) { if (attempt) {
if (attempt.UserId == SessionStore.user.UserId) { if (attempt.UserId == SessionStore.user.UserId) {
await this.authService.SetSession(attempt, this.userattempt); await this.authService.SetSession(attempt, this.userattempt);
await this.authService.loginChat(); //await this.authService.loginChat();
await this.authService.loginToChatWs() //await this.authService.loginToChatWs()
this.getToken(); this.getToken();
SessionStore.setInativity(true); SessionStore.setInativity(true);
@@ -117,8 +117,8 @@ export class LoginPage implements OnInit {
await this.authService.SetSession(attempt, this.userattempt); await this.authService.SetSession(attempt, this.userattempt);
this.changeProfileService.run() this.changeProfileService.run()
await this.authService.loginChat(); /* await this.authService.loginChat();
await this.authService.loginToChatWs() await this.authService.loginToChatWs() */
this.getToken(); this.getToken();
this.router.navigateByUrl('/pin', { replaceUrl: true }); this.router.navigateByUrl('/pin', { replaceUrl: true });
} }
@@ -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>
@@ -14,6 +14,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',
@@ -26,7 +27,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;
@@ -48,7 +49,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 => {
@@ -72,7 +74,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', () => {
@@ -94,7 +96,7 @@ export class ViewPublicationsPage implements OnInit {
// } // }
//this.testForkJoin() //this.testForkJoin()
//this.getPublicationDetail(); //this.getPublicationDetail();
// this.getPublicationsIds(); // this.getPublications();
} }
doRefresh = (event) => { doRefresh = (event) => {
@@ -269,7 +271,7 @@ export class ViewPublicationsPage implements OnInit {
}); });
this.getpublication = publicationArray; this.publicationList = publicationArray;
}) })
} }
+2 -2
View File
@@ -32,13 +32,13 @@ export class ChatService {
private storageService:StorageService, private storageService:StorageService,
) )
{ {
this.loggedUserChat = authService.ValidatedUserChat; /* this.loggedUserChat = authService.ValidatedUserChat;
this.headers = new HttpHeaders(); this.headers = new HttpHeaders();
this.headers = this.headers.set('X-User-Id', this.loggedUserChat['data'].userId); this.headers = this.headers.set('X-User-Id', this.loggedUserChat['data'].userId);
this.headers = this.headers.set('X-Auth-Token', this.loggedUserChat['data'].authToken); this.headers = this.headers.set('X-Auth-Token', this.loggedUserChat['data'].authToken);
this.options = { this.options = {
headers: this.headers, headers: this.headers,
}; }; */
} }
@@ -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">
@@ -146,7 +146,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;
}) })
} }