From 445174dbad699952256db75801c0e9e3219dae92 Mon Sep 17 00:00:00 2001 From: Tim Date: Sun, 11 Aug 2019 16:50:31 +0100 Subject: [PATCH] Add Zero Conf framework --- lib/src/configurations/zeroconf.dart | 54 ++++++++++++++++++++++++++++ pubspec.yaml | 1 + 2 files changed, 55 insertions(+) create mode 100644 lib/src/configurations/zeroconf.dart diff --git a/lib/src/configurations/zeroconf.dart b/lib/src/configurations/zeroconf.dart new file mode 100644 index 0000000..5652aad --- /dev/null +++ b/lib/src/configurations/zeroconf.dart @@ -0,0 +1,54 @@ +// OpenLP Mobile Remote +// --------------------------------------------------------------------------- +// Copyright (c) 2008-2019 OpenLP Developers +// --------------------------------------------------------------------------- +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + +import 'package:coucou_flutter/coucou.dart'; + + +class ZeroConf { + + /* + final Locale locale; + + AppLocalizations(this.locale); + + static AppLocalizations of(BuildContext context) => + Localizations.of(context, AppLocalizations); + + + final discovery = coucou.startDiscovery("_http._tcp").listen((event) { + // TODO: Something with the current event + }, onError: (error) { + // TODO: Something with the error + }); + +// .. when not needed, dispose + + discovery.cancel(); + coucou.stopDiscovery("_http._tcp"); + + + String translate(String key) => _localizedString[key]; + + static const LocalizationsDelegate delegate = + _AppLocalizationsDelegate(); + */ +} diff --git a/pubspec.yaml b/pubspec.yaml index 0365b73..956f2b7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -42,6 +42,7 @@ dependencies: flutter: sdk: flutter url_launcher: ^5.1.2 + coucou_flutter: ^0.0.2 dev_dependencies: flutter_test: