diff --git a/lib/main.dart b/lib/main.dart index 65f42e6..a1aeeb3 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,7 +1,8 @@ import "package:flutter/material.dart"; import "package:provider/provider.dart"; -import "package:xconn_ui/Providers/args_provider.dart"; -import "package:xconn_ui/Providers/kwargs_provider.dart"; +import "package:xconn_ui/providers/args_provider.dart"; +import "package:xconn_ui/providers/invocation_provider.dart"; +import "package:xconn_ui/providers/kwargs_provider.dart"; import "package:xconn_ui/responsive/responsive_layout.dart"; import "package:xconn_ui/screens/mobile/mobile_home.dart"; @@ -18,6 +19,7 @@ class MyApp extends StatelessWidget { providers: [ ChangeNotifierProvider(create: (context) => ArgsProvider()), ChangeNotifierProvider(create: (context) => KwargsProvider()), + ChangeNotifierProvider(create: (context) => InvocationProvider()), ], child: MaterialApp( debugShowCheckedModeBanner: false, diff --git a/lib/Providers/args_provider.dart b/lib/providers/args_provider.dart similarity index 100% rename from lib/Providers/args_provider.dart rename to lib/providers/args_provider.dart diff --git a/lib/providers/invocation_provider.dart b/lib/providers/invocation_provider.dart new file mode 100644 index 0000000..9f31dbe --- /dev/null +++ b/lib/providers/invocation_provider.dart @@ -0,0 +1,14 @@ +import "package:flutter/cupertino.dart"; + +class InvocationProvider extends ChangeNotifier { + final List _results = []; + + List get results => _results; + + void addResult(String result, int index) { + if (!_results.contains(result)) { + _results.add(result); + notifyListeners(); + } + } +} diff --git a/lib/Providers/kwargs_provider.dart b/lib/providers/kwargs_provider.dart similarity index 74% rename from lib/Providers/kwargs_provider.dart rename to lib/providers/kwargs_provider.dart index bf2683c..f79c4cb 100644 --- a/lib/Providers/kwargs_provider.dart +++ b/lib/providers/kwargs_provider.dart @@ -8,12 +8,16 @@ class KwargsProvider extends ChangeNotifier { List> get tableData => _tableData; void addRow(Map rowData) { + // print("Hello"); _tableData.add(rowData); + // print("length ${_tableData.length}"); notifyListeners(); } void removeRow(int index) { + // print("Kassssss"); _tableData.removeAt(index); + // print("lenggggggg ${_tableData.length}"); notifyListeners(); } } diff --git a/lib/screens/mobile/mobile_home.dart b/lib/screens/mobile/mobile_home.dart index f4ce8ad..0b69027 100644 --- a/lib/screens/mobile/mobile_home.dart +++ b/lib/screens/mobile/mobile_home.dart @@ -1,11 +1,14 @@ import "package:flutter/material.dart"; import "package:provider/provider.dart"; -import "package:xconn_ui/Providers/args_provider.dart"; -import "package:xconn_ui/Providers/kwargs_provider.dart"; +import "package:xconn/exports.dart"; import "package:xconn_ui/constants.dart"; +import "package:xconn_ui/providers/args_provider.dart"; +import "package:xconn_ui/providers/invocation_provider.dart"; +import "package:xconn_ui/providers/kwargs_provider.dart"; import "package:xconn_ui/utils/args_screen.dart"; import "package:xconn_ui/utils/kwargs_screen.dart"; import "package:xconn_ui/utils/tab_data_class.dart"; +import "package:xconn_ui/wamp_actions.dart"; class MobileHomeScaffold extends StatefulWidget { const MobileHomeScaffold({super.key}); @@ -19,12 +22,15 @@ class _MobileHomeScaffoldState extends State with TickerProv final List _tabNames = ["Tab 1"]; final List _tabContents = ["Content for Tab 1"]; final List _tabData = [TabData()]; + final List _argsProviders = []; + final List _kwargsProviders = []; @override void initState() { super.initState(); _tabController = TabController(length: _tabNames.length, vsync: this); _tabController.addListener(_handleTabSelection); + _initializeProviders(); } // HANDLE TABS SELECTION @@ -32,25 +38,42 @@ class _MobileHomeScaffoldState extends State with TickerProv setState(() {}); } + // INITIALIZE PROVIDERS + void _initializeProviders() { + for (final _ in _tabNames) { + _argsProviders.add(ArgsProvider()); + _kwargsProviders.add(KwargsProvider()); + } + } + + void _addTab() { setState(() { - int newIndex = _tabNames.length + 1; - _tabNames.add("Tab $newIndex"); - _tabContents.add("Content for Tab $newIndex"); + int newIndex = _tabNames.length; // Start index from 0 + _tabNames.add("Tab ${newIndex + 1}"); // Increment for display + _tabContents.add("Content for Tab ${newIndex + 1}"); _tabData.add(TabData()); + _argsProviders.add(ArgsProvider()); + _kwargsProviders.add(KwargsProvider()); if (_tabController.length != _tabNames.length) { _tabController = TabController(length: _tabNames.length, vsync: this); _tabController.addListener(_handleTabSelection); } + _tabController.index = newIndex; // Set index to newly created tab }); } + + + // REMOVE TABS void _removeTab(int index) { setState(() { _tabNames.removeAt(index); _tabContents.removeAt(index); _tabData[index].disposeControllers(); _tabData.removeAt(index); + _argsProviders.removeAt(index); + _kwargsProviders.removeAt(index); if (_tabController.length != _tabNames.length) { _tabController = TabController(length: _tabNames.length, vsync: this); @@ -59,11 +82,23 @@ class _MobileHomeScaffoldState extends State with TickerProv }); } + + + + + + @override void dispose() { _tabController ..removeListener(_handleTabSelection) ..dispose(); + for (final provider in _argsProviders) { + provider.dispose(); + } + for (final kProvider in _kwargsProviders) { + kProvider.dispose(); + } super.dispose(); } @@ -150,7 +185,7 @@ class _MobileHomeScaffoldState extends State with TickerProv ); } - // Main Build Tab + // MAIN BUILD TAB Widget _buildTab(int index) { return SingleChildScrollView( physics: const BouncingScrollPhysics(), @@ -307,19 +342,19 @@ class _MobileHomeScaffoldState extends State with TickerProv ), // Args - buildArgs(_tabData[index].sendButtonText), + buildArgs(_tabData[index].sendButtonText, _argsProviders[index]), const SizedBox( height: 20, ), // K-Wargs - buildKwargs(_tabData[index].sendButtonText), + buildKwargs(_tabData[index].sendButtonText, _kwargsProviders[index]), const SizedBox(height: 20), // Send Button - sendButton(_tabData[index].sendButtonText), + sendButton(_tabData[index].sendButtonText, index), const SizedBox( height: 50, @@ -329,7 +364,7 @@ class _MobileHomeScaffoldState extends State with TickerProv child: Align( alignment: Alignment.topLeft, child: SizedBox( - height: 100, + height: 30, width: MediaQuery.of(context).size.width, child: Text( "Result", @@ -342,22 +377,87 @@ class _MobileHomeScaffoldState extends State with TickerProv ), ), ), + + Consumer( + builder: (context, registrationResult, _) { + List results = registrationResult.results; + // Filter results based on the current tab index + List tabResults = results.where((result) => result.startsWith("$index:")).toList(); + + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: tabResults.map((result) { + return Align( + alignment: Alignment.topLeft, + child: Padding( + padding: const EdgeInsets.only(top: 10), + child: Container( + margin: const EdgeInsets.only(left: 20, right: 20), + padding: const EdgeInsets.all(10), + decoration: BoxDecoration( + color: Colors.blue[50], + borderRadius: BorderRadius.circular(8), + ), + child: Text( + result, + style: TextStyle( + fontSize: 17, + fontWeight: FontWeight.w700, + color: blackColor, + ), + ), + ), + ), + ); + }).toList(), + ); + }, + ), const SizedBox( - height: 40, + height: 20, ), ], ), ); } - // Send Button Widget - Widget sendButton(String sendButton) { + // SEND BUTTON WIDGET + Widget sendButton(String sendButton, int index) { + final scaffoldMessenger = ScaffoldMessenger.of(context); switch (sendButton) { case "Publish": return Padding( padding: const EdgeInsets.symmetric(horizontal: 110), child: MaterialButton( - onPressed: () {}, + onPressed: () async { + try { + final scaffoldMessenger = ScaffoldMessenger.of(context); + // Args + List argsData = _argsProviders[index].controllers.map((controller) => controller.text).toList(); + Map kWarValues = {}; + for (final map in _kwargsProviders[index].tableData) { + String key = map["key"]; + dynamic value = map["value"]; + kWarValues[key] = value; + } + Map formattedResult = kWarValues; + var session = await connect(_tabData[index].linkController.text, _tabData[index].realmController.text, + _tabData[index].selectedSerializer,); + await session.publish(_tabData[index].topicProcedureController.text, args: argsData, kwargs: formattedResult); + + // Show success message + scaffoldMessenger.showSnackBar(const SnackBar( + content: Text("Publish Successful"), + duration: Duration(seconds: 3), + ),); + } on Exception catch (error) { + // Show error message + scaffoldMessenger.showSnackBar(SnackBar( + content: Text("Publish Error: $error"), + duration: const Duration(seconds: 3), + ),); + } + }, color: Colors.blueAccent, minWidth: 200, shape: RoundedRectangleBorder( @@ -378,7 +478,34 @@ class _MobileHomeScaffoldState extends State with TickerProv return Padding( padding: const EdgeInsets.symmetric(horizontal: 110), child: MaterialButton( - onPressed: () {}, + onPressed: () async { + try { + // Args + // List argsData = _argsProviders[index].controllers.map((controller) => controller.text).toList(); + Map kWarValues = {}; + for (final map in _kwargsProviders[index].tableData) { + String key = map["key"]; + dynamic value = map["value"]; + kWarValues[key] = value; + } + // Map formattedResult = kWarValues; + var session = await connect(_tabData[index].linkController.text, _tabData[index].realmController.text, + _tabData[index].selectedSerializer,); + await session.subscribe(_tabData[index].topicProcedureController.text, (event) {}); + + // Show success message + scaffoldMessenger.showSnackBar(const SnackBar( + content: Text("Subscribe Successful"), + duration: Duration(seconds: 3), + ),); + } on Exception catch (error) { + + scaffoldMessenger.showSnackBar(SnackBar( + content: Text("Subscribe Error: $error"), + duration: const Duration(seconds: 3), + ),); + } + }, color: Colors.blueAccent, minWidth: 200, shape: RoundedRectangleBorder( @@ -399,7 +526,47 @@ class _MobileHomeScaffoldState extends State with TickerProv return Padding( padding: const EdgeInsets.symmetric(horizontal: 110), child: MaterialButton( - onPressed: () {}, + onPressed: () async { + try { + // Args + List argsData = _argsProviders[index].controllers.map((controller) => controller.text).toList(); + Map kWarValues = {}; + for (final map in _kwargsProviders[index].tableData) { + String key = map["key"]; + dynamic value = map["value"]; + kWarValues[key] = value; + } + Map formattedResult = kWarValues; + // print("vvv $formattedResult"); + + var session = await connect( + _tabData[index].linkController.text, + _tabData[index].realmController.text, + _tabData[index].selectedSerializer, + ); + + Future.delayed(const Duration(seconds: 1), (){ + session.call(_tabData[index].topicProcedureController.text, args: argsData, kwargs: formattedResult); + _tabData[index].linkController.clear(); + _tabData[index].realmController.clear(); + _tabData[index].selectedSerializer = ""; + _argsProviders[index].controllers.clear(); + _kwargsProviders[index].tableData.clear(); + + }); + + // Show success message + scaffoldMessenger.showSnackBar(const SnackBar( + content: Text("Call Successful"), + duration: Duration(seconds: 3), + ),); + } on Exception catch (error) { + scaffoldMessenger.showSnackBar(SnackBar( + content: Text("Call Error: $error"), + duration: const Duration(seconds: 3), + ),); + } + }, color: Colors.blueAccent, minWidth: 200, shape: RoundedRectangleBorder( @@ -420,7 +587,9 @@ class _MobileHomeScaffoldState extends State with TickerProv return Padding( padding: const EdgeInsets.symmetric(horizontal: 110), child: MaterialButton( - onPressed: () {}, + onPressed: () async { + await _registerAndStoreResult(index); + }, color: Colors.blueAccent, minWidth: 200, shape: RoundedRectangleBorder( @@ -442,7 +611,54 @@ class _MobileHomeScaffoldState extends State with TickerProv } } - // Topic and Procedure TextFormFields Widget + // REGISTER AND STORE RESULT FUNCTION + Future _registerAndStoreResult(int index) async { + final scaffoldMessenger = ScaffoldMessenger.of(context); + try { + var session = await connect( + _tabData[index].linkController.text, + _tabData[index].realmController.text, + _tabData[index].selectedSerializer, + ); + + Future.delayed(const Duration(seconds: 2), () async { + try { + await session.register( + _tabData[index].topicProcedureController.text, + (invocation) { + // Modify the result string format as per your requirement + String result = "$index: args=${invocation.args}, kwargs=${invocation.kwargs}"; + Provider.of(context, listen: false).addResult(result, index); + return Result( + args: invocation.args, + kwargs: invocation.kwargs, + details: invocation.details, + ); + }, + ); + + // If registration succeeds, show success toast + scaffoldMessenger.showSnackBar(const SnackBar( + content: Text("Registration Successful"), + duration: Duration(seconds: 3), + ),); + } on Exception catch (error) { + + scaffoldMessenger.showSnackBar(SnackBar( + content: Text("Registration Error: $error"), + duration: const Duration(seconds: 2), + ),); + } + }); + } on Exception catch (error) { + scaffoldMessenger.showSnackBar(SnackBar( + content: Text("Connection Error: $error"), + duration: const Duration(seconds: 2), + ),); + } + } + + // BUILD TOPIC PROCEDURE WIDGET Widget buildTopicProcedure(TextEditingController controller, String sendButtonText) { switch (sendButtonText) { case "Publish": @@ -514,101 +730,17 @@ class _MobileHomeScaffoldState extends State with TickerProv } } - // Build Args Widget - Widget buildArgs(String argsSendButton) { + // BUILD ARGS WIDGET + Widget buildArgs(String argsSendButton, ArgsProvider argsProvider) { switch (argsSendButton) { case "Publish": - return Column( - children: [ - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 15, - ), - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - const Padding( - padding: EdgeInsets.only(left: 10), - child: Align( - alignment: Alignment.topLeft, - child: Text( - "Args", - style: TextStyle( - fontSize: 15, - fontWeight: FontWeight.w600, - color: Colors.black, - ), - ), - ), - ), - IconButton( - onPressed: () { - Provider.of( - context, - listen: false, - ).addController(); - }, - icon: const Icon( - Icons.add_box_sharp, - size: 24, - ), - ), - ], - ), - ], - ), - ), - const ArgsTextFormFields(), - ], + return ArgsTextFormFields( + provider: argsProvider, ); case "Call": - return Column( - children: [ - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 15, - ), - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - const Padding( - padding: EdgeInsets.only(left: 10), - child: Align( - alignment: Alignment.topLeft, - child: Text( - "Args", - style: TextStyle( - fontSize: 15, - fontWeight: FontWeight.w600, - color: Colors.black, - ), - ), - ), - ), - IconButton( - onPressed: () { - Provider.of( - context, - listen: false, - ).addController(); - }, - icon: const Icon( - Icons.add_box_sharp, - size: 24, - ), - ), - ], - ), - ], - ), - ), - const ArgsTextFormFields(), - ], + return ArgsTextFormFields( + provider: argsProvider, ); default: @@ -616,99 +748,17 @@ class _MobileHomeScaffoldState extends State with TickerProv } } - // BUILD Kwargs Widget - Widget buildKwargs(String kWargSendButton) { + // BUILD KWARGS WIDGET + Widget buildKwargs(String kWargSendButton, KwargsProvider kwargsProvider) { switch (kWargSendButton) { case "Publish": - return Column( - children: [ - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 15, - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - const Padding( - padding: EdgeInsets.only(left: 10), - child: Align( - alignment: Alignment.topLeft, - child: Text( - "Kwargs", - style: TextStyle( - fontSize: 15, - fontWeight: FontWeight.w600, - color: Colors.black, - ), - ), - ), - ), - IconButton( - onPressed: () { - Provider.of( - context, - listen: false, - ).addRow({ - "key": "", - "value": "", - }); - }, - icon: const Icon( - Icons.add_box_sharp, - size: 24, - ), - ), - ], - ), - ), - const DynamicKeyValuePairs(), - ], + return DynamicKeyValuePairs( + provider: kwargsProvider, ); case "Call": - return Column( - children: [ - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 15, - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - const Padding( - padding: EdgeInsets.only(left: 10), - child: Align( - alignment: Alignment.topLeft, - child: Text( - "Kwargs", - style: TextStyle( - fontSize: 15, - fontWeight: FontWeight.w600, - color: Colors.black, - ), - ), - ), - ), - IconButton( - onPressed: () { - Provider.of( - context, - listen: false, - ).addRow({ - "key": "", - "value": "", - }); - }, - icon: const Icon( - Icons.add_box_sharp, - size: 24, - ), - ), - ], - ), - ), - const DynamicKeyValuePairs(), - ], + return DynamicKeyValuePairs( + provider: kwargsProvider, ); default: diff --git a/lib/utils/args_screen.dart b/lib/utils/args_screen.dart index 0feec5c..ff60faa 100644 --- a/lib/utils/args_screen.dart +++ b/lib/utils/args_screen.dart @@ -1,26 +1,72 @@ +import "package:flutter/foundation.dart"; import "package:flutter/material.dart"; -import "package:provider/provider.dart"; -import "package:xconn_ui/Providers/args_provider.dart"; import "package:xconn_ui/constants.dart"; +import "package:xconn_ui/providers/args_provider.dart"; -class ArgsTextFormFields extends StatelessWidget { - const ArgsTextFormFields({super.key}); +class ArgsTextFormFields extends StatefulWidget { + const ArgsTextFormFields({required this.provider, super.key}); + final ArgsProvider provider; + @override + State createState() => _ArgsTextFormFieldsState(); + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties.add(DiagnosticsProperty("provider", provider)); + } +} + +class _ArgsTextFormFieldsState extends State { @override Widget build(BuildContext context) { - return Consumer( - builder: (context, model, _) { - return SizedBox( + return Column( + children: [ + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 15, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + const Padding( + padding: EdgeInsets.only(left: 10), + child: Align( + alignment: Alignment.topLeft, + child: Text( + "Args", + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.w600, + color: Colors.black, + ), + ), + ), + ), + IconButton( + onPressed: () { + setState(() { + widget.provider.addController(); + }); + }, + icon: const Icon( + Icons.add_box_sharp, + size: 24, + ), + ), + ], + ), + ), + SizedBox( height: 120, child: ListView.builder( shrinkWrap: true, - itemCount: model.controllers.length, + itemCount: widget.provider.controllers.length, itemBuilder: (context, index) { return ListTile( title: SizedBox( height: 45, child: TextFormField( - controller: model.controllers[index], + controller: widget.provider.controllers[index], decoration: InputDecoration( labelText: "Enter args here", labelStyle: TextStyle(color: blackColor), @@ -40,7 +86,11 @@ class ArgsTextFormFields extends StatelessWidget { ), trailing: InkWell( hoverColor: Colors.blue.shade200, - onTap: () => model.removeController(index), + onTap: () { + setState(() { + widget.provider.removeController(index); + }); + }, child: Icon( Icons.delete, color: closeIconColor, @@ -49,8 +99,14 @@ class ArgsTextFormFields extends StatelessWidget { ); }, ), - ); - }, + ), + ], ); } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties.add(DiagnosticsProperty("provider", widget.provider)); + } } diff --git a/lib/utils/kwargs_screen.dart b/lib/utils/kwargs_screen.dart index 4072071..16ad7af 100644 --- a/lib/utils/kwargs_screen.dart +++ b/lib/utils/kwargs_screen.dart @@ -1,11 +1,22 @@ import "package:flutter/foundation.dart"; import "package:flutter/material.dart"; import "package:provider/provider.dart"; -import "package:xconn_ui/Providers/kwargs_provider.dart"; +import "package:xconn_ui/providers/kwargs_provider.dart"; -class DynamicKeyValuePairs extends StatelessWidget { - const DynamicKeyValuePairs({super.key}); +class DynamicKeyValuePairs extends StatefulWidget { + const DynamicKeyValuePairs({required this.provider, super.key}); + final KwargsProvider provider; + @override + State createState() => _DynamicKeyValuePairsState(); + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties.add(DiagnosticsProperty("provider", provider)); + } +} + +class _DynamicKeyValuePairsState extends State { @override Widget build(BuildContext context) { return Consumer( @@ -24,17 +35,74 @@ class DynamicKeyValuePairs extends StatelessWidget { return SizedBox( height: 200, child: SingleChildScrollView( - child: TableWidget(tableProvider.tableData), + child: Column( + children: [ + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 15, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + const Padding( + padding: EdgeInsets.only(left: 10), + child: Align( + alignment: Alignment.topLeft, + child: Text( + "Kwargs", + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.w600, + color: Colors.black, + ), + ), + ), + ), + IconButton( + onPressed: () { + setState(() { + widget.provider.addRow({ + "key": "", + "value": "", + }); + }); + // Provider.of( + // context, + // listen: false, + // ). + // addRow({ + // "key": "", + // "value": "", + // }); + }, + icon: const Icon( + Icons.add_box_sharp, + size: 24, + ), + ), + ], + ), + ), + TableWidget(widget.provider.tableData, widget.provider), + ], + ), ), ); }, ); } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties.add(DiagnosticsProperty("provider", widget.provider)); + } } class TableWidget extends StatefulWidget { - const TableWidget(this.tableData, {super.key}); + const TableWidget(this.tableData, this.provider, {super.key}); final List> tableData; + final KwargsProvider provider; @override State createState() => _TableWidgetState(); @@ -42,7 +110,8 @@ class TableWidget extends StatefulWidget { @override void debugFillProperties(DiagnosticPropertiesBuilder properties) { super.debugFillProperties(properties); - properties.add(IterableProperty>("tableData", tableData)); + properties..add(IterableProperty>("tableData", tableData)) + ..add(DiagnosticsProperty("provider", provider)); } } @@ -50,7 +119,7 @@ class _TableWidgetState extends State { TableRow _buildTableRow( Map rowData, int index, - KwargsProvider kWarProvider, + // KwargsProvider kWarProvider, ) { return TableRow( children: [ @@ -85,7 +154,9 @@ class _TableWidgetState extends State { color: Colors.red, ), onPressed: () { - kWarProvider.removeRow(index); + setState(() { + widget.provider.removeRow(index); + }); }, ), ), @@ -142,7 +213,7 @@ class _TableWidgetState extends State { (entry) => _buildTableRow( entry.value, entry.key, - Provider.of(context, listen: false), + // Provider.of(context, listen: false), ), ), ], diff --git a/lib/utils/tab_data_class.dart b/lib/utils/tab_data_class.dart index 5ee26f4..07eb831 100644 --- a/lib/utils/tab_data_class.dart +++ b/lib/utils/tab_data_class.dart @@ -1,4 +1,5 @@ import "package:flutter/cupertino.dart"; +import "package:xconn/exports.dart"; class TabData { TabData() { @@ -12,6 +13,7 @@ class TabData { TextEditingController linkController = TextEditingController(); TextEditingController realmController = TextEditingController(); TextEditingController topicProcedureController = TextEditingController(); + Future? registration; void disposeControllers() { linkController.dispose(); diff --git a/lib/wamp_actions.dart b/lib/wamp_actions.dart index 0323583..3a50d96 100644 --- a/lib/wamp_actions.dart +++ b/lib/wamp_actions.dart @@ -1,7 +1,4 @@ -import "package:wampproto/auth.dart"; -import "package:wampproto/serializers.dart"; import "package:xconn/exports.dart"; - import "package:xconn_ui/constants.dart"; Serializer _getSerializer(String? serializerString) { @@ -31,6 +28,10 @@ Future connect( var serializer = _getSerializer(serializerStr); Client client; + // print("serializer $serializerStr"); + // print("serializer $serializer"); + + if (ticket != null) { client = Client(serializer: serializer, authenticator: TicketAuthenticator(ticket, authid ?? "")); } else if (secret != null) { @@ -46,7 +47,8 @@ Future connect( Future register(Session session, String procedure) { return session.register(procedure, (Invocation inv) { - return Result(args: inv.args, kwargs: inv.kwargs); + + return Result(); }); } diff --git a/pubspec.yaml b/pubspec.yaml index f165452..3a0f66d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -35,9 +35,10 @@ dependencies: flutter: sdk: flutter + fluttertoast: ^8.2.5 provider: ^6.1.2 - wampproto: ^0.1.0 - xconn: ^0.1.0 + xconn: + git: https://github.com/xconnio/xconn-dart dev_dependencies: # The "flutter_lints" package below contains a set of recommended lints to