Skip to content

Commit

Permalink
Fix android 14 migration error, and also a small inconvenience when z…
Browse files Browse the repository at this point in the history
…ooming in to micromapping
  • Loading branch information
Zverik committed Mar 18, 2024
1 parent 159cf74 commit 64bc397
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
27 changes: 23 additions & 4 deletions lib/screens/browser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,17 @@ class _BrowserPageState extends ConsumerState<BrowserPage> {
ref.read(needMapUpdateProvider).trigger();
}

bool canPopScope() {
bool canPopScope(bool updateProviders) {
if (ref.read(microZoomedInProvider) != null) {
ref.read(microZoomedInProvider.notifier).state = null;
if (updateProviders) {
ref.read(microZoomedInProvider.notifier).state = null;
}
return false;
} else if (!ref.read(trackingProvider) &&
ref.read(geolocationProvider) != null) {
ref.read(trackingProvider.notifier).state = true;
if (updateProviders) {
ref.read(trackingProvider.notifier).state = true;
}
return false;
} else {
return true;
Expand All @@ -130,6 +134,14 @@ class _BrowserPageState extends ConsumerState<BrowserPage> {
ref.read(microZoomedInProvider.notifier).state = null;
});

// Now we have to listen to both providers to change the pop state.
ref.listen(microZoomedInProvider, (_, next) {
setState(() {});
});
ref.listen(trackingProvider, (_, next) {
setState(() {});
});

final screenSize = MediaQuery.of(context).size;
final isWide =
screenSize.width > screenSize.height && screenSize.height < 600;
Expand All @@ -155,7 +167,14 @@ class _BrowserPageState extends ConsumerState<BrowserPage> {
}

return PopScope(
canPop: canPopScope(),
canPop: canPopScope(false),
onPopInvoked: (didPop) {
if (!didPop) {
setState(() {
canPopScope(true);
});
}
},
child: Scaffold(
body: Column(
children: [
Expand Down
2 changes: 2 additions & 0 deletions lib/screens/modes/poi_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ class _PoiListPageState extends ConsumerState<PoiListPane> {
} else {
// Multiple amenities: zoom in and enhance.
ref.read(microZoomedInProvider.notifier).state = area;
// Disable tracking.
ref.read(trackingProvider.notifier).state = false;
// updateNearest(forceLocation: area.center);
setState(() {
nearestPOI = nearestPOI
Expand Down

0 comments on commit 64bc397

Please sign in to comment.