mirror of
https://github.com/rzuasti/oott.git
synced 2026-07-08 19:21:54 +02:00
Add devices screen to the Flutter frontend
Lists devices with New/Registered/All filtering, pull-to-refresh, device-type icons, and visual differentiation between new and registered devices. Introduces a reusable StatusBadge widget for colour-coded labels. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
6d72ba7202
commit
d0b9855bad
@@ -4,6 +4,7 @@ import 'package:dio/dio.dart';
|
||||
import 'package:encrypter/encrypter/xor.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:frontend/utils/pref_utils.dart';
|
||||
import '../model/device.dart';
|
||||
import '../model/notification.dart';
|
||||
|
||||
class BackendAPI {
|
||||
@@ -82,6 +83,21 @@ class BackendAPI {
|
||||
await _dio.post('/notifications/mark_all_as_old');
|
||||
}
|
||||
|
||||
Future<List<Device>> listDevices({bool? isRegistered}) async {
|
||||
debugPrint('About to call /devices');
|
||||
|
||||
final params = <String, dynamic>{};
|
||||
if (isRegistered != null) params['is_registered'] = isRegistered;
|
||||
|
||||
final response = await _dio.get('/devices', queryParameters: params);
|
||||
|
||||
debugPrint('Received: ${response.data}');
|
||||
|
||||
return (response.data as List)
|
||||
.map((item) => Device.fromJson(item as Map<String, dynamic>))
|
||||
.toList();
|
||||
}
|
||||
|
||||
Future<List<Notification>> listNotifications(bool? isNew, int offset) async {
|
||||
debugPrint('About to call /notifications');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user