diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 5ec09a75..42f527ad 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -22,6 +22,7 @@ import 'package:diplomaticquarterapp/services/family_files/family_files_provider import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/LocalNotification.dart'; +import 'package:diplomaticquarterapp/uitl/SignalRUtil.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/location_util.dart'; @@ -74,6 +75,8 @@ class _LandingPageState extends State with WidgetsBindingObserver { var themeNotifier; DateTime currentBackPressTime; + SignalRUtil signalRUtil; + bool _showBottomNavigationBar = true; ///inject the user data @@ -229,11 +232,14 @@ class _LandingPageState extends State with WidgetsBindingObserver { pageController = PageController(keepPage: true); _firebaseMessaging.setAutoInitEnabled(true); + signalRUtil = new SignalRUtil(hubName: "http://192.168.8.101:5001/chatHub", context: context); + locationUtils = new LocationUtils(isShowConfirmDialog: false, context: context); WidgetsBinding.instance.addPostFrameCallback((_) { if (projectViewModel.isLogin) { familyFileProvider.getSharedRecordByStatus(); } + signalRUtil.startSignalRConnection(); }); // HMG (Guest/Internet) Wifi Access [Zohaib Kambrani] //for now commented to reduce this call will enable it when needed @@ -632,6 +638,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { elevation: true, onTap: () { changeCurrentTab(2); + signalRUtil.sendMessage(['Bob', 'Says hi!']); }) : null); } diff --git a/lib/pages/webRTC/call_page.dart b/lib/pages/webRTC/call_page.dart new file mode 100644 index 00000000..e69de29b diff --git a/lib/uitl/SignalRUtil.dart b/lib/uitl/SignalRUtil.dart index 9231b81a..52f34cf7 100644 --- a/lib/uitl/SignalRUtil.dart +++ b/lib/uitl/SignalRUtil.dart @@ -25,10 +25,16 @@ class SignalRUtil { await connectionBuilder.start(); connectionBuilder.on('ReceiveMessage', (message) { - print(message.toString()); + handleIncomingMessage(message); }); + } + + void handleIncomingMessage(List message) { + print(message.toString()); + } - await connectionBuilder.invoke('SendMessage', args: ['Bob', 'Says hi!']); + void sendMessage(List args) async { + await connectionBuilder.invoke('SendMessage', args: args); //['Bob', 'Says hi!'] } bool getConnectionState() {