feat: migrate Flutter to Cupertino with daily logs and computer groups
This commit is contained in:
1 parent
c568749d23
commit
87e1fff59b
22 files changed
+808
-55
No files matched your search
@@ -12,6 +12,7 @@ import '../data/agent_service.dart';
|
||||
class AgentModel extends ChangeNotifier {
|
||||
AgentModel(this.repository);
|
||||
final AgentRepository repository;
|
||||
void Function(String)? onLog;
|
||||
List<ManagedAgent> _agents = [];
|
||||
List<ManagedAgent> get agents => List.unmodifiable(_agents);
|
||||
String? selectedId, selectedPhone;
|
||||
@@ -111,6 +112,7 @@ class AgentModel extends ChangeNotifier {
|
||||
if (busy || _disposed) {
|
||||
return;
|
||||
}
|
||||
final previousNotice = notice;
|
||||
busy = true;
|
||||
_notify();
|
||||
try {
|
||||
@@ -118,6 +120,7 @@ class AgentModel extends ChangeNotifier {
|
||||
} catch (error) {
|
||||
notice = repository.redact(error.toString());
|
||||
} finally {
|
||||
if (notice != previousNotice) onLog?.call(notice);
|
||||
busy = false;
|
||||
_notify();
|
||||
}
|
||||
@@ -241,9 +244,11 @@ class AgentModel extends ChangeNotifier {
|
||||
_cursor = page['next'] as int;
|
||||
for (final value in page['entries']! as List<Object?>) {
|
||||
final line = value! as Map<String, Object?>;
|
||||
logText += repository.redact(
|
||||
'${line['time']} ${line['level']} ${line['message']}\n',
|
||||
final text = repository.redact(
|
||||
'${line['time']} ${line['level']} ${line['message']}',
|
||||
);
|
||||
logText += '$text\n';
|
||||
onLog?.call('[${selectedId ?? "local"}] $text');
|
||||
}
|
||||
if (logText.length > 100000) {
|
||||
logText = logText.substring(logText.length - 100000);
|
||||
|
||||
Reference in new issue
Block a user