
diff --git a/src/app/pages/publications/view-publications/view-publications.page.ts b/src/app/pages/publications/view-publications/view-publications.page.ts
index bfa837357..aebb528c3 100644
--- a/src/app/pages/publications/view-publications/view-publications.page.ts
+++ b/src/app/pages/publications/view-publications/view-publications.page.ts
@@ -13,6 +13,7 @@ import { PublicationDetailPage } from './publication-detail/publication-detail.p
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';
@Component({
selector: 'app-view-publications',
@@ -25,7 +26,9 @@ 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/"
folderId: string;
+ id: string;
error: any;
publicationListStorage = PublicationListStorage
@@ -66,9 +69,15 @@ export class ViewPublicationsPage implements OnInit {
this.folderId = this.folderId['ProcessId']
}
+
+ if (typeof (this.id) == 'object') {
+ this.id = this.id['ProcessId']
+ }
+
this.getPublicationDetail();
setTimeout(() => {
- this.getPublications();
+ this.testForkJoin()
+ // this.getPublications();
}, 1000);
this.backgroundservice.registerBackService('Online',() => {
@@ -85,14 +94,20 @@ export class ViewPublicationsPage implements OnInit {
this.folderId = this.folderId['ProcessId']
}
+ // if (typeof (this.id == 'object') {
+ // this.id = this.id['ProcessId']
+ // }
+ this.testForkJoin()
this.getPublicationDetail();
- this.getPublications();
+ // this.getPublications();
+
}
doRefresh = (event) => {
setTimeout(() => {
+ this.testForkJoin()
this.getPublicationDetail();
- this.getPublications();
+ // this.getPublications();
event.target.complete();
}, 3000);
@@ -119,7 +134,43 @@ export class ViewPublicationsPage implements OnInit {
}, 100);
}
+// goes to fork
+ getPublicationsIds() {
+ this.showLoader = true;
+ const folderId = this.folderId
+
+ this.publications.GetIdsPublicationsImages(this.id).subscribe(res => {
+
+ console.log(this.id)
+
+ this.publicationList = new Array();
+
+ res.forEach(element => {
+ console.log('getPublications', element)
+ let item: Publication = this.publicationPipe.itemList(element)
+ this.publicationList.push(item);
+ });
+ this.sqliteservice.updateactions(this.id, JSON.stringify(this.publicationList));
+
+ // this.publicationListStorage.add(id, this.publicationList)
+ // this.getpublication = this.publicationList;
+
+ // this.showLoader = false;
+ // }, (error) => {
+
+ // if(error.status == '0') {
+ // this.getFromDB();
+ // }
+ // if (error.status == '404') {
+ // this.error = 'Sem publicações disponíveis!';
+ // this.publicationList = [];
+ // this.publicationListStorage.add(id, this.publicationList)
+ // }
+ this.showLoader = false;
+ });
+ }
+// goes to fork
getPublications() {
this.showLoader = true;
@@ -156,6 +207,16 @@ export class ViewPublicationsPage implements OnInit {
});
}
+ testForkJoin(){
+ forkJoin([
+ this.getPublications(),
+ this.getPublicationsIds()
+
+ ]).subscribe(allResults =>{
+ this.publicationList = allResults[2]
+ })
+ }
+
getFromDB() {
this.sqliteservice.getActionById(this.folderId).then((publications) => {
diff --git a/src/app/services/file/custom-image-cache/custom-image-cache-routing.module.ts b/src/app/services/file/custom-image-cache/custom-image-cache-routing.module.ts
new file mode 100644
index 000000000..4632ffd0b
--- /dev/null
+++ b/src/app/services/file/custom-image-cache/custom-image-cache-routing.module.ts
@@ -0,0 +1,17 @@
+import { NgModule } from '@angular/core';
+import { Routes, RouterModule } from '@angular/router';
+
+import { CustomImageCachePage } from './custom-image-cache.page';
+
+const routes: Routes = [
+ {
+ path: '',
+ component: CustomImageCachePage
+ }
+];
+
+@NgModule({
+ imports: [RouterModule.forChild(routes)],
+ exports: [RouterModule],
+})
+export class CustomImageCachePageRoutingModule {}
diff --git a/src/app/services/file/custom-image-cache/custom-image-cache.module.ts b/src/app/services/file/custom-image-cache/custom-image-cache.module.ts
new file mode 100644
index 000000000..7f1fa8b50
--- /dev/null
+++ b/src/app/services/file/custom-image-cache/custom-image-cache.module.ts
@@ -0,0 +1,21 @@
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FormsModule } from '@angular/forms';
+
+import { IonicModule } from '@ionic/angular';
+
+import { CustomImageCachePageRoutingModule } from './custom-image-cache-routing.module';
+
+import { CustomImageCachePage } from './custom-image-cache.page';
+
+@NgModule({
+ imports: [
+ CommonModule,
+ FormsModule,
+ IonicModule,
+ CustomImageCachePageRoutingModule
+ ],
+ exports: [CustomImageCachePage],
+ declarations: [CustomImageCachePage]
+})
+export class CustomImageCachePageModule {}
diff --git a/src/app/services/file/custom-image-cache/custom-image-cache.page.html b/src/app/services/file/custom-image-cache/custom-image-cache.page.html
new file mode 100644
index 000000000..0f86fae9f
--- /dev/null
+++ b/src/app/services/file/custom-image-cache/custom-image-cache.page.html
@@ -0,0 +1,5 @@
+
![]()
+
+
+
+
\ No newline at end of file
diff --git a/src/app/services/file/custom-image-cache/custom-image-cache.page.scss b/src/app/services/file/custom-image-cache/custom-image-cache.page.scss
new file mode 100644
index 000000000..e69de29bb
diff --git a/src/app/services/file/custom-image-cache/custom-image-cache.page.spec.ts b/src/app/services/file/custom-image-cache/custom-image-cache.page.spec.ts
new file mode 100644
index 000000000..eb8009136
--- /dev/null
+++ b/src/app/services/file/custom-image-cache/custom-image-cache.page.spec.ts
@@ -0,0 +1,24 @@
+import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
+import { IonicModule } from '@ionic/angular';
+
+import { CustomImageCachePage } from './custom-image-cache.page';
+
+describe('CustomImageCachePage', () => {
+ let component: CustomImageCachePage;
+ let fixture: ComponentFixture
;
+
+ beforeEach(waitForAsync(() => {
+ TestBed.configureTestingModule({
+ declarations: [ CustomImageCachePage ],
+ imports: [IonicModule.forRoot()]
+ }).compileComponents();
+
+ fixture = TestBed.createComponent(CustomImageCachePage);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ }));
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/services/file/custom-image-cache/custom-image-cache.page.ts b/src/app/services/file/custom-image-cache/custom-image-cache.page.ts
new file mode 100644
index 000000000..e225ba059
--- /dev/null
+++ b/src/app/services/file/custom-image-cache/custom-image-cache.page.ts
@@ -0,0 +1,76 @@
+import { Component, Input, OnInit } from '@angular/core';
+import { Directory, Filesystem } from '@capacitor/filesystem';
+// import { readFile } from 'fs';
+
+
+
+const CACHE_FOLDER = 'CACHED-IMG'
+
+@Component({
+ selector: 'app-custom-image-cache',
+ templateUrl: './custom-image-cache.page.html',
+ styleUrls: ['./custom-image-cache.page.scss'],
+})
+export class CustomImageCachePage implements OnInit {
+
+ _src ="";
+ @Input () spinner = false
+
+ ngOnInit() {
+ }
+ constructor() { }
+
+ @Input()
+ set src(imageUrl: string){
+ console.log('SET SOURCE', imageUrl)
+
+ const imageName = imageUrl.split('/').pop()
+ const fileType = imageName.split('.').pop()
+
+ Filesystem.readFile({
+ directory: Directory.Cache,
+ path: `${CACHE_FOLDER}/${imageName}`}).then(readFile =>{
+ console.log('LOCAL FILE: ', readFile)
+ // set to SRC
+ this._src = `data:image/${fileType};base64ToFile, ${readFile.data}`
+ }).catch(async e =>{
+ await this.storedImage(imageUrl, imageName)
+ })
+ Filesystem.readFile({
+ directory: Directory.Cache,
+ path: `${CACHE_FOLDER}/${imageName}`
+ }).then(readFile =>{
+ this._src = `data:image/${fileType};base64ToFile, ${readFile.data}`
+ })
+
+ }
+ async storedImage(url, path){
+ const response = await fetch(`http://api-cors-proxy-devdactic.herokuapp.com/${url}`)
+ const blob = await response.blob()
+
+ const base64Data = await this.convertBlobToBase64(blob) as string;
+ const savedFile = await Filesystem.writeFile({
+ path: `${CACHE_FOLDER}/${path}`,
+ data: base64Data,
+ directory: Directory.Cache
+ })
+ return savedFile
+ }
+
+ convertBlobToBase64(blob: Blob){
+ return new Promise((resolve, reject) =>{
+ const reader = new FileReader;
+ reader.onerror = reject;
+ reader.onload = () => {
+ resolve(reader.result)
+ }
+ reader.readAsDataURL(blob)
+ })
+ }
+ }
+
+
+
+
+
+
diff --git a/src/app/services/publications.service.ts b/src/app/services/publications.service.ts
index 3d14a1344..0d6080da3 100644
--- a/src/app/services/publications.service.ts
+++ b/src/app/services/publications.service.ts
@@ -1,4 +1,4 @@
-import { Injectable } from '@angular/core';
+import { Injectable, OnInit } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { environment } from 'src/environments/environment';
import { AuthService } from '../services/auth.service';
@@ -6,20 +6,27 @@ import { LoginUserRespose } from '../models/user.model';
import { Observable, throwError } from 'rxjs';
import { catchError } from 'rxjs/operators'
import { Publication } from '../models/publication';
+import { getUrl } from 'ionicons/dist/types/components/icon/utils';
+import { ActivatedRoute, Router } from '@angular/router';
@Injectable({
providedIn: 'root'
})
-export class PublicationsService {
+export class PublicationsService {
+
+
authheader = {};
loggeduser: LoginUserRespose;
headers: HttpHeaders;
- constructor(private http: HttpClient, user: AuthService) {
+ constructor(private http: HttpClient, user: AuthService,
+ private activatedRoute: ActivatedRoute,
+ private router: Router) {
this.loggeduser = user.ValidatedUser;
this.headers = new HttpHeaders();
this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey);
+
}
GetPublicationFolderList(){
@@ -77,6 +84,7 @@ export class PublicationsService {
return this.http.delete(`${geturl}`, options);
}
+ //this worker obervable goes to ForkJoin as a second api call
GetPublications(id:any){
const geturl = environment.apiURL + 'presidentialActions/'+ id +'/posts';
let params = new HttpParams();
@@ -90,6 +98,20 @@ export class PublicationsService {
return this.http.get(`${geturl}`, options)
}
+ // this one too,goes to observable as a first api call
+ GetIdsPublicationsImages(id:any){
+ const geturl = environment.apiURL + 'presidentialActions/'+ id +'/posts/ids';
+ let params = new HttpParams();
+
+ params = params.set("folderId", id);
+
+ let options = {
+ headers: this.headers,
+ params: params
+ };
+ return this.http.get(`${geturl}`, options)
+ }
+
GetPublicationById( publicationId:any){
const geturl = environment.apiURL + 'presidentialActions/posts/'+ publicationId;
let params = new HttpParams();
@@ -103,6 +125,60 @@ export class PublicationsService {
return this.http.get(`${geturl}`, options);
}
+// my own tries
+
+GetPublicationByIdNext( publicationId:any){
+ let geturl = environment.apiURL + 'presidentialActions/'+ publicationId + '/posts/ids';
+ let params = new HttpParams();
+
+ params = params.set("folderId", publicationId);
+
+ let options = {
+ headers: this.headers,
+ /* params: params */
+ };
+
+ const imageLoads = !!(+localStorage.getItem('loadedimage'))
+ if(imageLoads){
+ return true
+ }else{
+ const navigation = this.router.getCurrentNavigation()
+ console.log('nav:', navigation)
+
+ if(navigation){
+ geturl = navigation.extractedUrl.toString()
+ }
+
+ this.router.navigate([URL], {queryParams: {returnto: geturl}})
+
+ }
+}
+
+GetIdsPublicationNext(id:any){
+ let geturl = environment.apiURL + 'presidentialActions/posts/' + id;
+ let params = new HttpParams();
+
+ params = params.set("id", id);
+
+ let options = {
+ headers: this.headers,
+ params: params
+ };
+
+ var search = this.http.get(`${geturl}`, options).subscribe(
+ res => {
+ res.this.activatedRoute.snapshot.queryParams.get('returnto') || '/posts'
+
+ }
+
+ )
+
+ return search
+
+}
+
+//my last tries
+
CreatePublication(folderId:any,body:any){
const geturl = environment.apiURL + 'presidentialActions/'+folderId+'/posts';
let params = new HttpParams();
diff --git a/src/app/store/publication-list.service.ts b/src/app/store/publication-list.service.ts
index a84ed779d..093f4f763 100644
--- a/src/app/store/publication-list.service.ts
+++ b/src/app/store/publication-list.service.ts
@@ -31,9 +31,12 @@ export class PublicationListService {
return this._document[folderId]
}
+
add(folderId, document = []) {
this._document[folderId] = document
+
+
setTimeout(()=> {
localstoreService.set(this.keyName, {
document: this._document
diff --git a/src/assets/icon/chat/Ellipse 1.svg b/src/assets/icon/chat/Ellipse 1.svg
new file mode 100644
index 000000000..d43d45429
--- /dev/null
+++ b/src/assets/icon/chat/Ellipse 1.svg
@@ -0,0 +1,4 @@
+
diff --git a/src/assets/icon/chat/Ellipse 3.svg b/src/assets/icon/chat/Ellipse 3.svg
new file mode 100644
index 000000000..ccbf2eb90
--- /dev/null
+++ b/src/assets/icon/chat/Ellipse 3.svg
@@ -0,0 +1,3 @@
+
diff --git a/src/assets/icon/chat/Ellipse 8.svg b/src/assets/icon/chat/Ellipse 8.svg
new file mode 100644
index 000000000..475cd6171
--- /dev/null
+++ b/src/assets/icon/chat/Ellipse 8.svg
@@ -0,0 +1,4 @@
+
diff --git a/src/assets/icon/chat/Ellipse.svg b/src/assets/icon/chat/Ellipse.svg
new file mode 100644
index 000000000..60ed39b5b
--- /dev/null
+++ b/src/assets/icon/chat/Ellipse.svg
@@ -0,0 +1,4 @@
+
diff --git a/src/assets/icon/chat/Ellipsed.svg b/src/assets/icon/chat/Ellipsed.svg
new file mode 100644
index 000000000..453e02896
--- /dev/null
+++ b/src/assets/icon/chat/Ellipsed.svg
@@ -0,0 +1,4 @@
+
diff --git a/src/assets/icon/chat/Ellipselast.svg b/src/assets/icon/chat/Ellipselast.svg
new file mode 100644
index 000000000..d5c790d77
--- /dev/null
+++ b/src/assets/icon/chat/Ellipselast.svg
@@ -0,0 +1,4 @@
+
diff --git a/src/assets/icon/chat/Untitled.svg b/src/assets/icon/chat/Untitled.svg
new file mode 100644
index 000000000..cd3bc9abc
--- /dev/null
+++ b/src/assets/icon/chat/Untitled.svg
@@ -0,0 +1,228 @@
+
diff --git a/src/assets/icon/chat/Vector.svg b/src/assets/icon/chat/Vector.svg
new file mode 100644
index 000000000..ad99b9c44
--- /dev/null
+++ b/src/assets/icon/chat/Vector.svg
@@ -0,0 +1,3 @@
+
diff --git a/src/assets/icon/chat/circle-info-solid (1) 1.svg b/src/assets/icon/chat/circle-info-solid (1) 1.svg
new file mode 100644
index 000000000..bb713f866
--- /dev/null
+++ b/src/assets/icon/chat/circle-info-solid (1) 1.svg
@@ -0,0 +1,3 @@
+
diff --git a/src/assets/icon/chat/circle-info-solids.svg b/src/assets/icon/chat/circle-info-solids.svg
new file mode 100644
index 000000000..544ac6623
--- /dev/null
+++ b/src/assets/icon/chat/circle-info-solids.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/global.scss b/src/global.scss
index 58e1c40f2..fe173290d 100644
--- a/src/global.scss
+++ b/src/global.scss
@@ -1336,12 +1336,12 @@ ngx-mat-datetime-content{
.ldio-rpinwye8j0b div { box-sizing: content-box; }
.transparent-modal {
- --background: #dfb2b2e7;
+ --background: #f1eaeae7;
--margin: 0;
--padding: 0;
ion-content {
- --background:#caa1a1e7;
+ --background:#f1f0ebe7;
}
}
@@ -1360,4 +1360,17 @@ ngx-mat-datetime-content{
.transparent-modal .modal-wrapper {
--background: rgba(8, 8, 8, 0.7);
}
- }
\ No newline at end of file
+ }
+
+
+$font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
+$font-size: 11pt;
+
+ ion-segment-button .segment ion-row ul> li{
+ font-family: $font-family;
+ font-size: $font-size;
+
+}
+
+
+
\ No newline at end of file
diff --git a/tsconfig.json b/tsconfig.json
index 9ad7b2c58..399fde719 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -11,7 +11,7 @@
"module": "es2020",
"moduleResolution": "node",
"importHelpers": true,
- "target": "es2015",
+ "target": "es2017",
//"target": "es5",
"lib": [
"es2018",