mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
Fixe android build
This commit is contained in:
@@ -16,7 +16,7 @@ import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
|
||||
//import { File } from '@ionic-native/File/ngx';
|
||||
import { WebView } from '@ionic-native/ionic-webview/ngx';
|
||||
import { FilePath } from '@ionic-native/file-path/ngx';
|
||||
import { Camera } from '@ionic-native/camera/ngx';
|
||||
/* import { Camera } from '@ionic-native/camera/ngx'; */
|
||||
import { IonicStorageModule } from '@ionic/storage';
|
||||
import { PipesModule } from './pipes/pipes.module';
|
||||
//
|
||||
@@ -52,7 +52,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
HttpClientModule,
|
||||
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
|
||||
InAppBrowser,
|
||||
Camera,
|
||||
/* Camera, */
|
||||
//File,
|
||||
WebView,
|
||||
FilePath,
|
||||
|
||||
+85
-37
@@ -7,12 +7,13 @@ import { StorageService } from 'src/app/services/storage.service';
|
||||
import { ModalController } from '@ionic/angular';
|
||||
import { PublicationDetailPage } from '../../app/pages/publications/view-publications/publication-detail/publication-detail.page';
|
||||
import { ViewPublicationsPage } from '../../app/pages/publications/view-publications/view-publications.page';
|
||||
import { ExpedienteDetailPage } from '../../app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page'
|
||||
|
||||
import { Plugins, PushNotification, PushNotificationToken, PushNotificationActionPerformed, Modals } from '@capacitor/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { MethodCall } from '@angular/compiler';
|
||||
|
||||
const { PushNotifications, LocalNotifications } = Plugins;
|
||||
const { PushNotifications, LocalNotifications, LocalNotificationAction } = Plugins;
|
||||
|
||||
@Component({
|
||||
selector: 'app-home',
|
||||
@@ -69,51 +70,75 @@ export class HomePage implements OnInit {
|
||||
alert('Error on registration: ' + JSON.stringify(error));
|
||||
});
|
||||
|
||||
PushNotifications.addListener(
|
||||
'pushNotificationReceived',
|
||||
(notification: PushNotification) => {
|
||||
//alert('Push received: ' + JSON.stringify(notification));
|
||||
//this.localNotificationPresent(notification);
|
||||
PushNotifications.addListener('pushNotificationReceived', notification => {
|
||||
|
||||
},
|
||||
);
|
||||
//const isPushNotification = !!notification.title || !!notification.body;
|
||||
|
||||
// if this is a push notification received when the app is in the foreground on Android
|
||||
//if (isAndroid && isPushNotification) {
|
||||
|
||||
// We schedule a LocalNotification 1 second later since Capacitor for Android doesn't show anything in this case
|
||||
LocalNotifications.schedule({
|
||||
notifications: [{
|
||||
title: notification.title,
|
||||
body: notification.body,
|
||||
id: new Date().getUTCMilliseconds(),
|
||||
schedule: {
|
||||
at: new Date(Date.now() + 1000)
|
||||
},
|
||||
extra: notification.data,
|
||||
channelId: 'pop-notifications'
|
||||
}]
|
||||
});
|
||||
//}
|
||||
});
|
||||
|
||||
|
||||
PushNotifications.addListener(
|
||||
'pushNotificationActionPerformed',
|
||||
(notification: PushNotificationActionPerformed) => {
|
||||
let service = notification.notification.data.service;
|
||||
|
||||
let object = notification.notification.data.object;
|
||||
let idObject = notification.notification.data.idObject;
|
||||
let folder = notification.notification.data.folder;
|
||||
let publicationId = notification.notification.data.publicationId;
|
||||
let processId = notification.notification.data.processId;
|
||||
|
||||
console.log('FOLDER PROCESS', folder.ProcessId)
|
||||
console.log('Service: ', service);
|
||||
console.log('Object: ', object);
|
||||
console.log('idObject: ', idObject);
|
||||
|
||||
if (service != null) {
|
||||
/* if (service === "events") {
|
||||
this.router.navigate(['/home/', service, idObject, 'home']);
|
||||
} else if (service === "agenda") {
|
||||
this.router.navigate(['/home/', service, idObject, 'home']);
|
||||
} else if (service === "gabinete-digital" && object != "expediente") {*/
|
||||
// this.router.navigate(['/home/', service]);
|
||||
// }
|
||||
|
||||
if (service === "events") {
|
||||
this.router.navigate(['/home/', service, idObject, 'home']);
|
||||
} else if (service === "agenda") {
|
||||
this.router.navigate(['/home/', service, idObject, 'home']);
|
||||
} else if (service === "gabinete-digital") {
|
||||
this.router.navigate(['/home/', service]);
|
||||
} else if (service === "gabinete-digital-expediente") {
|
||||
this.router.navigate(['/home/gabinete-digital/', object, idObject]);
|
||||
}
|
||||
} else {
|
||||
//if (service != null) {
|
||||
|
||||
if (processId || publicationId != null) {
|
||||
this.viewPublicationDetail(processId, publicationId)
|
||||
}
|
||||
|
||||
if (notification.notification.data.folder.ProcessId != null) {
|
||||
this.viewPublications(folder)
|
||||
}
|
||||
/*const routeValue = {
|
||||
"agenda": this.router.navigate(['/home/', service, idObject, 'home']),
|
||||
"gabinete-digital": this.router.navigate(['/home/', service]),
|
||||
"accoes": this.viewExpedientDetail(idObject),
|
||||
|
||||
}
|
||||
|
||||
const route = routeValue[service] && object ;
|
||||
|
||||
service = "agenda" ? this.router.navigate(['/home/', service, idObject, 'home']) : */
|
||||
|
||||
if (service === "agenda") {
|
||||
this.router.navigate(['/home/', service, idObject, 'home']);
|
||||
} else if (service === "gabinete-digital" && object != "expediente") {
|
||||
this.router.navigate(['/home/', service]);
|
||||
} else if (service === "gabinete-digital" && object === "expediente") {
|
||||
this.viewExpedientDetail(idObject)
|
||||
} else if (service === "accoes" && object === "accao") {
|
||||
this.viewPublications(idObject)
|
||||
} else if (service === "accoes" && object === "publicacao") {
|
||||
this.viewPublicationDetail(idObject)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*switch (service) {
|
||||
@@ -151,6 +176,8 @@ export class HomePage implements OnInit {
|
||||
|
||||
async localNotificationPresent(notification) {
|
||||
|
||||
LocalNotificationAction.
|
||||
|
||||
LocalNotifications.schedule({
|
||||
notifications: [
|
||||
{
|
||||
@@ -161,20 +188,40 @@ export class HomePage implements OnInit {
|
||||
sound: null,
|
||||
attachments: null,
|
||||
actionTypeId: "",
|
||||
extra: null
|
||||
extra: null,
|
||||
foreground: true,
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async viewExpedientDetail(serialNumber:any) {
|
||||
console.log(this.profile);
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: ExpedienteDetailPage,
|
||||
componentProps:{
|
||||
serialNumber: serialNumber,
|
||||
profile: this.profile,
|
||||
},
|
||||
cssClass: 'modal',
|
||||
backdropDismiss: false
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then((res)=>{
|
||||
if(res){
|
||||
console.log(res);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
async viewPublicationDetail(processId: string, publicationId: string) {
|
||||
|
||||
async viewPublicationDetail(folderId) {
|
||||
const modal = await this.modalController.create({
|
||||
component: PublicationDetailPage,
|
||||
componentProps: {
|
||||
publicationId: publicationId,
|
||||
folderId: processId,
|
||||
folderId: folderId,
|
||||
},
|
||||
cssClass: 'publication-detail',
|
||||
backdropDismiss: false
|
||||
@@ -183,14 +230,15 @@ export class HomePage implements OnInit {
|
||||
modal.onDidDismiss();
|
||||
}
|
||||
|
||||
async viewPublications(folder) {
|
||||
async viewPublications(folderId) {
|
||||
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: ViewPublicationsPage,
|
||||
/* enterAnimation,
|
||||
leaveAnimation, */
|
||||
componentProps: {
|
||||
item: folder,
|
||||
item: folderId,
|
||||
},
|
||||
cssClass: 'new-action',
|
||||
backdropDismiss: false
|
||||
|
||||
@@ -14,7 +14,7 @@ import { AlertService } from 'src/app/services/alert.service';
|
||||
/* const { Camera } = Plugins; */
|
||||
|
||||
//Cordova
|
||||
import { Camera, CameraOptions } from '@ionic-native/camera/ngx';
|
||||
/* import { Camera, CameraOptions } from '@ionic-native/camera/ngx'; */
|
||||
import { PublicationFolder } from 'src/app/models/publicationfolder';
|
||||
import { ViewPublicationsPage } from '../view-publications/view-publications.page';
|
||||
import { LoadingService } from 'src/app/services/loading.service';
|
||||
@@ -51,7 +51,7 @@ export class NewPublicationPage implements OnInit {
|
||||
public photoService: PhotoService,
|
||||
private navParams: NavParams,
|
||||
private publications: PublicationsService,
|
||||
private camera: Camera,
|
||||
/* private camera: Camera, */
|
||||
) {
|
||||
|
||||
this.publicationType = this.navParams.get('publicationType');
|
||||
@@ -65,7 +65,7 @@ export class NewPublicationPage implements OnInit {
|
||||
this.takePicture();
|
||||
}
|
||||
takePicture(){
|
||||
const options: CameraOptions = {
|
||||
/* const options: CameraOptions = {
|
||||
quality: 100,
|
||||
destinationType: this.camera.DestinationType.DATA_URL,
|
||||
encodingType: this.camera.EncodingType.JPEG,
|
||||
@@ -82,11 +82,11 @@ export class NewPublicationPage implements OnInit {
|
||||
this.capturedImageTitle = new Date().getTime() + '.jpeg';
|
||||
}, (err) => {
|
||||
console.log(err);
|
||||
});
|
||||
}); */
|
||||
}
|
||||
|
||||
getPicture(){
|
||||
const options: CameraOptions = {
|
||||
/* const options: CameraOptions = {
|
||||
quality: 100,
|
||||
sourceType: this.camera.PictureSourceType.PHOTOLIBRARY,
|
||||
destinationType: this.camera.DestinationType.DATA_URL,
|
||||
@@ -103,7 +103,7 @@ export class NewPublicationPage implements OnInit {
|
||||
this.capturedImageTitle = new Date().getTime() + '.jpeg';
|
||||
}, (err) => {
|
||||
console.log(err);
|
||||
});
|
||||
}); */
|
||||
}
|
||||
|
||||
async save(){
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<div class="item"
|
||||
*ngFor="let viagem of publicationsTravelFolderList"
|
||||
|
||||
(click)="viewPublications(viagem)">
|
||||
(click)="viewPublications(viagem.ProcessId)">
|
||||
<div class="item-icon">
|
||||
<ion-icon slot="end" src='assets/images/icons-plane-active.svg'></ion-icon>
|
||||
</div>
|
||||
|
||||
@@ -112,7 +112,8 @@ export class PublicationsPage implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
async viewPublications(folder: PublicationFolder) {
|
||||
async viewPublications(folderId: string) {
|
||||
console.log('FOLDER', folderId)
|
||||
|
||||
/* const enterAnimation = (baseEl: any) => {
|
||||
const backdropAnimation = this.animationController.create()
|
||||
@@ -145,7 +146,7 @@ export class PublicationsPage implements OnInit {
|
||||
/* enterAnimation,
|
||||
leaveAnimation, */
|
||||
componentProps:{
|
||||
item:folder,
|
||||
folderId:folderId,
|
||||
},
|
||||
cssClass: 'new-action',
|
||||
backdropDismiss: false
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ export class PublicationDetailPage implements OnInit {
|
||||
this.showLoader = true;
|
||||
console.log(this.publicationId);
|
||||
console.log(this.folderId);
|
||||
this.publications.GetPublicationById(this.folderId,this.publicationId).subscribe(res=>{
|
||||
this.publications.GetPublicationById(this.publicationId).subscribe(res=>{
|
||||
console.log(res);
|
||||
/* this.publication = res; */
|
||||
this.publication = {
|
||||
|
||||
@@ -18,6 +18,7 @@ export class ViewPublicationsPage implements OnInit {
|
||||
|
||||
publicationList: Publication[];
|
||||
item: PublicationFolder;
|
||||
folderId:string;
|
||||
|
||||
constructor(
|
||||
private loadingController: LoadingService,
|
||||
@@ -25,27 +26,38 @@ export class ViewPublicationsPage implements OnInit {
|
||||
private publications: PublicationsService,
|
||||
private navParams: NavParams,
|
||||
) {
|
||||
this.item = this.navParams.get('item');
|
||||
this.item = new PublicationFolder();
|
||||
this.folderId = this.navParams.get('folderId');
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.getPublications()
|
||||
console.log(this.folderId);
|
||||
|
||||
this.getPublications();
|
||||
this.getPublicationDetail();
|
||||
}
|
||||
doRefresh(event) {
|
||||
this.getPublications();
|
||||
|
||||
setTimeout(() => {
|
||||
this.getPublications();
|
||||
this.getPublicationDetail();
|
||||
event.target.complete();
|
||||
}, 3000);
|
||||
}
|
||||
close(){
|
||||
this.modalController.dismiss();
|
||||
}
|
||||
getPublicationDetail(){
|
||||
this.publications.GetPublicationFolderById(this.folderId).subscribe(res=>{
|
||||
console.log(res);
|
||||
this.item = res;
|
||||
});
|
||||
}
|
||||
getPublications(){
|
||||
this.showLoader = true;
|
||||
|
||||
this.publications.GetPublications(this.item.ProcessId).subscribe(res=>{
|
||||
this.publications.GetPublications(this.folderId).subscribe(res=>{
|
||||
this.publicationList = new Array();
|
||||
console.log(res);
|
||||
res.forEach(element => {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Injectable } from '@angular/core';
|
||||
/* import { Plugins, CameraResultType, Capacitor, FilesystemDirectory, CameraPhoto, CameraSource } from '@capacitor/core'; */
|
||||
import { Photo } from '../models/photo';
|
||||
import { Platform } from '@ionic/angular';
|
||||
import { Camera, CameraOptions } from '@ionic-native/camera/ngx';
|
||||
/* import { Camera, CameraOptions } from '@ionic-native/camera/ngx'; */
|
||||
|
||||
/* const { Camera, Filesystem, Storage } = Plugins; */
|
||||
|
||||
@@ -16,12 +16,13 @@ export class PhotoService {
|
||||
private platform: Platform;
|
||||
|
||||
constructor(platform: Platform,
|
||||
private camera:Camera) {
|
||||
/* private camera:Camera */
|
||||
) {
|
||||
this.platform = platform;
|
||||
}
|
||||
|
||||
async takePicture(){
|
||||
const options: CameraOptions = {
|
||||
/* const options: CameraOptions = {
|
||||
quality: 100,
|
||||
destinationType: this.camera.DestinationType.FILE_URI,
|
||||
encodingType: this.camera.EncodingType.JPEG,
|
||||
@@ -37,7 +38,7 @@ export class PhotoService {
|
||||
return base64Image;
|
||||
}, (err) => {
|
||||
// Handle error
|
||||
});
|
||||
}); */
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -29,14 +29,10 @@ export class PublicationsService {
|
||||
}
|
||||
|
||||
GetPublicationFolderById(id:any){
|
||||
const geturl = environment.apiURL + 'presidentialActions';
|
||||
let params = new HttpParams();
|
||||
|
||||
params = params.set("id", id);
|
||||
const geturl = environment.apiURL + 'presidentialActions/'+id;
|
||||
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
params: params
|
||||
};
|
||||
return this.http.get<any>(`${geturl}`, options);
|
||||
}
|
||||
@@ -87,11 +83,10 @@ export class PublicationsService {
|
||||
return this.http.get<any>(`${geturl}`, options);
|
||||
}
|
||||
|
||||
GetPublicationById(folderId:any, publicationId:any){
|
||||
const geturl = environment.apiURL + 'presidentialActions/'+ folderId +'/posts/'+ publicationId;
|
||||
GetPublicationById( publicationId:any){
|
||||
const geturl = environment.apiURL + 'presidentialActions/posts/'+ publicationId;
|
||||
let params = new HttpParams();
|
||||
|
||||
params = params.set("folderId", folderId);
|
||||
params = params.set("id", publicationId);
|
||||
|
||||
|
||||
@@ -104,6 +99,7 @@ export class PublicationsService {
|
||||
};
|
||||
return this.http.get<any>(`${geturl}`, options);
|
||||
}
|
||||
|
||||
CreatePublication(folderId:any,body:any){
|
||||
const geturl = environment.apiURL + 'presidentialActions/'+folderId+'/posts';
|
||||
let params = new HttpParams();
|
||||
|
||||
Reference in New Issue
Block a user