Enum added to iOS implementation
MODIFY
geolocator/android/src/main/java/com/baseflow/geolocator/location/LocationServiceStatusReceiver.java
geolocator/android/src/main/java/com/baseflow/geolocator/location/LocationServiceStatusReceiver.java
@@ -29,7 +29,7 @@ public class LocationServiceStatusReceiver extends BroadcastReceiver {
boolean isNetworkEnabled = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
- if (isGpsEnabled) {
+ if (isGpsEnabled || isNetworkEnabled) {
/*
It may occur that the broadcastreceiver receives several events of the same type,
that's why u should check whether or not the event is fired more then one time.
@@ -38,14 +38,14 @@ public class LocationServiceStatusReceiver extends BroadcastReceiver {
if(!isEnabled){
isEnabled = true;
if (events != null) {
- events.success(ServiceStatus.enabled);
+ events.success(ServiceStatus.enabled.ordinal());
}
}
} else {
if(isEnabled){
isEnabled = false;
if (events != null) {
- events.success(ServiceStatus.disabled);
+ events.success(ServiceStatus.disabled.ordinal());
}
}

MODIFY
geolocator/ios/Classes/GeolocatorPlugin.m
geolocator/ios/Classes/GeolocatorPlugin.m
#import "Utils/LocationAccuracyMapper.h"
#import "Utils/LocationDistanceMapper.h"
#import "Utils/LocationMapper.h"
+#import "Utils/ServiceStatus.h"
@interface GeolocatorPlugin() <FlutterStreamHandler, CLLocationManagerDelegate>
@property (strong, nonatomic) GeolocationHandler *geolocationHandler;
- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status{
if([CLLocationManager locationServicesEnabled]){
- _locationServiceEventSink([NSNumber numberWithBool:YES]);
+ _locationServiceEventSink([NSNumber numberWithInt:(ServiceStatus)enabled]);
}else{
- _locationServiceEventSink([NSNumber numberWithBool:NO]);
+ _locationServiceEventSink([NSNumber numberWithInt:(ServiceStatus)disabled]);
}
}

ADD
geolocator/ios/Classes/Utils/ServiceStatus.h
+//
+// ServiceStatus.h
+// Pods
+//
+// Created by Floris Smit on 03/06/2021.
+//
+
+#ifndef ServiceStatus_h
+#define ServiceStatus_h
+
+@interface ServiceStatusEnum : NSObject {
+
+}
+
+typedef enum {
+ disabled,
+ enabled
+} ServiceStatus;
+
+@end
+
+#endif /* ServiceStatus_h */

MODIFY
geolocator/pubspec.yaml
geolocator/pubspec.yaml
@@ -11,8 +11,8 @@ dependencies:
flutter:
sdk: flutter
- geolocator_platform_interface: ^2.1.0
- geolocator_web: ^2.0.1
+ geolocator_platform_interface:
+ path: ../geolocator_platform_interface
dev_dependencies:
flutter_test:

Enum added to iOS implementation