From 6edbf3ac39d9a7f27961ef64ba91ada8ed818f91 Mon Sep 17 00:00:00 2001 From: Daniel Ponte Date: Sat, 19 Oct 2024 23:26:55 -0400 Subject: [PATCH] fix --- android/app/build.gradle | 3 +- android/settings.gradle | 2 +- lib/controller/stillbox.dart | 5 +- lib/pb/stillbox.pb.dart | 177 ++++++++++++++++++++++++++--------- lib/pb/stillbox.pbjson.dart | 52 +++++++--- lib/views/keypad.dart | 14 +++ lib/views/lcd.dart | 117 +++++++++++++++-------- protobuf/stillbox.proto | 18 +++- 8 files changed, 281 insertions(+), 107 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index a0a9029..2a19dee 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -8,7 +8,8 @@ plugins { android { namespace = "me.dynatron.calls" compileSdk = flutter.compileSdkVersion - ndkVersion = flutter.ndkVersion + // ndkVersion = flutter.ndkVersion + ndkVersion = "25.1.8937393" compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 diff --git a/android/settings.gradle b/android/settings.gradle index 536165d..91bc9cc 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -18,7 +18,7 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "7.3.0" apply false + id "com.android.application" version "8.3.2" apply false id "org.jetbrains.kotlin.android" version "1.7.10" apply false } diff --git a/lib/controller/stillbox.dart b/lib/controller/stillbox.dart index 7067483..9afee64 100644 --- a/lib/controller/stillbox.dart +++ b/lib/controller/stillbox.dart @@ -131,10 +131,11 @@ class Stillbox extends ChangeNotifier { case Message_ToClientMessage.notification: case Message_ToClientMessage.popup: case Message_ToClientMessage.error: - case Message_ToClientMessage.tgInfo: - tgCache.handleTgInfo(msg.tgInfo); case Message_ToClientMessage.hello: version = msg.hello.version; + case Message_ToClientMessage.response: + final response = msg.response; + tgCache.handleTgInfo(response.tgInfo); default: } } diff --git a/lib/pb/stillbox.pb.dart b/lib/pb/stillbox.pb.dart index 8fc3dcc..be09062 100644 --- a/lib/pb/stillbox.pb.dart +++ b/lib/pb/stillbox.pb.dart @@ -21,8 +21,8 @@ import 'stillbox.pbenum.dart'; export 'stillbox.pbenum.dart'; enum Message_ToClientMessage { + response, call, - tgInfo, notification, popup, error, @@ -32,20 +32,20 @@ enum Message_ToClientMessage { class Message extends $pb.GeneratedMessage { factory Message({ + CommandResponse? response, Call? call, - TalkgroupInfo? tgInfo, Notification? notification, UserPopup? popup, Error? error, Hello? hello, }) { final $result = create(); + if (response != null) { + $result.response = response; + } if (call != null) { $result.call = call; } - if (tgInfo != null) { - $result.tgInfo = tgInfo; - } if (notification != null) { $result.notification = notification; } @@ -65,8 +65,8 @@ class Message extends $pb.GeneratedMessage { factory Message.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); static const $core.Map<$core.int, Message_ToClientMessage> _Message_ToClientMessageByTag = { - 1 : Message_ToClientMessage.call, - 2 : Message_ToClientMessage.tgInfo, + 1 : Message_ToClientMessage.response, + 2 : Message_ToClientMessage.call, 3 : Message_ToClientMessage.notification, 4 : Message_ToClientMessage.popup, 5 : Message_ToClientMessage.error, @@ -75,8 +75,8 @@ class Message extends $pb.GeneratedMessage { }; static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Message', package: const $pb.PackageName(_omitMessageNames ? '' : 'stillbox'), createEmptyInstance: create) ..oo(0, [1, 2, 3, 4, 5, 6]) - ..aOM(1, _omitFieldNames ? '' : 'call', subBuilder: Call.create) - ..aOM(2, _omitFieldNames ? '' : 'tgInfo', subBuilder: TalkgroupInfo.create) + ..aOM(1, _omitFieldNames ? '' : 'response', subBuilder: CommandResponse.create) + ..aOM(2, _omitFieldNames ? '' : 'call', subBuilder: Call.create) ..aOM(3, _omitFieldNames ? '' : 'notification', subBuilder: Notification.create) ..aOM(4, _omitFieldNames ? '' : 'popup', subBuilder: UserPopup.create) ..aOM(5, _omitFieldNames ? '' : 'error', subBuilder: Error.create) @@ -109,26 +109,26 @@ class Message extends $pb.GeneratedMessage { void clearToClientMessage() => clearField($_whichOneof(0)); @$pb.TagNumber(1) - Call get call => $_getN(0); + CommandResponse get response => $_getN(0); @$pb.TagNumber(1) - set call(Call v) { setField(1, v); } + set response(CommandResponse v) { setField(1, v); } @$pb.TagNumber(1) - $core.bool hasCall() => $_has(0); + $core.bool hasResponse() => $_has(0); @$pb.TagNumber(1) - void clearCall() => clearField(1); + void clearResponse() => clearField(1); @$pb.TagNumber(1) - Call ensureCall() => $_ensure(0); + CommandResponse ensureResponse() => $_ensure(0); @$pb.TagNumber(2) - TalkgroupInfo get tgInfo => $_getN(1); + Call get call => $_getN(1); @$pb.TagNumber(2) - set tgInfo(TalkgroupInfo v) { setField(2, v); } + set call(Call v) { setField(2, v); } @$pb.TagNumber(2) - $core.bool hasTgInfo() => $_has(1); + $core.bool hasCall() => $_has(1); @$pb.TagNumber(2) - void clearTgInfo() => clearField(2); + void clearCall() => clearField(2); @$pb.TagNumber(2) - TalkgroupInfo ensureTgInfo() => $_ensure(1); + Call ensureCall() => $_ensure(1); @$pb.TagNumber(3) Notification get notification => $_getN(2); @@ -175,6 +175,85 @@ class Message extends $pb.GeneratedMessage { Hello ensureHello() => $_ensure(5); } +enum CommandResponse_CommandResponse { + tgInfo, + notSet +} + +class CommandResponse extends $pb.GeneratedMessage { + factory CommandResponse({ + $fixnum.Int64? commandId, + TalkgroupInfo? tgInfo, + }) { + final $result = create(); + if (commandId != null) { + $result.commandId = commandId; + } + if (tgInfo != null) { + $result.tgInfo = tgInfo; + } + return $result; + } + CommandResponse._() : super(); + factory CommandResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory CommandResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static const $core.Map<$core.int, CommandResponse_CommandResponse> _CommandResponse_CommandResponseByTag = { + 2 : CommandResponse_CommandResponse.tgInfo, + 0 : CommandResponse_CommandResponse.notSet + }; + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'CommandResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'stillbox'), createEmptyInstance: create) + ..oo(0, [2]) + ..aInt64(1, _omitFieldNames ? '' : 'commandId') + ..aOM(2, _omitFieldNames ? '' : 'tgInfo', subBuilder: TalkgroupInfo.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + CommandResponse clone() => CommandResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + CommandResponse copyWith(void Function(CommandResponse) updates) => super.copyWith((message) => updates(message as CommandResponse)) as CommandResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static CommandResponse create() => CommandResponse._(); + CommandResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static CommandResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static CommandResponse? _defaultInstance; + + CommandResponse_CommandResponse whichCommandResponse() => _CommandResponse_CommandResponseByTag[$_whichOneof(0)]!; + void clearCommandResponse() => clearField($_whichOneof(0)); + + @$pb.TagNumber(1) + $fixnum.Int64 get commandId => $_getI64(0); + @$pb.TagNumber(1) + set commandId($fixnum.Int64 v) { $_setInt64(0, v); } + @$pb.TagNumber(1) + $core.bool hasCommandId() => $_has(0); + @$pb.TagNumber(1) + void clearCommandId() => clearField(1); + + @$pb.TagNumber(2) + TalkgroupInfo get tgInfo => $_getN(1); + @$pb.TagNumber(2) + set tgInfo(TalkgroupInfo v) { setField(2, v); } + @$pb.TagNumber(2) + $core.bool hasTgInfo() => $_has(1); + @$pb.TagNumber(2) + void clearTgInfo() => clearField(2); + @$pb.TagNumber(2) + TalkgroupInfo ensureTgInfo() => $_ensure(1); +} + class Call extends $pb.GeneratedMessage { factory Call({ $core.String? audioName, @@ -620,11 +699,15 @@ enum Command_Command { class Command extends $pb.GeneratedMessage { factory Command({ + $fixnum.Int64? commandId, Live? liveCommand, Search? searchCommand, Talkgroup? tgCommand, }) { final $result = create(); + if (commandId != null) { + $result.commandId = commandId; + } if (liveCommand != null) { $result.liveCommand = liveCommand; } @@ -641,16 +724,17 @@ class Command extends $pb.GeneratedMessage { factory Command.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); static const $core.Map<$core.int, Command_Command> _Command_CommandByTag = { - 1 : Command_Command.liveCommand, - 2 : Command_Command.searchCommand, - 3 : Command_Command.tgCommand, + 2 : Command_Command.liveCommand, + 3 : Command_Command.searchCommand, + 4 : Command_Command.tgCommand, 0 : Command_Command.notSet }; static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Command', package: const $pb.PackageName(_omitMessageNames ? '' : 'stillbox'), createEmptyInstance: create) - ..oo(0, [1, 2, 3]) - ..aOM(1, _omitFieldNames ? '' : 'liveCommand', subBuilder: Live.create) - ..aOM(2, _omitFieldNames ? '' : 'searchCommand', subBuilder: Search.create) - ..aOM(3, _omitFieldNames ? '' : 'tgCommand', subBuilder: Talkgroup.create) + ..oo(0, [2, 3, 4]) + ..aInt64(1, _omitFieldNames ? '' : 'commandId') + ..aOM(2, _omitFieldNames ? '' : 'liveCommand', subBuilder: Live.create) + ..aOM(3, _omitFieldNames ? '' : 'searchCommand', subBuilder: Search.create) + ..aOM(4, _omitFieldNames ? '' : 'tgCommand', subBuilder: Talkgroup.create) ..hasRequiredFields = false ; @@ -679,37 +763,46 @@ class Command extends $pb.GeneratedMessage { void clearCommand() => clearField($_whichOneof(0)); @$pb.TagNumber(1) - Live get liveCommand => $_getN(0); + $fixnum.Int64 get commandId => $_getI64(0); @$pb.TagNumber(1) - set liveCommand(Live v) { setField(1, v); } + set commandId($fixnum.Int64 v) { $_setInt64(0, v); } @$pb.TagNumber(1) - $core.bool hasLiveCommand() => $_has(0); + $core.bool hasCommandId() => $_has(0); @$pb.TagNumber(1) - void clearLiveCommand() => clearField(1); - @$pb.TagNumber(1) - Live ensureLiveCommand() => $_ensure(0); + void clearCommandId() => clearField(1); @$pb.TagNumber(2) - Search get searchCommand => $_getN(1); + Live get liveCommand => $_getN(1); @$pb.TagNumber(2) - set searchCommand(Search v) { setField(2, v); } + set liveCommand(Live v) { setField(2, v); } @$pb.TagNumber(2) - $core.bool hasSearchCommand() => $_has(1); + $core.bool hasLiveCommand() => $_has(1); @$pb.TagNumber(2) - void clearSearchCommand() => clearField(2); + void clearLiveCommand() => clearField(2); @$pb.TagNumber(2) - Search ensureSearchCommand() => $_ensure(1); + Live ensureLiveCommand() => $_ensure(1); @$pb.TagNumber(3) - Talkgroup get tgCommand => $_getN(2); + Search get searchCommand => $_getN(2); @$pb.TagNumber(3) - set tgCommand(Talkgroup v) { setField(3, v); } + set searchCommand(Search v) { setField(3, v); } @$pb.TagNumber(3) - $core.bool hasTgCommand() => $_has(2); + $core.bool hasSearchCommand() => $_has(2); @$pb.TagNumber(3) - void clearTgCommand() => clearField(3); + void clearSearchCommand() => clearField(3); @$pb.TagNumber(3) - Talkgroup ensureTgCommand() => $_ensure(2); + Search ensureSearchCommand() => $_ensure(2); + + @$pb.TagNumber(4) + Talkgroup get tgCommand => $_getN(3); + @$pb.TagNumber(4) + set tgCommand(Talkgroup v) { setField(4, v); } + @$pb.TagNumber(4) + $core.bool hasTgCommand() => $_has(3); + @$pb.TagNumber(4) + void clearTgCommand() => clearField(4); + @$pb.TagNumber(4) + Talkgroup ensureTgCommand() => $_ensure(3); } class TalkgroupInfo extends $pb.GeneratedMessage { diff --git a/lib/pb/stillbox.pbjson.dart b/lib/pb/stillbox.pbjson.dart index 88b189c..be7eaf2 100644 --- a/lib/pb/stillbox.pbjson.dart +++ b/lib/pb/stillbox.pbjson.dart @@ -32,8 +32,8 @@ final $typed_data.Uint8List liveStateDescriptor = $convert.base64Decode( const Message$json = { '1': 'Message', '2': [ - {'1': 'call', '3': 1, '4': 1, '5': 11, '6': '.stillbox.Call', '9': 0, '10': 'call'}, - {'1': 'tg_info', '3': 2, '4': 1, '5': 11, '6': '.stillbox.TalkgroupInfo', '9': 0, '10': 'tgInfo'}, + {'1': 'response', '3': 1, '4': 1, '5': 11, '6': '.stillbox.CommandResponse', '9': 0, '10': 'response'}, + {'1': 'call', '3': 2, '4': 1, '5': 11, '6': '.stillbox.Call', '9': 0, '10': 'call'}, {'1': 'notification', '3': 3, '4': 1, '5': 11, '6': '.stillbox.Notification', '9': 0, '10': 'notification'}, {'1': 'popup', '3': 4, '4': 1, '5': 11, '6': '.stillbox.UserPopup', '9': 0, '10': 'popup'}, {'1': 'error', '3': 5, '4': 1, '5': 11, '6': '.stillbox.Error', '9': 0, '10': 'error'}, @@ -46,12 +46,31 @@ const Message$json = { /// Descriptor for `Message`. Decode as a `google.protobuf.DescriptorProto`. final $typed_data.Uint8List messageDescriptor = $convert.base64Decode( - 'CgdNZXNzYWdlEiQKBGNhbGwYASABKAsyDi5zdGlsbGJveC5DYWxsSABSBGNhbGwSMgoHdGdfaW' - '5mbxgCIAEoCzIXLnN0aWxsYm94LlRhbGtncm91cEluZm9IAFIGdGdJbmZvEjwKDG5vdGlmaWNh' - 'dGlvbhgDIAEoCzIWLnN0aWxsYm94Lk5vdGlmaWNhdGlvbkgAUgxub3RpZmljYXRpb24SKwoFcG' - '9wdXAYBCABKAsyEy5zdGlsbGJveC5Vc2VyUG9wdXBIAFIFcG9wdXASJwoFZXJyb3IYBSABKAsy' - 'Dy5zdGlsbGJveC5FcnJvckgAUgVlcnJvchInCgVoZWxsbxgGIAEoCzIPLnN0aWxsYm94LkhlbG' - 'xvSABSBWhlbGxvQhIKEHRvQ2xpZW50X21lc3NhZ2U='); + 'CgdNZXNzYWdlEjcKCHJlc3BvbnNlGAEgASgLMhkuc3RpbGxib3guQ29tbWFuZFJlc3BvbnNlSA' + 'BSCHJlc3BvbnNlEiQKBGNhbGwYAiABKAsyDi5zdGlsbGJveC5DYWxsSABSBGNhbGwSPAoMbm90' + 'aWZpY2F0aW9uGAMgASgLMhYuc3RpbGxib3guTm90aWZpY2F0aW9uSABSDG5vdGlmaWNhdGlvbh' + 'IrCgVwb3B1cBgEIAEoCzITLnN0aWxsYm94LlVzZXJQb3B1cEgAUgVwb3B1cBInCgVlcnJvchgF' + 'IAEoCzIPLnN0aWxsYm94LkVycm9ySABSBWVycm9yEicKBWhlbGxvGAYgASgLMg8uc3RpbGxib3' + 'guSGVsbG9IAFIFaGVsbG9CEgoQdG9DbGllbnRfbWVzc2FnZQ=='); + +@$core.Deprecated('Use commandResponseDescriptor instead') +const CommandResponse$json = { + '1': 'CommandResponse', + '2': [ + {'1': 'command_id', '3': 1, '4': 1, '5': 3, '9': 1, '10': 'commandId', '17': true}, + {'1': 'tg_info', '3': 2, '4': 1, '5': 11, '6': '.stillbox.TalkgroupInfo', '9': 0, '10': 'tgInfo'}, + ], + '8': [ + {'1': 'command_response'}, + {'1': '_command_id'}, + ], +}; + +/// Descriptor for `CommandResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List commandResponseDescriptor = $convert.base64Decode( + 'Cg9Db21tYW5kUmVzcG9uc2USIgoKY29tbWFuZF9pZBgBIAEoA0gBUgljb21tYW5kSWSIAQESMg' + 'oHdGdfaW5mbxgCIAEoCzIXLnN0aWxsYm94LlRhbGtncm91cEluZm9IAFIGdGdJbmZvQhIKEGNv' + 'bW1hbmRfcmVzcG9uc2VCDQoLX2NvbW1hbmRfaWQ='); @$core.Deprecated('Use callDescriptor instead') const Call$json = { @@ -143,21 +162,24 @@ final $typed_data.Uint8List notificationDescriptor = $convert.base64Decode( const Command$json = { '1': 'Command', '2': [ - {'1': 'live_command', '3': 1, '4': 1, '5': 11, '6': '.stillbox.Live', '9': 0, '10': 'liveCommand'}, - {'1': 'search_command', '3': 2, '4': 1, '5': 11, '6': '.stillbox.Search', '9': 0, '10': 'searchCommand'}, - {'1': 'tg_command', '3': 3, '4': 1, '5': 11, '6': '.stillbox.Talkgroup', '9': 0, '10': 'tgCommand'}, + {'1': 'command_id', '3': 1, '4': 1, '5': 3, '9': 1, '10': 'commandId', '17': true}, + {'1': 'live_command', '3': 2, '4': 1, '5': 11, '6': '.stillbox.Live', '9': 0, '10': 'liveCommand'}, + {'1': 'search_command', '3': 3, '4': 1, '5': 11, '6': '.stillbox.Search', '9': 0, '10': 'searchCommand'}, + {'1': 'tg_command', '3': 4, '4': 1, '5': 11, '6': '.stillbox.Talkgroup', '9': 0, '10': 'tgCommand'}, ], '8': [ {'1': 'command'}, + {'1': '_command_id'}, ], }; /// Descriptor for `Command`. Decode as a `google.protobuf.DescriptorProto`. final $typed_data.Uint8List commandDescriptor = $convert.base64Decode( - 'CgdDb21tYW5kEjMKDGxpdmVfY29tbWFuZBgBIAEoCzIOLnN0aWxsYm94LkxpdmVIAFILbGl2ZU' - 'NvbW1hbmQSOQoOc2VhcmNoX2NvbW1hbmQYAiABKAsyEC5zdGlsbGJveC5TZWFyY2hIAFINc2Vh' - 'cmNoQ29tbWFuZBI0Cgp0Z19jb21tYW5kGAMgASgLMhMuc3RpbGxib3guVGFsa2dyb3VwSABSCX' - 'RnQ29tbWFuZEIJCgdjb21tYW5k'); + 'CgdDb21tYW5kEiIKCmNvbW1hbmRfaWQYASABKANIAVIJY29tbWFuZElkiAEBEjMKDGxpdmVfY2' + '9tbWFuZBgCIAEoCzIOLnN0aWxsYm94LkxpdmVIAFILbGl2ZUNvbW1hbmQSOQoOc2VhcmNoX2Nv' + 'bW1hbmQYAyABKAsyEC5zdGlsbGJveC5TZWFyY2hIAFINc2VhcmNoQ29tbWFuZBI0Cgp0Z19jb2' + '1tYW5kGAQgASgLMhMuc3RpbGxib3guVGFsa2dyb3VwSABSCXRnQ29tbWFuZEIJCgdjb21tYW5k' + 'Qg0KC19jb21tYW5kX2lk'); @$core.Deprecated('Use talkgroupInfoDescriptor instead') const TalkgroupInfo$json = { diff --git a/lib/views/keypad.dart b/lib/views/keypad.dart index 8454e1d..2eea11d 100644 --- a/lib/views/keypad.dart +++ b/lib/views/keypad.dart @@ -6,6 +6,20 @@ class Keypad extends StatefulWidget { @override State createState() => _KeypadState(); } +/* +class KeypadKey extends ElevatedButton { + @override + ButtonStyle? themeStyleOf(BuildContext context) { + return ElevatedButtonTheme( + data: ElevatedButtonThemeData( + style: ButtonStyle( + shape: BoxBorder() + ) + ), + ); + } +} +*/ class _KeypadState extends State { @override diff --git a/lib/views/lcd.dart b/lib/views/lcd.dart index 63c7a60..c18a76e 100644 --- a/lib/views/lcd.dart +++ b/lib/views/lcd.dart @@ -1,5 +1,6 @@ import 'package:intl/intl.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import '../controller/stillbox.dart'; import '../pb/stillbox.pb.dart'; @@ -18,9 +19,11 @@ class LCD extends StatelessWidget { color: _lcdColor, border: const Border( top: BorderSide(width: 3.0, color: Color.fromARGB(255, 94, 94, 94)), - left: BorderSide(width: 3.0, color: Color.fromARGB(255, 63, 63, 63)), + left: + BorderSide(width: 3.0, color: Color.fromARGB(255, 63, 63, 63)), bottom: BorderSide(width: 3.0, color: Colors.white), - right: BorderSide(width: 3.0, color: Color.fromARGB(255, 229, 229, 229)), + right: BorderSide( + width: 3.0, color: Color.fromARGB(255, 229, 229, 229)), ), ), margin: const EdgeInsets.all(16.0), @@ -61,35 +64,40 @@ class LCD extends StatelessWidget { '${tgi.data?.systemName ?? (_call?.call.system ?? '')}'), Text('Q: $queueLen'), ]), - Row( - children: [Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( + Row(children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - ConstrainedBox( - constraints: BoxConstraints(maxWidth: MediaQuery.sizeOf(context).width / 1.6), - child: Text( - '${tgi.data?.name ?? (_call?.call.talkgroup ?? '')}${tgi.data?.learned ?? false ? ' 📓' : ''}', - style: const TextStyle( - fontSize: 20.0, - overflow: TextOverflow.ellipsis, - )), - ), - Text(_call != null ? '${_call.call.talkgroup}' : '', - textAlign: TextAlign.end, - style: const TextStyle( - fontSize: 10, - overflow: TextOverflow.ellipsis, - )), - ], + Row( + children: [ + ConstrainedBox( + constraints: BoxConstraints( + maxWidth: + MediaQuery.sizeOf(context).width / 1.6), + child: Text( + '${tgi.data?.name ?? (_call?.call.talkgroup ?? '')}${tgi.data?.learned ?? false ? ' 📓' : ''}', + style: const TextStyle( + fontSize: 20.0, + overflow: TextOverflow.ellipsis, + )), ), - Text(tgi.data != null ? tgi.data!.group : ''), - ])]), + Text(_call != null ? '${_call.call.talkgroup}' : '', + textAlign: TextAlign.end, + style: const TextStyle( + fontSize: 10, + overflow: TextOverflow.ellipsis, + )), + ], + ), + Text(tgi.data != null ? tgi.data!.group : ''), + ]) + ]), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text(_call != null ? '${(_call.call.frequency.toDouble() / 1024 / 1024).toStringAsFixed(4)} MHz' : ''), + Text(_call != null + ? '${(_call.call.frequency.toDouble() / 1024 / 1024).toStringAsFixed(4)} MHz' + : ''), Text(_call != null ? 'S: ${_call.call.source}' : ''), ]), ]); @@ -109,16 +117,19 @@ class LED extends StatelessWidget { height: 20.0, margin: const EdgeInsets.only(top: 4.0, right: 10.0), decoration: BoxDecoration( - color: _ledColor, - shape: BoxShape.circle, - border: const Border( + color: _ledColor, + shape: BoxShape.circle, + border: const Border( top: BorderSide(width: 1.0, color: Colors.white), left: BorderSide(width: 1.0, color: Colors.white), - ), - boxShadow: [ - BoxShadow(color: const Color.fromARGB(255, 151, 151, 151), offset: Offset.fromDirection(1, 3.0), blurRadius: 4.0, spreadRadius: 2.0) - ] - ), + ), + boxShadow: [ + BoxShadow( + color: const Color.fromARGB(255, 151, 151, 151), + offset: Offset.fromDirection(1, 3.0), + blurRadius: 4.0, + spreadRadius: 2.0) + ]), ); } } @@ -133,13 +144,37 @@ class ScannerLabel extends StatelessWidget { return Container( margin: const EdgeInsets.only(top: 10), alignment: Alignment.topLeft, - child: Text(_label, - textAlign: TextAlign.left, - style: const TextStyle( - fontSize: 22.0, - fontWeight: FontWeight.bold, - fontFamily: "Warnes", - )), + child: GestureDetector( + onTap: () { + final version = Provider.of(context, listen: false).version; + showDialog( + context: context, + builder: (BuildContext context) { + return Dialog( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(20.0), + ), + elevation: 5.0, + backgroundColor: Colors.grey, + child: Container( + padding: EdgeInsets.all(20.0), + child: Text( + 'Server info:\n${version.serverName} ${version.version}\nbuilt ${version.built}\nrunning on ${version.platform}', + style: TextStyle(color: Colors.black), + ), + ), + ); + }, + ); + }, + child: Text(_label, + textAlign: TextAlign.left, + style: const TextStyle( + fontSize: 22.0, + fontWeight: FontWeight.bold, + fontFamily: "Warnes", + )), + ), ); } } diff --git a/protobuf/stillbox.proto b/protobuf/stillbox.proto index a9c7e59..8a49ce8 100644 --- a/protobuf/stillbox.proto +++ b/protobuf/stillbox.proto @@ -7,8 +7,8 @@ import "google/protobuf/struct.proto"; message Message { oneof toClient_message { - Call call = 1; - TalkgroupInfo tg_info = 2; + CommandResponse response = 1; + Call call = 2; Notification notification = 3; UserPopup popup = 4; Error error = 5; @@ -16,6 +16,13 @@ message Message { } } +message CommandResponse { + optional int64 command_id = 1; + oneof command_response { + TalkgroupInfo tg_info = 2; + } +} + message Call { string audioName = 1; string audioType = 2; @@ -51,10 +58,11 @@ message Notification { } message Command { + optional int64 command_id = 1; oneof command { - Live live_command = 1; - Search search_command = 2; - Talkgroup tg_command = 3; + Live live_command = 2; + Search search_command = 3; + Talkgroup tg_command = 4; } }