diff --git a/capacitor.config.json b/capacitor.config.json deleted file mode 100644 index 1119e4dc1..000000000 --- a/capacitor.config.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "appId": "com.gpr.gabinetedigital", - "appName": "gabinete-digital", - "webDir": "www", - "npmClient": "npm", - "linuxAndroidStudioPath": "/snap/android-studio/current/android-studio/bin/studio.sh", - "cordova": { - "preferences": { - "ScrollEnabled": "false", - "BackupWebStorage": "none", - "SplashMaintainAspectRatio": "true", - "FadeSplashScreenDuration": "300", - "SplashShowOnlyFirstTime": "false", - "SplashScreen": "screen", - "SplashScreenDelay": "3000" - } - }, - "android": { - "allowMixedContent": true - }, - "bundledWebRuntime": false -} diff --git a/capacitor.config.ts b/capacitor.config.ts new file mode 100644 index 000000000..35aed5d7f --- /dev/null +++ b/capacitor.config.ts @@ -0,0 +1,25 @@ +// / +// / +// / + +import { CapacitorConfig } from '@capacitor/cli'; + +const config: CapacitorConfig = { + appId: 'com.capacitorjs.app.testapp', + appName: 'capacitor-testapp', + webDir: 'build', + plugins: { + SplashScreen: { + launchAutoHide: false, + }, + LocalNotifications: { + smallIcon: 'ic_stat_icon_config_sample', + iconColor: '#CE0B7C', + }, + PushNotifications: { + presentationOptions: ['alert', 'sound'], + }, + }, +}; + +export default config; diff --git a/package-lock.json b/package-lock.json index a5beebb2b..ca1c032a7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2030,10 +2030,28 @@ "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", "dev": true }, + "@capacitor-community/camera-preview": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@capacitor-community/camera-preview/-/camera-preview-1.2.1.tgz", + "integrity": "sha512-rskj/12TR4X8cUzvkWvygf7A/4TFUld9BU5nAc1gc3LXU06FGP0R/6MxZKQdf20qqRaTRLPrF3HFAlkz7xb6yg==", + "requires": { + "@capacitor/core": "^3.3.2" + }, + "dependencies": { + "@capacitor/core": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/@capacitor/core/-/core-3.3.2.tgz", + "integrity": "sha512-pyI3dQdQjA1L5iEw0jkeKCogx9t5d5kIFTB5M3CJRg9Uj5MIpU2J5CRj+74A7BflvZJo8IBd6IfMJaOArRumaw==", + "requires": { + "tslib": "^2.1.0" + } + } + } + }, "@capacitor/android": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/@capacitor/android/-/android-3.3.1.tgz", - "integrity": "sha512-TB9UJh6/e6CV6KDpu/lNHKhgVvnDL2d3crNYtfKzp64CzeZhttQGIQShXSdMb3DG4kk7Zi/qBlfSaWBBD95NhQ==" + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/@capacitor/android/-/android-3.3.2.tgz", + "integrity": "sha512-TG+tGz0KxkT/BgvSLQfbQwQ9c4Budub5TRijIGdmMbB1ZYB76TFhwvVuwWZ52HFSlKS3sx/UYLlbULL7UQ2aug==" }, "@capacitor/app": { "version": "1.0.5", @@ -3425,6 +3443,46 @@ "tslib": "^1.10.0" }, "dependencies": { + "localforage-cordovasqlitedriver": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/localforage-cordovasqlitedriver/-/localforage-cordovasqlitedriver-1.7.0.tgz", + "integrity": "sha1-i5OVd1nuaI06WNW6fAR39sy1ODg=", + "requires": { + "localforage": ">=1.5.0" + } + }, + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + } + } + }, + "@ionic/storage-angular": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@ionic/storage-angular/-/storage-angular-3.0.6.tgz", + "integrity": "sha512-ZXlIFWGU27aCxVFgZb0KFJFtWwnn6+HK6v0rMGzjN8f7oV2ewXaQ2dl1gTw/A8YoozTVPOFxwfFHCjhWLFR1Fw==", + "requires": { + "@ionic/storage": "^3.0.4", + "tslib": "^1.10.0" + }, + "dependencies": { + "@ionic/storage": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@ionic/storage/-/storage-3.0.6.tgz", + "integrity": "sha512-sw+zSJINIpbQCGZR9mEtb9N0WmZLuhcMVqOZJBqLuDACAMdXqG39zmp5nSVqhGI1/9X3nd0K5gVn6icyVfUnUg==", + "requires": { + "localforage": "^1.9.0" + } + }, + "localforage": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/localforage/-/localforage-1.10.0.tgz", + "integrity": "sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg==", + "requires": { + "lie": "3.1.1" + } + }, "tslib": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", @@ -7950,6 +8008,11 @@ "integrity": "sha512-+v/VzCYBdGsIxJTP2m+RWaq7l/NLu7b976w6XGJUFiN2TVOeaGrytaR4jRy0w9akRai8uKFeBmuGHmlS/sOeCA==", "dev": true }, + "cordova-plugin-x-socialsharing": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/cordova-plugin-x-socialsharing/-/cordova-plugin-x-socialsharing-6.0.3.tgz", + "integrity": "sha512-pnrE2CXsz4G0n0WoFDAasLS1VT3nIsNpddvXgfpiqX3wyOlSjO2NdF+sjYaTvs1B+f7z8EWbYCHpCrgBQiMLIg==" + }, "cordova-res": { "version": "0.15.3", "resolved": "https://registry.npmjs.org/cordova-res/-/cordova-res-0.15.3.tgz", @@ -8032,19 +8095,6 @@ } } }, - "cordova-sqlite-storage": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/cordova-sqlite-storage/-/cordova-sqlite-storage-5.1.0.tgz", - "integrity": "sha512-UmHe9yQiYblDBToh3z91WHuD6ZgmCm3VX+1QFseYQs4WVQ3+ndj22qyGby/NV0uyCgok91gB1obLjLM+9vYJEw==", - "requires": { - "cordova-sqlite-storage-dependencies": "3.0.0" - } - }, - "cordova-sqlite-storage-dependencies": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cordova-sqlite-storage-dependencies/-/cordova-sqlite-storage-dependencies-3.0.0.tgz", - "integrity": "sha512-A7gV5lQZc0oPrJ/a+lsZmMZr7vYou4MXyQFOY+b/dwuCMsagLT0EsL7oY54tqzpvjtzLfh0aZGGm9i8DMAIFSA==" - }, "core-js": { "version": "3.18.1", "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.18.1.tgz", @@ -15357,14 +15407,6 @@ "lie": "3.1.1" } }, - "localforage-cordovasqlitedriver": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/localforage-cordovasqlitedriver/-/localforage-cordovasqlitedriver-1.7.0.tgz", - "integrity": "sha1-i5OVd1nuaI06WNW6fAR39sy1ODg=", - "requires": { - "localforage": ">=1.5.0" - } - }, "localtunnel": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/localtunnel/-/localtunnel-2.0.2.tgz", @@ -16214,6 +16256,14 @@ "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=" }, + "ng-lazyload-image": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/ng-lazyload-image/-/ng-lazyload-image-9.1.0.tgz", + "integrity": "sha512-ZdfCXMTaehfzxcSRRThpz9YZbEA+8LPA086Od6JiylrGj0yNM7Aq830A1x6NE/M8o2VuVq93emH9m8T6SFBHlA==", + "requires": { + "tslib": "^2.0.0" + } + }, "ng2-pdf-viewer": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/ng2-pdf-viewer/-/ng2-pdf-viewer-7.0.1.tgz", diff --git a/package.json b/package.json index 37884141a..3947f6c01 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,8 @@ "@angular/platform-browser": "~12.1.2", "@angular/platform-browser-dynamic": "~12.1.2", "@angular/router": "~12.1.2", - "@capacitor/android": "3.3.1", + "@capacitor-community/camera-preview": "^1.2.1", + "@capacitor/android": "^3.3.2", "@capacitor/app": "^1.0.5", "@capacitor/browser": "1.0.6", "@capacitor/camera": "^1.2.0", @@ -78,6 +79,7 @@ "@ionic/core": "^5.8.1", "@ionic/pwa-elements": "^3.0.2", "@ionic/storage": "^2.3.1", + "@ionic/storage-angular": "^3.0.6", "@logisticinfotech/ionic4-datepicker": "^1.4.4", "@ng-bootstrap/ng-bootstrap": "^9.1.2", "@ngx-translate/core": "^13.0.0", @@ -98,8 +100,8 @@ "cordova-plugin-filepath": "^1.5.8", "cordova-plugin-okhttp": "^2.0.0", "cordova-plugin-screen-orientation": "^3.0.2", + "cordova-plugin-x-socialsharing": "^6.0.3", "cordova-res": "^0.15.3", - "cordova-sqlite-storage": "^5.1.0", "cross-env": "^7.0.3", "crypto-js": "^4.0.0", "date-fns": "^2.17.0", @@ -120,6 +122,7 @@ "jetifier": "^1.6.8", "lite-server": "^2.6.1", "moment": "^2.29.1", + "ng-lazyload-image": "^9.1.0", "ng2-pdf-viewer": "^7.0.1", "ngx-cookie-service": "^12.0.3", "ngx-image-cropper": "^5.0.1", diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 77e583867..db3b417bf 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -219,6 +219,10 @@ const routes = [ path: 'preview-photo', loadChildren: () => import('./modals/preview-photo/preview-photo.module').then( m => m.PreviewPhotoPageModule) }, + { + path: 'custom-image-cache', + loadChildren: () => import('./services/file/custom-image-cache/custom-image-cache.module').then( m => m.CustomImageCachePageModule) + }, diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 9e8e8372a..94dcce95c 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -11,6 +11,8 @@ import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-pick import { SqliteService } from 'src/app/services/sqlite.service'; import { BackgroundService } from 'src/app/services/background.service'; import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx'; +import { Directory, Filesystem } from '@capacitor/filesystem'; + const CUSTOM_DATE_FORMATS: NgxMatDateFormats = { @@ -41,11 +43,20 @@ export class AppComponent { private statusBar: StatusBar, private screenOrientation: ScreenOrientation, private sqliteservice: SqliteService, - private backgroundservice: BackgroundService + private backgroundservice: BackgroundService, + ) { + this.createCacheFolder() this.initializeApp(); } + async createCacheFolder(){ + await Filesystem.mkdir({ + directory: Directory.Cache, + path: `CACHED-IMG` + }) + } + initializeApp() { this.platform.ready().then(() => { this.statusBar.styleDefault(); diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 9861e351f..40f8a91d6 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -36,7 +36,7 @@ import {MAT_DATE_FORMATS, MAT_DATE_LOCALE} from '@angular/material/core'; import { NgxMatDateFormats, NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker'; import { Network } from '@ionic-native/network/ngx'; import { File } from '@ionic-native/file/ngx'; -import { ImageCropperModule } from 'ngx-image-cropper'; + import { @@ -65,6 +65,9 @@ import { MediaCapture } from '@ionic-native/media-capture/ngx'; import { Media } from '@ionic-native/media/ngx'; import { StreamingMedia } from '@ionic-native/streaming-media/ngx'; import { PhotoViewer } from '@ionic-native/photo-viewer/ngx'; +import { CustomImageCachePageRoutingModule } from './services/file/custom-image-cache/custom-image-cache-routing.module'; + + /* import { FCM } from '@ionic-native/fcm/ngx'; @@ -82,7 +85,11 @@ import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */ useFactory: adapterFactory }), IonicModule.forRoot({animated: false}), - IonicStorageModule.forRoot(), + IonicStorageModule.forRoot({ + name: '__mydb', + driverOrder: ['indexeddb', 'sqlite', 'websql'] + }), + AppRoutingModule, FontAwesomeModule, HttpClientModule, @@ -104,6 +111,7 @@ import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */ // PdfViewerModule, HammerModule, + CustomImageCachePageRoutingModule ], diff --git a/src/app/modals/group-icons/group-icons.page.html b/src/app/modals/group-icons/group-icons.page.html index e92a1ac13..b8f37cf02 100644 --- a/src/app/modals/group-icons/group-icons.page.html +++ b/src/app/modals/group-icons/group-icons.page.html @@ -4,10 +4,17 @@ - Iniciar Video Chamada? + Tem certeza que apagar imagem? - Iniciar Video Chamada? + + Sim + + + + Não + + diff --git a/src/app/modals/group-icons/group-icons.page.scss b/src/app/modals/group-icons/group-icons.page.scss index 1ba6d40db..fdc5fe30a 100644 --- a/src/app/modals/group-icons/group-icons.page.scss +++ b/src/app/modals/group-icons/group-icons.page.scss @@ -60,4 +60,8 @@ color: rgb(255, 38, 0); // background-color: rgb(255, 72, 0); +} + +.placed{ + float:right } \ No newline at end of file diff --git a/src/app/modals/group-icons/group-icons.page.ts b/src/app/modals/group-icons/group-icons.page.ts index 5e0a5aba6..47d79442a 100644 --- a/src/app/modals/group-icons/group-icons.page.ts +++ b/src/app/modals/group-icons/group-icons.page.ts @@ -1,5 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { IonSlides, ModalController, NavParams } from '@ionic/angular'; +import { PublicationsService } from 'src/app/services/publications.service'; @Component({ selector: 'app-group-icons', @@ -9,7 +10,8 @@ import { IonSlides, ModalController, NavParams } from '@ionic/angular'; export class GroupIconsPage implements OnInit { constructor( private modalController: ModalController, - private navParams:NavParams) { } + private navParams:NavParams, + private publicService:PublicationsService ) { } ngOnInit() { } @@ -26,6 +28,7 @@ export class GroupIconsPage implements OnInit { pesquizarWeb(){ } + dismiss() { // using the injected ModalController this page @@ -33,6 +36,11 @@ export class GroupIconsPage implements OnInit { this.modalController.dismiss({ 'dismissed': true }); + + } + // delete(){ + // this.publicService.DeletePublication() + // } } diff --git a/src/app/modals/preview-camera/preview-camera.page.html b/src/app/modals/preview-camera/preview-camera.page.html index 53647d342..f57da29b9 100644 --- a/src/app/modals/preview-camera/preview-camera.page.html +++ b/src/app/modals/preview-camera/preview-camera.page.html @@ -6,7 +6,7 @@ - {{username}} {{_updatedAt | date}}
+ {{username}} {{_updatedAt | date}}
@@ -30,20 +30,20 @@ - + - - - - + + + - + - + + diff --git a/src/app/modals/preview-camera/preview-camera.page.scss b/src/app/modals/preview-camera/preview-camera.page.scss index e8333bcdf..f1d3a917e 100644 --- a/src/app/modals/preview-camera/preview-camera.page.scss +++ b/src/app/modals/preview-camera/preview-camera.page.scss @@ -7,7 +7,7 @@ ion-slides { } .redla{ - color: rgb(250, 248, 248); + color: rgb(250, 250, 4); background-color: rgb(255, 238, 0); border-radius: 120px; width: 30px; @@ -18,7 +18,7 @@ ion-slides { } .cardconteudo { - background: rgb(8, 8, 8); + background: rgb(253, 252, 252); display: flex; flex-wrap: wrap; diff --git a/src/app/modals/preview-camera/preview-camera.page.ts b/src/app/modals/preview-camera/preview-camera.page.ts index 2766fc583..c5445dc27 100644 --- a/src/app/modals/preview-camera/preview-camera.page.ts +++ b/src/app/modals/preview-camera/preview-camera.page.ts @@ -1,6 +1,7 @@ import { Component, OnInit, ViewChild } from '@angular/core'; import { IonSlides, ModalController, NavParams } from '@ionic/angular'; import { ImageCroppedEvent } from 'ngx-image-cropper'; +import { PublicationsService } from 'src/app/services/publications.service'; import { GroupIconsPage } from '../group-icons/group-icons.page'; @Component({ @@ -11,7 +12,8 @@ import { GroupIconsPage } from '../group-icons/group-icons.page'; export class PreviewCameraPage implements OnInit { constructor( private modalController: ModalController, - private navParams:NavParams) { } + private navParams:NavParams, + private publicService: PublicationsService) { } @ViewChild(IonSlides) slides : IonSlides @@ -72,7 +74,7 @@ async getIconGallery(){ const modal = await this.modalController.create({ component: GroupIconsPage , animated: true, - cssClass: 'transparentblack-modal', + cssClass: 'transparent-modal', }); modal.present(); } @@ -80,11 +82,25 @@ async getIconGallery(){ openChat(){ + } + + clear() { + this.getIconGallery() + } openChatVideo(){ } + deleteImage(){ + window.onload = function(){ + const delmage = document.getElementById("img") + delmage.onclick = function(){ + return window.localStorage.removeItem("img") + } + + } + } - +} diff --git a/src/app/pages/agenda/agenda.page.scss b/src/app/pages/agenda/agenda.page.scss index 05c3185a0..951deeb7a 100644 --- a/src/app/pages/agenda/agenda.page.scss +++ b/src/app/pages/agenda/agenda.page.scss @@ -292,6 +292,11 @@ td.monthview-primary-with-event { .segment { +} + + div ion-raw > ul > li{ + font-size: 11pt; + font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif; } /* Timeline */ diff --git a/src/app/pages/chat/messages/messages.page.ts b/src/app/pages/chat/messages/messages.page.ts index 51936512e..bded0d72a 100644 --- a/src/app/pages/chat/messages/messages.page.ts +++ b/src/app/pages/chat/messages/messages.page.ts @@ -652,6 +652,9 @@ touchStart(card) { modal.present(); } + + + imageSize(img){ var canvas = document.createElement('canvas'); var ctx = canvas.getContext('2d'); diff --git a/src/app/pages/publications/new-publication/new-publication.page.ts b/src/app/pages/publications/new-publication/new-publication.page.ts index 5fb46c486..86cbc5186 100644 --- a/src/app/pages/publications/new-publication/new-publication.page.ts +++ b/src/app/pages/publications/new-publication/new-publication.page.ts @@ -106,6 +106,8 @@ export class NewPublicationPage implements OnInit { const image = await Camera.getPhoto({ quality: 50, allowEditing: false, + width:50, + height: 50, resultType: CameraResultType.Uri, source: CameraSource.Camera // Camera, Photos or Prompt! @@ -393,6 +395,8 @@ export class NewPublicationPage implements OnInit { async selectImage() { const image = await Camera.getPhoto({ quality: 50, + width:50, + height:50, allowEditing: false, resultType: CameraResultType.Uri, source: CameraSource.Camera // Camera, Photos or Prompt! diff --git a/src/app/pages/publications/publications.module.ts b/src/app/pages/publications/publications.module.ts index dbb7e19a7..5f121647f 100644 --- a/src/app/pages/publications/publications.module.ts +++ b/src/app/pages/publications/publications.module.ts @@ -15,6 +15,7 @@ import { PublicationDetailPageModule } from 'src/app/shared/publication/view-pub import { HeaderPageModule } from 'src/app/shared/header/header.module'; import { EditActionPageModule } from 'src/app/shared/publication/edit-action/edit-action.module'; import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; +import { LazyLoadImageModule } from 'ng-lazyload-image'; // <-- import it @NgModule({ imports: [ @@ -29,6 +30,7 @@ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; PublicationDetailPageModule, NewActionPageModule, EditActionPageModule, + LazyLoadImageModule ], declarations: [ PublicationsPage, diff --git a/src/app/pages/publications/view-publications/view-publications.module.ts b/src/app/pages/publications/view-publications/view-publications.module.ts index d05bd8b49..35b432670 100644 --- a/src/app/pages/publications/view-publications/view-publications.module.ts +++ b/src/app/pages/publications/view-publications/view-publications.module.ts @@ -10,6 +10,9 @@ import { ViewPublicationsPage } from './view-publications.page'; import { HeaderPageModule } from 'src/app/shared/header/header.module'; +import { LazyLoadImageModule } from 'ng-lazyload-image'; // <-- import it + + @NgModule({ imports: [ CommonModule, @@ -18,6 +21,7 @@ import { HeaderPageModule } from 'src/app/shared/header/header.module'; ViewPublicationsPageRoutingModule, HeaderPageModule, + LazyLoadImageModule ], exports: [ViewPublicationsPage], declarations: [ViewPublicationsPage] diff --git a/src/app/pages/publications/view-publications/view-publications.page.html b/src/app/pages/publications/view-publications/view-publications.page.html index 672d27c47..dfc615f99 100644 --- a/src/app/pages/publications/view-publications/view-publications.page.html +++ b/src/app/pages/publications/view-publications/view-publications.page.html @@ -39,7 +39,7 @@ (click)="goToPublicationDetail(publication.DocumentId)" >
- image + image
image 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",