From 085faffe277d66aa847e19ede42949ebe78192e5 Mon Sep 17 00:00:00 2001 From: manavmodi Date: Fri, 1 Nov 2024 15:24:08 -0400 Subject: [PATCH 1/9] Adding some fixes for link and back button --- .../ExploreStoriedSightsBottomSheet.dart | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/lib/ui/explore/ExploreStoriedSightsBottomSheet.dart b/lib/ui/explore/ExploreStoriedSightsBottomSheet.dart index c9f10cda0..b3a75804f 100644 --- a/lib/ui/explore/ExploreStoriedSightsBottomSheet.dart +++ b/lib/ui/explore/ExploreStoriedSightsBottomSheet.dart @@ -10,6 +10,7 @@ import 'package:rokwire_plugin/model/places.dart' as places_model; import 'package:rokwire_plugin/service/localization.dart'; import 'package:rokwire_plugin/service/places.dart'; import 'package:rokwire_plugin/service/styles.dart'; +import 'package:rokwire_plugin/service/tracking_services.dart'; import 'package:rokwire_plugin/ui/panels/modal_image_holder.dart'; import 'package:rokwire_plugin/ui/widgets/triangle_header_image.dart'; import 'package:rokwire_plugin/utils/utils.dart'; @@ -37,6 +38,7 @@ class ExploreStoriedSightsBottomSheetState extends State> _mainFilters = {}; Set _regularFilters = {}; Set _expandedMainTags = {}; + TrackingAuthorizationStatus? status; @@ -153,6 +155,11 @@ class ExploreStoriedSightsBottomSheetState extends State setState(() { _selectedDestination = null; + _controller.animateTo( + 0.65, + duration: const Duration(milliseconds: 300), + curve: Curves.easeInOut, + ); }))]; double _calculateFilterButtonsHeight() { @@ -589,6 +596,23 @@ class _ExploreStoriedSightWidgetState extends State { List _placeCheckInDates = []; bool? _isHistoryExpanded; + TrackingAuthorizationStatus? status; + + @override + void initState() { + super.initState(); + _loadTrackingStatus(); + } + + void _loadTrackingStatus() async { + TrackingAuthorizationStatus? trackingStatus = await TrackingServices.queryAuthorizationStatus(); + if (mounted) { + setState(() { + status = trackingStatus; + }); + } + } + @override Widget build(BuildContext context) => @@ -603,7 +627,14 @@ class _ExploreStoriedSightWidgetState extends State { data: widget.place.description ?? Localization().getStringEx('panel.explore.storied_sites.default.description', 'No description available'), onTapLink: (text, href, title) { if (href?.startsWith('https://') == true) { - Navigator.push(context, CupertinoPageRoute(builder: (context) => WebPanel(url: href))); + if (status == TrackingAuthorizationStatus.allowed) { + Navigator.push( + context, + CupertinoPageRoute(builder: (context) => WebPanel(url: href)), + ); + } else { + UrlUtils.launchExternal(href); + } return; } UrlUtils.launchExternal(href); From c20c25524c5c615bde527677f64b9ec0dd5d6ea5 Mon Sep 17 00:00:00 2001 From: manavmodi Date: Fri, 1 Nov 2024 15:54:05 -0400 Subject: [PATCH 2/9] Add group places filter --- .../ExploreStoriedSightsBottomSheet.dart | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/lib/ui/explore/ExploreStoriedSightsBottomSheet.dart b/lib/ui/explore/ExploreStoriedSightsBottomSheet.dart index b3a75804f..b34de5cc8 100644 --- a/lib/ui/explore/ExploreStoriedSightsBottomSheet.dart +++ b/lib/ui/explore/ExploreStoriedSightsBottomSheet.dart @@ -39,6 +39,7 @@ class ExploreStoriedSightsBottomSheetState extends State _regularFilters = {}; Set _expandedMainTags = {}; TrackingAuthorizationStatus? status; + List? _customPlaces; @@ -313,6 +314,13 @@ class ExploreStoriedSightsBottomSheetState extends State filterButtons = []; + // Add Custom Selection Filter Button + if (_customPlaces != null) { + String label = '${_customPlaces!.length} Places'; + bool isSelected = _selectedFilters.contains('CustomSelection'); + filterButtons.add(_buildCustomFilterButton(label, isSelected)); + } + filterButtons.addAll(_regularFilters.map((tag) => _buildRegularFilterButton(tag))); for (String mainTag in _mainFilters.keys) { @@ -360,6 +368,46 @@ class ExploreStoriedSightsBottomSheetState extends State places) { setState(() { _storiedSights = places; + _customPlaces = places; _selectedDestination = null; _selectedFilters.clear(); + _selectedFilters.add('CustomSelection'); }); _controller.animateTo( 0.65, From c8be4760ac588da3ae2053c3163c669e0ef81fcd Mon Sep 17 00:00:00 2001 From: manavmodi Date: Fri, 1 Nov 2024 16:58:10 -0400 Subject: [PATCH 3/9] zoom into locations --- lib/ui/explore/ExploreMapPanel.dart | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/ui/explore/ExploreMapPanel.dart b/lib/ui/explore/ExploreMapPanel.dart index b94c11fd7..feb43bc26 100644 --- a/lib/ui/explore/ExploreMapPanel.dart +++ b/lib/ui/explore/ExploreMapPanel.dart @@ -619,6 +619,7 @@ class _ExploreMapPanelState extends State if (_selectedMapType == ExploreMapType.StoriedSites) { if (origin is Place) { _storiedSightsKey.currentState?.selectPlace(origin); + // _centerMapOnExplore(origin); } else if (origin is List) { List places = origin.cast(); _storiedSightsKey.currentState?.selectPlaces(places); @@ -630,7 +631,7 @@ class _ExploreMapPanelState extends State } - void _centerMapOnExplore(dynamic explore) { + void _centerMapOnExplore(dynamic explore) async { LatLng? targetPosition; if (explore is Explore) { @@ -640,13 +641,18 @@ class _ExploreMapPanelState extends State } if (targetPosition != null && _mapController != null) { - CameraUpdate cameraUpdate = CameraUpdate.newLatLng(targetPosition); - _mapController!.moveCamera(cameraUpdate); + double currentZoom = await _mapController!.getZoomLevel(); + double targetZoom = currentZoom + 1; + if (targetZoom > 20) { + targetZoom = 20; + } + CameraUpdate cameraUpdate = CameraUpdate.newLatLngZoom(targetPosition, targetZoom); + await _mapController!.moveCamera(cameraUpdate); double devicePixelRatio = MediaQuery.of(context).devicePixelRatio; double offset = 450 / devicePixelRatio; - _mapController!.moveCamera(CameraUpdate.scrollBy(0, offset)); + await _mapController!.moveCamera(CameraUpdate.scrollBy(0, offset)); } } From 69af9546593bb8585366a45637578602c9622583 Mon Sep 17 00:00:00 2001 From: manavmodi Date: Fri, 1 Nov 2024 17:41:59 -0400 Subject: [PATCH 4/9] Add Visited type and and zooming into location --- lib/ui/explore/ExploreMapPanel.dart | 20 +++++++++++++------ .../ExploreStoriedSightsBottomSheet.dart | 10 ++++++++-- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/lib/ui/explore/ExploreMapPanel.dart b/lib/ui/explore/ExploreMapPanel.dart index feb43bc26..df7e01150 100644 --- a/lib/ui/explore/ExploreMapPanel.dart +++ b/lib/ui/explore/ExploreMapPanel.dart @@ -468,7 +468,7 @@ class _ExploreMapPanelState extends State key: _storiedSightsKey, places: _explores?.whereType().toList() ?? [], onPlaceSelected: (places_model.Place place) { - _centerMapOnExplore(place); + _centerMapOnExplore(place, zoom: false); _selectMapExplore(place); }, ), @@ -631,7 +631,7 @@ class _ExploreMapPanelState extends State } - void _centerMapOnExplore(dynamic explore) async { + void _centerMapOnExplore(dynamic explore, {bool zoom = true}) async { LatLng? targetPosition; if (explore is Explore) { @@ -642,11 +642,19 @@ class _ExploreMapPanelState extends State if (targetPosition != null && _mapController != null) { double currentZoom = await _mapController!.getZoomLevel(); - double targetZoom = currentZoom + 1; - if (targetZoom > 20) { - targetZoom = 20; + double targetZoom = currentZoom; + + if (zoom) { + targetZoom += 1; + if (targetZoom > 20) { + targetZoom = 20; + } } - CameraUpdate cameraUpdate = CameraUpdate.newLatLngZoom(targetPosition, targetZoom); + + CameraUpdate cameraUpdate = zoom + ? CameraUpdate.newLatLngZoom(targetPosition, targetZoom) + : CameraUpdate.newLatLng(targetPosition); // Center without zoom + await _mapController!.moveCamera(cameraUpdate); double devicePixelRatio = MediaQuery.of(context).devicePixelRatio; diff --git a/lib/ui/explore/ExploreStoriedSightsBottomSheet.dart b/lib/ui/explore/ExploreStoriedSightsBottomSheet.dart index b34de5cc8..65929663d 100644 --- a/lib/ui/explore/ExploreStoriedSightsBottomSheet.dart +++ b/lib/ui/explore/ExploreStoriedSightsBottomSheet.dart @@ -199,6 +199,12 @@ class ExploreStoriedSightsBottomSheetState extends State typesToShow = List.from(place.types ?? []); + if (place.userData?.visited != null && place.userData!.visited!.isNotEmpty) { + typesToShow.add('Visited'); + } + return InkWell( onTap: () => _onTapDestinationCard(place), child: Container( @@ -206,8 +212,8 @@ class ExploreStoriedSightsBottomSheetState extends State Date: Fri, 1 Nov 2024 17:44:20 -0400 Subject: [PATCH 5/9] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1ba80f95..87a47c0dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## Unreleased +### Fixed +- Bug fixes on the stories sites bottomsheet [#4454](https://github.com/rokwire/illinois-app/issues/4454) ## [6.0.55] - 2024-10-24 ### Fixed From 2751e3a757c082deca1581c7412d63671379ae75 Mon Sep 17 00:00:00 2001 From: manavmodi Date: Mon, 4 Nov 2024 00:05:45 -0500 Subject: [PATCH 6/9] Make some minor fixes --- lib/ui/explore/ExploreStoriedSightsBottomSheet.dart | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/ui/explore/ExploreStoriedSightsBottomSheet.dart b/lib/ui/explore/ExploreStoriedSightsBottomSheet.dart index 65929663d..e37cdd76b 100644 --- a/lib/ui/explore/ExploreStoriedSightsBottomSheet.dart +++ b/lib/ui/explore/ExploreStoriedSightsBottomSheet.dart @@ -38,7 +38,6 @@ class ExploreStoriedSightsBottomSheetState extends State> _mainFilters = {}; Set _regularFilters = {}; Set _expandedMainTags = {}; - TrackingAuthorizationStatus? status; List? _customPlaces; @@ -656,7 +655,7 @@ class _ExploreStoriedSightWidgetState extends State { List _placeCheckInDates = []; bool? _isHistoryExpanded; - TrackingAuthorizationStatus? status; + TrackingAuthorizationStatus? _status; @override void initState() { @@ -668,7 +667,7 @@ class _ExploreStoriedSightWidgetState extends State { TrackingAuthorizationStatus? trackingStatus = await TrackingServices.queryAuthorizationStatus(); if (mounted) { setState(() { - status = trackingStatus; + _status = trackingStatus; }); } } @@ -687,7 +686,7 @@ class _ExploreStoriedSightWidgetState extends State { data: widget.place.description ?? Localization().getStringEx('panel.explore.storied_sites.default.description', 'No description available'), onTapLink: (text, href, title) { if (href?.startsWith('https://') == true) { - if (status == TrackingAuthorizationStatus.allowed) { + if (_status == TrackingAuthorizationStatus.allowed) { Navigator.push( context, CupertinoPageRoute(builder: (context) => WebPanel(url: href)), From 4c8c736c69a4ad56915b54bc34833b7838955a38 Mon Sep 17 00:00:00 2001 From: manavmodi Date: Mon, 4 Nov 2024 01:45:00 -0500 Subject: [PATCH 7/9] small fix --- lib/ui/explore/ExploreMapPanel.dart | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/ui/explore/ExploreMapPanel.dart b/lib/ui/explore/ExploreMapPanel.dart index df7e01150..be2cb05d5 100644 --- a/lib/ui/explore/ExploreMapPanel.dart +++ b/lib/ui/explore/ExploreMapPanel.dart @@ -587,10 +587,7 @@ class _ExploreMapPanelState extends State void _onMapTap(LatLng coordinate) { debugPrint('ExploreMap tap' ); MTDStop? mtdStop; - if (_selectedMapType == ExploreMapType.StoriedSites) { - _storiedSightsKey.currentState?.resetSelection(); - } - else if ((mtdStop = MTD().stops?.findStop(location: Native.LatLng(latitude: coordinate.latitude, longitude: coordinate.longitude), locationThresholdDistance: 25 /*in meters*/)) != null) { + if ((mtdStop = MTD().stops?.findStop(location: Native.LatLng(latitude: coordinate.latitude, longitude: coordinate.longitude), locationThresholdDistance: 25 /*in meters*/)) != null) { _selectMapExplore(mtdStop); } else if (_selectedMapExplore != null) { From d9a03c10b5aae05a7be11a17f74cca17387482ea Mon Sep 17 00:00:00 2001 From: Mihail Varbanov Date: Mon, 4 Nov 2024 09:55:09 +0200 Subject: [PATCH 8/9] Acknowledge UrlUtils.isWebScheme for determination of browser launched URLs [#4454]. --- .../explore/ExploreStoriedSightsBottomSheet.dart | 15 ++++----------- plugin | 2 +- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/lib/ui/explore/ExploreStoriedSightsBottomSheet.dart b/lib/ui/explore/ExploreStoriedSightsBottomSheet.dart index e37cdd76b..78b44df06 100644 --- a/lib/ui/explore/ExploreStoriedSightsBottomSheet.dart +++ b/lib/ui/explore/ExploreStoriedSightsBottomSheet.dart @@ -685,18 +685,11 @@ class _ExploreStoriedSightWidgetState extends State { child: MarkdownBody( data: widget.place.description ?? Localization().getStringEx('panel.explore.storied_sites.default.description', 'No description available'), onTapLink: (text, href, title) { - if (href?.startsWith('https://') == true) { - if (_status == TrackingAuthorizationStatus.allowed) { - Navigator.push( - context, - CupertinoPageRoute(builder: (context) => WebPanel(url: href)), - ); - } else { - UrlUtils.launchExternal(href); - } - return; + if (UrlUtils.isWebScheme(href) && (_status == TrackingAuthorizationStatus.allowed)) { + Navigator.push(context, CupertinoPageRoute(builder: (context) => WebPanel(url: href)),); + } else { + UrlUtils.launchExternal(href); } - UrlUtils.launchExternal(href); }, styleSheet: MarkdownStyleSheet( p: Styles().textStyles.getTextStyle("widget.description.regular"), diff --git a/plugin b/plugin index 635d257bf..9bc389e61 160000 --- a/plugin +++ b/plugin @@ -1 +1 @@ -Subproject commit 635d257bf5454c8e7cc74617c1c8919142633b61 +Subproject commit 9bc389e618fb0d809f01f574e6741fa5241ccacb From d5d61b12d46812f37af733fae8efc76e45c06d88 Mon Sep 17 00:00:00 2001 From: Mihail Varbanov Date: Mon, 4 Nov 2024 09:59:11 +0200 Subject: [PATCH 9/9] Use single string constant for "CustomSelection" key value [#4454]. --- lib/ui/explore/ExploreStoriedSightsBottomSheet.dart | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/ui/explore/ExploreStoriedSightsBottomSheet.dart b/lib/ui/explore/ExploreStoriedSightsBottomSheet.dart index 78b44df06..2d47ba45a 100644 --- a/lib/ui/explore/ExploreStoriedSightsBottomSheet.dart +++ b/lib/ui/explore/ExploreStoriedSightsBottomSheet.dart @@ -40,6 +40,7 @@ class ExploreStoriedSightsBottomSheetState extends State _expandedMainTags = {}; List? _customPlaces; + static final String _customSelectionFilterKey = 'CustomSelection'; @override @@ -322,7 +323,7 @@ class ExploreStoriedSightsBottomSheetState extends State