From e8ef78d0e2b08f7c239464fcf291999ad37123b9 Mon Sep 17 00:00:00 2001 From: Thomas Fransolet Date: Fri, 13 Mar 2026 17:43:17 +0100 Subject: [PATCH] Update fix after service generation + need test geoloc ! + need test for connexion with apikey also ! + check where http needed.. need to pass by service generation --- lib/Components/audio_player.dart | 2 +- lib/Helpers/DatabaseHelper.dart | 17 +- lib/Helpers/modelsHelper.dart | 2 - lib/Models/visitContext.dart | 21 +- lib/Screens/Home/home.dart | 7 +- lib/Screens/Home/home_3.0.dart | 4 +- .../Sections/Agenda/event_list_item.dart | 8 +- lib/Screens/Sections/Agenda/event_popup.dart | 12 +- lib/Screens/Sections/Agenda/month_filter.dart | 2 +- lib/Screens/Sections/Game/game_page.dart | 48 +- lib/Screens/Sections/Game/message_dialog.dart | 4 +- .../Sections/Map/flutter_map_view.dart | 16 +- .../Sections/Map/geo_point_filter.dart | 98 +++-- lib/Screens/Sections/Map/google_map_view.dart | 210 +++------ lib/Screens/Sections/Map/map_box_view.dart | 74 +++- lib/Screens/Sections/Map/marker_view.dart | 26 +- lib/Screens/Sections/Menu/menu_page.dart | 2 +- lib/Screens/Sections/PDF/pdf_filter.dart | 2 +- lib/Screens/Sections/PDF/pdf_page.dart | 4 +- lib/Screens/Sections/Slider/slider_page.dart | 10 +- .../Sections/Weather/weather_page.dart | 10 +- lib/Screens/section_page.dart | 11 +- lib/Services/apiService.dart | 2 +- lib/client.dart | 7 +- lib/constants.dart | 5 + lib/main.dart | 26 +- manager_api_new/lib/api.dart | 13 + .../lib/model/app_configuration_link.dart | 369 ++++++++++++++++ ...nfiguration_link_application_instance.dart | 277 ++++++++++++ .../app_configuration_link_configuration.dart | 21 + .../model/app_configuration_link_device.dart | 21 + manager_api_new/lib/model/app_type.dart | 110 +++++ .../lib/model/application_instance_dto.dart | 295 +++++++++++++ ...cation_instance_dto_section_event_dto.dart | 409 ++++++++++++++++++ .../application_instance_section_event.dart | 387 +++++++++++++++++ manager_api_new/lib/model/instance_dto.dart | 132 +++++- .../lib/model/layout_main_page_type.dart | 102 +++++ manager_api_new/lib/model/map_annotation.dart | 31 ++ .../lib/model/programme_block.dart | 31 ++ manager_api_new/lib/model/section_event.dart | 386 +++++++++++++++++ .../lib/model/section_event_dto.dart | 406 +++++++++++++++++ pubspec.lock | 2 +- pubspec.yaml | 1 + 43 files changed, 3317 insertions(+), 306 deletions(-) create mode 100644 manager_api_new/lib/model/app_configuration_link.dart create mode 100644 manager_api_new/lib/model/app_configuration_link_application_instance.dart create mode 100644 manager_api_new/lib/model/app_configuration_link_configuration.dart create mode 100644 manager_api_new/lib/model/app_configuration_link_device.dart create mode 100644 manager_api_new/lib/model/app_type.dart create mode 100644 manager_api_new/lib/model/application_instance_dto.dart create mode 100644 manager_api_new/lib/model/application_instance_dto_section_event_dto.dart create mode 100644 manager_api_new/lib/model/application_instance_section_event.dart create mode 100644 manager_api_new/lib/model/layout_main_page_type.dart create mode 100644 manager_api_new/lib/model/map_annotation.dart create mode 100644 manager_api_new/lib/model/programme_block.dart create mode 100644 manager_api_new/lib/model/section_event.dart create mode 100644 manager_api_new/lib/model/section_event_dto.dart diff --git a/lib/Components/audio_player.dart b/lib/Components/audio_player.dart index bbb78ff..eef0df8 100644 --- a/lib/Components/audio_player.dart +++ b/lib/Components/audio_player.dart @@ -201,7 +201,7 @@ class _AudioPlayerFloatingContainerState extends State e.toString().contains(columnApiKey)).isEmpty) { + await db.rawQuery("ALTER TABLE $nameOfTable ADD $columnApiKey TEXT"); + } DatabaseHelper.instance.insert(DatabaseTableType.main, visitAppContext.toMap()); } catch (e) { print("ERROR IN updateTableMain"); @@ -321,6 +323,7 @@ class DatabaseHelper { language: element["language"], isAdmin: element["isAdmin"] == 1 ? true : false, isAllLanguages: element["isAllLanguages"] == 1 ? true : false, + apiKey: element["apiKey"] as String?, ); break; case DatabaseTableType.configurations: @@ -381,8 +384,6 @@ class DatabaseHelper { secondaryColor: element["secondaryColor"], languages: List.from(jsonDecode(element["languages"])), dateCreation: DateTime.tryParse(element["dateCreation"]), - isMobile: element["isMobile"] == 1 ? true : false, - isTablet: element["isTablet"] == 1 ? true : false, isOffline: element["isOffline"] == 1 ? true : false ); } diff --git a/lib/Helpers/modelsHelper.dart b/lib/Helpers/modelsHelper.dart index 8aaa9da..14db4d3 100644 --- a/lib/Helpers/modelsHelper.dart +++ b/lib/Helpers/modelsHelper.dart @@ -16,8 +16,6 @@ class ModelsHelper { 'secondaryColor': configuration.secondaryColor, 'languages': configuration.languages, 'dateCreation': configuration.dateCreation!.toUtc().toIso8601String(), - 'isMobile': configuration.isMobile, - 'isTablet': configuration.isTablet, 'isOffline': configuration.isOffline }; } diff --git a/lib/Models/visitContext.dart b/lib/Models/visitContext.dart index 6892c5c..d9f0fd9 100644 --- a/lib/Models/visitContext.dart +++ b/lib/Models/visitContext.dart @@ -5,13 +5,15 @@ import 'package:mymuseum_visitapp/Services/statisticsService.dart'; import 'package:mymuseum_visitapp/Models/beaconSection.dart'; import 'package:mymuseum_visitapp/Models/resourceModel.dart'; import 'package:mymuseum_visitapp/client.dart'; +import 'package:mymuseum_visitapp/constants.dart'; class VisitAppContext with ChangeNotifier { - Client clientAPI = Client("http://192.168.31.228:5000"); // Replace by https://api.mymuseum.be //http://192.168.31.140:8089 // https://api.myinfomate.be // http://192.168.31.228:5000 + Client clientAPI = Client(kApiBaseUrl); String? id = ""; String? language = ""; - String? instanceId = "63514fd67ed8c735aaa4b8f2"; // 63514fd67ed8c735aaa4b8f2 MyInfoMate test instance -- Fort de Saint-Héribert Mymuseum instance id : 633ee379d9405f32f166f047 // 63514fd67ed8c735aaa4b8f1 Mymuseum test // MDLF instance 65ccc67265373befd15be511 + String? instanceId = kInstanceId; + String? apiKey; List? configurations; ConfigurationDTO? configuration; @@ -31,12 +33,21 @@ class VisitAppContext with ChangeNotifier { ApplicationInstanceDTO? applicationInstanceDTO; // null = assistant non activé StatisticsService? statisticsService; + /// Retourne l'AppConfigurationLink de l'instance mobile pour la configuration courante. + /// Contient roundedValue, isSectionImageBackground, etc. + AppConfigurationLink? get currentAppConfigurationLink { + if (applicationInstanceDTO == null || configuration == null) return null; + return applicationInstanceDTO!.configurations + ?.where((c) => c.configurationId == configuration!.id) + .firstOrNull; + } + bool? isAdmin = false; bool? isAllLanguages = false; String? localPath; - VisitAppContext({this.language, this.id, this.configuration, this.isAdmin, this.isAllLanguages, this.instanceId}); + VisitAppContext({this.language, this.id, this.configuration, this.isAdmin, this.isAllLanguages, this.instanceId, this.apiKey}); Map toMap() { return { @@ -44,7 +55,8 @@ class VisitAppContext with ChangeNotifier { 'instanceId': instanceId, 'language': language, 'isAdmin': isAdmin != null ? isAdmin! ? 1 : 0 : 0, - 'isAllLanguages': isAllLanguages != null ? isAllLanguages! ? 1 : 0 : 0 + 'isAllLanguages': isAllLanguages != null ? isAllLanguages! ? 1 : 0 : 0, + 'apiKey': apiKey, }; } @@ -54,6 +66,7 @@ class VisitAppContext with ChangeNotifier { instanceId: json['instanceId'] as String, language: json['language'] as String, configuration: json['configuration'] == null ? null : ConfigurationDTO.fromJson(json['configuration']), + apiKey: json['apiKey'] as String?, ); } diff --git a/lib/Screens/Home/home.dart b/lib/Screens/Home/home.dart index 6dcf7aa..589c7fd 100644 --- a/lib/Screens/Home/home.dart +++ b/lib/Screens/Home/home.dart @@ -58,7 +58,12 @@ class _HomePageState extends State with WidgetsBindingObserver { future: getConfigurationsCall(visitAppContext.clientAPI, appContext), builder: (context, AsyncSnapshot snapshot) { if (snapshot.connectionState == ConnectionState.done) { - configurations = List.from(snapshot.data).where((configuration) => configuration.isMobile!).toList(); + // Filtrer par les configurations liées à l'instance Mobile (appType == Mobile) + final mobileConfigIds = visitAppContext.applicationInstanceDTO + ?.configurations?.map((c) => c.configurationId).toSet() ?? {}; + configurations = List.from(snapshot.data) + .where((c) => mobileConfigIds.isEmpty || mobileConfigIds.contains(c.id)) + .toList(); return RefreshIndicator ( onRefresh: () { setState(() {}); diff --git a/lib/Screens/Home/home_3.0.dart b/lib/Screens/Home/home_3.0.dart index 4f2184c..2fd3ab8 100644 --- a/lib/Screens/Home/home_3.0.dart +++ b/lib/Screens/Home/home_3.0.dart @@ -159,8 +159,10 @@ class _HomePage3State extends State with WidgetsBindingObserver { future: _futureConfigurations, builder: (context, AsyncSnapshot snapshot) { if (snapshot.connectionState == ConnectionState.done) { + final mobileConfigIds = visitAppContext.applicationInstanceDTO + ?.configurations?.map((c) => c.configurationId).toSet() ?? {}; configurations = List.from(snapshot.data) - .where((c) => c.isMobile!) + .where((c) => mobileConfigIds.isEmpty || mobileConfigIds.contains(c.id)) .toList(); final layoutType = visitAppContext.applicationInstanceDTO?.layoutMainPage; diff --git a/lib/Screens/Sections/Agenda/event_list_item.dart b/lib/Screens/Sections/Agenda/event_list_item.dart index 10593c2..fe4d4de 100644 --- a/lib/Screens/Sections/Agenda/event_list_item.dart +++ b/lib/Screens/Sections/Agenda/event_list_item.dart @@ -32,7 +32,7 @@ class EventListItem extends StatelessWidget { return Container( margin: const EdgeInsets.all(10.0), decoration: BoxDecoration( - borderRadius: BorderRadius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 20.0), + borderRadius: BorderRadius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 20.0), //color: Colors.red, boxShadow: const [ BoxShadow( @@ -53,7 +53,7 @@ class EventListItem extends StatelessWidget { child: Stack( children: [ eventAgenda.image != null ? ClipRRect( - borderRadius: BorderRadius.only(topLeft: Radius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 20.0), topRight: Radius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 20.0)), + borderRadius: BorderRadius.only(topLeft: Radius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 20.0), topRight: Radius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 20.0)), child: Container( //color: Colors.green, //constraints: const BoxConstraints(maxHeight: 175), @@ -82,7 +82,7 @@ class EventListItem extends StatelessWidget { decoration: BoxDecoration( color: primaryColor, borderRadius: BorderRadius.only( - topLeft: Radius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 20.0), + topLeft: Radius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 20.0), ), ), child: Padding( @@ -127,7 +127,7 @@ class EventListItem extends StatelessWidget { width: size.width, decoration: BoxDecoration( color: Colors.white, - borderRadius: BorderRadius.only(bottomLeft: Radius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 20.0), bottomRight: Radius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 20.0)), + borderRadius: BorderRadius.only(bottomLeft: Radius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 20.0), bottomRight: Radius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 20.0)), border: Border(top: BorderSide(width: 0.1, color: kMainGrey)) ), child: Padding( diff --git a/lib/Screens/Sections/Agenda/event_popup.dart b/lib/Screens/Sections/Agenda/event_popup.dart index 7223f13..15eea8a 100644 --- a/lib/Screens/Sections/Agenda/event_popup.dart +++ b/lib/Screens/Sections/Agenda/event_popup.dart @@ -130,11 +130,11 @@ class _EventPopupState extends State { return Dialog( insetPadding: const EdgeInsets.all(4.0), shape: RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 20.0)) + borderRadius: BorderRadius.all(Radius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 20.0)) ), child: Container( decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 20.0)), + borderRadius: BorderRadius.all(Radius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 20.0)), color: kBackgroundColor, ), height: size.height * 0.92, @@ -142,7 +142,7 @@ class _EventPopupState extends State { child: Stack( children: [ ClipRRect( - borderRadius: BorderRadius.only(topLeft: Radius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 20.0), topRight: Radius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 20.0)), + borderRadius: BorderRadius.only(topLeft: Radius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 20.0), topRight: Radius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 20.0)), child: Stack( children: [ Container( @@ -234,7 +234,7 @@ class _EventPopupState extends State { width: size.width, decoration: BoxDecoration( color: kBackgroundLight, - borderRadius: BorderRadius.all(Radius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 20.0)) + borderRadius: BorderRadius.all(Radius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 20.0)) ), child: Padding( padding: const EdgeInsets.only(left: 20, right: 10, bottom: 10, top: 15), @@ -286,7 +286,7 @@ class _EventPopupState extends State { height: size.height * 0.2, child: widget.mapProvider == MapProvider.Google ? ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 20.0)), + borderRadius: BorderRadius.all(Radius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 20.0)), child: GoogleMap( mapToolbarEnabled: false, initialCameraPosition: CameraPosition( @@ -300,7 +300,7 @@ class _EventPopupState extends State { ), ) : ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 20.0)), + borderRadius: BorderRadius.all(Radius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 20.0)), child: mapBox.MapWidget( key: ValueKey("mapBoxWidget"), styleUri: mapBox.MapboxStyles.STANDARD, diff --git a/lib/Screens/Sections/Agenda/month_filter.dart b/lib/Screens/Sections/Agenda/month_filter.dart index 2af8579..4e4f38f 100644 --- a/lib/Screens/Sections/Agenda/month_filter.dart +++ b/lib/Screens/Sections/Agenda/month_filter.dart @@ -74,7 +74,7 @@ class _MonthFilterState extends State with SingleTickerProviderStat ? Color(int.parse(visitAppContext.configuration!.primaryColor!.split('(0x')[1].split(')')[0], radix: 16)) : kSecondColor; - double rounded = visitAppContext.configuration?.roundedValue?.toDouble() ?? 20.0; + double rounded = visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 20.0; List> sortedMonths = _getSortedMonths(); diff --git a/lib/Screens/Sections/Game/game_page.dart b/lib/Screens/Sections/Game/game_page.dart index 677dd90..21efc05 100644 --- a/lib/Screens/Sections/Game/game_page.dart +++ b/lib/Screens/Sections/Game/game_page.dart @@ -9,7 +9,7 @@ import 'package:manager_api_new/api.dart'; import 'package:mymuseum_visitapp/Components/loading_common.dart'; import 'package:mymuseum_visitapp/Helpers/translationHelper.dart'; import 'package:mymuseum_visitapp/Models/visitContext.dart'; -import 'package:mymuseum_visitapp/Screens/Sections/Puzzle/message_dialog.dart'; +import 'package:mymuseum_visitapp/Screens/Sections/Game/message_dialog.dart'; import 'package:mymuseum_visitapp/app_context.dart'; import 'package:mymuseum_visitapp/constants.dart'; import 'package:provider/provider.dart'; @@ -17,20 +17,20 @@ import 'puzzle_piece.dart'; const IMAGE_PATH = 'image_path'; -class PuzzlePage extends StatefulWidget { - final PuzzleDTO section; - PuzzlePage({required this.section}); +class GamePage extends StatefulWidget { + final GameDTO section; + GamePage({required this.section}); @override - _PuzzlePage createState() => _PuzzlePage(); + _GamePage createState() => _GamePage(); } -class _PuzzlePage extends State { - PuzzleDTO puzzleDTO = PuzzleDTO(); +class _GamePage extends State { + GameDTO gameDTO = GameDTO(); int allInPlaceCount = 0; bool isFinished = false; - DateTime? _puzzleStartTime; + DateTime? _gameStartTime; GlobalKey _widgetKey = GlobalKey(); Size? realWidgetSize; List pieces = []; @@ -40,28 +40,28 @@ class _PuzzlePage extends State { @override void initState() { //puzzleDTO = PuzzleDTO.fromJson(jsonDecode(widget.section!.data!))!; - puzzleDTO = widget.section; - puzzleDTO.rows = puzzleDTO.rows ?? 3; - puzzleDTO.cols = puzzleDTO.cols ?? 3; - _puzzleStartTime = DateTime.now(); + gameDTO = widget.section; + gameDTO.rows = gameDTO.rows ?? 3; + gameDTO.cols = gameDTO.cols ?? 3; + _gameStartTime = DateTime.now(); WidgetsBinding.instance.addPostFrameCallback((_) async { Size size = MediaQuery.of(context).size; final appContext = Provider.of(context, listen: false); VisitAppContext visitAppContext = appContext.getContext(); - print(puzzleDTO.messageDebut); - TranslationAndResourceDTO? messageDebut = puzzleDTO.messageDebut != null && puzzleDTO.messageDebut!.isNotEmpty ? puzzleDTO.messageDebut!.where((message) => message.language!.toUpperCase() == visitAppContext.language!.toUpperCase()).firstOrNull : null; + print(gameDTO.messageDebut); + TranslationAndResourceDTO? messageDebut = gameDTO.messageDebut != null && gameDTO.messageDebut!.isNotEmpty ? gameDTO.messageDebut!.where((message) => message.language!.toUpperCase() == visitAppContext.language!.toUpperCase()).firstOrNull : null; //await Future.delayed(const Duration(milliseconds: 50)); await WidgetsBinding.instance.endOfFrame; getRealWidgetSize(); - if(puzzleDTO.puzzleImage != null && puzzleDTO.puzzleImage!.url != null) { + if(gameDTO.puzzleImage != null && gameDTO.puzzleImage!.url != null) { //splitImage(Image.network(puzzleDTO.image!.resourceUrl!)); splitImage(CachedNetworkImage( - imageUrl: puzzleDTO.puzzleImage!.url!, + imageUrl: gameDTO.puzzleImage!.url!, fit: BoxFit.fill, errorWidget: (context, url, error) => Icon(Icons.error), )); @@ -152,8 +152,8 @@ class _PuzzlePage extends State { //imageSize = realWidgetSize!; Size imageSize = Size(realWidgetSize!.width * 1.25, realWidgetSize!.height * 1.25); - for (int x = 0; x < puzzleDTO.rows!; x++) { - for (int y = 0; y < puzzleDTO.cols!; y++) { + for (int x = 0; x < gameDTO.rows!; x++) { + for (int y = 0; y < gameDTO.cols!; y++) { setState(() { pieces.add( PuzzlePiece( @@ -162,8 +162,8 @@ class _PuzzlePage extends State { imageSize: imageSize, row: x, col: y, - maxRow: puzzleDTO.rows!, - maxCol: puzzleDTO.cols!, + maxRow: gameDTO.rows!, + maxCol: gameDTO.cols!, bringToTop: bringToTop, sendToBack: sendToBack, ), @@ -190,7 +190,7 @@ class _PuzzlePage extends State { void sendToBack(Widget widget) { setState(() { allInPlaceCount++; - isFinished = allInPlaceCount == puzzleDTO.rows! * puzzleDTO.cols!; + isFinished = allInPlaceCount == gameDTO.rows! * gameDTO.cols!; pieces.remove(widget); pieces.insert(0, widget); @@ -198,12 +198,12 @@ class _PuzzlePage extends State { Size size = MediaQuery.of(context).size; final appContext = Provider.of(context, listen: false); VisitAppContext visitAppContext = appContext.getContext(); - final duration = _puzzleStartTime != null ? DateTime.now().difference(_puzzleStartTime!).inSeconds : 0; + final duration = _gameStartTime != null ? DateTime.now().difference(_gameStartTime!).inSeconds : 0; visitAppContext.statisticsService?.track( VisitEventType.gameComplete, metadata: {'gameType': 'Puzzle', 'durationSeconds': duration}, ); - TranslationAndResourceDTO? messageFin = puzzleDTO.messageFin != null && puzzleDTO.messageFin!.isNotEmpty ? puzzleDTO.messageFin!.where((message) => message.language!.toUpperCase() == visitAppContext.language!.toUpperCase()).firstOrNull : null; + TranslationAndResourceDTO? messageFin = gameDTO.messageFin != null && gameDTO.messageFin!.isNotEmpty ? gameDTO.messageFin!.where((message) => message.language!.toUpperCase() == visitAppContext.language!.toUpperCase()).firstOrNull : null; if(messageFin != null) { showMessage(messageFin, appContext, context, size); @@ -336,7 +336,7 @@ class _PuzzlePage extends State { key: _widgetKey, padding: const EdgeInsets.all(0.0), child: isSplittingImage ? Center(child: LoadingCommon()) : - puzzleDTO.puzzleImage == null || puzzleDTO.puzzleImage!.url == null || realWidgetSize == null + gameDTO.puzzleImage == null || gameDTO.puzzleImage!.url == null || realWidgetSize == null ? Center(child: Text("Aucune image à afficher", style: TextStyle(fontSize: kNoneInfoOrIncorrect))) : Center( child: Padding( diff --git a/lib/Screens/Sections/Game/message_dialog.dart b/lib/Screens/Sections/Game/message_dialog.dart index 1ba157c..13648e8 100644 --- a/lib/Screens/Sections/Game/message_dialog.dart +++ b/lib/Screens/Sections/Game/message_dialog.dart @@ -15,7 +15,7 @@ void showMessage(TranslationAndResourceDTO translationAndResourceDTO, AppContext showDialog( builder: (BuildContext context) => AlertDialog( shape: RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 20.0)) + borderRadius: BorderRadius.all(Radius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 20.0)) ), content: SingleChildScrollView( child: Column( @@ -31,7 +31,7 @@ void showMessage(TranslationAndResourceDTO translationAndResourceDTO, AppContext child: Center( child: Container( decoration: BoxDecoration( - borderRadius: BorderRadius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 30), + borderRadius: BorderRadius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 30), //border: Border.all(width: 3, color: Colors.black) ), child: showElementForResource(ResourceDTO(id: translationAndResourceDTO.resourceId, type: translationAndResourceDTO.resource!.type, url: translationAndResourceDTO.resource!.url), appContext, true, false), diff --git a/lib/Screens/Sections/Map/flutter_map_view.dart b/lib/Screens/Sections/Map/flutter_map_view.dart index 7ce7408..ae392e8 100644 --- a/lib/Screens/Sections/Map/flutter_map_view.dart +++ b/lib/Screens/Sections/Map/flutter_map_view.dart @@ -46,11 +46,16 @@ class _FlutterMapViewState extends State { //var icon = point.categorie == null ? BitmapDescriptor.fromBytes(widget.icons.where((i) => i['id'] == null).first['icon']) : widget.icons.any((i) => i['id'] == point.categorieId) ? BitmapDescriptor.fromBytes(widget.icons.where((i) => i['id'] == point.categorieId).first['icon']) : BitmapDescriptor.fromBytes(widget.icons.where((i) => i['id'] == null).first['icon']); //widget.selectedMarkerIcon,; + final coords = point.geometry?.type == 'Point' && point.geometry?.coordinates is List ? point.geometry!.coordinates as List : null; + if (coords == null || coords.length < 2) return; + final lat = (coords[1] as num).toDouble(); + final lon = (coords[0] as num).toDouble(); + markers.add( Marker( width: 80.0, height: 80.0, - point: LatLng(double.tryParse(point.latitude!)!, double.tryParse(point.longitude!)!), + point: LatLng(lat, lon), child: GestureDetector( onTap: () { /*final mapContext = Provider.of(context, listen: false); @@ -121,8 +126,13 @@ class _FlutterMapViewState extends State { builder: (context, mapContext, _) { var geoPoint = mapContext.getSelectedPointForNavigate() as GeoPointDTO?; if (geoPoint != null && mapController != null) { - print("COUCOU IL FAUT NAVIGATE FLUTTER MAP"); - mapController!.move(LatLng(double.tryParse(geoPoint.latitude!)!, double.tryParse(geoPoint.longitude!)!), mapController!.camera.zoom/*, widget.mapDTO!.zoom != null ? widget.mapDTO!.zoom!.toDouble() : 16*/); // keep actual zoom + final coords = geoPoint.geometry?.type == 'Point' && geoPoint.geometry?.coordinates is List ? geoPoint.geometry!.coordinates as List : null; + if (coords != null && coords.length >= 2) { + final lat = (coords[1] as num).toDouble(); + final lon = (coords[0] as num).toDouble(); + print("COUCOU IL FAUT NAVIGATE FLUTTER MAP"); + mapController!.move(LatLng(lat, lon), mapController!.camera.zoom); + } } return SizedBox(); }, diff --git a/lib/Screens/Sections/Map/geo_point_filter.dart b/lib/Screens/Sections/Map/geo_point_filter.dart index 541b754..3df4fd0 100644 --- a/lib/Screens/Sections/Map/geo_point_filter.dart +++ b/lib/Screens/Sections/Map/geo_point_filter.dart @@ -90,9 +90,15 @@ class _GeoPointFilterState extends State with SingleTickerProvid for(var pointWithoutCat in geoPoints.where((gp) => gp.categorieId == null)) { if(pointWithoutCat.title!.where((l) => l.language == widget.language).firstOrNull != null) { + // Extraire lat/lon depuis la géométrie GeoJSON (Point → [longitude, latitude]) + final coordsNocat = pointWithoutCat.geometry?.type == 'Point' + ? pointWithoutCat.geometry!.coordinates as List? + : null; + final latNocat = coordsNocat != null && coordsNocat.length >= 2 ? (coordsNocat[1] as num).toDouble().toString() : ''; + final lonNocat = coordsNocat != null && coordsNocat.length >= 2 ? (coordsNocat[0] as num).toDouble().toString() : ''; TreeNode nodeWithoutCat = TreeNode( id: 000 + int.parse( - (pointWithoutCat.latitude ?? '').substring(0, min(pointWithoutCat.latitude!.length, 10)).replaceAll(".", "").replaceAll("-","") + (pointWithoutCat.longitude ?? '').substring(0, min(pointWithoutCat.longitude!.length, 10)).replaceAll(".", "").replaceAll("-","") + latNocat.substring(0, min(latNocat.length, 10)).replaceAll(".", "").replaceAll("-","") + lonNocat.substring(0, min(lonNocat.length, 10)).replaceAll(".", "").replaceAll("-","") ), title: parse(pointWithoutCat.title!.firstWhere((l) => l.language == widget.language).value!).documentElement!.text, children: [], @@ -122,9 +128,11 @@ class _GeoPointFilterState extends State with SingleTickerProvid // Ajoutez les géopoints correspondant à cette catégorie en tant qu'enfants du nœud parent for (var geoPoint in geoPoints.where((gp) => gp.categorieId != null)) { if (geoPoint.categorieId == category.id && geoPoint.title!.where((l) => l.language == widget.language).firstOrNull != null) { + final lat = _getPointLatLon(geoPoint, true); + final lon = _getPointLatLon(geoPoint, false); TreeNode geoPointNode = TreeNode( id: 000 + int.parse( - (geoPoint.latitude ?? '').substring(0, min(geoPoint.latitude!.length, 10)).replaceAll(".", "").replaceAll("-", "") + (geoPoint.longitude ?? '').substring(0, min(geoPoint.longitude!.length, 10)).replaceAll(".", "").replaceAll("-", "") + lat.substring(0, min(lat.length, 10)).replaceAll(".", "").replaceAll("-", "") + lon.substring(0, min(lon.length, 10)).replaceAll(".", "").replaceAll("-", "") ), title: parse(geoPoint.title!.firstWhere((l) => l.language == widget.language).value!).documentElement!.text, checked: true, // default true @@ -170,12 +178,12 @@ class _GeoPointFilterState extends State with SingleTickerProvid if (childNode.checked) { var point = widget.geoPoints.firstWhere( (point) { - String latitudePart = (point.latitude ?? '') - .substring(0, min(point.latitude!.length, 10)) + String latitudePart = _getPointLatLon(point, true) + .substring(0, min(_getPointLatLon(point, true).length, 10)) .replaceAll(".", "") .replaceAll("-", ""); - String longitudePart = (point.longitude ?? '') - .substring(0, min(point.longitude!.length, 10)) + String longitudePart = _getPointLatLon(point, false) + .substring(0, min(_getPointLatLon(point, false).length, 10)) .replaceAll(".", "") .replaceAll("-", ""); int combinedValue = int.parse(latitudePart + longitudePart); @@ -192,21 +200,21 @@ class _GeoPointFilterState extends State with SingleTickerProvid } } else { if(node.checked) { - var point = widget.geoPoints.firstWhere( - (point) { - String latitudePart = (point.latitude ?? '') - .substring(0, min(point.latitude!.length, 10)) - .replaceAll(".", "") - .replaceAll("-", ""); - String longitudePart = (point.longitude ?? '') - .substring(0, min(point.longitude!.length, 10)) - .replaceAll(".", "") - .replaceAll("-", ""); - int combinedValue = int.parse(latitudePart + longitudePart); - return combinedValue == node.id; - }, - orElse: () => GeoPointDTO(id: -1), - ); + var point = widget.geoPoints.firstWhere( + (point) { + String latitudePart = _getPointLatLon(point, true) + .substring(0, min(_getPointLatLon(point, true).length, 10)) + .replaceAll(".", "") + .replaceAll("-", ""); + String longitudePart = _getPointLatLon(point, false) + .substring(0, min(_getPointLatLon(point, false).length, 10)) + .replaceAll(".", "") + .replaceAll("-", ""); + int combinedValue = int.parse(latitudePart + longitudePart); + return combinedValue == node.id; + }, + orElse: () => GeoPointDTO(id: -1), + ); if (point.id != -1) { checkedGeoPoints.add(point); @@ -261,7 +269,7 @@ class _GeoPointFilterState extends State with SingleTickerProvid final mapContext = Provider.of(context); var primaryColor = visitAppContext.configuration != null ? visitAppContext.configuration!.primaryColor != null ? Color(int.parse(visitAppContext.configuration!.primaryColor!.split('(0x')[1].split(')')[0], radix: 16)) : kSecondColor : kSecondColor; - double rounded = visitAppContext.configuration?.roundedValue?.toDouble() ?? 20.0; + double rounded = visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 20.0; return Positioned( left: 0, @@ -307,7 +315,7 @@ class _GeoPointFilterState extends State with SingleTickerProvid ), focusColor: primaryColor, focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 20.0)), + borderRadius: BorderRadius.all(Radius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 20.0)), borderSide: BorderSide(color: primaryColor)), //labelStyle: TextStyle(color: primaryColor), suffixIcon: IconButton( @@ -343,22 +351,24 @@ class _GeoPointFilterState extends State with SingleTickerProvid sendFilteredGeoPoint(); }, onClicked: (node, commonID) { - var selectedNode = widget.geoPoints.firstWhere( - (point) { - String latitudePart = (point.latitude ?? '') - .substring(0, min(point.latitude!.length, 10)) - .replaceAll(".", "") - .replaceAll("-", ""); - String longitudePart = (point.longitude ?? '') - .substring(0, min(point.longitude!.length, 10)) - .replaceAll(".", "") - .replaceAll("-", ""); - int combinedValue = - int.parse(latitudePart + longitudePart); - return combinedValue == commonID; - }, - orElse: () => GeoPointDTO(id: -1), - ); + var selectedNode = widget.geoPoints.firstWhere( + (point) { + final lat = _getPointLatLon(point, true); + final lon = _getPointLatLon(point, false); + String latitudePart = lat + .substring(0, min(lat.length, 10)) + .replaceAll(".", "") + .replaceAll("-", ""); + String longitudePart = lon + .substring(0, min(lon.length, 10)) + .replaceAll(".", "") + .replaceAll("-", ""); + int combinedValue = + int.parse(latitudePart + longitudePart); + return combinedValue == commonID; + }, + orElse: () => GeoPointDTO(id: -1), + ); if (selectedNode.id != -1) { mapContext.setSelectedPointForNavigate(selectedNode); @@ -385,5 +395,15 @@ class _GeoPointFilterState extends State with SingleTickerProvid ), ); } + + String _getPointLatLon(GeoPointDTO point, bool isLat) { + if (point.geometry?.type == 'Point' && point.geometry?.coordinates is List) { + final coords = point.geometry!.coordinates as List; + if (coords.length >= 2) { + return (coords[isLat ? 1 : 0] as num).toDouble().toString(); + } + } + return ''; + } } diff --git a/lib/Screens/Sections/Map/google_map_view.dart b/lib/Screens/Sections/Map/google_map_view.dart index 053a382..01b12b2 100644 --- a/lib/Screens/Sections/Map/google_map_view.dart +++ b/lib/Screens/Sections/Map/google_map_view.dart @@ -32,7 +32,6 @@ class _GoogleMapViewState extends State { GoogleMapController? _GoogleMapcontroller; Set markers = {}; List? pointsToShow = []; - //List? selectedCategories = []; bool init = false; Set getMarkers(language, mapContext) { @@ -40,131 +39,105 @@ class _GoogleMapViewState extends State { int i = 0; pointsToShow!.forEach((point) { - var textSansHTML = parse(point.title!.firstWhere((translation) => translation.language == language).value); - point.id = i; - /*var mapMarker = new MapMarker( - id: point.id, - title: parse(textSansHTML.body!.text).documentElement!.text, - description: point.description!.firstWhere((translation) => translation.language == language).value, - longitude: point.longitude, - latitude: point.latitude, - contents: point.contents - );*/ - if (point.latitude != null && point.longitude != null) { - var icon = point.categorieId == null ? BitmapDescriptor.bytes(widget.icons.where((i) => i['id'] == null).first['icon']) : widget.icons.any((i) => i['id'] == point.categorieId) ? BitmapDescriptor.bytes(widget.icons.where((i) => i['id'] == point.categorieId).first['icon']) : BitmapDescriptor.bytes(widget.icons.where((i) => i['id'] == null).first['icon']); //widget.selectedMarkerIcon,; - markers.add(Marker( - draggable: false, - markerId: MarkerId(parse(textSansHTML.body!.text).documentElement!.text + point.latitude! + point.longitude!), - position: LatLng( - double.tryParse(point.latitude!)!, - double.tryParse(point.longitude!)!, - ), - icon: icon, //widget.selectedMarkerIcon, - //widget.selectedMarkerIcon != null ? BitmapDescriptor.fromBytes(widget.selectedMarkerIcon!) : BitmapDescriptor.defaultMarker, - /*icon: BitmapDescriptor.defaultMarkerWithHue( - BitmapDescriptor.hueYellow, - ),*/ - onTap: () { - //setState(() { - mapContext.setSelectedPoint(point); - //mapContext.setSelectedPointForNavigate(point); - //}); - (Provider.of(context, listen: false).getContext() as VisitAppContext) - .statisticsService?.track( - VisitEventType.mapPoiTap, - metadata: { - 'geoPointId': point.id, - 'geoPointTitle': parse(textSansHTML.body!.text).documentElement!.text, - }, - ); - }, - infoWindow: InfoWindow.noText)); + if (point.title != null && point.title!.any((translation) => translation.language == language)) { + var translation = point.title!.firstWhere((translation) => translation.language == language); + var textSansHTML = parse(translation.value); + point.id = i; + var coords = _getPointLatLon(point); + if (coords != null) { + var icon = point.categorieId == null + ? BitmapDescriptor.bytes(widget.icons.where((i) => i['id'] == null).first['icon']) + : widget.icons.any((i) => i['id'] == point.categorieId) + ? BitmapDescriptor.bytes(widget.icons.where((i) => i['id'] == point.categorieId).first['icon']) + : BitmapDescriptor.bytes(widget.icons.where((i) => i['id'] == null).first['icon']); + + markers.add(Marker( + draggable: false, + markerId: MarkerId(parse(textSansHTML.body!.text).documentElement!.text + coords.latitude.toString() + coords.longitude.toString()), + position: coords, + icon: icon, + onTap: () { + mapContext.setSelectedPoint(point); + (Provider.of(context, listen: false).getContext() as VisitAppContext) + .statisticsService?.track( + VisitEventType.mapPoiTap, + metadata: { + 'geoPointId': point.id, + 'geoPointTitle': parse(textSansHTML.body!.text).documentElement!.text, + }, + ); + }, + infoWindow: InfoWindow.noText)); + } } i++; }); return markers; } + LatLng? _getPointLatLon(GeoPointDTO point) { + if (point.geometry?.type == 'Point' && point.geometry?.coordinates != null && point.geometry!.coordinates! is List) { + final coords = point.geometry!.coordinates! as List; + if (coords.length >= 2) { + return LatLng( + (coords[1] as num).toDouble(), + (coords[0] as num).toDouble(), + ); + } + } + return null; + } + @override void initState() { - //selectedCategories = widget.mapDTO.categories!.map((cat) => cat.label!.firstWhere((element) => element.language == widget.language).value!).toList(); super.initState(); } @override void dispose() { - // TODO: implement dispose super.dispose(); } @override Widget build(BuildContext context) { final mapContext = Provider.of(context); - final appContext = Provider.of(context); - VisitAppContext visitAppContext = appContext.getContext() as VisitAppContext; - Size size = MediaQuery.of(context).size; - + //final appContext = Provider.of(context); + pointsToShow = widget.geoPoints; - - /*if(!init) { - print("getmarkers in build");*/ - getMarkers(widget.language, mapContext); - /* init = true; - }*/ - //MapTypeApp? mapTypeApp = MapTypeApp.fromJson(widget.mapDTO!.mapType!.value); - //print(mapTypeApp.toString()); + getMarkers(widget.language, mapContext); MapType type = MapType.hybrid; - //if(kIsWeb) { - if(widget.mapDTO.mapType != null) { - switch(widget.mapDTO.mapType!.value) { - case 0: - type = MapType.none; - break; - case 1: - type = MapType.normal; - break; - case 2: - type = MapType.satellite; - break; - case 3: - type = MapType.terrain; - break; - case 4: - type = MapType.hybrid; - break; - } + if(widget.mapDTO.mapType != null) { + switch(widget.mapDTO.mapType!.value) { + case 0: type = MapType.none; break; + case 1: type = MapType.normal; break; + case 2: type = MapType.satellite; break; + case 3: type = MapType.terrain; break; + case 4: type = MapType.hybrid; break; } + } - /*} else { - print("is OTHEER"); - type = EnumToString.fromString(MapType.values, widget.mapDTO!.mapType.toString()) != null ? EnumToString.fromString(MapType.values, widget.mapDTO!.mapType.toString())! : MapType.hybrid; - }*/ - - - //MapType type = EnumToString.fromString(MapType.values, widget.mapDTO!.mapType.toString()) != null ? EnumToString.fromString(MapType.values, widget.mapDTO!.mapType.toString())! : MapType.hybrid; return Stack( children: [ Center( child: GoogleMap( - mapType: type, // widget.mapDTO!.mapType != null ? EnumToString.fromString(MapType.values, widget.mapDTO!.mapType.toString())!: MapType.hybrid, + mapType: type, mapToolbarEnabled: false, indoorViewEnabled: false, initialCameraPosition: CameraPosition( - target: widget.mapDTO.longitude != null && widget.mapDTO.latitude != null ? LatLng(double.tryParse(widget.mapDTO.latitude!)!, double.tryParse(widget.mapDTO.longitude!)!) : LatLng(50.465503, 4.865105) , // MDLF 50.416639, 4.879169 / Namur 50.465503, 4.865105 + target: widget.mapDTO.longitude != null && widget.mapDTO.latitude != null + ? LatLng(double.tryParse(widget.mapDTO.latitude!)!, double.tryParse(widget.mapDTO.longitude!)!) + : LatLng(50.465503, 4.865105), zoom: widget.mapDTO.zoom != null ? widget.mapDTO.zoom!.toDouble() : 18, ), onMapCreated: (GoogleMapController controller) { - if(kIsWeb) { - //_controllerWeb.complete(controller); - } else { + if (!kIsWeb) { _controller.complete(controller); _GoogleMapcontroller = controller; } }, markers: markers, onTap: (LatLng location) { - print(location); mapContext.setSelectedPoint(null); mapContext.setSelectedPointForNavigate(null); }, @@ -177,19 +150,19 @@ class _GoogleMapViewState extends State { builder: (context, mapContext, _) { var geopoint = mapContext.getSelectedPointForNavigate() as GeoPointDTO?; if (geopoint != null && _GoogleMapcontroller != null) { - print("COUCOU IL FAUT NAVUGATE"); - // TODO Handle zoomDetail _GoogleMapcontroller!.getZoomLevel().then((actualZoom) { var zoomToNavigate = actualZoom <= 12.0 ? 15.0 : actualZoom; - _GoogleMapcontroller!.animateCamera(CameraUpdate.newCameraPosition( - CameraPosition( - target: LatLng(double.tryParse(geopoint.latitude!)!, double.tryParse(geopoint.longitude!)!), - tilt: 0.0, - bearing: 0.0, - zoom: zoomToNavigate - //zoom: widget.mapDTO.zoom != null ? widget.mapDTO.zoom!.toDouble() : 16 - ) - )); + var coords = _getPointLatLon(geopoint); + if (coords != null) { + _GoogleMapcontroller!.animateCamera(CameraUpdate.newCameraPosition( + CameraPosition( + target: coords, + tilt: 0.0, + bearing: 0.0, + zoom: zoomToNavigate + ) + )); + } }); } return SizedBox(); @@ -198,50 +171,7 @@ class _GoogleMapViewState extends State { } ), ) - /*Positioned( - left: 5, - top: 35, - child: SizedBox( - width: size.width * 0.3, - height: size.height * 0.76, - child: GeoPointFilter( - language: tabletAppContext.language!, - geoPoints: widget.mapDTO!.points!, - categories: widget.mapDTO!.categories!, - filteredPoints: (filteredPoints) { - print("COUCOU FILTERED POINTS"); - print(filteredPoints); - }), - ), - ), - Positioned( - bottom: 35, - left: 10, - child: SizedBox( - width: size.width * 0.75, - child: MultiSelectContainer( - label: null, - color: kBackgroundGrey, - initialValue: selectedCategories!, - isMultiple: true, - values: widget.mapDTO!.categories!.map((categorie) => categorie.label!.firstWhere((element) => element.language == widget.language).value!).toList(), - onChanged: (value) { - var tempOutput = new List.from(value); - print(tempOutput); - if(init) { - selectedCategories = tempOutput; - pointsToShow = widget.mapDTO!.points!.where((point) => tempOutput.any((tps) => point.categorie?.label?.firstWhere((lab) => lab.language == widget.language).value == tps) || point.categorie == null).toList(); - setState(() { - markers = getMarkers(widget.language, mapContext); - mapContext.notifyListeners(); - }); - } - }, - ), - ), - ),*/ ], ); } - } \ No newline at end of file diff --git a/lib/Screens/Sections/Map/map_box_view.dart b/lib/Screens/Sections/Map/map_box_view.dart index 49bd513..36b5741 100644 --- a/lib/Screens/Sections/Map/map_box_view.dart +++ b/lib/Screens/Sections/Map/map_box_view.dart @@ -40,7 +40,17 @@ class AnnotationClickListener extends mapBox.OnPointAnnotationClickListener { @override void onPointAnnotationClick(mapBox.PointAnnotation annotation) { try{ - var markerToShow = markersList.firstWhere((ml) => "${parse(ml.title!.first.value).documentElement!.text}${ml.latitude}${ml.longitude}" == annotation.textField); + var markerToShow = markersList.firstWhere((ml) { + if (ml.geometry?.type == 'Point' && ml.geometry?.coordinates != null && ml.geometry!.coordinates! is List) { + final coords = ml.geometry!.coordinates! as List; + if (coords.length >= 2) { + final lat = (coords[1] as num).toDouble(); + final lon = (coords[0] as num).toDouble(); + return "${parse(ml.title!.first.value).documentElement!.text}$lat$lon" == annotation.textField; + } + } + return false; + }); mapContext.setSelectedPoint(markerToShow); //mapContext.setSelectedPointForNavigate(markerToShow); } catch(e) { @@ -73,21 +83,24 @@ class _MapBoxViewState extends State { contents: point.contents );*/ markersList.add(point); - options.add(mapBox.PointAnnotationOptions( - geometry: mapBox.Point( - coordinates: mapBox.Position( - double.tryParse(point.longitude!)!, - double.tryParse(point.latitude!)!, - )), // .toJson() - iconSize: 1.3, - textField: "${parse(textSansHTML.body!.text).documentElement!.text}${point.latitude}${point.longitude}", - textOpacity: 0.0, - iconOffset: [0.0, 0.0], - symbolSortKey: 10, - iconColor: 0, - iconImage: null, - image: point.categorieId == null ? widget.icons.where((i) => i['id'] == null).first['icon'] : widget.icons.any((i) => i['id'] == point.categorieId) ? widget.icons.where((i) => i['id'] == point.categorieId).first['icon'] : widget.icons.where((i) => i['id'] == null).first['icon'], //widget.selectedMarkerIcon, - )); // , + var coords = _getPointLatLon(point); + if (coords != null) { + options.add(mapBox.PointAnnotationOptions( + geometry: mapBox.Point( + coordinates: mapBox.Position( + coords.longitude, + coords.latitude, + )), // .toJson() + iconSize: 1.3, + textField: "${parse(textSansHTML.body!.text).documentElement!.text}${coords.latitude}${coords.longitude}", + textOpacity: 0.0, + iconOffset: [0.0, 0.0], + symbolSortKey: 10, + iconColor: 0, + iconImage: null, + image: point.categorieId == null ? widget.icons.where((i) => i['id'] == null).first['icon'] : widget.icons.any((i) => i['id'] == point.categorieId) ? widget.icons.where((i) => i['id'] == point.categorieId).first['icon'] : widget.icons.where((i) => i['id'] == null).first['icon'], //widget.selectedMarkerIcon, + )); // , + } i++; } @@ -199,13 +212,16 @@ class _MapBoxViewState extends State { if (geoPoint != null && mapboxMap != null) { print("COUCOU IL FAUT NAVUGATE MAPBOX"); // TODO Handle zoomDetail - mapboxMap?.easeTo( - mapBox.CameraOptions( - center: mapBox.Point(coordinates: mapBox.Position(double.tryParse(geoPoint.longitude!)!, double.tryParse(geoPoint.latitude!)!)), //.toJson() - zoom: 16, - bearing: 0, - pitch: 3), - mapBox.MapAnimationOptions(duration: 2000, startDelay: 0)); + var coords = _getPointLatLon(geoPoint); + if (coords != null) { + mapboxMap?.easeTo( + mapBox.CameraOptions( + center: mapBox.Point(coordinates: mapBox.Position(coords.longitude, coords.latitude)), //.toJson() + zoom: 16, + bearing: 0, + pitch: 3), + mapBox.MapAnimationOptions(duration: 2000, startDelay: 0)); + } } return SizedBox(); }, @@ -233,4 +249,16 @@ class _MapBoxViewState extends State { ); } + LatLng? _getPointLatLon(GeoPointDTO point) { + if (point.geometry?.type == 'Point' && point.geometry?.coordinates != null && point.geometry!.coordinates! is List) { + final coords = point.geometry!.coordinates! as List; + if (coords.length >= 2) { + return LatLng( + (coords[1] as num).toDouble(), + (coords[0] as num).toDouble(), + ); + } + } + return null; + } } \ No newline at end of file diff --git a/lib/Screens/Sections/Map/marker_view.dart b/lib/Screens/Sections/Map/marker_view.dart index d997428..a7f2d07 100644 --- a/lib/Screens/Sections/Map/marker_view.dart +++ b/lib/Screens/Sections/Map/marker_view.dart @@ -71,7 +71,7 @@ class _MarkerInfoWidget extends State { decoration: BoxDecoration( color: kBackgroundColor, // Colors.amberAccent //kBackgroundLight, //shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 10.0), + borderRadius: BorderRadius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 10.0), /*boxShadow: [ BoxShadow( color: kBackgroundSecondGrey, @@ -85,7 +85,7 @@ class _MarkerInfoWidget extends State { children: [ if(selectedPoint != null) ClipRRect( - borderRadius: BorderRadius.only(topLeft: Radius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 20.0), topRight: Radius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 20.0)), + borderRadius: BorderRadius.only(topLeft: Radius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 20.0), topRight: Radius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 20.0)), child: Stack( children: [ Container( @@ -149,7 +149,7 @@ class _MarkerInfoWidget extends State { width: size.width, decoration: BoxDecoration( color: kBackgroundLight, - borderRadius: BorderRadius.all(Radius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 20.0)) + borderRadius: BorderRadius.all(Radius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 20.0)) ), child: Padding( padding: const EdgeInsets.only(left: 20, right: 10, bottom: 10, top: 15), @@ -222,7 +222,7 @@ class _MarkerInfoWidget extends State { width: size.width, decoration: BoxDecoration( color: kBackgroundLight, - borderRadius: BorderRadius.all(Radius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 20.0)) + borderRadius: BorderRadius.all(Radius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 20.0)) ), child: Padding( padding: const EdgeInsets.only(left: 20, right: 10, bottom: 10, top: 15), @@ -400,7 +400,7 @@ class _MarkerInfoWidget extends State { decoration: BoxDecoration( color: kBackgroundColor, shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(tabletAppContext.configuration!.roundedValue?.toDouble() ?? 10.0), + borderRadius: BorderRadius.circular(tabletAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 10.0), boxShadow: [ BoxShadow( color: kBackgroundSecondGrey, @@ -509,13 +509,13 @@ getElementForResource(BuildContext context, AppContext appContext, ContentDTO i, builder: (BuildContext context) { return AlertDialog( shape: RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 20.0)) + borderRadius: BorderRadius.all(Radius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 20.0)) ), contentPadding: EdgeInsets.zero, // title: Text(eventAgenda.name!), content: Container( decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 20.0)), + borderRadius: BorderRadius.all(Radius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 20.0)), color: kBackgroundColor, ), constraints: const BoxConstraints(minWidth: 250, minHeight: 250, maxHeight: 350), @@ -524,7 +524,7 @@ getElementForResource(BuildContext context, AppContext appContext, ContentDTO i, child: Container( decoration: BoxDecoration( //color: Colors.yellow, - borderRadius: BorderRadius.all(Radius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 15.0)), + borderRadius: BorderRadius.all(Radius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 15.0)), ), child: PhotoView( imageProvider: ImageCustomProvider.getImageProvider(appContext, i.resourceId!, i.resource!.url!), @@ -533,7 +533,7 @@ getElementForResource(BuildContext context, AppContext appContext, ContentDTO i, backgroundDecoration: BoxDecoration( color: kBackgroundGrey, shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 15.0), + borderRadius: BorderRadius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 15.0), ), ), ), @@ -550,7 +550,7 @@ getElementForResource(BuildContext context, AppContext appContext, ContentDTO i, image: ImageCustomProvider.getImageProvider(appContext, i.resourceId!, i.resource!.url!), fit: BoxFit.cover, ), - borderRadius: BorderRadius.all(Radius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 15.0)), + borderRadius: BorderRadius.all(Radius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 15.0)), /*border: Border.all( color: kBackgroundGrey, width: 1.0, @@ -571,13 +571,13 @@ getElementForResource(BuildContext context, AppContext appContext, ContentDTO i, builder: (BuildContext context) { return AlertDialog( shape: RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 20.0)) + borderRadius: BorderRadius.all(Radius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 20.0)) ), contentPadding: EdgeInsets.zero, // title: Text(eventAgenda.name!), content: Container( decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 20.0)), + borderRadius: BorderRadius.all(Radius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 20.0)), color: kBackgroundColor, ), constraints: const BoxConstraints(minWidth: 250, minHeight: 250, maxHeight: 350), @@ -595,7 +595,7 @@ getElementForResource(BuildContext context, AppContext appContext, ContentDTO i, child: Container( decoration: BoxDecoration( shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 15.0), + borderRadius: BorderRadius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 15.0), ), child: showElementForResource(ResourceDTO(id: i.resourceId, url: i.resource?.url, type: i.resource?.type), appContext, false, true), ), diff --git a/lib/Screens/Sections/Menu/menu_page.dart b/lib/Screens/Sections/Menu/menu_page.dart index c38d9fc..bdaabd4 100644 --- a/lib/Screens/Sections/Menu/menu_page.dart +++ b/lib/Screens/Sections/Menu/menu_page.dart @@ -341,7 +341,7 @@ boxDecoration(AppContext appContext, SectionDTO section, bool isSelected, Object return BoxDecoration( color: kBackgroundLight, shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 20.0), + borderRadius: BorderRadius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 20.0), image: section.imageSource != null || section.type == SectionType.Video ? DecorationImage( fit: BoxFit.cover, colorFilter: !isSelected? ColorFilter.mode(kBackgroundLight.withValues(alpha: 0.35), BlendMode.dstATop) : null, diff --git a/lib/Screens/Sections/PDF/pdf_filter.dart b/lib/Screens/Sections/PDF/pdf_filter.dart index 242706b..d4d08e2 100644 --- a/lib/Screens/Sections/PDF/pdf_filter.dart +++ b/lib/Screens/Sections/PDF/pdf_filter.dart @@ -63,7 +63,7 @@ class _PdfFilterState extends State with SingleTickerProviderStateMix ? Color(int.parse(visitAppContext.configuration!.primaryColor!.split('(0x')[1].split(')')[0], radix: 16)) : kSecondColor; - double rounded = visitAppContext.configuration?.roundedValue?.toDouble() ?? 20.0; + double rounded = visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 20.0; return AnimatedBuilder( animation: _widthAnimation, diff --git a/lib/Screens/Sections/PDF/pdf_page.dart b/lib/Screens/Sections/PDF/pdf_page.dart index 82c4b45..e02e514 100644 --- a/lib/Screens/Sections/PDF/pdf_page.dart +++ b/lib/Screens/Sections/PDF/pdf_page.dart @@ -278,8 +278,8 @@ class _PDFPage extends State { valueListenable: currentState, builder: (context, value, _) { return Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 20.0)), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 20.0)), color: primaryColor ), child: Padding( diff --git a/lib/Screens/Sections/Slider/slider_page.dart b/lib/Screens/Sections/Slider/slider_page.dart index df250e5..593403e 100644 --- a/lib/Screens/Sections/Slider/slider_page.dart +++ b/lib/Screens/Sections/Slider/slider_page.dart @@ -83,7 +83,7 @@ class _SliderPage extends State { decoration: BoxDecoration( color: 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(visitAppContext.configuration!.roundedValue?.toDouble() ?? 10.0), + borderRadius: BorderRadius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 10.0), //border: Border.all(width: 0.3, color: kSecondGrey), ), child: Column( @@ -142,7 +142,7 @@ class _SliderPage extends State { decoration: BoxDecoration( color: kBackgroundLight,// kBackgroundLight, shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 10.0), + borderRadius: BorderRadius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 10.0), boxShadow: const [ BoxShadow( color: kBackgroundSecondGrey, @@ -305,7 +305,7 @@ class _SliderPage extends State { offset: Offset(0, 2), // changes position of shadow ), ], - borderRadius: BorderRadius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 15.0), + borderRadius: BorderRadius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 15.0), ), ); break; @@ -325,7 +325,7 @@ class _SliderPage extends State { offset: Offset(0, 2), // changes position of shadow ), ], - borderRadius: BorderRadius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 15.0), + borderRadius: BorderRadius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 15.0), ), ); break; @@ -336,7 +336,7 @@ class _SliderPage extends State { decoration: BoxDecoration( color: kBackgroundLight, //shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 15.0), + borderRadius: BorderRadius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 15.0), ), child: showElementForResource(ResourceDTO(id: i.resourceId, url: i.resource!.url, type: i.resource!.type), appContext, false, true), ); diff --git a/lib/Screens/Sections/Weather/weather_page.dart b/lib/Screens/Sections/Weather/weather_page.dart index 435c0bd..49175a6 100644 --- a/lib/Screens/Sections/Weather/weather_page.dart +++ b/lib/Screens/Sections/Weather/weather_page.dart @@ -153,7 +153,7 @@ class _WeatherPageState extends State { children: [ weatherData == null ? const Center(child: Text("Aucune donnée à afficher")) : Container( // TODO translate ? decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 20.0)), + borderRadius: BorderRadius.all(Radius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 20.0)), gradient: LinearGradient( begin: Alignment.topRight, end: Alignment.bottomLeft, @@ -234,7 +234,7 @@ class _WeatherPageState extends State { height: size.height * 0.25, width: size.width, /*decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 20.0)), + borderRadius: BorderRadius.all(Radius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 20.0)), //color: Colors.grey, ),*/ child: Column( @@ -260,7 +260,7 @@ class _WeatherPageState extends State { width: size.width * 0.25, constraints: const BoxConstraints(minWidth: 125, maxWidth: 250), decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 20.0)), + borderRadius: BorderRadius.all(Radius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 20.0)), color: Colors.lightBlueAccent, boxShadow: [ BoxShadow( @@ -295,7 +295,7 @@ class _WeatherPageState extends State { height: size.height * 0.3, width: size.width, decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 20.0)), + borderRadius: BorderRadius.all(Radius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 20.0)), //color: Colors.amber, ), child: Column( @@ -321,7 +321,7 @@ class _WeatherPageState extends State { width: size.width * 0.125, constraints: const BoxConstraints(minWidth: 150, maxWidth: 250), decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(visitAppContext.configuration!.roundedValue?.toDouble() ?? 20.0)), + borderRadius: BorderRadius.all(Radius.circular(visitAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 20.0)), color: Colors.lightBlue, boxShadow: [ BoxShadow( diff --git a/lib/Screens/section_page.dart b/lib/Screens/section_page.dart index d9feaf3..d796ae4 100644 --- a/lib/Screens/section_page.dart +++ b/lib/Screens/section_page.dart @@ -7,10 +7,8 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:manager_api_new/api.dart'; -import 'package:mymuseum_visitapp/Components/CustomAppBar.dart'; import 'package:mymuseum_visitapp/Components/loading_common.dart'; import 'package:mymuseum_visitapp/Helpers/DatabaseHelper.dart'; -import 'package:mymuseum_visitapp/Helpers/translationHelper.dart'; import 'package:mymuseum_visitapp/Models/articleRead.dart'; import 'package:mymuseum_visitapp/Models/resourceModel.dart'; import 'package:mymuseum_visitapp/Models/visitContext.dart'; @@ -26,7 +24,6 @@ import 'package:mymuseum_visitapp/Screens/Sections/Slider/slider_page.dart'; import 'package:mymuseum_visitapp/Screens/Sections/Video/video_page.dart'; import 'package:mymuseum_visitapp/Screens/Sections/Weather/weather_page.dart'; import 'package:mymuseum_visitapp/Screens/Sections/Web/web_page.dart'; -import 'package:mymuseum_visitapp/Services/statisticsService.dart'; import 'package:mymuseum_visitapp/app_context.dart'; import 'package:mymuseum_visitapp/client.dart'; import 'package:provider/provider.dart'; @@ -130,13 +127,13 @@ class _SectionPageState extends State { ); case SectionType.Menu: MenuDTO menuDTO = MenuDTO.fromJson(sectionResult)!; - return MenuPage(section: menuDTO, isImageBackground: widget.configuration.isSectionImageBackground!); + return MenuPage(section: menuDTO, isImageBackground: visitAppContext.currentAppConfigurationLink?.isSectionImageBackground ?? false); case SectionType.Pdf: PdfDTO pdfDTO = PdfDTO.fromJson(sectionResult)!; return PDFPage(section: pdfDTO); - case SectionType.Puzzle: - PuzzleDTO puzzleDTO = PuzzleDTO.fromJson(sectionResult)!; - return PuzzlePage(section: puzzleDTO); + case SectionType.Game: + GameDTO gameDTO = GameDTO.fromJson(sectionResult)!; + return GamePage(section: gameDTO); case SectionType.Quiz: QuizDTO quizDTO = QuizDTO.fromJson(sectionResult)!; return QuizPage( diff --git a/lib/Services/apiService.dart b/lib/Services/apiService.dart index df9d4bb..ec5d4c4 100644 --- a/lib/Services/apiService.dart +++ b/lib/Services/apiService.dart @@ -45,7 +45,7 @@ class ApiService { bool isOnline = await hasNetwork(); if(isOnline) { final rawList = await client.sectionApi!.sectionGetFromConfigurationDetail(configurationId); - var sections = rawList.map((json) => SectionDTO.fromJson(json)).toList(); + var sections = rawList?.map((json) => SectionDTO.fromJson(json)).toList(); return rawList ?? []; } else { return []; // TODO return local list.. diff --git a/lib/client.dart b/lib/client.dart index a089a6e..9faa111 100644 --- a/lib/client.dart +++ b/lib/client.dart @@ -34,10 +34,9 @@ class Client { StatsApi? _statsApi; StatsApi? get statsApi => _statsApi; - Client(String path) { - _apiClient = ApiClient( - basePath: path); // "http://192.168.31.96" - //basePath: "https://localhost:44339"); + Client(String path, {String? apiKey}) { + _apiClient = ApiClient(basePath: path); + if (apiKey != null) _apiClient!.addDefaultHeader('X-Api-Key', apiKey); _authenticationApi = AuthenticationApi(_apiClient); _userApi = UserApi(_apiClient); _configurationApi = ConfigurationApi(_apiClient); diff --git a/lib/constants.dart b/lib/constants.dart index 7a34334..20fa5df 100644 --- a/lib/constants.dart +++ b/lib/constants.dart @@ -1,5 +1,10 @@ import 'package:flutter/material.dart'; +// API configuration +const kApiBaseUrl = 'http://192.168.31.228:5000'; // Replace with production URL +const kInstancePinCode = ''; // TODO: fill in the instance PIN code +const kInstanceId = '63514fd67ed8c735aaa4b8f2'; // TODO: fill in the instance ID + // Colors - TO FILL WITH CORRECT COLOR const kBackgroundColor = Color(0xFFFFFFFF); const kMainColor = Color(0xFF306bac); diff --git a/lib/main.dart b/lib/main.dart index 9c354eb..42373d0 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,24 +1,25 @@ //import 'package:audioplayers/audioplayers.dart'; +import 'dart:convert'; import 'dart:io'; import 'package:flutter/material.dart'; +import 'package:http/http.dart' as http; import 'package:flutter/services.dart'; // TODO // import 'package:flutter_beacon/flutter_beacon.dart'; import 'package:get/get.dart'; import 'package:mapbox_maps_flutter/mapbox_maps_flutter.dart'; import 'package:mymuseum_visitapp/Helpers/requirement_state_controller.dart'; import 'package:mymuseum_visitapp/Models/articleRead.dart'; -import 'package:mymuseum_visitapp/Screens/Home/home.dart'; import 'package:mymuseum_visitapp/Screens/Home/home_3.0.dart'; import 'package:mymuseum_visitapp/l10n/app_localizations.dart'; +import 'package:path_provider/path_provider.dart'; import 'package:provider/provider.dart'; import 'Helpers/DatabaseHelper.dart'; import 'Models/visitContext.dart'; import 'app_context.dart'; +import 'client.dart'; import 'constants.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; -import 'l10n/app_localizations.dart'; -import 'package:path_provider/path_provider.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); @@ -37,7 +38,7 @@ void main() async { List articleReadTest = List.from(await DatabaseHelper.instance.getData(DatabaseTableType.articleRead)); localContext.readSections = articleReadTest; } else { - localContext = VisitAppContext(language: "FR", id: "UserId_Init", instanceId: "63514fd67ed8c735aaa4b8f2", isAdmin: false, isAllLanguages: false); // 63514fd67ed8c735aaa4b8f2 MyInfoMate test instance -- 633ee379d9405f32f166f047 MyMuseum Fort Saint-Héribert - MyMuseum instance 63514fd67ed8c735aaa4b8f1 // MDLF instance 65ccc67265373befd15be511 + localContext = VisitAppContext(language: "FR", id: "UserId_Init", instanceId: kInstanceId, isAdmin: false, isAllLanguages: false); DatabaseHelper.instance.insert(DatabaseTableType.main, localContext.toMap()); List articleReadTest = List.from(await DatabaseHelper.instance.getData(DatabaseTableType.articleRead)); @@ -47,6 +48,23 @@ void main() async { print("NO LOCAL DB !"); } + // Bootstrap API key if not yet stored + if (localContext.apiKey == null && kInstancePinCode.isNotEmpty) { + try { + final resp = await http.get(Uri.parse( + '$kApiBaseUrl/api/instance/app-key?pinCode=$kInstancePinCode&appType=VisitApp')); + if (resp.statusCode == 200) { + localContext.apiKey = jsonDecode(resp.body)['key'] as String?; + DatabaseHelper.instance.updateTableMain(DatabaseTableType.main, localContext); + } + } catch (e) { + print('Bootstrap apiKey failed: $e'); + } + } + + // Always initialize clientAPI with the current apiKey + localContext.clientAPI = Client(kApiBaseUrl, apiKey: localContext.apiKey); + localContext.localPath = localPath; print("Local path $localPath"); diff --git a/manager_api_new/lib/api.dart b/manager_api_new/lib/api.dart index 142059a..5f5481f 100644 --- a/manager_api_new/lib/api.dart +++ b/manager_api_new/lib/api.dart @@ -91,6 +91,19 @@ part 'model/user_detail_dto.dart'; part 'model/video_dto.dart'; part 'model/weather_dto.dart'; part 'model/web_dto.dart'; +part 'model/map_annotation.dart'; +part 'model/programme_block.dart'; +part 'model/app_configuration_link_configuration.dart'; +part 'model/app_configuration_link_device.dart'; +part 'model/app_configuration_link.dart'; +part 'model/app_configuration_link_application_instance.dart'; +part 'model/app_type.dart'; +part 'model/layout_main_page_type.dart'; +part 'model/application_instance_dto.dart'; +part 'model/application_instance_dto_section_event_dto.dart'; +part 'model/application_instance_section_event.dart'; +part 'model/section_event.dart'; +part 'model/section_event_dto.dart'; /// An [ApiClient] instance that uses the default values obtained from /// the OpenAPI specification file. diff --git a/manager_api_new/lib/model/app_configuration_link.dart b/manager_api_new/lib/model/app_configuration_link.dart new file mode 100644 index 0000000..d2f3600 --- /dev/null +++ b/manager_api_new/lib/model/app_configuration_link.dart @@ -0,0 +1,369 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class AppConfigurationLink { + /// Returns a new [AppConfigurationLink] instance. + AppConfigurationLink({ + required this.configurationId, + required this.applicationInstanceId, + this.id, + this.order, + this.isActive, + this.weightMasonryGrid, + this.isDate, + this.isHour, + this.roundedValue, + this.screenPercentageSectionsMainPage, + this.isSectionImageBackground, + this.layoutMainPage, + this.loaderImageId, + this.loaderImageUrl, + this.primaryColor, + this.secondaryColor, + this.configuration, + this.applicationInstance, + this.deviceId, + this.device, + }); + + String configurationId; + + String applicationInstanceId; + + String? id; + + int? order; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + bool? isActive; + + int? weightMasonryGrid; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + bool? isDate; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + bool? isHour; + + int? roundedValue; + + int? screenPercentageSectionsMainPage; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + bool? isSectionImageBackground; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + LayoutMainPageType? layoutMainPage; + + String? loaderImageId; + + String? loaderImageUrl; + + String? primaryColor; + + String? secondaryColor; + + AppConfigurationLinkConfiguration? configuration; + + AppConfigurationLinkApplicationInstance? applicationInstance; + + String? deviceId; + + AppConfigurationLinkDevice? device; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is AppConfigurationLink && + other.configurationId == configurationId && + other.applicationInstanceId == applicationInstanceId && + other.id == id && + other.order == order && + other.isActive == isActive && + other.weightMasonryGrid == weightMasonryGrid && + other.isDate == isDate && + other.isHour == isHour && + other.roundedValue == roundedValue && + other.screenPercentageSectionsMainPage == + screenPercentageSectionsMainPage && + other.isSectionImageBackground == isSectionImageBackground && + other.layoutMainPage == layoutMainPage && + other.loaderImageId == loaderImageId && + other.loaderImageUrl == loaderImageUrl && + other.primaryColor == primaryColor && + other.secondaryColor == secondaryColor && + other.configuration == configuration && + other.applicationInstance == applicationInstance && + other.deviceId == deviceId && + other.device == device; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (configurationId.hashCode) + + (applicationInstanceId.hashCode) + + (id == null ? 0 : id!.hashCode) + + (order == null ? 0 : order!.hashCode) + + (isActive == null ? 0 : isActive!.hashCode) + + (weightMasonryGrid == null ? 0 : weightMasonryGrid!.hashCode) + + (isDate == null ? 0 : isDate!.hashCode) + + (isHour == null ? 0 : isHour!.hashCode) + + (roundedValue == null ? 0 : roundedValue!.hashCode) + + (screenPercentageSectionsMainPage == null + ? 0 + : screenPercentageSectionsMainPage!.hashCode) + + (isSectionImageBackground == null + ? 0 + : isSectionImageBackground!.hashCode) + + (layoutMainPage == null ? 0 : layoutMainPage!.hashCode) + + (loaderImageId == null ? 0 : loaderImageId!.hashCode) + + (loaderImageUrl == null ? 0 : loaderImageUrl!.hashCode) + + (primaryColor == null ? 0 : primaryColor!.hashCode) + + (secondaryColor == null ? 0 : secondaryColor!.hashCode) + + (configuration == null ? 0 : configuration!.hashCode) + + (applicationInstance == null ? 0 : applicationInstance!.hashCode) + + (deviceId == null ? 0 : deviceId!.hashCode) + + (device == null ? 0 : device!.hashCode); + + @override + String toString() => + 'AppConfigurationLink[configurationId=$configurationId, applicationInstanceId=$applicationInstanceId, id=$id, order=$order, isActive=$isActive, weightMasonryGrid=$weightMasonryGrid, isDate=$isDate, isHour=$isHour, roundedValue=$roundedValue, screenPercentageSectionsMainPage=$screenPercentageSectionsMainPage, isSectionImageBackground=$isSectionImageBackground, layoutMainPage=$layoutMainPage, loaderImageId=$loaderImageId, loaderImageUrl=$loaderImageUrl, primaryColor=$primaryColor, secondaryColor=$secondaryColor, configuration=$configuration, applicationInstance=$applicationInstance, deviceId=$deviceId, device=$device]'; + + Map toJson() { + final json = {}; + json[r'configurationId'] = this.configurationId; + json[r'applicationInstanceId'] = this.applicationInstanceId; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; + } + if (this.order != null) { + json[r'order'] = this.order; + } else { + json[r'order'] = null; + } + if (this.isActive != null) { + json[r'isActive'] = this.isActive; + } else { + json[r'isActive'] = null; + } + if (this.weightMasonryGrid != null) { + json[r'weightMasonryGrid'] = this.weightMasonryGrid; + } else { + json[r'weightMasonryGrid'] = null; + } + if (this.isDate != null) { + json[r'isDate'] = this.isDate; + } else { + json[r'isDate'] = null; + } + if (this.isHour != null) { + json[r'isHour'] = this.isHour; + } else { + json[r'isHour'] = null; + } + if (this.roundedValue != null) { + json[r'roundedValue'] = this.roundedValue; + } else { + json[r'roundedValue'] = null; + } + if (this.screenPercentageSectionsMainPage != null) { + json[r'screenPercentageSectionsMainPage'] = + this.screenPercentageSectionsMainPage; + } else { + json[r'screenPercentageSectionsMainPage'] = null; + } + if (this.isSectionImageBackground != null) { + json[r'isSectionImageBackground'] = this.isSectionImageBackground; + } else { + json[r'isSectionImageBackground'] = null; + } + if (this.layoutMainPage != null) { + json[r'layoutMainPage'] = this.layoutMainPage; + } else { + json[r'layoutMainPage'] = null; + } + if (this.loaderImageId != null) { + json[r'loaderImageId'] = this.loaderImageId; + } else { + json[r'loaderImageId'] = null; + } + if (this.loaderImageUrl != null) { + json[r'loaderImageUrl'] = this.loaderImageUrl; + } else { + json[r'loaderImageUrl'] = null; + } + if (this.primaryColor != null) { + json[r'primaryColor'] = this.primaryColor; + } else { + json[r'primaryColor'] = null; + } + if (this.secondaryColor != null) { + json[r'secondaryColor'] = this.secondaryColor; + } else { + json[r'secondaryColor'] = null; + } + if (this.configuration != null) { + json[r'configuration'] = this.configuration; + } else { + json[r'configuration'] = null; + } + if (this.applicationInstance != null) { + json[r'applicationInstance'] = this.applicationInstance; + } else { + json[r'applicationInstance'] = null; + } + if (this.deviceId != null) { + json[r'deviceId'] = this.deviceId; + } else { + json[r'deviceId'] = null; + } + if (this.device != null) { + json[r'device'] = this.device; + } else { + json[r'device'] = null; + } + return json; + } + + /// Returns a new [AppConfigurationLink] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static AppConfigurationLink? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), + 'Required key "AppConfigurationLink[$key]" is missing from JSON.'); + assert(json[key] != null, + 'Required key "AppConfigurationLink[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return AppConfigurationLink( + configurationId: mapValueOfType(json, r'configurationId')!, + applicationInstanceId: + mapValueOfType(json, r'applicationInstanceId')!, + id: mapValueOfType(json, r'id'), + order: mapValueOfType(json, r'order'), + isActive: mapValueOfType(json, r'isActive'), + weightMasonryGrid: mapValueOfType(json, r'weightMasonryGrid'), + isDate: mapValueOfType(json, r'isDate'), + isHour: mapValueOfType(json, r'isHour'), + roundedValue: mapValueOfType(json, r'roundedValue'), + screenPercentageSectionsMainPage: + mapValueOfType(json, r'screenPercentageSectionsMainPage'), + isSectionImageBackground: + mapValueOfType(json, r'isSectionImageBackground'), + layoutMainPage: LayoutMainPageType.fromJson(json[r'layoutMainPage']), + loaderImageId: mapValueOfType(json, r'loaderImageId'), + loaderImageUrl: mapValueOfType(json, r'loaderImageUrl'), + primaryColor: mapValueOfType(json, r'primaryColor'), + secondaryColor: mapValueOfType(json, r'secondaryColor'), + configuration: + AppConfigurationLinkConfiguration.fromJson(json[r'configuration']), + applicationInstance: AppConfigurationLinkApplicationInstance.fromJson( + json[r'applicationInstance']), + deviceId: mapValueOfType(json, r'deviceId'), + device: AppConfigurationLinkDevice.fromJson(json[r'device']), + ); + } + return null; + } + + static List listFromJson( + dynamic json, { + bool growable = false, + }) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = AppConfigurationLink.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = AppConfigurationLink.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of AppConfigurationLink-objects as value to a dart map + static Map> mapListFromJson( + dynamic json, { + bool growable = false, + }) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = AppConfigurationLink.listFromJson( + entry.value, + growable: growable, + ); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'configurationId', + 'applicationInstanceId', + }; +} diff --git a/manager_api_new/lib/model/app_configuration_link_application_instance.dart b/manager_api_new/lib/model/app_configuration_link_application_instance.dart new file mode 100644 index 0000000..d34d758 --- /dev/null +++ b/manager_api_new/lib/model/app_configuration_link_application_instance.dart @@ -0,0 +1,277 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class AppConfigurationLinkApplicationInstance { + /// Returns a new [AppConfigurationLinkApplicationInstance] instance. + AppConfigurationLinkApplicationInstance({ + required this.instanceId, + required this.appType, + this.id, + this.configurations = const [], + this.mainImageId, + this.mainImageUrl, + this.loaderImageId, + this.loaderImageUrl, + this.primaryColor, + this.secondaryColor, + this.layoutMainPage, + this.languages = const [], + this.sectionEventId, + this.sectionEvent, + }); + + String instanceId; + + AppType appType; + + String? id; + + List? configurations; + + String? mainImageId; + + String? mainImageUrl; + + String? loaderImageId; + + String? loaderImageUrl; + + String? primaryColor; + + String? secondaryColor; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + LayoutMainPageType? layoutMainPage; + + List? languages; + + String? sectionEventId; + + ApplicationInstanceSectionEvent? sectionEvent; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is AppConfigurationLinkApplicationInstance && + other.instanceId == instanceId && + other.appType == appType && + other.id == id && + _deepEquality.equals(other.configurations, configurations) && + other.mainImageId == mainImageId && + other.mainImageUrl == mainImageUrl && + other.loaderImageId == loaderImageId && + other.loaderImageUrl == loaderImageUrl && + other.primaryColor == primaryColor && + other.secondaryColor == secondaryColor && + other.layoutMainPage == layoutMainPage && + _deepEquality.equals(other.languages, languages) && + other.sectionEventId == sectionEventId && + other.sectionEvent == sectionEvent; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (instanceId.hashCode) + + (appType.hashCode) + + (id == null ? 0 : id!.hashCode) + + (configurations == null ? 0 : configurations!.hashCode) + + (mainImageId == null ? 0 : mainImageId!.hashCode) + + (mainImageUrl == null ? 0 : mainImageUrl!.hashCode) + + (loaderImageId == null ? 0 : loaderImageId!.hashCode) + + (loaderImageUrl == null ? 0 : loaderImageUrl!.hashCode) + + (primaryColor == null ? 0 : primaryColor!.hashCode) + + (secondaryColor == null ? 0 : secondaryColor!.hashCode) + + (layoutMainPage == null ? 0 : layoutMainPage!.hashCode) + + (languages == null ? 0 : languages!.hashCode) + + (sectionEventId == null ? 0 : sectionEventId!.hashCode) + + (sectionEvent == null ? 0 : sectionEvent!.hashCode); + + @override + String toString() => + 'AppConfigurationLinkApplicationInstance[instanceId=$instanceId, appType=$appType, id=$id, configurations=$configurations, mainImageId=$mainImageId, mainImageUrl=$mainImageUrl, loaderImageId=$loaderImageId, loaderImageUrl=$loaderImageUrl, primaryColor=$primaryColor, secondaryColor=$secondaryColor, layoutMainPage=$layoutMainPage, languages=$languages, sectionEventId=$sectionEventId, sectionEvent=$sectionEvent]'; + + Map toJson() { + final json = {}; + json[r'instanceId'] = this.instanceId; + json[r'appType'] = this.appType; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; + } + if (this.configurations != null) { + json[r'configurations'] = this.configurations; + } else { + json[r'configurations'] = null; + } + if (this.mainImageId != null) { + json[r'mainImageId'] = this.mainImageId; + } else { + json[r'mainImageId'] = null; + } + if (this.mainImageUrl != null) { + json[r'mainImageUrl'] = this.mainImageUrl; + } else { + json[r'mainImageUrl'] = null; + } + if (this.loaderImageId != null) { + json[r'loaderImageId'] = this.loaderImageId; + } else { + json[r'loaderImageId'] = null; + } + if (this.loaderImageUrl != null) { + json[r'loaderImageUrl'] = this.loaderImageUrl; + } else { + json[r'loaderImageUrl'] = null; + } + if (this.primaryColor != null) { + json[r'primaryColor'] = this.primaryColor; + } else { + json[r'primaryColor'] = null; + } + if (this.secondaryColor != null) { + json[r'secondaryColor'] = this.secondaryColor; + } else { + json[r'secondaryColor'] = null; + } + if (this.layoutMainPage != null) { + json[r'layoutMainPage'] = this.layoutMainPage; + } else { + json[r'layoutMainPage'] = null; + } + if (this.languages != null) { + json[r'languages'] = this.languages; + } else { + json[r'languages'] = null; + } + if (this.sectionEventId != null) { + json[r'sectionEventId'] = this.sectionEventId; + } else { + json[r'sectionEventId'] = null; + } + if (this.sectionEvent != null) { + json[r'sectionEvent'] = this.sectionEvent; + } else { + json[r'sectionEvent'] = null; + } + return json; + } + + /// Returns a new [AppConfigurationLinkApplicationInstance] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static AppConfigurationLinkApplicationInstance? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), + 'Required key "AppConfigurationLinkApplicationInstance[$key]" is missing from JSON.'); + assert(json[key] != null, + 'Required key "AppConfigurationLinkApplicationInstance[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return AppConfigurationLinkApplicationInstance( + instanceId: mapValueOfType(json, r'instanceId')!, + appType: AppType.fromJson(json[r'appType'])!, + id: mapValueOfType(json, r'id'), + configurations: + AppConfigurationLink.listFromJson(json[r'configurations']), + mainImageId: mapValueOfType(json, r'mainImageId'), + mainImageUrl: mapValueOfType(json, r'mainImageUrl'), + loaderImageId: mapValueOfType(json, r'loaderImageId'), + loaderImageUrl: mapValueOfType(json, r'loaderImageUrl'), + primaryColor: mapValueOfType(json, r'primaryColor'), + secondaryColor: mapValueOfType(json, r'secondaryColor'), + layoutMainPage: LayoutMainPageType.fromJson(json[r'layoutMainPage']), + languages: json[r'languages'] is Iterable + ? (json[r'languages'] as Iterable) + .cast() + .toList(growable: false) + : const [], + sectionEventId: mapValueOfType(json, r'sectionEventId'), + sectionEvent: + ApplicationInstanceSectionEvent.fromJson(json[r'sectionEvent']), + ); + } + return null; + } + + static List listFromJson( + dynamic json, { + bool growable = false, + }) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = AppConfigurationLinkApplicationInstance.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson( + dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = + AppConfigurationLinkApplicationInstance.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of AppConfigurationLinkApplicationInstance-objects as value to a dart map + static Map> + mapListFromJson( + dynamic json, { + bool growable = false, + }) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = AppConfigurationLinkApplicationInstance.listFromJson( + entry.value, + growable: growable, + ); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'instanceId', + 'appType', + }; +} diff --git a/manager_api_new/lib/model/app_configuration_link_configuration.dart b/manager_api_new/lib/model/app_configuration_link_configuration.dart new file mode 100644 index 0000000..4614fd3 --- /dev/null +++ b/manager_api_new/lib/model/app_configuration_link_configuration.dart @@ -0,0 +1,21 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class AppConfigurationLinkConfiguration { + AppConfigurationLinkConfiguration({this.id}); + String? id; + + static AppConfigurationLinkConfiguration? fromJson(dynamic value) => + value is Map ? AppConfigurationLinkConfiguration() : null; + + static const requiredKeys = {}; +} diff --git a/manager_api_new/lib/model/app_configuration_link_device.dart b/manager_api_new/lib/model/app_configuration_link_device.dart new file mode 100644 index 0000000..fe05631 --- /dev/null +++ b/manager_api_new/lib/model/app_configuration_link_device.dart @@ -0,0 +1,21 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class AppConfigurationLinkDevice { + AppConfigurationLinkDevice({this.id}); + String? id; + + static AppConfigurationLinkDevice? fromJson(dynamic value) => + value is Map ? AppConfigurationLinkDevice() : null; + + static const requiredKeys = {}; +} diff --git a/manager_api_new/lib/model/app_type.dart b/manager_api_new/lib/model/app_type.dart new file mode 100644 index 0000000..7779efc --- /dev/null +++ b/manager_api_new/lib/model/app_type.dart @@ -0,0 +1,110 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +/// 0 = Mobile 1 = Tablet 2 = Web 3 = VR +class AppType { + /// Instantiate a new enum with the provided [value]. + const AppType._(this.value); + + /// The underlying value of this enum member. + final int value; + + @override + String toString() => value.toString(); + + int toJson() => value; + + static const Mobile = AppType._(0); + static const Tablet = AppType._(1); + static const Web = AppType._(2); + static const VR = AppType._(3); + + /// List of all possible values in this [enum][AppType]. + static const values = [ + Mobile, + Tablet, + Web, + VR, + ]; + + static AppType? fromJson(dynamic value) => + AppTypeTypeTransformer().decode(value); + + static List listFromJson( + dynamic json, { + bool growable = false, + }) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = AppType.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } +} + +/// Transformation class that can [encode] an instance of [AppType] to int, +/// and [decode] dynamic data back to [AppType]. +class AppTypeTypeTransformer { + factory AppTypeTypeTransformer() => + _instance ??= const AppTypeTypeTransformer._(); + + const AppTypeTypeTransformer._(); + + int encode(AppType data) => data.value; + + /// Decodes a [dynamic value][data] to a AppType. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + AppType? decode(dynamic data, {bool allowNull = true}) { + if (data != null) { + if(data.runtimeType == String) { + switch (data.toString()) { + case r'Mobile': return AppType.Mobile; + case r'Tablet': return AppType.Tablet; + case r'Web': return AppType.Web; + case r'VR': return AppType.VR; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + } else { + if(data.runtimeType == int) { + switch (data) { + case 0: return AppType.Mobile; + case 1: return AppType.Tablet; + case 2: return AppType.Web; + case 3: return AppType.VR; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + } + } + } + return null; + } + + /// Singleton [AppTypeTypeTransformer] instance. + static AppTypeTypeTransformer? _instance; +} diff --git a/manager_api_new/lib/model/application_instance_dto.dart b/manager_api_new/lib/model/application_instance_dto.dart new file mode 100644 index 0000000..0179a95 --- /dev/null +++ b/manager_api_new/lib/model/application_instance_dto.dart @@ -0,0 +1,295 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ApplicationInstanceDTO { + /// Returns a new [ApplicationInstanceDTO] instance. + ApplicationInstanceDTO({ + this.id, + this.instanceId, + this.appType, + this.configurations = const [], + this.mainImageId, + this.mainImageUrl, + this.loaderImageId, + this.loaderImageUrl, + this.primaryColor, + this.secondaryColor, + this.layoutMainPage, + this.languages = const [], + this.sectionEventId, + this.sectionEventDTO, + this.isAssistant, + }); + + String? id; + + String? instanceId; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + AppType? appType; + + List? configurations; + + String? mainImageId; + + String? mainImageUrl; + + String? loaderImageId; + + String? loaderImageUrl; + + String? primaryColor; + + String? secondaryColor; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + LayoutMainPageType? layoutMainPage; + + List? languages; + + String? sectionEventId; + + SectionEventDTO? sectionEventDTO; + + bool? isAssistant; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is ApplicationInstanceDTO && + other.id == id && + other.instanceId == instanceId && + other.appType == appType && + _deepEquality.equals(other.configurations, configurations) && + other.mainImageId == mainImageId && + other.mainImageUrl == mainImageUrl && + other.loaderImageId == loaderImageId && + other.loaderImageUrl == loaderImageUrl && + other.primaryColor == primaryColor && + other.secondaryColor == secondaryColor && + other.layoutMainPage == layoutMainPage && + _deepEquality.equals(other.languages, languages) && + other.sectionEventId == sectionEventId && + other.sectionEventDTO == sectionEventDTO && + other.isAssistant == isAssistant; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (id == null ? 0 : id!.hashCode) + + (instanceId == null ? 0 : instanceId!.hashCode) + + (appType == null ? 0 : appType!.hashCode) + + (configurations == null ? 0 : configurations!.hashCode) + + (mainImageId == null ? 0 : mainImageId!.hashCode) + + (mainImageUrl == null ? 0 : mainImageUrl!.hashCode) + + (loaderImageId == null ? 0 : loaderImageId!.hashCode) + + (loaderImageUrl == null ? 0 : loaderImageUrl!.hashCode) + + (primaryColor == null ? 0 : primaryColor!.hashCode) + + (secondaryColor == null ? 0 : secondaryColor!.hashCode) + + (layoutMainPage == null ? 0 : layoutMainPage!.hashCode) + + (languages == null ? 0 : languages!.hashCode) + + (sectionEventId == null ? 0 : sectionEventId!.hashCode) + + (sectionEventDTO == null ? 0 : sectionEventDTO!.hashCode) + + (isAssistant == null ? 0 : isAssistant!.hashCode); + + @override + String toString() => + 'ApplicationInstanceDTO[id=$id, instanceId=$instanceId, appType=$appType, configurations=$configurations, mainImageId=$mainImageId, mainImageUrl=$mainImageUrl, loaderImageId=$loaderImageId, loaderImageUrl=$loaderImageUrl, primaryColor=$primaryColor, secondaryColor=$secondaryColor, layoutMainPage=$layoutMainPage, languages=$languages, sectionEventId=$sectionEventId, sectionEventDTO=$sectionEventDTO, isAssistant=$isAssistant]'; + + Map toJson() { + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; + } + if (this.instanceId != null) { + json[r'instanceId'] = this.instanceId; + } else { + json[r'instanceId'] = null; + } + if (this.appType != null) { + json[r'appType'] = this.appType; + } else { + json[r'appType'] = null; + } + if (this.configurations != null) { + json[r'configurations'] = this.configurations; + } else { + json[r'configurations'] = null; + } + if (this.mainImageId != null) { + json[r'mainImageId'] = this.mainImageId; + } else { + json[r'mainImageId'] = null; + } + if (this.mainImageUrl != null) { + json[r'mainImageUrl'] = this.mainImageUrl; + } else { + json[r'mainImageUrl'] = null; + } + if (this.loaderImageId != null) { + json[r'loaderImageId'] = this.loaderImageId; + } else { + json[r'loaderImageId'] = null; + } + if (this.loaderImageUrl != null) { + json[r'loaderImageUrl'] = this.loaderImageUrl; + } else { + json[r'loaderImageUrl'] = null; + } + if (this.primaryColor != null) { + json[r'primaryColor'] = this.primaryColor; + } else { + json[r'primaryColor'] = null; + } + if (this.secondaryColor != null) { + json[r'secondaryColor'] = this.secondaryColor; + } else { + json[r'secondaryColor'] = null; + } + if (this.layoutMainPage != null) { + json[r'layoutMainPage'] = this.layoutMainPage; + } else { + json[r'layoutMainPage'] = null; + } + if (this.languages != null) { + json[r'languages'] = this.languages; + } else { + json[r'languages'] = null; + } + if (this.sectionEventId != null) { + json[r'sectionEventId'] = this.sectionEventId; + } else { + json[r'sectionEventId'] = null; + } + if (this.sectionEventDTO != null) { + json[r'sectionEventDTO'] = this.sectionEventDTO; + } else { + json[r'sectionEventDTO'] = null; + } + if (this.isAssistant != null) { + json[r'isAssistant'] = this.isAssistant; + } else { + json[r'isAssistant'] = null; + } + return json; + } + + /// Returns a new [ApplicationInstanceDTO] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static ApplicationInstanceDTO? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), + 'Required key "ApplicationInstanceDTO[$key]" is missing from JSON.'); + assert(json[key] != null, + 'Required key "ApplicationInstanceDTO[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return ApplicationInstanceDTO( + id: mapValueOfType(json, r'id'), + instanceId: mapValueOfType(json, r'instanceId'), + appType: AppType.fromJson(json[r'appType']), + configurations: + AppConfigurationLink.listFromJson(json[r'configurations']), + mainImageId: mapValueOfType(json, r'mainImageId'), + mainImageUrl: mapValueOfType(json, r'mainImageUrl'), + loaderImageId: mapValueOfType(json, r'loaderImageId'), + loaderImageUrl: mapValueOfType(json, r'loaderImageUrl'), + primaryColor: mapValueOfType(json, r'primaryColor'), + secondaryColor: mapValueOfType(json, r'secondaryColor'), + layoutMainPage: LayoutMainPageType.fromJson(json[r'layoutMainPage']), + languages: json[r'languages'] is Iterable + ? (json[r'languages'] as Iterable) + .cast() + .toList(growable: false) + : const [], + sectionEventId: mapValueOfType(json, r'sectionEventId'), + sectionEventDTO: SectionEventDTO.fromJson(json[r'sectionEventDTO']), + isAssistant: mapValueOfType(json, r'isAssistant'), + ); + } + return null; + } + + static List listFromJson( + dynamic json, { + bool growable = false, + }) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ApplicationInstanceDTO.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ApplicationInstanceDTO.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of ApplicationInstanceDTO-objects as value to a dart map + static Map> mapListFromJson( + dynamic json, { + bool growable = false, + }) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = ApplicationInstanceDTO.listFromJson( + entry.value, + growable: growable, + ); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = {}; +} diff --git a/manager_api_new/lib/model/application_instance_dto_section_event_dto.dart b/manager_api_new/lib/model/application_instance_dto_section_event_dto.dart new file mode 100644 index 0000000..8bde1c8 --- /dev/null +++ b/manager_api_new/lib/model/application_instance_dto_section_event_dto.dart @@ -0,0 +1,409 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ApplicationInstanceDTOSectionEventDTO { + /// Returns a new [ApplicationInstanceDTOSectionEventDTO] instance. + ApplicationInstanceDTOSectionEventDTO({ + this.id, + this.label, + this.title = const [], + this.description = const [], + this.isActive, + this.imageId, + this.imageSource, + this.configurationId, + this.isSubSection, + this.parentId, + this.type, + this.dateCreation, + this.order, + this.instanceId, + this.latitude, + this.longitude, + this.meterZoneGPS, + this.isBeacon, + this.beaconId, + this.startDate, + this.endDate, + this.parcoursIds = const [], + this.programme = const [], + }); + + String? id; + + String? label; + + List? title; + + List? description; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + bool? isActive; + + String? imageId; + + String? imageSource; + + String? configurationId; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + bool? isSubSection; + + String? parentId; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + SectionType? type; + + DateTime? dateCreation; + + int? order; + + String? instanceId; + + String? latitude; + + String? longitude; + + int? meterZoneGPS; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + bool? isBeacon; + + int? beaconId; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + DateTime? startDate; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + DateTime? endDate; + + List? parcoursIds; + + List? programme; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is ApplicationInstanceDTOSectionEventDTO && + other.id == id && + other.label == label && + _deepEquality.equals(other.title, title) && + _deepEquality.equals(other.description, description) && + other.isActive == isActive && + other.imageId == imageId && + other.imageSource == imageSource && + other.configurationId == configurationId && + other.isSubSection == isSubSection && + other.parentId == parentId && + other.type == type && + other.dateCreation == dateCreation && + other.order == order && + other.instanceId == instanceId && + other.latitude == latitude && + other.longitude == longitude && + other.meterZoneGPS == meterZoneGPS && + other.isBeacon == isBeacon && + other.beaconId == beaconId && + other.startDate == startDate && + other.endDate == endDate && + _deepEquality.equals(other.parcoursIds, parcoursIds) && + _deepEquality.equals(other.programme, programme); + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (id == null ? 0 : id!.hashCode) + + (label == null ? 0 : label!.hashCode) + + (title == null ? 0 : title!.hashCode) + + (description == null ? 0 : description!.hashCode) + + (isActive == null ? 0 : isActive!.hashCode) + + (imageId == null ? 0 : imageId!.hashCode) + + (imageSource == null ? 0 : imageSource!.hashCode) + + (configurationId == null ? 0 : configurationId!.hashCode) + + (isSubSection == null ? 0 : isSubSection!.hashCode) + + (parentId == null ? 0 : parentId!.hashCode) + + (type == null ? 0 : type!.hashCode) + + (dateCreation == null ? 0 : dateCreation!.hashCode) + + (order == null ? 0 : order!.hashCode) + + (instanceId == null ? 0 : instanceId!.hashCode) + + (latitude == null ? 0 : latitude!.hashCode) + + (longitude == null ? 0 : longitude!.hashCode) + + (meterZoneGPS == null ? 0 : meterZoneGPS!.hashCode) + + (isBeacon == null ? 0 : isBeacon!.hashCode) + + (beaconId == null ? 0 : beaconId!.hashCode) + + (startDate == null ? 0 : startDate!.hashCode) + + (endDate == null ? 0 : endDate!.hashCode) + + (parcoursIds == null ? 0 : parcoursIds!.hashCode) + + (programme == null ? 0 : programme!.hashCode); + + @override + String toString() => + 'ApplicationInstanceDTOSectionEventDTO[id=$id, label=$label, title=$title, description=$description, isActive=$isActive, imageId=$imageId, imageSource=$imageSource, configurationId=$configurationId, isSubSection=$isSubSection, parentId=$parentId, type=$type, dateCreation=$dateCreation, order=$order, instanceId=$instanceId, latitude=$latitude, longitude=$longitude, meterZoneGPS=$meterZoneGPS, isBeacon=$isBeacon, beaconId=$beaconId, startDate=$startDate, endDate=$endDate, parcoursIds=$parcoursIds, programme=$programme]'; + + Map toJson() { + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; + } + if (this.label != null) { + json[r'label'] = this.label; + } else { + json[r'label'] = null; + } + if (this.title != null) { + json[r'title'] = this.title; + } else { + json[r'title'] = null; + } + if (this.description != null) { + json[r'description'] = this.description; + } else { + json[r'description'] = null; + } + if (this.isActive != null) { + json[r'isActive'] = this.isActive; + } else { + json[r'isActive'] = null; + } + if (this.imageId != null) { + json[r'imageId'] = this.imageId; + } else { + json[r'imageId'] = null; + } + if (this.imageSource != null) { + json[r'imageSource'] = this.imageSource; + } else { + json[r'imageSource'] = null; + } + if (this.configurationId != null) { + json[r'configurationId'] = this.configurationId; + } else { + json[r'configurationId'] = null; + } + if (this.isSubSection != null) { + json[r'isSubSection'] = this.isSubSection; + } else { + json[r'isSubSection'] = null; + } + if (this.parentId != null) { + json[r'parentId'] = this.parentId; + } else { + json[r'parentId'] = null; + } + if (this.type != null) { + json[r'type'] = this.type; + } else { + json[r'type'] = null; + } + if (this.dateCreation != null) { + json[r'dateCreation'] = this.dateCreation!.toUtc().toIso8601String(); + } else { + json[r'dateCreation'] = null; + } + if (this.order != null) { + json[r'order'] = this.order; + } else { + json[r'order'] = null; + } + if (this.instanceId != null) { + json[r'instanceId'] = this.instanceId; + } else { + json[r'instanceId'] = null; + } + if (this.latitude != null) { + json[r'latitude'] = this.latitude; + } else { + json[r'latitude'] = null; + } + if (this.longitude != null) { + json[r'longitude'] = this.longitude; + } else { + json[r'longitude'] = null; + } + if (this.meterZoneGPS != null) { + json[r'meterZoneGPS'] = this.meterZoneGPS; + } else { + json[r'meterZoneGPS'] = null; + } + if (this.isBeacon != null) { + json[r'isBeacon'] = this.isBeacon; + } else { + json[r'isBeacon'] = null; + } + if (this.beaconId != null) { + json[r'beaconId'] = this.beaconId; + } else { + json[r'beaconId'] = null; + } + if (this.startDate != null) { + json[r'startDate'] = this.startDate!.toUtc().toIso8601String(); + } else { + json[r'startDate'] = null; + } + if (this.endDate != null) { + json[r'endDate'] = this.endDate!.toUtc().toIso8601String(); + } else { + json[r'endDate'] = null; + } + if (this.parcoursIds != null) { + json[r'parcoursIds'] = this.parcoursIds; + } else { + json[r'parcoursIds'] = null; + } + if (this.programme != null) { + json[r'programme'] = this.programme; + } else { + json[r'programme'] = null; + } + return json; + } + + /// Returns a new [ApplicationInstanceDTOSectionEventDTO] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static ApplicationInstanceDTOSectionEventDTO? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), + 'Required key "ApplicationInstanceDTOSectionEventDTO[$key]" is missing from JSON.'); + assert(json[key] != null, + 'Required key "ApplicationInstanceDTOSectionEventDTO[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return ApplicationInstanceDTOSectionEventDTO( + id: mapValueOfType(json, r'id'), + label: mapValueOfType(json, r'label'), + title: TranslationDTO.listFromJson(json[r'title']), + description: TranslationDTO.listFromJson(json[r'description']), + isActive: mapValueOfType(json, r'isActive'), + imageId: mapValueOfType(json, r'imageId'), + imageSource: mapValueOfType(json, r'imageSource'), + configurationId: mapValueOfType(json, r'configurationId'), + isSubSection: mapValueOfType(json, r'isSubSection'), + parentId: mapValueOfType(json, r'parentId'), + type: SectionType.fromJson(json[r'type']), + dateCreation: mapDateTime(json, r'dateCreation', r''), + order: mapValueOfType(json, r'order'), + instanceId: mapValueOfType(json, r'instanceId'), + latitude: mapValueOfType(json, r'latitude'), + longitude: mapValueOfType(json, r'longitude'), + meterZoneGPS: mapValueOfType(json, r'meterZoneGPS'), + isBeacon: mapValueOfType(json, r'isBeacon'), + beaconId: mapValueOfType(json, r'beaconId'), + startDate: mapDateTime(json, r'startDate', r''), + endDate: mapDateTime(json, r'endDate', r''), + parcoursIds: json[r'parcoursIds'] is Iterable + ? (json[r'parcoursIds'] as Iterable) + .cast() + .toList(growable: false) + : const [], + programme: ProgrammeBlock.listFromJson(json[r'programme']), + ); + } + return null; + } + + static List listFromJson( + dynamic json, { + bool growable = false, + }) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ApplicationInstanceDTOSectionEventDTO.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson( + dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = + ApplicationInstanceDTOSectionEventDTO.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of ApplicationInstanceDTOSectionEventDTO-objects as value to a dart map + static Map> + mapListFromJson( + dynamic json, { + bool growable = false, + }) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = ApplicationInstanceDTOSectionEventDTO.listFromJson( + entry.value, + growable: growable, + ); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = {}; +} diff --git a/manager_api_new/lib/model/application_instance_section_event.dart b/manager_api_new/lib/model/application_instance_section_event.dart new file mode 100644 index 0000000..e878de6 --- /dev/null +++ b/manager_api_new/lib/model/application_instance_section_event.dart @@ -0,0 +1,387 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ApplicationInstanceSectionEvent { + /// Returns a new [ApplicationInstanceSectionEvent] instance. + ApplicationInstanceSectionEvent({ + required this.id, + required this.label, + this.title = const [], + required this.configurationId, + required this.type, + required this.isSubSection, + required this.instanceId, + this.description = const [], + this.order, + this.imageId, + this.imageSource, + this.parentId, + this.dateCreation, + this.isBeacon, + this.beaconId, + this.latitude, + this.longitude, + this.meterZoneGPS, + this.isActive, + this.startDate, + this.endDate, + this.programme = const [], + this.parcoursIds = const [], + }); + + String id; + + String label; + + List title; + + String configurationId; + + SectionType type; + + bool isSubSection; + + String instanceId; + + List? description; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + int? order; + + String? imageId; + + String? imageSource; + + String? parentId; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + DateTime? dateCreation; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + bool? isBeacon; + + int? beaconId; + + String? latitude; + + String? longitude; + + int? meterZoneGPS; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + bool? isActive; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + DateTime? startDate; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + DateTime? endDate; + + List? programme; + + List? parcoursIds; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is ApplicationInstanceSectionEvent && + other.id == id && + other.label == label && + _deepEquality.equals(other.title, title) && + other.configurationId == configurationId && + other.type == type && + other.isSubSection == isSubSection && + other.instanceId == instanceId && + _deepEquality.equals(other.description, description) && + other.order == order && + other.imageId == imageId && + other.imageSource == imageSource && + other.parentId == parentId && + other.dateCreation == dateCreation && + other.isBeacon == isBeacon && + other.beaconId == beaconId && + other.latitude == latitude && + other.longitude == longitude && + other.meterZoneGPS == meterZoneGPS && + other.isActive == isActive && + other.startDate == startDate && + other.endDate == endDate && + _deepEquality.equals(other.programme, programme) && + _deepEquality.equals(other.parcoursIds, parcoursIds); + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (id.hashCode) + + (label.hashCode) + + (title.hashCode) + + (configurationId.hashCode) + + (type.hashCode) + + (isSubSection.hashCode) + + (instanceId.hashCode) + + (description == null ? 0 : description!.hashCode) + + (order == null ? 0 : order!.hashCode) + + (imageId == null ? 0 : imageId!.hashCode) + + (imageSource == null ? 0 : imageSource!.hashCode) + + (parentId == null ? 0 : parentId!.hashCode) + + (dateCreation == null ? 0 : dateCreation!.hashCode) + + (isBeacon == null ? 0 : isBeacon!.hashCode) + + (beaconId == null ? 0 : beaconId!.hashCode) + + (latitude == null ? 0 : latitude!.hashCode) + + (longitude == null ? 0 : longitude!.hashCode) + + (meterZoneGPS == null ? 0 : meterZoneGPS!.hashCode) + + (isActive == null ? 0 : isActive!.hashCode) + + (startDate == null ? 0 : startDate!.hashCode) + + (endDate == null ? 0 : endDate!.hashCode) + + (programme == null ? 0 : programme!.hashCode) + + (parcoursIds == null ? 0 : parcoursIds!.hashCode); + + @override + String toString() => + 'ApplicationInstanceSectionEvent[id=$id, label=$label, title=$title, configurationId=$configurationId, type=$type, isSubSection=$isSubSection, instanceId=$instanceId, description=$description, order=$order, imageId=$imageId, imageSource=$imageSource, parentId=$parentId, dateCreation=$dateCreation, isBeacon=$isBeacon, beaconId=$beaconId, latitude=$latitude, longitude=$longitude, meterZoneGPS=$meterZoneGPS, isActive=$isActive, startDate=$startDate, endDate=$endDate, programme=$programme, parcoursIds=$parcoursIds]'; + + Map toJson() { + final json = {}; + json[r'id'] = this.id; + json[r'label'] = this.label; + json[r'title'] = this.title; + json[r'configurationId'] = this.configurationId; + json[r'type'] = this.type; + json[r'isSubSection'] = this.isSubSection; + json[r'instanceId'] = this.instanceId; + if (this.description != null) { + json[r'description'] = this.description; + } else { + json[r'description'] = null; + } + if (this.order != null) { + json[r'order'] = this.order; + } else { + json[r'order'] = null; + } + if (this.imageId != null) { + json[r'imageId'] = this.imageId; + } else { + json[r'imageId'] = null; + } + if (this.imageSource != null) { + json[r'imageSource'] = this.imageSource; + } else { + json[r'imageSource'] = null; + } + if (this.parentId != null) { + json[r'parentId'] = this.parentId; + } else { + json[r'parentId'] = null; + } + if (this.dateCreation != null) { + json[r'dateCreation'] = this.dateCreation!.toUtc().toIso8601String(); + } else { + json[r'dateCreation'] = null; + } + if (this.isBeacon != null) { + json[r'isBeacon'] = this.isBeacon; + } else { + json[r'isBeacon'] = null; + } + if (this.beaconId != null) { + json[r'beaconId'] = this.beaconId; + } else { + json[r'beaconId'] = null; + } + if (this.latitude != null) { + json[r'latitude'] = this.latitude; + } else { + json[r'latitude'] = null; + } + if (this.longitude != null) { + json[r'longitude'] = this.longitude; + } else { + json[r'longitude'] = null; + } + if (this.meterZoneGPS != null) { + json[r'meterZoneGPS'] = this.meterZoneGPS; + } else { + json[r'meterZoneGPS'] = null; + } + if (this.isActive != null) { + json[r'isActive'] = this.isActive; + } else { + json[r'isActive'] = null; + } + if (this.startDate != null) { + json[r'startDate'] = this.startDate!.toUtc().toIso8601String(); + } else { + json[r'startDate'] = null; + } + if (this.endDate != null) { + json[r'endDate'] = this.endDate!.toUtc().toIso8601String(); + } else { + json[r'endDate'] = null; + } + if (this.programme != null) { + json[r'programme'] = this.programme; + } else { + json[r'programme'] = null; + } + if (this.parcoursIds != null) { + json[r'parcoursIds'] = this.parcoursIds; + } else { + json[r'parcoursIds'] = null; + } + return json; + } + + /// Returns a new [ApplicationInstanceSectionEvent] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static ApplicationInstanceSectionEvent? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), + 'Required key "ApplicationInstanceSectionEvent[$key]" is missing from JSON.'); + assert(json[key] != null, + 'Required key "ApplicationInstanceSectionEvent[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return ApplicationInstanceSectionEvent( + id: mapValueOfType(json, r'id')!, + label: mapValueOfType(json, r'label')!, + title: TranslationDTO.listFromJson(json[r'title']), + configurationId: mapValueOfType(json, r'configurationId')!, + type: SectionType.fromJson(json[r'type'])!, + isSubSection: mapValueOfType(json, r'isSubSection')!, + instanceId: mapValueOfType(json, r'instanceId')!, + description: TranslationDTO.listFromJson(json[r'description']), + order: mapValueOfType(json, r'order'), + imageId: mapValueOfType(json, r'imageId'), + imageSource: mapValueOfType(json, r'imageSource'), + parentId: mapValueOfType(json, r'parentId'), + dateCreation: mapDateTime(json, r'dateCreation', r''), + isBeacon: mapValueOfType(json, r'isBeacon'), + beaconId: mapValueOfType(json, r'beaconId'), + latitude: mapValueOfType(json, r'latitude'), + longitude: mapValueOfType(json, r'longitude'), + meterZoneGPS: mapValueOfType(json, r'meterZoneGPS'), + isActive: mapValueOfType(json, r'isActive'), + startDate: mapDateTime(json, r'startDate', r''), + endDate: mapDateTime(json, r'endDate', r''), + programme: ProgrammeBlock.listFromJson(json[r'programme']), + parcoursIds: json[r'parcoursIds'] is Iterable + ? (json[r'parcoursIds'] as Iterable) + .cast() + .toList(growable: false) + : const [], + ); + } + return null; + } + + static List listFromJson( + dynamic json, { + bool growable = false, + }) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ApplicationInstanceSectionEvent.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson( + dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ApplicationInstanceSectionEvent.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of ApplicationInstanceSectionEvent-objects as value to a dart map + static Map> mapListFromJson( + dynamic json, { + bool growable = false, + }) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = ApplicationInstanceSectionEvent.listFromJson( + entry.value, + growable: growable, + ); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'id', + 'label', + 'title', + 'configurationId', + 'type', + 'isSubSection', + 'instanceId', + }; +} diff --git a/manager_api_new/lib/model/instance_dto.dart b/manager_api_new/lib/model/instance_dto.dart index 3dff3e1..8d7e076 100644 --- a/manager_api_new/lib/model/instance_dto.dart +++ b/manager_api_new/lib/model/instance_dto.dart @@ -17,6 +17,14 @@ class InstanceDTO { this.name, this.dateCreation, this.pinCode, + this.isPushNotification, + this.isStatistic, + this.isMobile, + this.isTablet, + this.isWeb, + this.isVR, + this.isAssistant, + this.applicationInstanceDTOs = const [], }); String? id; @@ -27,6 +35,58 @@ class InstanceDTO { String? pinCode; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + bool? isPushNotification; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + bool? isStatistic; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + bool? isMobile; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + bool? isTablet; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + bool? isWeb; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + bool? isVR; + + bool? isAssistant; + + List? applicationInstanceDTOs; + @override bool operator ==(Object other) => identical(this, other) || @@ -34,7 +94,16 @@ class InstanceDTO { other.id == id && other.name == name && other.dateCreation == dateCreation && - other.pinCode == pinCode; + other.pinCode == pinCode && + other.isPushNotification == isPushNotification && + other.isStatistic == isStatistic && + other.isMobile == isMobile && + other.isTablet == isTablet && + other.isWeb == isWeb && + other.isVR == isVR && + other.isAssistant == isAssistant && + _deepEquality.equals( + other.applicationInstanceDTOs, applicationInstanceDTOs); @override int get hashCode => @@ -42,11 +111,19 @@ class InstanceDTO { (id == null ? 0 : id!.hashCode) + (name == null ? 0 : name!.hashCode) + (dateCreation == null ? 0 : dateCreation!.hashCode) + - (pinCode == null ? 0 : pinCode!.hashCode); + (pinCode == null ? 0 : pinCode!.hashCode) + + (isPushNotification == null ? 0 : isPushNotification!.hashCode) + + (isStatistic == null ? 0 : isStatistic!.hashCode) + + (isMobile == null ? 0 : isMobile!.hashCode) + + (isTablet == null ? 0 : isTablet!.hashCode) + + (isWeb == null ? 0 : isWeb!.hashCode) + + (isVR == null ? 0 : isVR!.hashCode) + + (isAssistant == null ? 0 : isAssistant!.hashCode) + + (applicationInstanceDTOs == null ? 0 : applicationInstanceDTOs!.hashCode); @override String toString() => - 'InstanceDTO[id=$id, name=$name, dateCreation=$dateCreation, pinCode=$pinCode]'; + 'InstanceDTO[id=$id, name=$name, dateCreation=$dateCreation, pinCode=$pinCode, isPushNotification=$isPushNotification, isStatistic=$isStatistic, isMobile=$isMobile, isTablet=$isTablet, isWeb=$isWeb, isVR=$isVR, isAssistant=$isAssistant, applicationInstanceDTOs=$applicationInstanceDTOs]'; Map toJson() { final json = {}; @@ -70,6 +147,46 @@ class InstanceDTO { } else { json[r'pinCode'] = null; } + if (this.isPushNotification != null) { + json[r'isPushNotification'] = this.isPushNotification; + } else { + json[r'isPushNotification'] = null; + } + if (this.isStatistic != null) { + json[r'isStatistic'] = this.isStatistic; + } else { + json[r'isStatistic'] = null; + } + if (this.isMobile != null) { + json[r'isMobile'] = this.isMobile; + } else { + json[r'isMobile'] = null; + } + if (this.isTablet != null) { + json[r'isTablet'] = this.isTablet; + } else { + json[r'isTablet'] = null; + } + if (this.isWeb != null) { + json[r'isWeb'] = this.isWeb; + } else { + json[r'isWeb'] = null; + } + if (this.isVR != null) { + json[r'isVR'] = this.isVR; + } else { + json[r'isVR'] = null; + } + if (this.isAssistant != null) { + json[r'isAssistant'] = this.isAssistant; + } else { + json[r'isAssistant'] = null; + } + if (this.applicationInstanceDTOs != null) { + json[r'applicationInstanceDTOs'] = this.applicationInstanceDTOs; + } else { + json[r'applicationInstanceDTOs'] = null; + } return json; } @@ -98,6 +215,15 @@ class InstanceDTO { name: mapValueOfType(json, r'name'), dateCreation: mapDateTime(json, r'dateCreation', r''), pinCode: mapValueOfType(json, r'pinCode'), + isPushNotification: mapValueOfType(json, r'isPushNotification'), + isStatistic: mapValueOfType(json, r'isStatistic'), + isMobile: mapValueOfType(json, r'isMobile'), + isTablet: mapValueOfType(json, r'isTablet'), + isWeb: mapValueOfType(json, r'isWeb'), + isVR: mapValueOfType(json, r'isVR'), + isAssistant: mapValueOfType(json, r'isAssistant'), + applicationInstanceDTOs: ApplicationInstanceDTO.listFromJson( + json[r'applicationInstanceDTOs']), ); } return null; diff --git a/manager_api_new/lib/model/layout_main_page_type.dart b/manager_api_new/lib/model/layout_main_page_type.dart new file mode 100644 index 0000000..1386215 --- /dev/null +++ b/manager_api_new/lib/model/layout_main_page_type.dart @@ -0,0 +1,102 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +/// 0 = SimpleGrid 1 = MasonryGrid +class LayoutMainPageType { + /// Instantiate a new enum with the provided [value]. + const LayoutMainPageType._(this.value); + + /// The underlying value of this enum member. + final int value; + + @override + String toString() => value.toString(); + + int toJson() => value; + + static const SimpleGrid = LayoutMainPageType._(0); + static const MasonryGrid = LayoutMainPageType._(1); + + /// List of all possible values in this [enum][LayoutMainPageType]. + static const values = [ + SimpleGrid, + MasonryGrid, + ]; + + static LayoutMainPageType? fromJson(dynamic value) => + LayoutMainPageTypeTypeTransformer().decode(value); + + static List listFromJson( + dynamic json, { + bool growable = false, + }) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = LayoutMainPageType.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } +} + +/// Transformation class that can [encode] an instance of [LayoutMainPageType] to int, +/// and [decode] dynamic data back to [LayoutMainPageType]. +class LayoutMainPageTypeTypeTransformer { + factory LayoutMainPageTypeTypeTransformer() => + _instance ??= const LayoutMainPageTypeTypeTransformer._(); + + const LayoutMainPageTypeTypeTransformer._(); + + int encode(LayoutMainPageType data) => data.value; + + /// Decodes a [dynamic value][data] to a LayoutMainPageType. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + LayoutMainPageType? decode(dynamic data, {bool allowNull = true}) { + if (data != null) { + if(data.runtimeType == String) { + switch (data.toString()) { + case r'SimpleGrid': return LayoutMainPageType.SimpleGrid; + case r'MasonryGrid': return LayoutMainPageType.MasonryGrid; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + } else { + if(data.runtimeType == int) { + switch (data) { + case 0: return LayoutMainPageType.SimpleGrid; + case 1: return LayoutMainPageType.MasonryGrid; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + } + } + } + return null; + } + + /// Singleton [LayoutMainPageTypeTypeTransformer] instance. + static LayoutMainPageTypeTypeTransformer? _instance; +} diff --git a/manager_api_new/lib/model/map_annotation.dart b/manager_api_new/lib/model/map_annotation.dart new file mode 100644 index 0000000..27418e0 --- /dev/null +++ b/manager_api_new/lib/model/map_annotation.dart @@ -0,0 +1,31 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class MapAnnotation { + MapAnnotation({this.id}); + String? id; + + static MapAnnotation? fromJson(dynamic value) => value is Map ? MapAnnotation() : null; + + static List listFromJson(dynamic json, {bool growable = false}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = MapAnnotation.fromJson(row); + if (value != null) result.add(value); + } + } + return result.toList(growable: growable); + } + + static const requiredKeys = {}; +} diff --git a/manager_api_new/lib/model/programme_block.dart b/manager_api_new/lib/model/programme_block.dart new file mode 100644 index 0000000..671add8 --- /dev/null +++ b/manager_api_new/lib/model/programme_block.dart @@ -0,0 +1,31 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ProgrammeBlock { + ProgrammeBlock({this.id}); + String? id; + + static ProgrammeBlock? fromJson(dynamic value) => value is Map ? ProgrammeBlock() : null; + + static List listFromJson(dynamic json, {bool growable = false}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ProgrammeBlock.fromJson(row); + if (value != null) result.add(value); + } + } + return result.toList(growable: growable); + } + + static const requiredKeys = {}; +} diff --git a/manager_api_new/lib/model/section_event.dart b/manager_api_new/lib/model/section_event.dart new file mode 100644 index 0000000..3a7a56a --- /dev/null +++ b/manager_api_new/lib/model/section_event.dart @@ -0,0 +1,386 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class SectionEvent { + /// Returns a new [SectionEvent] instance. + SectionEvent({ + required this.id, + required this.label, + this.title = const [], + required this.configurationId, + required this.type, + required this.isSubSection, + required this.instanceId, + this.description = const [], + this.order, + this.imageId, + this.imageSource, + this.parentId, + this.dateCreation, + this.isBeacon, + this.beaconId, + this.latitude, + this.longitude, + this.meterZoneGPS, + this.isActive, + this.startDate, + this.endDate, + this.programme = const [], + this.parcoursIds = const [], + }); + + String id; + + String label; + + List title; + + String configurationId; + + SectionType type; + + bool isSubSection; + + String instanceId; + + List? description; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + int? order; + + String? imageId; + + String? imageSource; + + String? parentId; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + DateTime? dateCreation; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + bool? isBeacon; + + int? beaconId; + + String? latitude; + + String? longitude; + + int? meterZoneGPS; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + bool? isActive; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + DateTime? startDate; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + DateTime? endDate; + + List? programme; + + List? parcoursIds; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is SectionEvent && + other.id == id && + other.label == label && + _deepEquality.equals(other.title, title) && + other.configurationId == configurationId && + other.type == type && + other.isSubSection == isSubSection && + other.instanceId == instanceId && + _deepEquality.equals(other.description, description) && + other.order == order && + other.imageId == imageId && + other.imageSource == imageSource && + other.parentId == parentId && + other.dateCreation == dateCreation && + other.isBeacon == isBeacon && + other.beaconId == beaconId && + other.latitude == latitude && + other.longitude == longitude && + other.meterZoneGPS == meterZoneGPS && + other.isActive == isActive && + other.startDate == startDate && + other.endDate == endDate && + _deepEquality.equals(other.programme, programme) && + _deepEquality.equals(other.parcoursIds, parcoursIds); + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (id.hashCode) + + (label.hashCode) + + (title.hashCode) + + (configurationId.hashCode) + + (type.hashCode) + + (isSubSection.hashCode) + + (instanceId.hashCode) + + (description == null ? 0 : description!.hashCode) + + (order == null ? 0 : order!.hashCode) + + (imageId == null ? 0 : imageId!.hashCode) + + (imageSource == null ? 0 : imageSource!.hashCode) + + (parentId == null ? 0 : parentId!.hashCode) + + (dateCreation == null ? 0 : dateCreation!.hashCode) + + (isBeacon == null ? 0 : isBeacon!.hashCode) + + (beaconId == null ? 0 : beaconId!.hashCode) + + (latitude == null ? 0 : latitude!.hashCode) + + (longitude == null ? 0 : longitude!.hashCode) + + (meterZoneGPS == null ? 0 : meterZoneGPS!.hashCode) + + (isActive == null ? 0 : isActive!.hashCode) + + (startDate == null ? 0 : startDate!.hashCode) + + (endDate == null ? 0 : endDate!.hashCode) + + (programme == null ? 0 : programme!.hashCode) + + (parcoursIds == null ? 0 : parcoursIds!.hashCode); + + @override + String toString() => + 'SectionEvent[id=$id, label=$label, title=$title, configurationId=$configurationId, type=$type, isSubSection=$isSubSection, instanceId=$instanceId, description=$description, order=$order, imageId=$imageId, imageSource=$imageSource, parentId=$parentId, dateCreation=$dateCreation, isBeacon=$isBeacon, beaconId=$beaconId, latitude=$latitude, longitude=$longitude, meterZoneGPS=$meterZoneGPS, isActive=$isActive, startDate=$startDate, endDate=$endDate, programme=$programme, parcoursIds=$parcoursIds]'; + + Map toJson() { + final json = {}; + json[r'id'] = this.id; + json[r'label'] = this.label; + json[r'title'] = this.title; + json[r'configurationId'] = this.configurationId; + json[r'type'] = this.type; + json[r'isSubSection'] = this.isSubSection; + json[r'instanceId'] = this.instanceId; + if (this.description != null) { + json[r'description'] = this.description; + } else { + json[r'description'] = null; + } + if (this.order != null) { + json[r'order'] = this.order; + } else { + json[r'order'] = null; + } + if (this.imageId != null) { + json[r'imageId'] = this.imageId; + } else { + json[r'imageId'] = null; + } + if (this.imageSource != null) { + json[r'imageSource'] = this.imageSource; + } else { + json[r'imageSource'] = null; + } + if (this.parentId != null) { + json[r'parentId'] = this.parentId; + } else { + json[r'parentId'] = null; + } + if (this.dateCreation != null) { + json[r'dateCreation'] = this.dateCreation!.toUtc().toIso8601String(); + } else { + json[r'dateCreation'] = null; + } + if (this.isBeacon != null) { + json[r'isBeacon'] = this.isBeacon; + } else { + json[r'isBeacon'] = null; + } + if (this.beaconId != null) { + json[r'beaconId'] = this.beaconId; + } else { + json[r'beaconId'] = null; + } + if (this.latitude != null) { + json[r'latitude'] = this.latitude; + } else { + json[r'latitude'] = null; + } + if (this.longitude != null) { + json[r'longitude'] = this.longitude; + } else { + json[r'longitude'] = null; + } + if (this.meterZoneGPS != null) { + json[r'meterZoneGPS'] = this.meterZoneGPS; + } else { + json[r'meterZoneGPS'] = null; + } + if (this.isActive != null) { + json[r'isActive'] = this.isActive; + } else { + json[r'isActive'] = null; + } + if (this.startDate != null) { + json[r'startDate'] = this.startDate!.toUtc().toIso8601String(); + } else { + json[r'startDate'] = null; + } + if (this.endDate != null) { + json[r'endDate'] = this.endDate!.toUtc().toIso8601String(); + } else { + json[r'endDate'] = null; + } + if (this.programme != null) { + json[r'programme'] = this.programme; + } else { + json[r'programme'] = null; + } + if (this.parcoursIds != null) { + json[r'parcoursIds'] = this.parcoursIds; + } else { + json[r'parcoursIds'] = null; + } + return json; + } + + /// Returns a new [SectionEvent] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static SectionEvent? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), + 'Required key "SectionEvent[$key]" is missing from JSON.'); + assert(json[key] != null, + 'Required key "SectionEvent[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return SectionEvent( + id: mapValueOfType(json, r'id')!, + label: mapValueOfType(json, r'label')!, + title: TranslationDTO.listFromJson(json[r'title']), + configurationId: mapValueOfType(json, r'configurationId')!, + type: SectionType.fromJson(json[r'type'])!, + isSubSection: mapValueOfType(json, r'isSubSection')!, + instanceId: mapValueOfType(json, r'instanceId')!, + description: TranslationDTO.listFromJson(json[r'description']), + order: mapValueOfType(json, r'order'), + imageId: mapValueOfType(json, r'imageId'), + imageSource: mapValueOfType(json, r'imageSource'), + parentId: mapValueOfType(json, r'parentId'), + dateCreation: mapDateTime(json, r'dateCreation', r''), + isBeacon: mapValueOfType(json, r'isBeacon'), + beaconId: mapValueOfType(json, r'beaconId'), + latitude: mapValueOfType(json, r'latitude'), + longitude: mapValueOfType(json, r'longitude'), + meterZoneGPS: mapValueOfType(json, r'meterZoneGPS'), + isActive: mapValueOfType(json, r'isActive'), + startDate: mapDateTime(json, r'startDate', r''), + endDate: mapDateTime(json, r'endDate', r''), + programme: ProgrammeBlock.listFromJson(json[r'programme']), + parcoursIds: json[r'parcoursIds'] is Iterable + ? (json[r'parcoursIds'] as Iterable) + .cast() + .toList(growable: false) + : const [], + ); + } + return null; + } + + static List listFromJson( + dynamic json, { + bool growable = false, + }) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = SectionEvent.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = SectionEvent.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of SectionEvent-objects as value to a dart map + static Map> mapListFromJson( + dynamic json, { + bool growable = false, + }) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = SectionEvent.listFromJson( + entry.value, + growable: growable, + ); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'id', + 'label', + 'title', + 'configurationId', + 'type', + 'isSubSection', + 'instanceId', + }; +} diff --git a/manager_api_new/lib/model/section_event_dto.dart b/manager_api_new/lib/model/section_event_dto.dart new file mode 100644 index 0000000..00ae563 --- /dev/null +++ b/manager_api_new/lib/model/section_event_dto.dart @@ -0,0 +1,406 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class SectionEventDTO { + /// Returns a new [SectionEventDTO] instance. + SectionEventDTO({ + this.id, + this.label, + this.title = const [], + this.description = const [], + this.isActive, + this.imageId, + this.imageSource, + this.configurationId, + this.isSubSection, + this.parentId, + this.type, + this.dateCreation, + this.order, + this.instanceId, + this.latitude, + this.longitude, + this.meterZoneGPS, + this.isBeacon, + this.beaconId, + this.startDate, + this.endDate, + this.parcoursIds = const [], + this.programme = const [], + }); + + String? id; + + String? label; + + List? title; + + List? description; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + bool? isActive; + + String? imageId; + + String? imageSource; + + String? configurationId; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + bool? isSubSection; + + String? parentId; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + SectionType? type; + + DateTime? dateCreation; + + int? order; + + String? instanceId; + + String? latitude; + + String? longitude; + + int? meterZoneGPS; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + bool? isBeacon; + + int? beaconId; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + DateTime? startDate; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + DateTime? endDate; + + List? parcoursIds; + + List? programme; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is SectionEventDTO && + other.id == id && + other.label == label && + _deepEquality.equals(other.title, title) && + _deepEquality.equals(other.description, description) && + other.isActive == isActive && + other.imageId == imageId && + other.imageSource == imageSource && + other.configurationId == configurationId && + other.isSubSection == isSubSection && + other.parentId == parentId && + other.type == type && + other.dateCreation == dateCreation && + other.order == order && + other.instanceId == instanceId && + other.latitude == latitude && + other.longitude == longitude && + other.meterZoneGPS == meterZoneGPS && + other.isBeacon == isBeacon && + other.beaconId == beaconId && + other.startDate == startDate && + other.endDate == endDate && + _deepEquality.equals(other.parcoursIds, parcoursIds) && + _deepEquality.equals(other.programme, programme); + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (id == null ? 0 : id!.hashCode) + + (label == null ? 0 : label!.hashCode) + + (title == null ? 0 : title!.hashCode) + + (description == null ? 0 : description!.hashCode) + + (isActive == null ? 0 : isActive!.hashCode) + + (imageId == null ? 0 : imageId!.hashCode) + + (imageSource == null ? 0 : imageSource!.hashCode) + + (configurationId == null ? 0 : configurationId!.hashCode) + + (isSubSection == null ? 0 : isSubSection!.hashCode) + + (parentId == null ? 0 : parentId!.hashCode) + + (type == null ? 0 : type!.hashCode) + + (dateCreation == null ? 0 : dateCreation!.hashCode) + + (order == null ? 0 : order!.hashCode) + + (instanceId == null ? 0 : instanceId!.hashCode) + + (latitude == null ? 0 : latitude!.hashCode) + + (longitude == null ? 0 : longitude!.hashCode) + + (meterZoneGPS == null ? 0 : meterZoneGPS!.hashCode) + + (isBeacon == null ? 0 : isBeacon!.hashCode) + + (beaconId == null ? 0 : beaconId!.hashCode) + + (startDate == null ? 0 : startDate!.hashCode) + + (endDate == null ? 0 : endDate!.hashCode) + + (parcoursIds == null ? 0 : parcoursIds!.hashCode) + + (programme == null ? 0 : programme!.hashCode); + + @override + String toString() => + 'SectionEventDTO[id=$id, label=$label, title=$title, description=$description, isActive=$isActive, imageId=$imageId, imageSource=$imageSource, configurationId=$configurationId, isSubSection=$isSubSection, parentId=$parentId, type=$type, dateCreation=$dateCreation, order=$order, instanceId=$instanceId, latitude=$latitude, longitude=$longitude, meterZoneGPS=$meterZoneGPS, isBeacon=$isBeacon, beaconId=$beaconId, startDate=$startDate, endDate=$endDate, parcoursIds=$parcoursIds, programme=$programme]'; + + Map toJson() { + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; + } + if (this.label != null) { + json[r'label'] = this.label; + } else { + json[r'label'] = null; + } + if (this.title != null) { + json[r'title'] = this.title; + } else { + json[r'title'] = null; + } + if (this.description != null) { + json[r'description'] = this.description; + } else { + json[r'description'] = null; + } + if (this.isActive != null) { + json[r'isActive'] = this.isActive; + } else { + json[r'isActive'] = null; + } + if (this.imageId != null) { + json[r'imageId'] = this.imageId; + } else { + json[r'imageId'] = null; + } + if (this.imageSource != null) { + json[r'imageSource'] = this.imageSource; + } else { + json[r'imageSource'] = null; + } + if (this.configurationId != null) { + json[r'configurationId'] = this.configurationId; + } else { + json[r'configurationId'] = null; + } + if (this.isSubSection != null) { + json[r'isSubSection'] = this.isSubSection; + } else { + json[r'isSubSection'] = null; + } + if (this.parentId != null) { + json[r'parentId'] = this.parentId; + } else { + json[r'parentId'] = null; + } + if (this.type != null) { + json[r'type'] = this.type; + } else { + json[r'type'] = null; + } + if (this.dateCreation != null) { + json[r'dateCreation'] = this.dateCreation!.toUtc().toIso8601String(); + } else { + json[r'dateCreation'] = null; + } + if (this.order != null) { + json[r'order'] = this.order; + } else { + json[r'order'] = null; + } + if (this.instanceId != null) { + json[r'instanceId'] = this.instanceId; + } else { + json[r'instanceId'] = null; + } + if (this.latitude != null) { + json[r'latitude'] = this.latitude; + } else { + json[r'latitude'] = null; + } + if (this.longitude != null) { + json[r'longitude'] = this.longitude; + } else { + json[r'longitude'] = null; + } + if (this.meterZoneGPS != null) { + json[r'meterZoneGPS'] = this.meterZoneGPS; + } else { + json[r'meterZoneGPS'] = null; + } + if (this.isBeacon != null) { + json[r'isBeacon'] = this.isBeacon; + } else { + json[r'isBeacon'] = null; + } + if (this.beaconId != null) { + json[r'beaconId'] = this.beaconId; + } else { + json[r'beaconId'] = null; + } + if (this.startDate != null) { + json[r'startDate'] = this.startDate!.toUtc().toIso8601String(); + } else { + json[r'startDate'] = null; + } + if (this.endDate != null) { + json[r'endDate'] = this.endDate!.toUtc().toIso8601String(); + } else { + json[r'endDate'] = null; + } + if (this.parcoursIds != null) { + json[r'parcoursIds'] = this.parcoursIds; + } else { + json[r'parcoursIds'] = null; + } + if (this.programme != null) { + json[r'programme'] = this.programme; + } else { + json[r'programme'] = null; + } + return json; + } + + /// Returns a new [SectionEventDTO] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static SectionEventDTO? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), + 'Required key "SectionEventDTO[$key]" is missing from JSON.'); + assert(json[key] != null, + 'Required key "SectionEventDTO[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return SectionEventDTO( + id: mapValueOfType(json, r'id'), + label: mapValueOfType(json, r'label'), + title: TranslationDTO.listFromJson(json[r'title']), + description: TranslationDTO.listFromJson(json[r'description']), + isActive: mapValueOfType(json, r'isActive'), + imageId: mapValueOfType(json, r'imageId'), + imageSource: mapValueOfType(json, r'imageSource'), + configurationId: mapValueOfType(json, r'configurationId'), + isSubSection: mapValueOfType(json, r'isSubSection'), + parentId: mapValueOfType(json, r'parentId'), + type: SectionType.fromJson(json[r'type']), + dateCreation: mapDateTime(json, r'dateCreation', r''), + order: mapValueOfType(json, r'order'), + instanceId: mapValueOfType(json, r'instanceId'), + latitude: mapValueOfType(json, r'latitude'), + longitude: mapValueOfType(json, r'longitude'), + meterZoneGPS: mapValueOfType(json, r'meterZoneGPS'), + isBeacon: mapValueOfType(json, r'isBeacon'), + beaconId: mapValueOfType(json, r'beaconId'), + startDate: mapDateTime(json, r'startDate', r''), + endDate: mapDateTime(json, r'endDate', r''), + parcoursIds: json[r'parcoursIds'] is Iterable + ? (json[r'parcoursIds'] as Iterable) + .cast() + .toList(growable: false) + : const [], + programme: ProgrammeBlock.listFromJson(json[r'programme']), + ); + } + return null; + } + + static List listFromJson( + dynamic json, { + bool growable = false, + }) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = SectionEventDTO.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = SectionEventDTO.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of SectionEventDTO-objects as value to a dart map + static Map> mapListFromJson( + dynamic json, { + bool growable = false, + }) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = SectionEventDTO.listFromJson( + entry.value, + growable: growable, + ); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = {}; +} diff --git a/pubspec.lock b/pubspec.lock index 9e0c95b..765cf3f 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -630,7 +630,7 @@ packages: source: hosted version: "0.15.4" http: - dependency: transitive + dependency: "direct main" description: name: http sha256: "2c11f3f94c687ee9bad77c171151672986360b2b001d109814ee7140b2cf261b" diff --git a/pubspec.yaml b/pubspec.yaml index 8b6981f..51cff9b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -58,6 +58,7 @@ dependencies: #qr_code_scanner: ^1.0.1 #not in web mobile_scanner: ^4.0.0 # that replace qr_code_scanner.. + http: ^1.2.0 sqflite: #not in web just_audio_cache: ^0.1.2 #not in web #flutter_beacon: ^0.5.1 #not in web