feat: Refactor code structure and optimize performance across multiple modules
This commit is contained in:
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import 'package:graphql_flutter/graphql_flutter.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
import 'package:krow/core/application/clients/api/api_client.dart';
|
||||
import 'package:krow/core/application/clients/api/api_exception.dart';
|
||||
import 'package:krow/features/clock_manual/data/clock_manual_gql.dart';
|
||||
|
||||
@singleton
|
||||
class NotificationsApiProvider {
|
||||
final ApiClient _client;
|
||||
|
||||
NotificationsApiProvider({required ApiClient client}) : _client = client;
|
||||
|
||||
Future<void> trackClientClockin(String positionStaffId) async {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
import 'package:krow/features/notificatins/domain/notification_entity.dart';
|
||||
|
||||
import '../domain/notification_repository.dart';
|
||||
import 'notifications_api_provider.dart';
|
||||
|
||||
@Singleton(as: NotificationsRepository)
|
||||
class NotificationsRepositoryImpl implements NotificationsRepository {
|
||||
final NotificationsApiProvider apiProvider;
|
||||
|
||||
NotificationsRepositoryImpl({required this.apiProvider});
|
||||
|
||||
@override
|
||||
Future<List<NotificationEntity>> fetchNotifications() async {
|
||||
try {
|
||||
// final response = await apiProvider.fetchNotifications();
|
||||
// return response;
|
||||
if (!kDebugMode) {
|
||||
return [
|
||||
NotificationEntity(
|
||||
id: '1',
|
||||
title: 'Test Notification',
|
||||
body: 'This is a test notification',
|
||||
type: NotificationType.general,
|
||||
dateTime: DateTime.now(),
|
||||
),
|
||||
NotificationEntity(
|
||||
id: '2',
|
||||
title: 'Invoice Notification',
|
||||
body: 'This is an invoice notification',
|
||||
type: NotificationType.invoice,
|
||||
dateTime: DateTime.now().subtract(Duration(days: 1)),
|
||||
),
|
||||
];
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
} catch (e) {
|
||||
debugPrint('Error fetching notifications: $e');
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> readNotification(String id) async {}
|
||||
}
|
||||
Reference in New Issue
Block a user