All checks were successful
Create Release / build (push) Successful in 4s
- Fix queue queries in mobile API and SSE to use twp_group_members (matching browser phone) instead of twp_queue_assignments - Auto-create personal queues if user has no extension - Make all model JSON parsing null-safe (handle null, string ints, bools) - Add AutofillGroup and autofill hints to login form - Add outbound calling with dialpad bottom sheet on dashboard Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
39 lines
1.1 KiB
Dart
39 lines
1.1 KiB
Dart
enum AgentStatusValue { available, busy, offline }
|
|
|
|
class AgentStatus {
|
|
final AgentStatusValue status;
|
|
final bool isLoggedIn;
|
|
final String? currentCallSid;
|
|
final String? lastActivity;
|
|
final bool availableForQueues;
|
|
|
|
AgentStatus({
|
|
required this.status,
|
|
required this.isLoggedIn,
|
|
this.currentCallSid,
|
|
this.lastActivity,
|
|
this.availableForQueues = true,
|
|
});
|
|
|
|
factory AgentStatus.fromJson(Map<String, dynamic> json) {
|
|
return AgentStatus(
|
|
status: _parseStatus((json['status'] ?? 'offline') as String),
|
|
isLoggedIn: json['is_logged_in'] == true || json['is_logged_in'] == 1 || json['is_logged_in'] == '1',
|
|
currentCallSid: json['current_call_sid'] as String?,
|
|
lastActivity: json['last_activity'] as String?,
|
|
availableForQueues: json['available_for_queues'] != false && json['available_for_queues'] != 0 && json['available_for_queues'] != '0',
|
|
);
|
|
}
|
|
|
|
static AgentStatusValue _parseStatus(String s) {
|
|
switch (s) {
|
|
case 'available':
|
|
return AgentStatusValue.available;
|
|
case 'busy':
|
|
return AgentStatusValue.busy;
|
|
default:
|
|
return AgentStatusValue.offline;
|
|
}
|
|
}
|
|
}
|