diff --git a/android/build.gradle b/android/build.gradle index 714549c..2c5c4dd 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,12 +1,12 @@ buildscript { - ext.kotlin_version = '1.6.10' + ext.kotlin_version = '1.7.10' repositories { google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:4.1.0' + classpath 'com.android.tools.build:gradle:7.2.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -26,6 +26,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/lib/Helpers/MQTTHelper.dart b/lib/Helpers/MQTTHelper.dart index dc71266..ba432f1 100644 --- a/lib/Helpers/MQTTHelper.dart +++ b/lib/Helpers/MQTTHelper.dart @@ -3,7 +3,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:fluttertoast/fluttertoast.dart'; import 'package:manager_api/api.dart'; -import 'package:mqtt_client/mqtt_browser_client.dart'; +//import 'package:mqtt_client/mqtt_browser_client.dart'; import 'package:mqtt_client/mqtt_client.dart'; import 'package:mqtt_client/mqtt_server_client.dart'; import 'package:tablet_app/Helpers/DeviceInfoHelper.dart'; @@ -22,9 +22,9 @@ class MQTTHelper { TabletAppContext tabletAppContext = appContext.getContext(); if(kIsWeb) { - tabletAppContext.clientBrowserMQTT!.updates!.listen((List> c) async { + /*tabletAppContext.clientBrowserMQTT!.updates!.listen((List> c) async { handleMessage(appContext, c); - }); + });*/ } else { tabletAppContext.clientMQTT!.updates!.listen((List> c) async { handleMessage(appContext, c); @@ -141,7 +141,7 @@ class MQTTHelper { .withWillQos(MqttQos.atLeastOnce); if(kIsWeb) { - tabletAppContext.clientBrowserMQTT = MqttBrowserClient.withPort(hostToTake!.replaceAll('http://', ''), 'tablet_app_'+identifier!, 1883); + /*tabletAppContext.clientBrowserMQTT = MqttBrowserClient.withPort(hostToTake!.replaceAll('http://', ''), 'tablet_app_'+identifier!, 1883); tabletAppContext.clientBrowserMQTT!.logging(on: false); tabletAppContext.clientBrowserMQTT!.keepAlivePeriod = 20; tabletAppContext.clientBrowserMQTT!.onDisconnected = onDisconnected; @@ -176,7 +176,7 @@ class MQTTHelper { } catch (e) { print('Exception clientBrowserMQTT: $e'); tabletAppContext.clientBrowserMQTT!.disconnect(); - } + }*/ } else { tabletAppContext.clientMQTT = MqttServerClient.withPort(hostToTake!.replaceAll('http://', ''), 'tablet_app_'+identifier!, 1883); tabletAppContext.clientMQTT!.logging(on: false); @@ -218,7 +218,8 @@ class MQTTHelper { isInstantiated = true; - return kIsWeb ? tabletAppContext.clientBrowserMQTT : tabletAppContext.clientMQTT!; + //return kIsWeb ? tabletAppContext.clientBrowserMQTT : tabletAppContext.clientMQTT!; + return tabletAppContext.clientMQTT!; } Future updateDevice(dynamic appContext) async { diff --git a/lib/Models/tabletContext.dart b/lib/Models/tabletContext.dart index b63fe37..2a066f1 100644 --- a/lib/Models/tabletContext.dart +++ b/lib/Models/tabletContext.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; import 'package:manager_api/api.dart'; -import 'package:mqtt_client/mqtt_browser_client.dart'; +//import 'package:mqtt_client/mqtt_browser_client.dart'; import 'package:mqtt_client/mqtt_server_client.dart'; import 'package:tablet_app/client.dart'; import 'dart:convert'; @@ -9,7 +9,7 @@ import 'dart:convert'; class TabletAppContext with ChangeNotifier{ Client? clientAPI; MqttServerClient? clientMQTT; - MqttBrowserClient? clientBrowserMQTT; + //MqttBrowserClient? clientBrowserMQTT; String? id; String? host; ConfigurationDTO? configuration; diff --git a/lib/Screens/Configuration/config_view.dart b/lib/Screens/Configuration/config_view.dart index a5ea99a..6b1b269 100644 --- a/lib/Screens/Configuration/config_view.dart +++ b/lib/Screens/Configuration/config_view.dart @@ -5,7 +5,7 @@ import 'package:flutter/rendering.dart'; import 'package:flutter/services.dart'; import 'package:fluttertoast/fluttertoast.dart'; import 'package:manager_api/api.dart'; -import 'package:mqtt_client/mqtt_browser_client.dart'; +//import 'package:mqtt_client/mqtt_browser_client.dart'; import 'package:mqtt_client/mqtt_server_client.dart'; import 'package:provider/provider.dart'; import 'package:tablet_app/Components/Buttons/rounded_button.dart'; @@ -39,7 +39,7 @@ class _ConfigViewWidget extends State { @override Widget build(BuildContext context) { final appContext = Provider.of(context); - SystemChrome.setEnabledSystemUIOverlays([]); + SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []); Size size = MediaQuery.of(context).size; TabletAppContext tabletAppContext = appContext.getContext(); @@ -137,7 +137,7 @@ class _ConfigViewWidget extends State { return Center( child: Container( height: size.height * 0.2, - child: kIsWeb ? LoadingCommon() : Loading() + child: LoadingCommon() ) ); } @@ -205,11 +205,11 @@ class _ConfigViewWidget extends State { var identifier = kIsWeb ? "WEB TEST" : await DeviceInfoHelper.getDeviceDetails(); if(kIsWeb) { - tabletAppContext.clientBrowserMQTT = new MqttBrowserClient(url.replaceAll('http://', ''),'tablet_app_'+ identifier!); + //tabletAppContext.clientBrowserMQTT = new MqttBrowserClient(url.replaceAll('http://', ''),'tablet_app_'+ identifier!); } else { // mobile specific - tabletAppContext!.clientMQTT = new MqttServerClient(url.replaceAll('http://', ''),'tablet_app_'+ identifier!); + tabletAppContext.clientMQTT = new MqttServerClient(url.replaceAll('http://', ''),'tablet_app_'+ identifier!); } setState(() { diff --git a/lib/Screens/MainView/main_view.dart b/lib/Screens/MainView/main_view.dart index 590b43b..a6e45fc 100644 --- a/lib/Screens/MainView/main_view.dart +++ b/lib/Screens/MainView/main_view.dart @@ -33,15 +33,18 @@ class MainViewWidget extends StatefulWidget { class _MainViewWidget extends State { Size sizeScreen = new Size(1080.0, 1920.0); // Tablet resolution SectionDTO? sectionSelected; + late ConfigurationDTO configurationDTO; int rowCount = 4; @override Widget build(BuildContext context) { final appContext = Provider.of(context); - SystemChrome.setEnabledSystemUIOverlays([]); + SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []); Size size = MediaQuery.of(context).size; + configurationDTO = appContext.getContext().configuration; + if (!MQTTHelper.instance.isInstantiated) MQTTHelper.instance.connect(appContext); @@ -87,7 +90,16 @@ class _MainViewWidget extends State { child: Container( height: size.height, width: size.width, - color: appContext.getContext().configuration == null ? kBackgroundGrey : appContext.getContext().configuration.secondaryColor != null ? new Color(int.parse(appContext.getContext().configuration.secondaryColor.split('(0x')[1].split(')')[0], radix: 16)): kBackgroundGrey, + color: configurationDTO.imageId == null ? configurationDTO.secondaryColor != null ? new Color(int.parse(configurationDTO.secondaryColor!.split('(0x')[1].split(')')[0], radix: 16)): kBackgroundGrey : null, + decoration: configurationDTO.imageId != null ? BoxDecoration( + image: new DecorationImage( + fit: BoxFit.cover, + colorFilter: new ColorFilter.mode(Colors.grey.withOpacity(0.7), BlendMode.color), + image: new NetworkImage( + configurationDTO.imageSource!, + ), + ), + ) : null, child: Column( children: [ Container( @@ -177,12 +189,15 @@ class _MainViewWidget extends State { width: kIsWeb ? size.width *0.08: 185.0, child: FittedBox( child: FloatingActionButton.extended( + backgroundColor: kBackgroundColor, + focusColor: kBackgroundColor, + splashColor: kBackgroundColor, onPressed: () { setState(() { sectionSelected = null; }); }, - icon: Icon(Icons.arrow_back), + icon: Icon(Icons.arrow_back, color: Colors.grey), label: Text("Menu") ), ), @@ -194,10 +209,19 @@ class _MainViewWidget extends State { body: Container( height: size.height, width: size.width, - color: appContext.getContext().configuration == null ? kBackgroundGrey : appContext.getContext().configuration.secondaryColor != null ? new Color(int.parse(appContext.getContext().configuration.secondaryColor.split('(0x')[1].split(')')[0], radix: 16)): kBackgroundGrey, + color: configurationDTO.imageId == null ? configurationDTO.secondaryColor != null ? new Color(int.parse(appContext.getContext().configuration.secondaryColor.split('(0x')[1].split(')')[0], radix: 16)): kBackgroundGrey : null, + decoration: configurationDTO.imageId != null ? BoxDecoration( + image: new DecorationImage( + fit: BoxFit.cover, + colorFilter: new ColorFilter.mode(Colors.grey.withOpacity(0.7), BlendMode.color), + image: new NetworkImage( + configurationDTO.imageSource!, + ), + ), + ) : null, child: Stack( children: [ - if (appContext.getContext().configuration != null) LanguageSelection(), + if (configurationDTO != null) LanguageSelection(), Center( child: Container( height: kIsWeb ? size.height : size.height * 0.85, @@ -264,7 +288,7 @@ class _MainViewWidget extends State { } else { return Center( child: Container( - child: kIsWeb ? LoadingCommon() : Loading() + child: LoadingCommon() ) ); } diff --git a/lib/Screens/Map/map_view.dart b/lib/Screens/Map/map_view.dart index 5f3d30e..107857b 100644 --- a/lib/Screens/Map/map_view.dart +++ b/lib/Screens/Map/map_view.dart @@ -82,7 +82,7 @@ class _MapViewWidget extends State { } else { return Center( child: Container( - child: kIsWeb ? LoadingCommon() : Loading() + child: LoadingCommon() ) ); } diff --git a/lib/Screens/Previous/previous_view.dart b/lib/Screens/Previous/previous_view.dart index 0aee5b5..e616a80 100644 --- a/lib/Screens/Previous/previous_view.dart +++ b/lib/Screens/Previous/previous_view.dart @@ -142,7 +142,7 @@ class _PreviousViewWidget extends State with TickerProviderS @override Widget build(BuildContext context) { - SystemChrome.setEnabledSystemUIOverlays([]); + SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []); Size size = MediaQuery .of(context) .size; diff --git a/lib/Screens/Slider/slider_view.dart b/lib/Screens/Slider/slider_view.dart index 120fc6c..46c2a07 100644 --- a/lib/Screens/Slider/slider_view.dart +++ b/lib/Screens/Slider/slider_view.dart @@ -22,6 +22,8 @@ class _SliderViewWidget extends State { CarouselController? sliderController; int currentIndex = 1; + late ConfigurationDTO configurationDTO; + @override void initState() { sliderController = CarouselController(); @@ -43,6 +45,8 @@ class _SliderViewWidget extends State { Size size = MediaQuery.of(context).size; final appContext = Provider.of(context); + configurationDTO = appContext.getContext().configuration; + return Stack( children: [ Column( @@ -70,7 +74,7 @@ class _SliderViewWidget extends State { height: MediaQuery.of(context).size.height, margin: EdgeInsets.symmetric(horizontal: 5.0), decoration: BoxDecoration( - color: appContext.getContext().configuration == null ? kBackgroundGrey : appContext.getContext().configuration.secondaryColor != null ? new Color(int.parse(appContext.getContext().configuration.secondaryColor.split('(0x')[1].split(')')[0], radix: 16)): kBackgroundGrey, + color: configurationDTO.imageId == null ? configurationDTO.secondaryColor != null ? new Color(int.parse(configurationDTO.secondaryColor!.split('(0x')[1].split(')')[0], radix: 16)): kBackgroundGrey : null, borderRadius: BorderRadius.circular(10.0), //border: Border.all(width: 0.3, color: kSecondGrey), ), diff --git a/lib/Screens/Web/web_view.dart b/lib/Screens/Web/web_view.dart index 91710d8..a438da5 100644 --- a/lib/Screens/Web/web_view.dart +++ b/lib/Screens/Web/web_view.dart @@ -1,5 +1,5 @@ import 'dart:convert'; -import 'dart:html'; +//import 'dart:html'; import 'dart:ui' as ui; import 'package:flutter/foundation.dart'; @@ -18,7 +18,7 @@ class WebView extends StatefulWidget { } class _WebViewWidget extends State { - final IFrameElement _iframeElement = IFrameElement(); + //final IFrameElement _iframeElement = IFrameElement(); //WebView _webView; WebDTO webDTO = WebDTO(); WebViewController? controller; @@ -31,14 +31,14 @@ class _WebViewWidget extends State { print(webDTO); if(kIsWeb) { - _iframeElement.src = webDTO.source_!; + /*_iframeElement.src = webDTO.source_!; _iframeElement.style.border = 'none'; //ignore: undefined_prefixed_name ui.platformViewRegistry.registerViewFactory( webDTO.source_!, //use source as registered key to ensure uniqueness (int viewId) => _iframeElement, - ); + );*/ } else { controller = WebViewController() ..setJavaScriptMode(JavaScriptMode.unrestricted) @@ -94,7 +94,6 @@ class _WebViewWidget extends State { key: UniqueKey(), viewType: webDTO.source_!, ) : - //WebViewWidget(controller: controller!) - Text("sousou"): + WebViewWidget(controller: controller!) : Center(child: Text("La page internet ne peut pas ĂȘtre affichĂ©e, l'url est incorrecte ou vide")); } //_webView \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index 3e5a549..18c94b8 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -23,7 +23,7 @@ void main() async { localContext = await DatabaseHelper.instance.getData(); } - if(localContext != null) { + if(localContext != null && localContext.host != null) { print("we've got an local db !"); localContext.clientAPI = new Client(localContext.host!); isConfig = localContext.configuration != null; diff --git a/manager_api/pubspec.yaml b/manager_api/pubspec.yaml index 67848de..50ecdf7 100644 --- a/manager_api/pubspec.yaml +++ b/manager_api/pubspec.yaml @@ -7,10 +7,10 @@ version: '1.0.0' description: 'OpenAPI API client' homepage: 'homepage' environment: - sdk: '>=2.12.0 <3.0.0' + sdk: ">=3.1.0 <4.0.0" dependencies: - http: '>=0.13.0 <0.14.0' - intl: '^0.17.0' + http: '^1.1.0' + intl: '^0.18.0' meta: '^1.1.8' dev_dependencies: test: '>=1.16.0 <1.18.0' diff --git a/pubspec.yaml b/pubspec.yaml index 1de0cc0..d693ea9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,10 +15,10 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.4.0+4 +version: 1.5.0+5 environment: - sdk: ">=2.17.0 <3.0.0" + sdk: ">=3.1.0 <4.0.0" dependencies: flutter: @@ -26,43 +26,42 @@ dependencies: # Specific Mobile sqflite: # Specific mobile and macOS - webview_flutter: ^4.0.1 # Specific mobile # old : ^3.0.4 - google_maps_flutter: ^2.0.1 # Specific mobile - youtube_player_flutter: ^8.1.1 # Specific mobile + webview_flutter: ^4.4.1 # Specific mobile # old : ^3.0.4 + google_maps_flutter: ^2.5.0 # Specific mobile + youtube_player_flutter: ^8.1.2 # Specific mobile # Specific Web - google_maps_flutter_web: ^0.4.0+5 # Specific WEB - youtube_player_iframe: ^4.0.1 # Handle mobile and web here => TO TEST + google_maps_flutter_web: ^0.5.4+2 # Specific WEB + youtube_player_iframe: ^4.0.4 # Handle mobile and web here => TO TEST - flare_flutter: ^3.0.1 - provider: ^6.0.4 - http: ^0.13.5 + flare_flutter: ^3.0.2 + provider: ^6.0.5 + http: ^1.1.0 auto_size_text: ^3.0.0 fluttertoast: device_info: ^2.0.2 # DISCONTINUED enum_to_string: ^2.0.1 - carousel_slider: ^4.0.0 - mqtt_client: ^9.6.8 + carousel_slider: ^4.2.1 + mqtt_client: ^10.0.0 photo_view: ^0.14.0 confetti: ^0.7.0 - flutter_launcher_icons: ^0.10.0 # All but web - flutter_svg_provider: ^1.0.3 + flutter_launcher_icons: ^0.13.1 # All but web + flutter_svg_provider: ^1.0.6 - openapi_generator_cli: ^4.0.0 - openapi_generator: ^4.0.0 - openapi_generator_annotations: ^4.0.0 + openapi_generator_cli: ^4.13.1 + openapi_generator: ^4.13.1 + openapi_generator_annotations: ^4.13.1 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. - cupertino_icons: ^1.0.0 + cupertino_icons: ^1.0.6 manager_api: path: manager_api dev_dependencies: flutter_test: sdk: flutter - build_runner: - openapi_generator: ^4.0.0 + openapi_generator: ^4.13.1 # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec