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
+29 -8
View File
@@ -32,6 +32,7 @@
"@awesome-cordova-plugins/ffmpeg": "^6.6.0",
"@awesome-cordova-plugins/file": "^5.41.0",
"@awesome-cordova-plugins/file-opener": "^5.41.0",
"@awesome-cordova-plugins/local-notifications": "^6.9.0",
"@awesome-cordova-plugins/media-capture": "^6.4.0",
"@awesome-cordova-plugins/multiple-document-picker": "^5.40.0",
"@capacitor-community/fcm": "^5.0.2",
@@ -45,7 +46,7 @@
"@capacitor/haptics": "^4.1.0",
"@capacitor/ios": "^5.4.2",
"@capacitor/keyboard": "^4.1.0",
"@capacitor/local-notifications": "^6.0.0",
"@capacitor/local-notifications": "^5.0.8",
"@capacitor/network": "^4.1.0",
"@capacitor/push-notifications": "^5.1.0",
"@capacitor/share": "^4.1.0",
@@ -1947,6 +1948,18 @@
"rxjs": "^5.5.0 || ^6.5.0 || ^7.3.0"
}
},
"node_modules/@awesome-cordova-plugins/local-notifications": {
"version": "6.9.0",
"resolved": "https://registry.npmjs.org/@awesome-cordova-plugins/local-notifications/-/local-notifications-6.9.0.tgz",
"integrity": "sha512-EMS3irV2B1Du17JtKHggc98/mBQaufuStgsbFTIALklMC03OQmXBRbkfEbzdxfpbi35z+VTldyBQXyKaPULfTw==",
"dependencies": {
"@types/cordova": "latest"
},
"peerDependencies": {
"@awesome-cordova-plugins/core": "^6.0.1",
"rxjs": "^5.5.0 || ^6.5.0 || ^7.3.0"
}
},
"node_modules/@awesome-cordova-plugins/media-capture": {
"version": "6.4.0",
"resolved": "https://registry.npmjs.org/@awesome-cordova-plugins/media-capture/-/media-capture-6.4.0.tgz",
@@ -4105,11 +4118,11 @@
}
},
"node_modules/@capacitor/local-notifications": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/@capacitor/local-notifications/-/local-notifications-6.0.0.tgz",
"integrity": "sha512-a/g/ZlPgaBXue374oNzGvvNZWNpnclfcLzfE/P/PjhHxdHsM7J3OK0IfmjrEsRiON4AEIga+dkHi5yBjNAHCFw==",
"version": "5.0.8",
"resolved": "https://registry.npmjs.org/@capacitor/local-notifications/-/local-notifications-5.0.8.tgz",
"integrity": "sha512-rNmEF1OntokzcKtb4H9hAF//4Z6svWxRlzlNHP3Am7Q9WdNScmq/KjolX4Z9tLGHapF6JfBytdADih5KHjB45A==",
"peerDependencies": {
"@capacitor/core": "^6.0.0"
"@capacitor/core": "^5.0.0"
}
},
"node_modules/@capacitor/network": {
@@ -45837,6 +45850,14 @@
"@types/cordova": "latest"
}
},
"@awesome-cordova-plugins/local-notifications": {
"version": "6.9.0",
"resolved": "https://registry.npmjs.org/@awesome-cordova-plugins/local-notifications/-/local-notifications-6.9.0.tgz",
"integrity": "sha512-EMS3irV2B1Du17JtKHggc98/mBQaufuStgsbFTIALklMC03OQmXBRbkfEbzdxfpbi35z+VTldyBQXyKaPULfTw==",
"requires": {
"@types/cordova": "latest"
}
},
"@awesome-cordova-plugins/media-capture": {
"version": "6.4.0",
"resolved": "https://registry.npmjs.org/@awesome-cordova-plugins/media-capture/-/media-capture-6.4.0.tgz",
@@ -47364,9 +47385,9 @@
"requires": {}
},
"@capacitor/local-notifications": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/@capacitor/local-notifications/-/local-notifications-6.0.0.tgz",
"integrity": "sha512-a/g/ZlPgaBXue374oNzGvvNZWNpnclfcLzfE/P/PjhHxdHsM7J3OK0IfmjrEsRiON4AEIga+dkHi5yBjNAHCFw==",
"version": "5.0.8",
"resolved": "https://registry.npmjs.org/@capacitor/local-notifications/-/local-notifications-5.0.8.tgz",
"integrity": "sha512-rNmEF1OntokzcKtb4H9hAF//4Z6svWxRlzlNHP3Am7Q9WdNScmq/KjolX4Z9tLGHapF6JfBytdADih5KHjB45A==",
"requires": {}
},
"@capacitor/network": {
+2 -1
View File
@@ -51,6 +51,7 @@
"@awesome-cordova-plugins/ffmpeg": "^6.6.0",
"@awesome-cordova-plugins/file": "^5.41.0",
"@awesome-cordova-plugins/file-opener": "^5.41.0",
"@awesome-cordova-plugins/local-notifications": "^6.9.0",
"@awesome-cordova-plugins/media-capture": "^6.4.0",
"@awesome-cordova-plugins/multiple-document-picker": "^5.40.0",
"@capacitor-community/fcm": "^5.0.2",
@@ -64,7 +65,7 @@
"@capacitor/haptics": "^4.1.0",
"@capacitor/ios": "^5.4.2",
"@capacitor/keyboard": "^4.1.0",
"@capacitor/local-notifications": "^6.0.0",
"@capacitor/local-notifications": "^5.0.8",
"@capacitor/network": "^4.1.0",
"@capacitor/push-notifications": "^5.1.0",
"@capacitor/share": "^4.1.0",
@@ -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) => {
+6 -6
View File
@@ -1,11 +1,11 @@
export let versionData = {
"shortSHA": "08f68940d",
"SHA": "08f68940dc458518245c9bbf976e3ff9bf10e548",
"shortSHA": "41dfb448d",
"SHA": "41dfb448ddc5f204fa034017473aebcac1af21e1",
"branch": "developer",
"lastCommitAuthor": "'Peter Maquiran'",
"lastCommitTime": "'Wed Oct 23 15:47:37 2024 +0100'",
"lastCommitMessage": "delete unused files",
"lastCommitNumber": "6118",
"changeStatus": "On branch developer\nYour branch is up to date with 'origin/developer'.\n\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tdeleted: nice.ts\n\tmodified: src/app/app.module.ts\n\tmodified: src/app/core/chat/usecase/socket/socket-message-create-use-case.service.ts\n\tdeleted: src/app/module/agenda/data/data-source/agenda-memory-source.service.ts\n\tmodified: src/app/module/agenda/data/repository/agenda-data-repository.service.ts\n\tmodified: src/app/ui/agenda/agenda.page.ts",
"lastCommitTime": "'Thu Oct 24 10:50:46 2024 +0100'",
"lastCommitMessage": "remove console logs",
"lastCommitNumber": "6119",
"changeStatus": "On branch developer\nYour branch is ahead of 'origin/developer' by 1 commit.\n (use \"git push\" to publish your local commits)\n\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: package-lock.json\n\tmodified: package.json\n\tmodified: src/app/pages/publications/view-publications/view-publications.page.html\n\tmodified: src/app/services/native-notification.service.ts\n\tmodified: src/app/ui/chat/component/messages/messages.page.ts\n\tmodified: src/app/ui/chat/modal/messages/messages.page.ts\n\tmodified: src/app/ui/chat/store/roomStore.ts\n\tmodified: version/git-version.ts",
"changeAuthor": "peter.maquiran"
}