Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] Handle errors in request access #1458

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions geolocator_windows/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.2.3

* Fixes crash under Windows when RequestAcess is called while the Geolocation Service is disabled. (#1455)

## 0.2.2

* Fixes crash under Windows when getCurrentPosition method is called. (#1240)
Expand Down
2 changes: 1 addition & 1 deletion geolocator_windows/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: geolocator_windows
description: Geolocation Windows plugin for Flutter. This plugin provides the Windows implementation for the geolocator.
repository: https://github.com/baseflow/flutter-geolocators
issue_tracker: https://github.com/baseflow/flutter-geolocator/issues?q=is%3Aissue+is%3Aopen
version: 0.2.2
version: 0.2.3

environment:
sdk: ">=2.15.0 <4.0.0"
Expand Down
6 changes: 5 additions & 1 deletion geolocator_windows/windows/geolocator_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,13 @@ winrt::fire_and_forget GeolocatorPlugin::RequestAccessAsync(std::unique_ptr<Meth
result->Success(EncodableValue((int)LocationPermission::Denied));
else if(access == GeolocationAccessStatus::Unspecified)
result->Success(EncodableValue((int)LocationPermission::DeniedForever));
} catch(const std::exception& ex) {
}
catch(const std::exception& ex) {
result->Error(ErrorCodeToString(ErrorCode::PermissionDefinitionsNotFound), ex.what());
}
catch (...) {
result->Error(ErrorCodeToString(ErrorCode::UnknownError), "RequestAccess failed. Check the Geolocation Service is running.");
}
}

void GeolocatorPlugin::OnCheckPermission(std::unique_ptr<MethodResult<>> result) {
Expand Down