Skip to content

Commit

Permalink
expose isPresent ios implementation (#203)
Browse files Browse the repository at this point in the history
* ios implementation

* updated iOS to return true from Dart
  • Loading branch information
TimHoogstrate authored Feb 16, 2024
1 parent ad50788 commit c1a804e
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 3 deletions.
4 changes: 4 additions & 0 deletions geocoding_ios/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.3.0

* Implements `isPresent` that always returns true.

## 2.2.0

* Updates `geocoding_platform_interface` to version 3.1.0.
Expand Down
16 changes: 16 additions & 0 deletions geocoding_ios/example/lib/plugin_example/geocode_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,22 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
});
}),
),
const Padding(
padding: EdgeInsets.only(top: 8),
),
Center(
child: ElevatedButton(
child: Text('Is present'),
onPressed: () {
GeocodingIOS().isPresent().then((isPresent) {
var output = isPresent
? "Geocoder is present"
: "Geocoder is not present";
setState(() {
_output = output;
});
});
})),
Expanded(
child: SingleChildScrollView(
child: Container(
Expand Down
2 changes: 1 addition & 1 deletion geocoding_ios/ios/Classes/GeocodingPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
message:errorDescription
details:nil]);
}];
}else {
} else {
result(FlutterMethodNotImplemented);
}
}
Expand Down
3 changes: 3 additions & 0 deletions geocoding_ios/lib/geocoding_ios.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ class GeocodingIOS extends GeocodingPlatform {
return Placemark.fromMaps(placemarks);
}

@override
Future<bool> isPresent() => Future<bool>.value(true);

void _handlePlatformException(PlatformException platformException) {
switch (platformException.code) {
case 'NOT_FOUND':
Expand Down
4 changes: 2 additions & 2 deletions geocoding_ios/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: geocoding_ios
description: A Flutter Geocoding plugin which provides easy geocoding and reverse-geocoding features.
version: 2.2.0
version: 2.3.0
repository: https://github.com/baseflow/flutter-geocoding/tree/main/geocoding_ios
issue_tracker: https://github.com/Baseflow/flutter-geocoding/issues

Expand All @@ -12,7 +12,7 @@ dependencies:
flutter:
sdk: flutter

geocoding_platform_interface: ^3.1.0
geocoding_platform_interface: ^3.2.0

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit c1a804e

Please sign in to comment.