feat(v1.2.1): Integración nativa de Google Calendar UI y exportación dual offline WebView/Share

This commit is contained in:
2026-03-27 16:37:42 -03:00
parent f1da6175ae
commit ca33ed19ce
67 changed files with 995 additions and 285 deletions
@@ -1,9 +1,10 @@
import { Component, Input, OnInit } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule, ModalController } from '@ionic/angular';
import { IonicModule, ModalController, AlertController, ToastController } from '@ionic/angular';
import { EventoAcademico } from '../../services/data';
import { EventosService } from '../../services/eventos.service';
import { CapacitorCalendar } from '@ebarooni/capacitor-calendar';
@Component({
@@ -28,7 +29,9 @@ export class EventoModalComponent implements OnInit {
constructor(
private modalCtrl: ModalController,
private eventosService: EventosService
private eventosService: EventosService,
private alertCtrl: AlertController,
private toastCtrl: ToastController
) { }
ngOnInit() {
@@ -63,8 +66,52 @@ export class EventoModalComponent implements OnInit {
async eliminar() {
if (this.eventoExistente) {
await this.eventosService.deleteEvento(this.eventoExistente.id);
this.modalCtrl.dismiss(null, 'deleted');
const alert = await this.alertCtrl.create({
header: 'Eliminar Evento',
message: '¿Estás seguro que querés eliminar este hito de tu agenda?',
buttons: [
{
text: 'Cancelar',
role: 'cancel'
},
{
text: 'Eliminar',
role: 'destructive',
handler: async () => {
await this.eventosService.deleteEvento(this.eventoExistente!.id);
this.modalCtrl.dismiss(null, 'deleted');
}
}
]
});
await alert.present();
}
}
async exportarCalendario() {
try {
const startDate = new Date(this.fecha);
const endDate = new Date(startDate.getTime() + 2 * 60 * 60 * 1000); // +2 horas por defecto
let descString = this.notas || '';
if (this.link) descString += `\n\nLink de cursada: ${this.link}`;
await CapacitorCalendar.createEventWithPrompt({
title: `${this.tipo} de ${this.materiaNombre}`,
description: descString,
location: this.aula ? `Aula ${this.aula}, Universidad de la Ciudad` : 'Universidad de la Ciudad',
startDate: startDate.getTime(),
endDate: endDate.getTime(),
isAllDay: false
});
} catch (e) {
console.error('Error abriendo enlace de Calendario:', e);
const toast = await this.toastCtrl.create({
message: 'No pudimos abrir tu Calendario. Verificá si tenés una app instalada.',
duration: 2500, color: 'warning'
});
toast.present();
}
}
}