diff options
author | Scott Murray <scott.murray@konsulko.com> | 2023-09-14 14:01:24 -0400 |
---|---|---|
committer | Scott Murray <scott.murray@konsulko.com> | 2023-09-14 14:37:02 -0400 |
commit | cbbb9f40e283d12f6c52ad28609516f390316f7a (patch) | |
tree | d8d2cd8f4641299dd35a3138c0e28f11443928d6 /lib/homescreen.dart | |
parent | 5ce59ba69f1451ec18c565b7b18301856553f574 (diff) |
Rework to use KUKSA.val databroker gRPC API
Rework to move from the WebSocket API with the older KUKSA.val
server to the gRPC "VAL" API of the databroker.
Changes include:
- All VISS WebSocket API code has been removed, and the signal
providers replumbed to be driven by a new VssClient class with
a homescreen-specific child class to hold all the gRPC API
handling.
- The generated code for the VAL API and its dependencies has
been checked in under lib/generated, as there still does not
seem to be a good way to generate it during the Flutter build.
- The configuration file is now expected to be "homescreen.yaml"
instead of "homescreen_config.yaml". The authorization token
field name has been renamed to "authorization", and there are
new "use-tls" and "ca-certificate" configuration fields. TLS
is disabled by default for now, and the default CA certificate
is /etc/kuksa.val/CA.pem.
- Updated .gitignore to cover a couple of generated files that
weren't included.
Bug-AGL: SPEC-4762, SPEC-4903
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Change-Id: I1b95ed27a72435364d54ec846f2be88e3d8bb092
Diffstat (limited to 'lib/homescreen.dart')
-rw-r--r-- | lib/homescreen.dart | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/lib/homescreen.dart b/lib/homescreen.dart index 7501292..be9c7ca 100644 --- a/lib/homescreen.dart +++ b/lib/homescreen.dart @@ -1,24 +1,26 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_homescreen/config.dart'; import 'package:grpc/grpc.dart'; import 'package:flutter_homescreen/generated/applauncher.pbgrpc.dart'; import 'package:flutter_homescreen/page_apps.dart'; import 'package:flutter_homescreen/widget_clock.dart'; import 'package:flutter_homescreen/bottom_panel.dart'; +import 'package:flutter_homescreen/vehicle-signals/vss_client.dart'; +import 'package:flutter_homescreen/vehicle-signals/vss_provider.dart'; enum PageIndex { home, dashboard, hvac, media } -class Homescreen extends StatefulWidget { - Homescreen({Key? key, required this.client}) : super(key: key); - final HttpClient client; +class Homescreen extends ConsumerStatefulWidget { + Homescreen({Key? key}) : super(key: key); @override _HomescreenState createState() => _HomescreenState(); } -class _HomescreenState extends State<Homescreen> with TickerProviderStateMixin { +class _HomescreenState extends ConsumerState<Homescreen> with TickerProviderStateMixin { int _selectedIndex = 0; int _previousIndex = 0; @@ -26,6 +28,7 @@ class _HomescreenState extends State<Homescreen> with TickerProviderStateMixin { late AppLauncherClient stub; List<String> apps_stack = []; static const agl_shell_channel = MethodChannel('flutter/agl_shell'); + late VssClient vss; Future<List<AppInfo>> getAppList() async { var response = await stub.listApplications(ListRequest()); @@ -34,6 +37,7 @@ class _HomescreenState extends State<Homescreen> with TickerProviderStateMixin { debugPrint("$info"); } return response.apps; + return []; } addAppToStack(String id) { @@ -90,7 +94,7 @@ class _HomescreenState extends State<Homescreen> with TickerProviderStateMixin { } initState() { - debugPrint("_HomescreenState.initState!"); + //debugPrint("_HomescreenState.initState!"); channel = ClientChannel('localhost', port: 50052, options: ChannelOptions(credentials: ChannelCredentials.insecure())); @@ -99,6 +103,9 @@ class _HomescreenState extends State<Homescreen> with TickerProviderStateMixin { handleAppStatusEvents(); + vss = ref.read(vssClientProvider); + vss.run(); + super.initState(); } @@ -276,16 +283,11 @@ class _HomescreenState extends State<Homescreen> with TickerProviderStateMixin { child: _childForIndex(_selectedIndex), ), ), - Stack(children: [ - BottomPanelWidget( - height: railSize, - color: NavigationBarTheme.of(context).backgroundColor), - Align( - alignment: Alignment.bottomLeft, - child: GetConfig(client: widget.client)) - ]), - ], - ), + BottomPanelWidget( + height: railSize, + color: NavigationBarTheme.of(context).backgroundColor + ) + ]) ); } } |