remove console logs

This commit is contained in:
Peter Maquiran
2024-10-25 12:23:58 +01:00
parent 41dfb448dd
commit 53497407df
8 changed files with 98 additions and 86 deletions
@@ -89,7 +89,7 @@
</span>
</div> -->
<div (click)="goToPublicationDetail(publication.DocumentId, publication.ProcessId)" class="post-content" style="background:red !important" >
<div (click)="goToPublicationDetail(publication.DocumentId, publication.ProcessId)" class="post-content" >
<div class="post-title-time">
<div class="post-title font-15-em">
<ion-label>{{publication.Title}}</ion-label>
+48 -48
View File
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { Platform } from '@ionic/angular';
//import { LocalNotifications } from '@capacitor/local-notifications';
import { LocalNotifications } from '@capacitor/local-notifications';
import { v4 as uuidv4 } from 'uuid'
@Injectable({
@@ -100,66 +100,66 @@ export class NativeNotificationService {
await this.cancelAllNotification();
// for (const event of events) {
for (const event of events) {
// const eventTime = new Date(event.start).getTime();
// const now = new Date().getTime();
const eventTime = new Date(event.start).getTime();
const now = new Date().getTime();
// // Schedule notifications for 1 hour before and 15 minutes before the event
// const oneHourBefore = eventTime - 60 * 60 * 1000;
// const fifteenMinutesBefore = eventTime - 15 * 60 * 1000;
// Schedule notifications for 1 hour before and 15 minutes before the event
const oneHourBefore = eventTime - 60 * 60 * 1000;
const fifteenMinutesBefore = eventTime - 15 * 60 * 1000;
// const timeDifference = eventTime - now;
// const oneHour = 60 * 60 * 1000; // 1 hour in milliseconds
// const fifteenMinutes = 15 * 60 * 1000; // 15 minutes in milliseconds
const timeDifference = eventTime - now;
const oneHour = 60 * 60 * 1000; // 1 hour in milliseconds
const fifteenMinutes = 15 * 60 * 1000; // 15 minutes in milliseconds
// console.log('notification to notify object', event)
// // if (timeDifference <= fifteenMinutes) {
console.log('notification to notify object', event)
// if (timeDifference <= fifteenMinutes) {
// // console.log({notification: event, e: '15 minutes'})
// // notifications.push({
// // title: 'Event Reminder',
// // body: `Reminder: ${event.Subject} starts in ${this.duration(event.start, new Date())} minutes.£`,
// // id: this.uuidTo32BitInt(event.event.id)
// // });
// // } else if (timeDifference <= oneHour) {
// console.log({notification: event, e: '15 minutes'})
// notifications.push({
// title: 'Event Reminder',
// body: `Reminder: ${event.Subject} starts in ${this.duration(event.start, new Date())} minutes.£`,
// id: this.uuidTo32BitInt(event.event.id)
// });
// } else if (timeDifference <= oneHour) {
// // console.log({notification: event, e: '1 hour.'})
// // notifications.push({
// // title: 'Event Reminder',
// // body: `Reminder: ${event.Subject} starts in ${this.duration(event.start, new Date())} hour.£`,
// // id: this.uuidTo32BitInt(event.id)
// // });
// // } else {
// // console.log("Event is more than 1 hour away.")
// console.log({notification: event, e: '1 hour.'})
// notifications.push({
// title: 'Event Reminder',
// body: `Reminder: ${event.Subject} starts in ${this.duration(event.start, new Date())} hour.£`,
// id: this.uuidTo32BitInt(event.id)
// });
// } else {
// console.log("Event is more than 1 hour away.")
// if (timeDifference >= fifteenMinutes) {
// notifications.push({
// title: 'Event Reminder',
// body: `Reminder: ${event.event.Subject} 15 minutes`,
// id: this.uuidTo32BitInt(event.id)+1,
// schedule: { at: new Date(fifteenMinutesBefore) },
// });
// console.log('15m', new Date(fifteenMinutesBefore))
if (timeDifference >= fifteenMinutes) {
notifications.push({
title: 'Event Reminder',
body: `Reminder: ${event.event.Subject} 15 minutes`,
id: this.uuidTo32BitInt(event.id)+1,
schedule: { at: new Date(fifteenMinutesBefore) },
});
console.log('15m', new Date(fifteenMinutesBefore))
// }
}
// if (timeDifference >= oneHour) {
// notifications.push({
// title: 'Event Reminder',
// body: `Reminder: ${event.event.Subject} 1 hour`,
// id: this.uuidTo32BitInt(event.id)+2,
// schedule: { at: new Date(oneHourBefore) },
// });
// console.log('1h', new Date(oneHourBefore))
// }
if (timeDifference >= oneHour) {
notifications.push({
title: 'Event Reminder',
body: `Reminder: ${event.event.Subject} 1 hour`,
id: this.uuidTo32BitInt(event.id)+2,
schedule: { at: new Date(oneHourBefore) },
});
console.log('1h', new Date(oneHourBefore))
}
// // }
// }
// }
}
// await LocalNotifications.schedule({ notifications });
await LocalNotifications.schedule({ notifications });
}
async eventNotification({eventId}) {
@@ -214,8 +214,11 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
setTimeout(() => {
this.getMessages()
}, 500)
} else {
this.listenToMessageLoadHistory()
}
setTimeout(() => {
this.subscribeToChanges()
}, 500)
@@ -352,14 +355,14 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
this.sendReadMessage()
}, 1000)
if(this.room.$id) {
this.onReconnectGetMessages()
if(this.room.id) {
this.listenToMessageLoadHistory()
}
}
}
onReconnectGetMessages() {
listenToMessageLoadHistory() {
this.messageOnReconnectSubject?.unsubscribe()
this.messageOnReconnectSubject = this.chatServiceService.listenToMessageLoadHistory({roomId: this.room.id}).subscribe((messages) => {
@@ -1,10 +1,7 @@
import { AfterViewInit, Component, ElementRef, HostListener, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { GestureController, ModalController, NavParams, PopoverController, Platform } from '@ionic/angular';
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
import { ExpedientTaskModalPageNavParamsTask } from 'src/app/models/ExpedientTaskModalPage';
import { ContactsPage } from 'src/app/ui/chat/modal/messages/contacts/contacts.page';
import { AlertService } from 'src/app/services/alert.service';
import { FileService } from 'src/app/services/functions/file.service';
import { ToastService } from 'src/app/services/toast.service';
import { ThemeService } from 'src/app/services/theme.service'
@@ -19,28 +16,22 @@ import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page';
//======
import { Subscription } from 'rxjs';
import { ChatServiceService } from 'src/app/module/chat/domain/chat-service.service';
import { EditMessagePage } from 'src/app/ui/chat/modal/edit-message/edit-message.page';
import { IMessageType, MessageAttachmentFileType, MessageAttachmentSource, MessageEntity } from 'src/app/core/chat/entity/message';
import { MemberTable } from 'src/app/infra/database/dexie/instance/chat/schema/members';
import { TypingTable } from 'src/app/infra/database/dexie/instance/chat/schema/typing';
import { compressImageBase64 } from 'src/app/utils/imageCompressore';
import { FilePickerService } from 'src/app/infra/file-picker/file-picker.service'
import { RecordingData } from 'capacitor-voice-recorder';
import { Logger } from 'src/app/services/logger/main/service';
import { ChatOptionsPopoverPage } from '../chat-options-popover/chat-options-popover.page';
import { CameraService } from 'src/app/infra/camera/camera.service'
import { FilePickerMobileService } from 'src/app/infra/file-picker/mobile/file-picker-mobile.service'
import { FilePickerWebService } from 'src/app/infra/file-picker/web/file-picker-web.service'
import { allowedDocExtension } from 'src/app/utils/allowedDocExtension';
import { createDataURL, JSFileToDataUrl } from 'src/app/utils/ToBase64';
import { JSFileToDataUrl } from 'src/app/utils/ToBase64';
import { RoomType } from "src/app/core/chat/entity/group";
import { MessageViewModal } from '../../store/model/message';
import { ChatPopoverPage } from '../chat-popover/chat-popover.page';
import { ViewOncesImagePageInput, ViewOncesImagePage } from '../view-onces/view-onces.page';
import { LastMessage } from '../../utils/lastMessage';
import { File } from '@awesome-cordova-plugins/file/ngx';
import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
import { FileSystemMobileService } from 'src/app/infra/file-system/mobile/file-system-mobile.service';
import { RoomViewModel } from '../../store/model/room';
import { RoomStore } from '../../store/roomStore'
@@ -48,8 +39,6 @@ import { EditGroupPage } from '../edit-group/edit-group.page';
import { imageMimeTypes } from 'src/app/utils/allowedImageExtension';
import { GroupContactsPage, IGroupContactsPageOutPutSchema } from '../group-contacts/group-contacts.page';
const IMAGE_DIR = 'stored-images';
@Component({
selector: 'app-messages',
templateUrl: './messages.page.html',
@@ -121,19 +110,15 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
private navParams: NavParams,
private alertService: AlertService,
private toastService: ToastService,
private fileService: FileService,
private gestureController: GestureController,
public ThemeService: ThemeService,
private platform: Platform,
private storage: Storage,
private sanitiser: DomSanitizer,
private chatServiceService: ChatServiceService,
private FilePickerService: FilePickerService,
private CameraService: CameraService,
private FilePickerMobileService: FilePickerMobileService,
private FilePickerWebService: FilePickerWebService,
private file: File,
private fileOpener: FileOpener,
private fileSystemMobileService: FileSystemMobileService,
public RoomStore: RoomStore,
) {
+5 -3
View File
@@ -92,6 +92,8 @@ export class RoomStore {
setTimeout(() => {
this.getMessages()
}, 500)
} else {
this.listenToMessageLoadHistory()
}
setTimeout(() => {
@@ -309,8 +311,8 @@ export class RoomStore {
this.sendReadMessage()
}, 1000)
if(this.room.$id) {
this.onReconnectGetMessages()
if(this.room.id) {
this.listenToMessageLoadHistory()
}
}
@@ -362,7 +364,7 @@ export class RoomStore {
}
}
onReconnectGetMessages() {
listenToMessageLoadHistory() {
this.messageOnReconnectSubject?.unsubscribe()
this.messageOnReconnectSubject = this.chatServiceService.listenToMessageLoadHistory({roomId: this.room.id}).subscribe((messages) => {