dev merge
This commit is contained in:
@@ -2,7 +2,6 @@ import 'package:krow_core/core.dart';
|
||||
|
||||
/// Represents the arguments required for the [ClockInUseCase].
|
||||
class ClockInArguments extends UseCaseArgument {
|
||||
|
||||
/// Creates a [ClockInArguments] instance.
|
||||
const ClockInArguments({
|
||||
required this.shiftId,
|
||||
@@ -18,6 +17,7 @@ class ClockInArguments extends UseCaseArgument {
|
||||
this.proofTimestamp,
|
||||
this.attestationProvider,
|
||||
this.attestationToken,
|
||||
this.sourceType = 'GEO',
|
||||
});
|
||||
|
||||
/// The ID of the shift to clock in to.
|
||||
@@ -59,14 +59,16 @@ class ClockInArguments extends UseCaseArgument {
|
||||
/// Signed attestation token from the device integrity API.
|
||||
final String? attestationToken;
|
||||
|
||||
/// The source type of the clock-in (e.g. 'GEO', 'NFC', 'QR').
|
||||
final String sourceType;
|
||||
|
||||
/// Serializes the arguments to a JSON map for the V2 API request body.
|
||||
///
|
||||
/// Only includes non-null fields. The `sourceType` is inferred from
|
||||
/// whether [nfcTagId] is present.
|
||||
/// Only includes non-null fields.
|
||||
Map<String, dynamic> toJson() {
|
||||
return <String, dynamic>{
|
||||
'shiftId': shiftId,
|
||||
'sourceType': nfcTagId != null ? 'NFC' : 'GEO',
|
||||
'sourceType': sourceType,
|
||||
if (notes != null && notes!.isNotEmpty) 'notes': notes,
|
||||
if (deviceId != null) 'deviceId': deviceId,
|
||||
if (latitude != null) 'latitude': latitude,
|
||||
@@ -101,5 +103,6 @@ class ClockInArguments extends UseCaseArgument {
|
||||
proofTimestamp,
|
||||
attestationProvider,
|
||||
attestationToken,
|
||||
sourceType,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ class ClockOutArguments extends UseCaseArgument {
|
||||
this.proofTimestamp,
|
||||
this.attestationProvider,
|
||||
this.attestationToken,
|
||||
this.sourceType = 'GEO',
|
||||
});
|
||||
|
||||
/// Optional notes provided by the user during clock-out.
|
||||
@@ -62,14 +63,16 @@ class ClockOutArguments extends UseCaseArgument {
|
||||
/// Signed attestation token from the device integrity API.
|
||||
final String? attestationToken;
|
||||
|
||||
/// The source type of the clock-out (e.g. 'GEO', 'NFC', 'QR').
|
||||
final String sourceType;
|
||||
|
||||
/// Serializes the arguments to a JSON map for the V2 API request body.
|
||||
///
|
||||
/// Only includes non-null fields. The `sourceType` is inferred from
|
||||
/// whether [nfcTagId] is present.
|
||||
/// Only includes non-null fields.
|
||||
Map<String, dynamic> toJson() {
|
||||
return <String, dynamic>{
|
||||
if (shiftId != null) 'shiftId': shiftId,
|
||||
'sourceType': nfcTagId != null ? 'NFC' : 'GEO',
|
||||
'sourceType': sourceType,
|
||||
if (notes != null && notes!.isNotEmpty) 'notes': notes,
|
||||
if (breakTimeMinutes != null) 'breakMinutes': breakTimeMinutes,
|
||||
if (deviceId != null) 'deviceId': deviceId,
|
||||
@@ -106,5 +109,6 @@ class ClockOutArguments extends UseCaseArgument {
|
||||
proofTimestamp,
|
||||
attestationProvider,
|
||||
attestationToken,
|
||||
sourceType,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -213,6 +213,7 @@ class ClockInBloc extends Bloc<ClockInEvent, ClockInState>
|
||||
longitude: location?.longitude,
|
||||
accuracyMeters: location?.accuracy,
|
||||
capturedAt: location?.timestamp,
|
||||
sourceType: event.sourceType,
|
||||
overrideReason: geofenceState.isGeofenceOverridden
|
||||
? geofenceState.overrideNotes
|
||||
: null,
|
||||
@@ -291,6 +292,7 @@ class ClockInBloc extends Bloc<ClockInEvent, ClockInState>
|
||||
longitude: location?.longitude,
|
||||
accuracyMeters: location?.accuracy,
|
||||
capturedAt: location?.timestamp,
|
||||
sourceType: event.sourceType,
|
||||
overrideReason: currentGeofence.isGeofenceOverridden
|
||||
? currentGeofence.overrideNotes
|
||||
: null,
|
||||
|
||||
@@ -47,6 +47,7 @@ class CheckInRequested extends ClockInEvent {
|
||||
this.clockInGreetingBody = '',
|
||||
this.leftGeofenceTitle = '',
|
||||
this.leftGeofenceBody = '',
|
||||
this.sourceType = 'GEO',
|
||||
});
|
||||
|
||||
/// The ID of the shift to clock into.
|
||||
@@ -67,6 +68,9 @@ class CheckInRequested extends ClockInEvent {
|
||||
/// Localized body for the left-geofence background notification.
|
||||
final String leftGeofenceBody;
|
||||
|
||||
/// The source type of the clock-in (e.g. 'GEO', 'NFC', 'QR').
|
||||
final String sourceType;
|
||||
|
||||
@override
|
||||
List<Object?> get props => <Object?>[
|
||||
shiftId,
|
||||
@@ -75,6 +79,7 @@ class CheckInRequested extends ClockInEvent {
|
||||
clockInGreetingBody,
|
||||
leftGeofenceTitle,
|
||||
leftGeofenceBody,
|
||||
sourceType,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -85,6 +90,7 @@ class CheckOutRequested extends ClockInEvent {
|
||||
this.breakTimeMinutes,
|
||||
this.clockOutTitle = '',
|
||||
this.clockOutBody = '',
|
||||
this.sourceType = 'GEO',
|
||||
});
|
||||
|
||||
/// Optional notes provided by the user.
|
||||
@@ -99,12 +105,16 @@ class CheckOutRequested extends ClockInEvent {
|
||||
/// Localized body for the clock-out notification.
|
||||
final String clockOutBody;
|
||||
|
||||
/// The source type of the clock-out (e.g. 'GEO', 'NFC', 'QR').
|
||||
final String sourceType;
|
||||
|
||||
@override
|
||||
List<Object?> get props => <Object?>[
|
||||
notes,
|
||||
breakTimeMinutes,
|
||||
clockOutTitle,
|
||||
clockOutBody,
|
||||
sourceType,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user