mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
remove console logs
This commit is contained in:
@@ -1,87 +0,0 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable, Subject, BehaviorSubject } from 'rxjs';
|
||||
import { webSocket, WebSocketSubject } from 'rxjs/webSocket';
|
||||
import { catchError, retryWhen, tap, delay } from 'rxjs/operators';
|
||||
|
||||
interface WebSocketMessage {
|
||||
type: string;
|
||||
payload: any;
|
||||
}
|
||||
|
||||
interface WebSocketError {
|
||||
type: string;
|
||||
error: any;
|
||||
}
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class MessageLiveDataSourceService {
|
||||
private socket$: WebSocketSubject<WebSocketMessage>;
|
||||
private messageSubject$: Subject<WebSocketMessage>;
|
||||
private connectionStatus$: BehaviorSubject<boolean>;
|
||||
private reconnectAttempts = 0;
|
||||
private readonly maxReconnectAttempts = 5;
|
||||
|
||||
constructor() {
|
||||
this.messageSubject$ = new Subject<WebSocketMessage>();
|
||||
this.connectionStatus$ = new BehaviorSubject<boolean>(false);
|
||||
}
|
||||
|
||||
public connect(url: string) {
|
||||
this.socket$ = webSocket<WebSocketMessage>(url);
|
||||
|
||||
this.socket$.pipe(
|
||||
tap({
|
||||
error: () => {
|
||||
this.connectionStatus$.next(false);
|
||||
}
|
||||
}),
|
||||
retryWhen(errors => errors.pipe(
|
||||
tap(() => {
|
||||
this.reconnectAttempts++;
|
||||
if (this.reconnectAttempts >= this.maxReconnectAttempts) {
|
||||
throw new Error('Max reconnect attempts reached');
|
||||
}
|
||||
}),
|
||||
delay(1000)
|
||||
))
|
||||
).subscribe(
|
||||
(message) => {
|
||||
this.messageSubject$.next(message);
|
||||
this.connectionStatus$.next(true);
|
||||
this.reconnectAttempts = 0;
|
||||
},
|
||||
(err) => {
|
||||
console.error('WebSocket connection error:', err);
|
||||
},
|
||||
() => {
|
||||
console.log('WebSocket connection closed');
|
||||
this.connectionStatus$.next(false);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public sendMessage(message: WebSocketMessage): Observable<void> {
|
||||
return new Observable<void>(observer => {
|
||||
this.socket$.next(message);
|
||||
observer.next();
|
||||
observer.complete();
|
||||
}).pipe(
|
||||
catchError(err => {
|
||||
console.error('Send message error:', err);
|
||||
return new Observable<never>(observer => {
|
||||
observer.error({ type: 'SEND_ERROR', error: err });
|
||||
});
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
public get messages$(): Observable<WebSocketMessage> {
|
||||
return this.messageSubject$.asObservable();
|
||||
}
|
||||
|
||||
public get connectionStatus(): Observable<boolean> {
|
||||
return this.connectionStatus$.asObservable();
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,7 @@ import { StreamingMedia } from '@ionic-native/streaming-media/ngx';
|
||||
import { PhotoViewer } from '@ionic-native/photo-viewer/ngx';
|
||||
import {NgxImageCompressService} from 'ngx-image-compress';
|
||||
import { CustomImageCachePageRoutingModule } from './services/file/custom-image-cache/custom-image-cache-routing.module';
|
||||
import { IonicImageLoaderComponent, IonicImageLoaderModule } from 'ionic-image-loader-v5';
|
||||
import { IonicImageLoaderModule } from 'ionic-image-loader-v5';
|
||||
import { NgxExtendedPdfViewerModule } from 'ngx-extended-pdf-viewer';
|
||||
import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
|
||||
|
||||
@@ -94,16 +94,12 @@ import { VisibilityDirective } from './services/directives/visibility.directive'
|
||||
import { DeplomaOptionsPageModule } from './shared/popover/deploma-options/deploma-options.module';
|
||||
import { DiplomaOptionsPage } from './shared/popover/deploma-options/deploma-options.page';
|
||||
import { ImageCropperModule } from 'ngx-image-cropper';
|
||||
import { metricsInterceptor, MetricsInterceptor } from './interceptors/metter.interceptor';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { metricsInterceptor } from './interceptors/metter.interceptor';
|
||||
|
||||
import {MatMenuModule} from '@angular/material/menu';
|
||||
import {MatIconModule} from '@angular/material/icon';
|
||||
import { AngularCropperjsModule } from 'angular-cropperjs';
|
||||
import { calendarReducer } from './module/agenda/data/data-source/agenda-memory-source.service';
|
||||
import { createAction, createReducer, on, StoreModule } from '@ngrx/store';
|
||||
import { ChatModule } from './module/chat/chat.module';
|
||||
import { openTelemetryLogging, OpenTelemetryLogging } from './services/monitoring/opentelemetry/logging';
|
||||
import { openTelemetryLogging } from './services/monitoring/opentelemetry/logging';
|
||||
|
||||
import { registerLocaleData } from '@angular/common';
|
||||
import localePt from '@angular/common/locales/pt';
|
||||
@@ -156,8 +152,6 @@ registerLocaleData(localePt, 'pt');
|
||||
@NgModule({
|
||||
declarations: [AppComponent, PopupQuestionPipe, InputFilterDirective],
|
||||
imports: [BrowserModule,
|
||||
StoreModule.forRoot({ calendar: calendarReducer }),
|
||||
// StoreModule.forRoot({ userTyping: typingReducer }),
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
CalendarModule.forRoot({
|
||||
|
||||
@@ -70,7 +70,7 @@ export class SocketMessageCreateUseCaseService {
|
||||
this.processedMessages.add(incomingMessage.id);
|
||||
|
||||
|
||||
console.log('create message', { incomingMessage });
|
||||
// console.log('create message', { incomingMessage });
|
||||
|
||||
tracing?.addEvent("Message Create start");
|
||||
const result = await this.messageLocalDataSourceService.insert(incomingMessage);
|
||||
|
||||
@@ -1,110 +0,0 @@
|
||||
// calendar.actions.ts
|
||||
import { createAction, props } from '@ngrx/store';
|
||||
import { createReducer, on } from '@ngrx/store';
|
||||
import { EventList, EventListStore } from 'src/app/models/agenda/AgendaEventList';
|
||||
import { createFeatureSelector, createSelector } from '@ngrx/store';
|
||||
|
||||
export const loadEvents = createAction('[Calendar] Load Events');
|
||||
export const loadEventsSuccess = createAction(
|
||||
'[Calendar] Load Events Success',
|
||||
props<{ events: EventListStore[] }>()
|
||||
);
|
||||
|
||||
export const resetList = createAction(
|
||||
'[Calendar] Reset List',
|
||||
props<{ eventSource: EventListStore[] }>()
|
||||
);
|
||||
|
||||
export const pushEvent = createAction(
|
||||
'[Calendar] Push Event',
|
||||
props<{ eventsList: EventList[], profile: 'pr' | 'md', userId: string }>()
|
||||
);
|
||||
|
||||
export const removeRangeForCalendar = createAction(
|
||||
'[Calendar] Remove Range For Calendar',
|
||||
props<{ startDate: Date, endDate: Date, userId: string }>()
|
||||
);
|
||||
|
||||
export const getRangeForCalendar = createAction(
|
||||
'[Calendar] Remove Range For Calendar',
|
||||
props<{ startDate: Date, endDate: Date, userId: string }>()
|
||||
);
|
||||
|
||||
|
||||
export const deleteAllEvents = createAction('[Calendar] Delete All Events');
|
||||
|
||||
|
||||
|
||||
// =========================================================================
|
||||
|
||||
|
||||
export interface CalendarState {
|
||||
eventSource: EventListStore[];
|
||||
}
|
||||
|
||||
export const initialState: CalendarState = {
|
||||
eventSource: []
|
||||
};
|
||||
|
||||
export const calendarReducer = createReducer(
|
||||
initialState,
|
||||
on(loadEventsSuccess, (state, { events }) => ({
|
||||
...state,
|
||||
eventSource: events
|
||||
})),
|
||||
on(resetList, (state, { eventSource }) => ({
|
||||
...state,
|
||||
eventSource
|
||||
})),
|
||||
on(pushEvent, (state, { eventsList, profile, userId }) => {
|
||||
let news = eventsList.map(element => ({
|
||||
startTime: new Date(element.StartDate),
|
||||
endTime: new Date(element.EndDate),
|
||||
allDay: false,
|
||||
event: element,
|
||||
calendarName: element.CalendarName,
|
||||
profile: profile,
|
||||
id: element.EventId,
|
||||
CalendarId: userId
|
||||
}));
|
||||
|
||||
let instance = state.eventSource.concat(news as any);
|
||||
const ids = instance.map(o => o.id);
|
||||
const filtered = instance.filter(({ id }, index) => !ids.includes(id, index + 1));
|
||||
|
||||
return {
|
||||
...state,
|
||||
eventSource: filtered
|
||||
};
|
||||
}),
|
||||
on(removeRangeForCalendar, (state, { startDate, endDate, userId }) => ({
|
||||
...state,
|
||||
eventSource: state.eventSource.filter(e =>
|
||||
!(new Date(e.endTime).getTime() >= new Date(startDate).getTime() &&
|
||||
new Date(endDate).getTime() >= new Date(e.startTime).getTime() && e.CalendarId == userId)
|
||||
)
|
||||
})),
|
||||
on(deleteAllEvents, state => ({
|
||||
...state,
|
||||
eventSource: []
|
||||
}))
|
||||
);
|
||||
|
||||
// =========================================================================
|
||||
export const selectCalendarState = createFeatureSelector<CalendarState>('calendar');
|
||||
|
||||
export const selectEventSource = createSelector(
|
||||
selectCalendarState,
|
||||
(state: CalendarState) => state.eventSource
|
||||
);
|
||||
|
||||
|
||||
// Create selector to get range of events
|
||||
export const selectEventsInRange = (startDate: Date, endDate: Date, userId: string) => createSelector(
|
||||
selectEventSource,
|
||||
(events) => events.filter(event =>
|
||||
new Date(event.startTime).getTime() >= new Date(startDate).getTime() &&
|
||||
new Date(event.endTime).getTime() <= new Date(endDate).getTime() &&
|
||||
event.CalendarId === userId
|
||||
)
|
||||
);
|
||||
@@ -17,8 +17,6 @@ import { EventUpdateInputDTOSchema } from '../dto/eventUpdateInputDtO';
|
||||
import { AttachInputDTOSchema } from '../dto/addAttachmentDTOInput';
|
||||
import { EventListDataOutputDTOSchema } from '../dto/eventListDTOOutput';
|
||||
import { EventSearchMapper } from '../../domain/mapper/EventSearchMapper';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { CalendarState } from '../data-source/agenda-memory-source.service';
|
||||
import { NativeNotificationService } from 'src/app/services/native-notification.service';
|
||||
import { ListBoxService } from 'src/app/ui/agenda/service/list-box.service';
|
||||
import { EventListStore } from 'src/app/models/agenda/AgendaEventList';
|
||||
@@ -37,7 +35,6 @@ export class AgendaDataRepositoryService {
|
||||
private agendaDataService: AgendaDataService,
|
||||
private utils: Utils,
|
||||
private agendaLocalDataSourceService: AgendaLocalDataSourceService,
|
||||
private memoryStore: Store<CalendarState>,
|
||||
private NativeNotificationService: NativeNotificationService,
|
||||
public listBoxService: ListBoxService,
|
||||
) { }
|
||||
|
||||
@@ -40,10 +40,8 @@ import { map, throttleTime } from 'rxjs/operators';
|
||||
import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
|
||||
import { isHttpError } from 'src/app/services/http.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { NotificationRepositoryService } from 'src/app/module/notification/data/notification-repository.service';
|
||||
import { EEventFilterStatus } from 'src/app/module/agenda/data/dto/enums';
|
||||
import { CalendarState, selectEventSource } from 'src/app/module/agenda/data/data-source/agenda-memory-source.service';
|
||||
// import { Unsubscribable } from '../../../../android/app/build/intermediates/assets/debug/public/assets/dexie/dist/dexie';
|
||||
|
||||
@Component({
|
||||
@@ -189,7 +187,6 @@ export class AgendaPage implements OnInit {
|
||||
showCalendarField = false
|
||||
hasChangeCalendar = false
|
||||
|
||||
eventSource$ = this.store.select(selectEventSource);
|
||||
private NotificationUpdate = new Subject<void>();
|
||||
|
||||
listenToEventNotificationSubscription!: Subscription;
|
||||
@@ -207,7 +204,6 @@ export class AgendaPage implements OnInit {
|
||||
public RoleIdService: RoleIdService,
|
||||
public AgendaDataRepositoryService: AgendaDataRepositoryService,
|
||||
private toastService: ToastService,
|
||||
private store: Store<CalendarState>,
|
||||
private notificationRepository: NotificationRepositoryService
|
||||
) {
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
export let versionData = {
|
||||
"shortSHA": "f7c78c0c3",
|
||||
"SHA": "f7c78c0c3cf5ad94ab6e5671f1036993ccb10dac",
|
||||
"shortSHA": "08f68940d",
|
||||
"SHA": "08f68940dc458518245c9bbf976e3ff9bf10e548",
|
||||
"branch": "developer",
|
||||
"lastCommitAuthor": "'Peter Maquiran'",
|
||||
"lastCommitTime": "'Wed Oct 23 15:46:02 2024 +0100'",
|
||||
"lastCommitMessage": "remove unused files",
|
||||
"lastCommitNumber": "6117",
|
||||
"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\tdeleted: src/setupProxy.js\n\tdeleted: src/shared-worker.js\n\tmodified: version/git-version.ts",
|
||||
"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",
|
||||
"changeAuthor": "peter.maquiran"
|
||||
}
|
||||
Reference in New Issue
Block a user