From 98b3d98b08d0519a9f262502753bcd5eb9c0d82a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 03:22:06 +0000 Subject: [PATCH 01/29] [geolocator_apple]: Bump flutter_lints in /geolocator_apple Bumps [flutter_lints](https://github.com/flutter/packages/tree/main/packages) from 4.0.0 to 5.0.0. - [Release notes](https://github.com/flutter/packages/releases) - [Commits](https://github.com/flutter/packages/commits/flutter_lints-v5.0.0/packages) --- updated-dependencies: - dependency-name: flutter_lints dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- geolocator_apple/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geolocator_apple/pubspec.yaml b/geolocator_apple/pubspec.yaml index f3bbe3e7..2797b3bc 100644 --- a/geolocator_apple/pubspec.yaml +++ b/geolocator_apple/pubspec.yaml @@ -28,6 +28,6 @@ dev_dependencies: async: ^2.8.2 flutter_test: sdk: flutter - flutter_lints: ">=3.0.1 <5.0.0" + flutter_lints: ">=3.0.1 <6.0.0" mockito: ^5.2.0 plugin_platform_interface: ^2.1.2 From eb5bf712a557456382cfd33e70e4216da844623b Mon Sep 17 00:00:00 2001 From: Ksenya Date: Thu, 14 Nov 2024 19:50:14 +0700 Subject: [PATCH 02/29] Fixes a bug where iOS location settings, e.g. `accuracy` and `distanceFilter` are overridden by different calls (#1600) * Fixes a bug where iOS location settings, e.g. `accuracy` and `distanceFilter` are overridden by different calls * Reverted changes to the geolocator package to create a separate PR for those. Revert the changes for the requestLocation API. Now use separate oneTimeLocationManager with startUpdatingLocation logic. Reverted and updated tests. --------- Co-authored-by: Oksana Liahusha --- geolocator_apple/CHANGELOG.md | 6 + .../ios/RunnerTests/GeolocationHandlerTests.m | 157 +++++++++++------- .../ios/RunnerTests/GeolocatorPluginTests.m | 4 +- .../ios/Classes/Handlers/GeolocationHandler.m | 129 +++++++------- .../Handlers/GeolocationHandler_Test.h | 4 + geolocator_apple/ios/geolocator_apple.podspec | 2 +- geolocator_apple/pubspec.yaml | 2 +- 7 files changed, 176 insertions(+), 128 deletions(-) diff --git a/geolocator_apple/CHANGELOG.md b/geolocator_apple/CHANGELOG.md index 815ecb4b..78eb1234 100644 --- a/geolocator_apple/CHANGELOG.md +++ b/geolocator_apple/CHANGELOG.md @@ -1,3 +1,9 @@ +## 2.3.8 + +* Uses different `CLLocationManager` instances, for one time request location and persistent request location. +* Fixes a bug where iOS location settings, e.g. `accuracy` and `distanceFilter` are overridden by different calls. +* Updates minimum deployment target to `iOS 11` as lower is not supported anymore by Xcode. + ## 2.3.7 * Adds privacy manifest. diff --git a/geolocator_apple/example/ios/RunnerTests/GeolocationHandlerTests.m b/geolocator_apple/example/ios/RunnerTests/GeolocationHandlerTests.m index a9a6f8e6..f0932cc6 100644 --- a/geolocator_apple/example/ios/RunnerTests/GeolocationHandlerTests.m +++ b/geolocator_apple/example/ios/RunnerTests/GeolocationHandlerTests.m @@ -19,14 +19,18 @@ @interface GeolocationHandlerTests : XCTestCase @implementation GeolocationHandlerTests { CLLocationManager *_mockLocationManager; + CLLocationManager *_mockOneTimeLocationManager; + GeolocationHandler *_geolocationHandler; } - (void)setUp { _mockLocationManager = OCMClassMock(CLLocationManager.class); + _mockOneTimeLocationManager = OCMClassMock(CLLocationManager.class); _geolocationHandler = [[GeolocationHandler alloc] init]; [_geolocationHandler setLocationManagerOverride:_mockLocationManager]; + [_geolocationHandler setOneTimeLocationManagerOverride:_mockOneTimeLocationManager]; } #pragma mark - Test requesting current location @@ -36,25 +40,25 @@ - (void)testGetCurrentPositionShouldCallStartUpdatingLocation { resultHandler:^(CLLocation * _Nullable location) {} errorHandler:^(NSString * _Nonnull errorCode, NSString * _Nonnull errorDescription) {}]; - OCMVerify(times(1), [self->_mockLocationManager setDesiredAccuracy:kCLLocationAccuracyBest]); - OCMVerify(times(1), [self->_mockLocationManager startUpdatingLocation]); + OCMVerify(times(1), [self->_mockOneTimeLocationManager setDesiredAccuracy:kCLLocationAccuracyBest]); + OCMVerify(times(1), [self->_mockOneTimeLocationManager startUpdatingLocation]); } - (void)testRequestPositionShouldReturnLocationWithinTimeConstraints { NSDate *now = [NSDate date]; NSCalendar *calendar = [NSCalendar currentCalendar]; - + CLLocation *firstLocation = [[CLLocation alloc] initWithCoordinate:CLLocationCoordinate2DMake(54.0, 6.4) altitude:0.0 horizontalAccuracy:0 verticalAccuracy:0 timestamp:[calendar dateByAddingUnit:NSCalendarUnitSecond value:-6 toDate:now options:0]]; CLLocation *secondLocation = [[CLLocation alloc] initWithCoordinate:CLLocationCoordinate2DMake(54.1, 6.4) - altitude:0.0 - horizontalAccuracy:0 - verticalAccuracy:0 - timestamp:now]; - + altitude:0.0 + horizontalAccuracy:0 + verticalAccuracy:0 + timestamp:now]; + XCTestExpectation *expectation = [self expectationWithDescription:@"expect result return third location"]; [_geolocationHandler requestPositionWithDesiredAccuracy:kCLLocationAccuracyBest @@ -64,20 +68,20 @@ - (void)testRequestPositionShouldReturnLocationWithinTimeConstraints { } errorHandler:^(NSString * _Nonnull errorCode, NSString * _Nonnull errorDescription) {}]; - [_geolocationHandler locationManager:_mockLocationManager didUpdateLocations: @[firstLocation]]; - [_geolocationHandler locationManager:_mockLocationManager didUpdateLocations: @[secondLocation]]; - + [_geolocationHandler locationManager:_mockOneTimeLocationManager didUpdateLocations: @[firstLocation]]; + [_geolocationHandler locationManager:_mockOneTimeLocationManager didUpdateLocations: @[secondLocation]]; + [self waitForExpectationsWithTimeout:5.0 handler:nil]; - OCMVerify(times(1), [self->_mockLocationManager stopUpdatingLocation]); + OCMVerify(times(1), [self->_mockOneTimeLocationManager stopUpdatingLocation]); } - (void)testRequestPositionShouldStopListeningOnResult { CLLocation *location = [[CLLocation alloc] initWithCoordinate:CLLocationCoordinate2DMake(54.1, 6.4) - altitude:0.0 - horizontalAccuracy:0 - verticalAccuracy:0 - timestamp:[NSDate date]]; + altitude:0.0 + horizontalAccuracy:0 + verticalAccuracy:0 + timestamp:[NSDate date]]; XCTestExpectation *expectation = [self expectationWithDescription:@"expect first result return third location"]; [_geolocationHandler requestPositionWithDesiredAccuracy:kCLLocationAccuracyBest @@ -88,11 +92,11 @@ - (void)testRequestPositionShouldStopListeningOnResult { }]; - [_geolocationHandler locationManager:_mockLocationManager didUpdateLocations: @[location]]; + [_geolocationHandler locationManager:_mockOneTimeLocationManager didUpdateLocations: @[location]]; [self waitForExpectationsWithTimeout:5.0 handler:nil]; - OCMVerify(times(1), [self->_mockLocationManager stopUpdatingLocation]); + OCMVerify(times(1), [self->_mockOneTimeLocationManager stopUpdatingLocation]); } - (void)testRequestPositionShouldStopListeningOnError { @@ -107,11 +111,11 @@ - (void)testRequestPositionShouldStopListeningOnError { }]; - [_geolocationHandler locationManager:_mockLocationManager didFailWithError: error]; + [_geolocationHandler locationManager:_mockOneTimeLocationManager didFailWithError: error]; [self waitForExpectationsWithTimeout:5.0 handler:nil]; - OCMVerify(times(1), [self->_mockLocationManager stopUpdatingLocation]); + OCMVerify(times(1), [self->_mockOneTimeLocationManager stopUpdatingLocation]); } - (void)testRequestPositionShouldNotStopListeningOnErrorDomainAndErrorLocationUnknown { @@ -158,7 +162,7 @@ - (void)testStartListeningShouldNotStopListeningWhenListeningToStream { - (void)testRequestingPositionWhileListeningDoesntStopStream { CLLocation *mockLocation = [[CLLocation alloc] initWithLatitude:54.0 longitude:6.4]; XCTestExpectation *expectationStream = [self expectationWithDescription:@"expect result return third location"]; - XCTestExpectation *expectationForeground = [self expectationWithDescription:@"expect result return third location"]; + XCTestExpectation *expectationForeground = [self expectationWithDescription:@"expect result return third location"]; [_geolocationHandler startListeningWithDesiredAccuracy: kCLLocationAccuracyBest distanceFilter:0 pauseLocationUpdatesAutomatically:NO @@ -172,14 +176,14 @@ - (void)testRequestingPositionWhileListeningDoesntStopStream { errorHandler:^(NSString * _Nonnull errorCode, NSString * _Nonnull errorDescription) { }]; - + [_geolocationHandler requestPositionWithDesiredAccuracy:kCLLocationAccuracyHundredMeters resultHandler:^(CLLocation * _Nullable location) { - XCTAssertEqual(location, mockLocation); - [expectationForeground fulfill]; - } errorHandler:^(NSString * _Nonnull errorCode, NSString * _Nonnull errorDescription) { - - }]; + XCTAssertEqual(location, mockLocation); + [expectationForeground fulfill]; + } errorHandler:^(NSString * _Nonnull errorCode, NSString * _Nonnull errorDescription) { + + }]; [_geolocationHandler locationManager:_mockLocationManager didUpdateLocations: @[mockLocation]]; [self waitForExpectationsWithTimeout:5.0 handler:nil]; @@ -236,39 +240,39 @@ - (void)testStartListeningShouldNotReportErrorOnErrorDomainAndErrorLocationUnkno } - (void)testListeningBackgroundGeolocationOnlyWhenAllowedAndEnabled { - id geolocationHandlerMock = OCMPartialMock(_geolocationHandler); - [geolocationHandlerMock setLocationManagerOverride:_mockLocationManager]; - OCMStub(ClassMethod([geolocationHandlerMock shouldEnableBackgroundLocationUpdates]))._andReturn([NSNumber numberWithBool:YES]); - [geolocationHandlerMock startListeningWithDesiredAccuracy: kCLLocationAccuracyBest - distanceFilter:0 - pauseLocationUpdatesAutomatically:NO - showBackgroundLocationIndicator:NO - activityType:CLActivityTypeOther - allowBackgroundLocationUpdates:YES - resultHandler:^(CLLocation * _Nullable location) { - } - errorHandler:^(NSString * _Nonnull errorCode, NSString * _Nonnull errorDescription) { - - }]; - OCMVerify([_mockLocationManager setAllowsBackgroundLocationUpdates:YES]); + id geolocationHandlerMock = OCMPartialMock(_geolocationHandler); + [geolocationHandlerMock setLocationManagerOverride:_mockLocationManager]; + OCMStub(ClassMethod([geolocationHandlerMock shouldEnableBackgroundLocationUpdates]))._andReturn([NSNumber numberWithBool:YES]); + [geolocationHandlerMock startListeningWithDesiredAccuracy: kCLLocationAccuracyBest + distanceFilter:0 + pauseLocationUpdatesAutomatically:NO + showBackgroundLocationIndicator:NO + activityType:CLActivityTypeOther + allowBackgroundLocationUpdates:YES + resultHandler:^(CLLocation * _Nullable location) { + } + errorHandler:^(NSString * _Nonnull errorCode, NSString * _Nonnull errorDescription) { + + }]; + OCMVerify([_mockLocationManager setAllowsBackgroundLocationUpdates:YES]); } - (void)testNotListeningBackgroundGeolocationWhenNotEnabled { - id geolocationHandlerMock = OCMPartialMock(_geolocationHandler); - [geolocationHandlerMock setLocationManagerOverride:_mockLocationManager]; - OCMStub(ClassMethod([geolocationHandlerMock shouldEnableBackgroundLocationUpdates]))._andReturn([NSNumber numberWithBool:YES]); - [geolocationHandlerMock startListeningWithDesiredAccuracy: kCLLocationAccuracyBest - distanceFilter:0 - pauseLocationUpdatesAutomatically:NO - showBackgroundLocationIndicator:NO - activityType:CLActivityTypeOther - allowBackgroundLocationUpdates:NO - resultHandler:^(CLLocation * _Nullable location) { - } - errorHandler:^(NSString * _Nonnull errorCode, NSString * _Nonnull errorDescription) { - - }]; - OCMVerify(never(), [_mockLocationManager setAllowsBackgroundLocationUpdates:YES]); + id geolocationHandlerMock = OCMPartialMock(_geolocationHandler); + [geolocationHandlerMock setLocationManagerOverride:_mockLocationManager]; + OCMStub(ClassMethod([geolocationHandlerMock shouldEnableBackgroundLocationUpdates]))._andReturn([NSNumber numberWithBool:YES]); + [geolocationHandlerMock startListeningWithDesiredAccuracy: kCLLocationAccuracyBest + distanceFilter:0 + pauseLocationUpdatesAutomatically:NO + showBackgroundLocationIndicator:NO + activityType:CLActivityTypeOther + allowBackgroundLocationUpdates:NO + resultHandler:^(CLLocation * _Nullable location) { + } + errorHandler:^(NSString * _Nonnull errorCode, NSString * _Nonnull errorDescription) { + + }]; + OCMVerify(never(), [_mockLocationManager setAllowsBackgroundLocationUpdates:YES]); } - (void)testKeepLocationManagerSettingsWhenRequestingCurrentPosition { @@ -283,14 +287,14 @@ - (void)testKeepLocationManagerSettingsWhenRequestingCurrentPosition { ._andReturn([NSNumber numberWithBool:YES]); } [geolocationHandlerMock startListeningWithDesiredAccuracy: kCLLocationAccuracyBest - distanceFilter:0 - pauseLocationUpdatesAutomatically:NO - showBackgroundLocationIndicator:YES - activityType:CLActivityTypeOther - allowBackgroundLocationUpdates:YES - resultHandler:^(CLLocation * _Nullable location) { + distanceFilter:0 + pauseLocationUpdatesAutomatically:NO + showBackgroundLocationIndicator:YES + activityType:CLActivityTypeOther + allowBackgroundLocationUpdates:YES + resultHandler:^(CLLocation * _Nullable location) { } - errorHandler:^(NSString * _Nonnull errorCode, NSString * _Nonnull errorDescription) { + errorHandler:^(NSString * _Nonnull errorCode, NSString * _Nonnull errorDescription) { }]; OCMVerify([_mockLocationManager setAllowsBackgroundLocationUpdates:YES]); @@ -306,4 +310,29 @@ - (void)testKeepLocationManagerSettingsWhenRequestingCurrentPosition { } } +- (void)testKeepLocationManagerSettingsWhenRequestingCurrentPosition1 { + [_geolocationHandler startListeningWithDesiredAccuracy:kCLLocationAccuracyThreeKilometers + distanceFilter:kCLLocationAccuracyThreeKilometers + pauseLocationUpdatesAutomatically:NO + showBackgroundLocationIndicator:YES + activityType:CLActivityTypeOther + allowBackgroundLocationUpdates:YES + resultHandler:^(CLLocation * _Nullable location) { + } + errorHandler:^(NSString * _Nonnull errorCode, NSString * _Nonnull errorDescription) { + + }]; + OCMVerify([_mockLocationManager setDesiredAccuracy:kCLLocationAccuracyThreeKilometers]); + OCMVerify([_mockLocationManager setDistanceFilter:kCLLocationAccuracyThreeKilometers]); + + [_geolocationHandler requestPositionWithDesiredAccuracy:kCLLocationAccuracyBest + resultHandler:^(CLLocation * _Nullable location) {} + errorHandler:^(NSString * _Nonnull errorCode, NSString * _Nonnull errorDescription) {}]; + OCMVerify([_mockOneTimeLocationManager setDesiredAccuracy:kCLLocationAccuracyBest]); + OCMVerify([_mockOneTimeLocationManager setDistanceFilter:kCLDistanceFilterNone]); + + OCMVerify(never(), [_mockLocationManager setDesiredAccuracy:kCLLocationAccuracyBest]); + OCMVerify(never(), [_mockLocationManager setDistanceFilter:kCLDistanceFilterNone]); +} + @end diff --git a/geolocator_apple/example/ios/RunnerTests/GeolocatorPluginTests.m b/geolocator_apple/example/ios/RunnerTests/GeolocatorPluginTests.m index c4e9cf4a..72c5cfe1 100644 --- a/geolocator_apple/example/ios/RunnerTests/GeolocatorPluginTests.m +++ b/geolocator_apple/example/ios/RunnerTests/GeolocatorPluginTests.m @@ -336,7 +336,7 @@ - (void)testOpenAppSettings { if (@available(iOS 8, *)) { id mockApplication = OCMClassMock([UIApplication class]); - OCMStub([mockApplication openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]).andReturn(YES); + OCMStub([(UIApplication *)mockApplication openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]).andReturn(YES); OCMStub(ClassMethod([mockApplication sharedApplication])).andReturn(mockApplication); @@ -394,7 +394,7 @@ - (void)testOpenLocationSettings { if (@available(iOS 8, *)) { id mockApplication = OCMClassMock([UIApplication class]); - OCMStub([mockApplication openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]).andReturn(YES); + OCMStub([(UIApplication *)mockApplication openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]).andReturn(YES); OCMStub(ClassMethod([mockApplication sharedApplication])).andReturn(mockApplication); diff --git a/geolocator_apple/ios/Classes/Handlers/GeolocationHandler.m b/geolocator_apple/ios/Classes/Handlers/GeolocationHandler.m index 0ebc96bd..6deda563 100644 --- a/geolocator_apple/ios/Classes/Handlers/GeolocationHandler.m +++ b/geolocator_apple/ios/Classes/Handlers/GeolocationHandler.m @@ -13,12 +13,12 @@ @interface GeolocationHandler() -@property(assign, nonatomic) bool isListeningForPositionUpdates; - @property(strong, nonatomic, nonnull) CLLocationManager *locationManager; - @property(strong, nonatomic) GeolocatorError errorHandler; +@property(strong, nonatomic, nonnull) CLLocationManager *oneTimeLocationManager; +@property(strong, nonatomic) GeolocatorError oneTimeErrorHandler; + @property(strong, nonatomic) GeolocatorResult currentLocationResultHandler; @property(strong, nonatomic) GeolocatorResult listenerResultHandler; @@ -32,8 +32,7 @@ - (id) init { if (!self) { return nil; } - - self.isListeningForPositionUpdates = NO; + return self; } @@ -49,32 +48,42 @@ - (void)setLocationManagerOverride:(CLLocationManager *)locationManager { self.locationManager = locationManager; } -- (CLLocation *)getLastKnownPosition { +- (CLLocationManager *) getOneTimeLocationManager { + if (!self.oneTimeLocationManager) { + self.oneTimeLocationManager = [[CLLocationManager alloc] init]; + self.oneTimeLocationManager.delegate = self; + } + return self.oneTimeLocationManager; +} + +- (void)setOneTimeLocationManagerOverride:(CLLocationManager *)locationManager { + self.oneTimeLocationManager = locationManager; +} + +- (CLLocation *) getLastKnownPosition { CLLocationManager *locationManager = [self getLocationManager]; - return [locationManager location]; + CLLocation *cashedLocation = [locationManager location]; + if (cashedLocation != nil) { + return cashedLocation; + } + CLLocationManager *persistentLocationManager = [self getOneTimeLocationManager]; + return [persistentLocationManager location]; } - (void)requestPositionWithDesiredAccuracy:(CLLocationAccuracy)desiredAccuracy resultHandler:(GeolocatorResult _Nonnull)resultHandler errorHandler:(GeolocatorError _Nonnull)errorHandler { - self.errorHandler = errorHandler; + self.oneTimeErrorHandler = errorHandler; self.currentLocationResultHandler = resultHandler; - + BOOL showBackgroundLocationIndicator = NO; BOOL allowBackgroundLocationUpdates = NO; - #if TARGET_OS_IOS - if (self.isListeningForPositionUpdates) { - CLLocationManager *locationManager = [self getLocationManager]; - showBackgroundLocationIndicator = locationManager.showsBackgroundLocationIndicator; - allowBackgroundLocationUpdates = locationManager.allowsBackgroundLocationUpdates; - } - #endif [self startUpdatingLocationWithDesiredAccuracy:desiredAccuracy distanceFilter:kCLDistanceFilterNone pauseLocationUpdatesAutomatically:NO activityType:CLActivityTypeOther - isListeningForPositionUpdates:self.isListeningForPositionUpdates + isListeningForPositionUpdates:NO showBackgroundLocationIndicator:showBackgroundLocationIndicator allowBackgroundLocationUpdates:allowBackgroundLocationUpdates]; } @@ -87,10 +96,10 @@ - (void)startListeningWithDesiredAccuracy:(CLLocationAccuracy)desiredAccuracy allowBackgroundLocationUpdates:(BOOL)allowBackgroundLocationUpdates resultHandler:(GeolocatorResult _Nonnull )resultHandler errorHandler:(GeolocatorError _Nonnull)errorHandler { - + self.errorHandler = errorHandler; self.listenerResultHandler = resultHandler; - + [self startUpdatingLocationWithDesiredAccuracy:desiredAccuracy distanceFilter:distanceFilter pauseLocationUpdatesAutomatically:pauseLocationUpdatesAutomatically @@ -107,60 +116,61 @@ - (void)startUpdatingLocationWithDesiredAccuracy:(CLLocationAccuracy)desiredAccu isListeningForPositionUpdates:(BOOL)isListeningForPositionUpdates showBackgroundLocationIndicator:(BOOL)showBackgroundLocationIndicator allowBackgroundLocationUpdates:(BOOL)allowBackgroundLocationUpdates - { - self.isListeningForPositionUpdates = isListeningForPositionUpdates; - CLLocationManager *locationManager = [self getLocationManager]; - locationManager.desiredAccuracy = desiredAccuracy; - locationManager.distanceFilter = distanceFilter; - if (@available(iOS 6.0, macOS 10.15, *)) { - locationManager.activityType = activityType; - locationManager.pausesLocationUpdatesAutomatically = pauseLocationUpdatesAutomatically; - } +{ + if (isListeningForPositionUpdates) { + CLLocationManager *locationManager = [self getLocationManager]; + locationManager.desiredAccuracy = desiredAccuracy; + locationManager.distanceFilter = distanceFilter; + if (@available(iOS 6.0, macOS 10.15, *)) { + locationManager.activityType = activityType; + locationManager.pausesLocationUpdatesAutomatically = pauseLocationUpdatesAutomatically; + } + #if TARGET_OS_IOS - if (@available(iOS 9.0, macOS 11.0, *)) { locationManager.allowsBackgroundLocationUpdates = allowBackgroundLocationUpdates - && [GeolocationHandler shouldEnableBackgroundLocationUpdates]; - } - if (@available(iOS 11.0, macOS 11.0, *)) { + && [GeolocationHandler shouldEnableBackgroundLocationUpdates]; locationManager.showsBackgroundLocationIndicator = showBackgroundLocationIndicator; - } #endif - - [locationManager startUpdatingLocation]; + [locationManager startUpdatingLocation]; + } else { + CLLocationManager *locationManager = [self getOneTimeLocationManager]; + locationManager.desiredAccuracy = desiredAccuracy; + locationManager.distanceFilter = distanceFilter; + [locationManager startUpdatingLocation]; + } } -- (void)stopListening { - [[self getLocationManager] stopUpdatingLocation]; - self.isListeningForPositionUpdates = NO; - self.errorHandler = nil; - self.listenerResultHandler = nil; +- (void)stopOneTimeLocationListening { + [[self getOneTimeLocationManager] stopUpdatingLocation]; + self.oneTimeErrorHandler = nil; + self.currentLocationResultHandler = nil; } - (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations { if (!self.listenerResultHandler && !self.currentLocationResultHandler) return; - + CLLocation *mostRecentLocation = [locations lastObject]; NSTimeInterval ageInSeconds = -[mostRecentLocation.timestamp timeIntervalSinceNow]; // If location is older then 5.0 seconds it is likely a cached location which // will be skipped. - if (!self.isListeningForPositionUpdates && ageInSeconds > kMaxLocationLifeTimeInSeconds) { + if (manager == [self getOneTimeLocationManager] && ageInSeconds > kMaxLocationLifeTimeInSeconds) { return; } - + if ([locations lastObject]) { - if (self.currentLocationResultHandler != nil) { - self.currentLocationResultHandler(mostRecentLocation); - } - if (self.listenerResultHandler != nil) { - self.listenerResultHandler(mostRecentLocation); - } + if (self.currentLocationResultHandler != nil) { + self.currentLocationResultHandler(mostRecentLocation); + } + if (self.listenerResultHandler != nil) { + self.listenerResultHandler(mostRecentLocation); + } } - + self.currentLocationResultHandler = nil; - if (!self.isListeningForPositionUpdates) { - [self stopListening]; + if (manager == [self getOneTimeLocationManager]) { + [self stopOneTimeLocationListening]; } } @@ -178,17 +188,16 @@ - (void)locationManager:(CLLocationManager *)manager self.errorHandler(GeolocatorErrorLocationUpdateFailure, error.localizedDescription); } - self.currentLocationResultHandler = nil; - if (!self.isListeningForPositionUpdates) { - [self stopListening]; + if (self.oneTimeErrorHandler) { + self.oneTimeErrorHandler(GeolocatorErrorLocationUpdateFailure, error.localizedDescription); + } + + if (manager == [self getOneTimeLocationManager]) { + [self stopOneTimeLocationListening]; } } + (BOOL) shouldEnableBackgroundLocationUpdates { - if (@available(iOS 9.0, *)) { - return [[NSBundle.mainBundle objectForInfoDictionaryKey:@"UIBackgroundModes"] containsObject: @"location"]; - } else { - return NO; - } + return [[NSBundle.mainBundle objectForInfoDictionaryKey:@"UIBackgroundModes"] containsObject: @"location"]; } @end diff --git a/geolocator_apple/ios/Classes/Handlers/GeolocationHandler_Test.h b/geolocator_apple/ios/Classes/Handlers/GeolocationHandler_Test.h index fed2845d..302b1a7d 100644 --- a/geolocator_apple/ios/Classes/Handlers/GeolocationHandler_Test.h +++ b/geolocator_apple/ios/Classes/Handlers/GeolocationHandler_Test.h @@ -9,4 +9,8 @@ /// This should only be used for testing purposes. - (void)setLocationManagerOverride:(CLLocationManager *)locationManager; +/// Overrides the CLLocationManager instance used by the GeolocationHandler. +/// This should only be used for testing purposes. +- (void)setOneTimeLocationManagerOverride:(CLLocationManager *)locationManager; + @end diff --git a/geolocator_apple/ios/geolocator_apple.podspec b/geolocator_apple/ios/geolocator_apple.podspec index e2ab47f3..00c7aace 100644 --- a/geolocator_apple/ios/geolocator_apple.podspec +++ b/geolocator_apple/ios/geolocator_apple.podspec @@ -17,7 +17,7 @@ Pod::Spec.new do |s| s.public_header_files = 'Classes/**/*.h' s.module_map = 'Classes/GeolocatorPlugin.modulemap' s.dependency 'Flutter' - s.platform = :ios, '8.0' + s.platform = :ios, '11.0' # Flutter.framework does not contain a i386 slice. Only x86_64 simulators are supported. s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386'} diff --git a/geolocator_apple/pubspec.yaml b/geolocator_apple/pubspec.yaml index 2797b3bc..9e76d7c2 100644 --- a/geolocator_apple/pubspec.yaml +++ b/geolocator_apple/pubspec.yaml @@ -2,7 +2,7 @@ name: geolocator_apple description: Geolocation Apple plugin for Flutter. This plugin provides the Apple implementation for the geolocator. repository: https://github.com/baseflow/flutter-geolocator/tree/main/geolocator_apple issue_tracker: https://github.com/baseflow/flutter-geolocator/issues?q=is%3Aissue+is%3Aopen -version: 2.3.7 +version: 2.3.8 environment: sdk: ">=2.15.0 <4.0.0" From 8060651db89fa943d635fd68d52f06889c6235ec Mon Sep 17 00:00:00 2001 From: Ksenya Date: Thu, 14 Nov 2024 23:13:37 +0700 Subject: [PATCH 03/29] Changed geolocator to 13.0.2 which updates dependency on geolocator_apple to version 2.3.8. (#1605) Co-authored-by: Oksana Liahusha --- geolocator/CHANGELOG.md | 4 ++++ geolocator/example/ios/Flutter/AppFrameworkInfo.plist | 2 +- geolocator/example/ios/Runner.xcodeproj/project.pbxproj | 9 ++++++--- geolocator/pubspec.yaml | 4 ++-- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/geolocator/CHANGELOG.md b/geolocator/CHANGELOG.md index b7ecf283..3b5d648b 100644 --- a/geolocator/CHANGELOG.md +++ b/geolocator/CHANGELOG.md @@ -1,3 +1,7 @@ +## 13.0.2 + +- Updates dependency on geolocator_apple to version 2.3.8 + ## 13.0.1 - Resolves problems when compiling non-web platforms because of illegal reference to `dart:js_interop`. diff --git a/geolocator/example/ios/Flutter/AppFrameworkInfo.plist b/geolocator/example/ios/Flutter/AppFrameworkInfo.plist index 6b4c0f78..4f8d4d24 100644 --- a/geolocator/example/ios/Flutter/AppFrameworkInfo.plist +++ b/geolocator/example/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 8.0 + 11.0 diff --git a/geolocator/example/ios/Runner.xcodeproj/project.pbxproj b/geolocator/example/ios/Runner.xcodeproj/project.pbxproj index 36aa7366..19138798 100644 --- a/geolocator/example/ios/Runner.xcodeproj/project.pbxproj +++ b/geolocator/example/ios/Runner.xcodeproj/project.pbxproj @@ -332,7 +332,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -353,6 +353,7 @@ "$(PROJECT_DIR)/Flutter", ); INFOPLIST_FILE = Runner/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -414,7 +415,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -463,7 +464,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -485,6 +486,7 @@ "$(PROJECT_DIR)/Flutter", ); INFOPLIST_FILE = Runner/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -511,6 +513,7 @@ "$(PROJECT_DIR)/Flutter", ); INFOPLIST_FILE = Runner/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/geolocator/pubspec.yaml b/geolocator/pubspec.yaml index edebb745..12d08022 100644 --- a/geolocator/pubspec.yaml +++ b/geolocator/pubspec.yaml @@ -2,7 +2,7 @@ name: geolocator description: Geolocation plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API for generic location (GPS etc.) functions. repository: https://github.com/baseflow/flutter-geolocator/tree/main/geolocator issue_tracker: https://github.com/baseflow/flutter-geolocator/issues?q=is%3Aissue+is%3Aopen -version: 13.0.1 +version: 13.0.2 environment: sdk: ">=2.15.0 <4.0.0" @@ -28,7 +28,7 @@ dependencies: geolocator_platform_interface: ^4.2.3 geolocator_android: ^4.6.0 - geolocator_apple: ^2.3.7 + geolocator_apple: ^2.3.8 geolocator_web: ^4.1.1 geolocator_windows: ^0.2.3 From ad525fe277029b07d98795688ae6e58f0d558de2 Mon Sep 17 00:00:00 2001 From: Maurits van Beusekom Date: Thu, 14 Nov 2024 17:35:59 +0100 Subject: [PATCH 04/29] Migrates away from Android imperative gradle api --- geolocator/CHANGELOG.md | 3 ++- geolocator/example/android/app/build.gradle | 17 +++++------- geolocator/example/android/build.gradle | 13 +-------- geolocator/example/android/settings.gradle | 29 ++++++++++++++------- 4 files changed, 29 insertions(+), 33 deletions(-) diff --git a/geolocator/CHANGELOG.md b/geolocator/CHANGELOG.md index 3b5d648b..dfe7dcd9 100644 --- a/geolocator/CHANGELOG.md +++ b/geolocator/CHANGELOG.md @@ -1,6 +1,7 @@ ## 13.0.2 -- Updates dependency on geolocator_apple to version 2.3.8 +- Updates dependency on geolocator_apple to version 2.3.8. +- Migrates Android configuration of example app away from imperative gradle API. ## 13.0.1 diff --git a/geolocator/example/android/app/build.gradle b/geolocator/example/android/app/build.gradle index 91cfad65..1a5fe61f 100644 --- a/geolocator/example/android/app/build.gradle +++ b/geolocator/example/android/app/build.gradle @@ -1,3 +1,8 @@ +plugins { + id "com.android.application" + id "dev.flutter.flutter-gradle-plugin" +} + def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { @@ -6,11 +11,6 @@ if (localPropertiesFile.exists()) { } } -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' @@ -27,17 +27,14 @@ project.getTasks().withType(JavaCompile) { options.compilerArgs.addAll(args) } -apply plugin: 'com.android.application' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - android { - compileSdkVersion 33 + compileSdkVersion 34 defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.baseflow.geolocator_example" - minSdkVersion 16 + minSdkVersion flutter.minSdkVersion targetSdkVersion 30 versionCode flutterVersionCode.toInteger() versionName flutterVersionName diff --git a/geolocator/example/android/build.gradle b/geolocator/example/android/build.gradle index e29a4431..bc157bd1 100644 --- a/geolocator/example/android/build.gradle +++ b/geolocator/example/android/build.gradle @@ -1,14 +1,3 @@ -buildscript { - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:7.1.2' - } -} - allprojects { repositories { google() @@ -24,6 +13,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/geolocator/example/android/settings.gradle b/geolocator/example/android/settings.gradle index 5a2f14fb..a7f13a03 100644 --- a/geolocator/example/android/settings.gradle +++ b/geolocator/example/android/settings.gradle @@ -1,15 +1,24 @@ -include ':app' +pluginManagement { + def flutterSdkPath = { + def properties = new Properties() + file("local.properties").withInputStream { properties.load(it) } + def flutterSdkPath = properties.getProperty("flutter.sdk") + assert flutterSdkPath != null, "flutter.sdk not set in local.properties" + return flutterSdkPath + }() -def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") -def plugins = new Properties() -def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') -if (pluginsFile.exists()) { - pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } + repositories { + google() + mavenCentral() + gradlePluginPortal() + } } -plugins.each { name, path -> - def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() - include ":$name" - project(":$name").projectDir = pluginDirectory +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "7.1.2" apply false } + +include ":app" \ No newline at end of file From f3f4ea8f38bf84d7e5172b8559e3f2648dc51395 Mon Sep 17 00:00:00 2001 From: Maurits van Beusekom Date: Thu, 14 Nov 2024 18:43:04 +0100 Subject: [PATCH 05/29] Adds back the stopListening method --- geolocator_apple/CHANGELOG.md | 4 +++ .../ios/Flutter/AppFrameworkInfo.plist | 2 +- geolocator_apple/example/ios/Podfile | 4 +-- .../ios/Runner.xcodeproj/project.pbxproj | 32 +++++++++++++++---- .../xcshareddata/xcschemes/Runner.xcscheme | 2 +- .../ios/Classes/Handlers/GeolocationHandler.m | 6 ++++ geolocator_apple/pubspec.yaml | 2 +- 7 files changed, 40 insertions(+), 12 deletions(-) diff --git a/geolocator_apple/CHANGELOG.md b/geolocator_apple/CHANGELOG.md index 78eb1234..a62b2666 100644 --- a/geolocator_apple/CHANGELOG.md +++ b/geolocator_apple/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.3.8+1 + +* HOT FIX: Adds back implementation of the `stopListening` method in the `GeolocationHandler.m` file. + ## 2.3.8 * Uses different `CLLocationManager` instances, for one time request location and persistent request location. diff --git a/geolocator_apple/example/ios/Flutter/AppFrameworkInfo.plist b/geolocator_apple/example/ios/Flutter/AppFrameworkInfo.plist index 4f8d4d24..8c6e5614 100644 --- a/geolocator_apple/example/ios/Flutter/AppFrameworkInfo.plist +++ b/geolocator_apple/example/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 11.0 + 12.0 diff --git a/geolocator_apple/example/ios/Podfile b/geolocator_apple/example/ios/Podfile index 87a77d50..c654fd27 100644 --- a/geolocator_apple/example/ios/Podfile +++ b/geolocator_apple/example/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -# platform :ios, '11.0' +# platform :ios, '12.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' @@ -31,7 +31,7 @@ target 'Runner' do flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) target 'RunnerTests' do - platform :ios, '11.0' + platform :ios, '12.0' inherit! :search_paths # Pods for testing pod 'OCMock', '~> 3.8.1' diff --git a/geolocator_apple/example/ios/Runner.xcodeproj/project.pbxproj b/geolocator_apple/example/ios/Runner.xcodeproj/project.pbxproj index 2608a385..33880a1c 100644 --- a/geolocator_apple/example/ios/Runner.xcodeproj/project.pbxproj +++ b/geolocator_apple/example/ios/Runner.xcodeproj/project.pbxproj @@ -192,6 +192,7 @@ 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + 591FD69E94FC610DB997784E /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -227,7 +228,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1430; + LastUpgradeCheck = 1510; ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { @@ -296,6 +297,23 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; + 591FD69E94FC610DB997784E /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; 6E879EFB06735EEE96AC22A9 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -448,7 +466,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -530,7 +548,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -579,7 +597,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -656,7 +674,7 @@ CURRENT_PROJECT_VERSION = 1; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MARKETING_VERSION = 1.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; @@ -683,7 +701,7 @@ CURRENT_PROJECT_VERSION = 1; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MARKETING_VERSION = 1.0; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.baseflow.geolocatorExample.RunnerTests; @@ -709,7 +727,7 @@ CURRENT_PROJECT_VERSION = 1; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MARKETING_VERSION = 1.0; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.baseflow.geolocatorExample.RunnerTests; diff --git a/geolocator_apple/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/geolocator_apple/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 4a7e772c..0d7f6f9e 100644 --- a/geolocator_apple/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/geolocator_apple/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ *)locations { if (!self.listenerResultHandler && !self.currentLocationResultHandler) return; diff --git a/geolocator_apple/pubspec.yaml b/geolocator_apple/pubspec.yaml index 9e76d7c2..c4b48a9f 100644 --- a/geolocator_apple/pubspec.yaml +++ b/geolocator_apple/pubspec.yaml @@ -2,7 +2,7 @@ name: geolocator_apple description: Geolocation Apple plugin for Flutter. This plugin provides the Apple implementation for the geolocator. repository: https://github.com/baseflow/flutter-geolocator/tree/main/geolocator_apple issue_tracker: https://github.com/baseflow/flutter-geolocator/issues?q=is%3Aissue+is%3Aopen -version: 2.3.8 +version: 2.3.8+1 environment: sdk: ">=2.15.0 <4.0.0" From e3bc4d45bfc43f2695a4212c0c3da632b5f0885e Mon Sep 17 00:00:00 2001 From: TimHoogstrate Date: Wed, 12 Feb 2025 13:41:59 +0100 Subject: [PATCH 06/29] adds privacy manifest to MacOS (#1636) --- geolocator_apple/CHANGELOG.md | 4 ++++ .../macos/Resources/PrivacyInfo.xcprivacy | 14 ++++++++++++++ geolocator_apple/pubspec.yaml | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 geolocator_apple/macos/Resources/PrivacyInfo.xcprivacy diff --git a/geolocator_apple/CHANGELOG.md b/geolocator_apple/CHANGELOG.md index a62b2666..28f13d10 100644 --- a/geolocator_apple/CHANGELOG.md +++ b/geolocator_apple/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.3.9 + +* Adds privacy manifest for macOS. + ## 2.3.8+1 * HOT FIX: Adds back implementation of the `stopListening` method in the `GeolocationHandler.m` file. diff --git a/geolocator_apple/macos/Resources/PrivacyInfo.xcprivacy b/geolocator_apple/macos/Resources/PrivacyInfo.xcprivacy new file mode 100644 index 00000000..aac0f74c --- /dev/null +++ b/geolocator_apple/macos/Resources/PrivacyInfo.xcprivacy @@ -0,0 +1,14 @@ + + + + + NSPrivacyTrackingDomains + + NSPrivacyAccessedAPITypes + + NSPrivacyCollectedDataTypes + + NSPrivacyTracking + + + diff --git a/geolocator_apple/pubspec.yaml b/geolocator_apple/pubspec.yaml index c4b48a9f..195b6b22 100644 --- a/geolocator_apple/pubspec.yaml +++ b/geolocator_apple/pubspec.yaml @@ -2,7 +2,7 @@ name: geolocator_apple description: Geolocation Apple plugin for Flutter. This plugin provides the Apple implementation for the geolocator. repository: https://github.com/baseflow/flutter-geolocator/tree/main/geolocator_apple issue_tracker: https://github.com/baseflow/flutter-geolocator/issues?q=is%3Aissue+is%3Aopen -version: 2.3.8+1 +version: 2.3.9 environment: sdk: ">=2.15.0 <4.0.0" From 5316740b11a3881d973cd29b60637e83de79c4ca Mon Sep 17 00:00:00 2001 From: TimHoogstrate Date: Tue, 4 Mar 2025 12:51:17 +0100 Subject: [PATCH 07/29] Android updates (#1641) * Android updates * Format Android * fixed analyzer issues * update * update * update settings * change java version form 11 to 17 * update * update * cleanup * cleanup * cleanup * Update build.gradle * Update build.gradle * update * update * Update CHANGELOG.md * Update build.gradle * Update build.gradle * update * reverts breaking changes when you use Flutter 3.27.0 * updated build script * Temporary omit deprecation warnings. --- .github/workflows/geolocator_android.yaml | 2 +- geolocator_android/CHANGELOG.md | 7 ++++ geolocator_android/android/build.gradle | 6 ++-- .../example/android/app/build.gradle | 4 +-- .../gradle/wrapper/gradle-wrapper.properties | 3 +- .../example/android/settings.gradle | 2 +- geolocator_android/example/lib/main.dart | 34 +++++++++++-------- geolocator_android/example/pubspec.yaml | 3 +- .../lib/src/types/android_position.dart | 5 +-- .../lib/src/types/android_settings.dart | 11 +++--- .../lib/src/types/foreground_settings.dart | 2 ++ geolocator_android/pubspec.yaml | 6 ++-- .../test/geolocator_android_test.dart | 2 ++ 13 files changed, 51 insertions(+), 36 deletions(-) diff --git a/.github/workflows/geolocator_android.yaml b/.github/workflows/geolocator_android.yaml index 0aa16c1b..2a51b467 100644 --- a/.github/workflows/geolocator_android.yaml +++ b/.github/workflows/geolocator_android.yaml @@ -37,7 +37,7 @@ jobs: - uses: actions/setup-java@v4 with: distribution: 'temurin' - java-version: '11' + java-version: '17' # Make sure the stable version of Flutter is available - uses: subosito/flutter-action@v2 diff --git a/geolocator_android/CHANGELOG.md b/geolocator_android/CHANGELOG.md index b0e5ab35..304a9766 100644 --- a/geolocator_android/CHANGELOG.md +++ b/geolocator_android/CHANGELOG.md @@ -1,3 +1,10 @@ +## 4.6.2 + +* Updates compileSDKVersion to 35 +* Updates Fixed warnings in Android package and Android example project +* Updates gradle version +* Updates com.android.application version to 8.7.0 + ## 4.6.1 * Fixes a bug where the plugin throws an exception while requesting locations updates with coarse location permission only. diff --git a/geolocator_android/android/build.gradle b/geolocator_android/android/build.gradle index 928c59da..1659b851 100644 --- a/geolocator_android/android/build.gradle +++ b/geolocator_android/android/build.gradle @@ -8,7 +8,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:7.4.2' + classpath 'com.android.tools.build:gradle:8.0.2' } } @@ -26,10 +26,10 @@ android { namespace("com.baseflow.geolocator") } - compileSdk 34 + compileSdk flutter.compileSdkVersion defaultConfig { - minSdkVersion 16 + minSdkVersion flutter.minSdkVersion } lintOptions { disable 'InvalidPackage' diff --git a/geolocator_android/example/android/app/build.gradle b/geolocator_android/example/android/app/build.gradle index 7eeb09b5..d662262f 100644 --- a/geolocator_android/example/android/app/build.gradle +++ b/geolocator_android/example/android/app/build.gradle @@ -32,8 +32,8 @@ android { compileSdkVersion flutter.compileSdkVersion compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } lintOptions { diff --git a/geolocator_android/example/android/gradle/wrapper/gradle-wrapper.properties b/geolocator_android/example/android/gradle/wrapper/gradle-wrapper.properties index b4ab7d88..4ef267ae 100644 --- a/geolocator_android/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/geolocator_android/example/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip + diff --git a/geolocator_android/example/android/settings.gradle b/geolocator_android/example/android/settings.gradle index 30f7cbca..56eb85cb 100644 --- a/geolocator_android/example/android/settings.gradle +++ b/geolocator_android/example/android/settings.gradle @@ -18,7 +18,7 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "7.4.2" apply false + id "com.android.application" version "8.7.0" apply false } include ":app" \ No newline at end of file diff --git a/geolocator_android/example/lib/main.dart b/geolocator_android/example/lib/main.dart index 9c4f7260..3934a102 100644 --- a/geolocator_android/example/lib/main.dart +++ b/geolocator_android/example/lib/main.dart @@ -17,17 +17,21 @@ void main() { /// Example [Widget] showing the functionalities of the geolocator plugin. class GeolocatorWidget extends StatefulWidget { - /// Creates a new GeolocatorWidget. - const GeolocatorWidget({Key? key}) : super(key: key); + /// Creates a [PermissionHandlerWidget]. + const GeolocatorWidget({ + super.key, + }); - /// Utility method to create a page with the Baseflow templating. + /// Create a page containing the functionality of this plugin static ExamplePage createPage() { return ExamplePage( Icons.location_on, (context) => const GeolocatorWidget()); } @override - _GeolocatorWidgetState createState() => _GeolocatorWidgetState(); + State createState() { + return _GeolocatorWidgetState(); + } } class _GeolocatorWidgetState extends State { @@ -75,26 +79,26 @@ class _GeolocatorWidgetState extends State { }, itemBuilder: (context) => [ const PopupMenuItem( - child: Text("Get Location Accuracy"), value: 1, + child: Text("Get Location Accuracy"), ), if (Platform.isIOS) const PopupMenuItem( - child: Text("Request Temporary Full Accuracy"), value: 2, + child: Text("Request Temporary Full Accuracy"), ), const PopupMenuItem( - child: Text("Open App Settings"), value: 3, + child: Text("Open App Settings"), ), if (Platform.isAndroid) const PopupMenuItem( - child: Text("Open Location Settings"), value: 4, + child: Text("Open Location Settings"), ), const PopupMenuItem( - child: Text("Clear"), value: 5, + child: Text("Clear"), ), ], ); @@ -150,10 +154,6 @@ class _GeolocatorWidgetState extends State { mainAxisAlignment: MainAxisAlignment.end, children: [ FloatingActionButton( - child: (_positionStreamSubscription == null || - _positionStreamSubscription!.isPaused) - ? const Icon(Icons.play_arrow) - : const Icon(Icons.pause), onPressed: _toggleListening, tooltip: (_positionStreamSubscription == null) ? 'Start position updates' @@ -161,16 +161,20 @@ class _GeolocatorWidgetState extends State { ? 'Resume' : 'Pause', backgroundColor: _determineButtonColor(), + child: (_positionStreamSubscription == null || + _positionStreamSubscription!.isPaused) + ? const Icon(Icons.play_arrow) + : const Icon(Icons.pause), ), sizedBox, FloatingActionButton( - child: const Icon(Icons.my_location), onPressed: _getCurrentPosition, + child: const Icon(Icons.my_location), ), sizedBox, FloatingActionButton( - child: const Icon(Icons.bookmark), onPressed: _getLastKnownPosition, + child: const Icon(Icons.bookmark), ), ], ), diff --git a/geolocator_android/example/pubspec.yaml b/geolocator_android/example/pubspec.yaml index 22febac1..2653454a 100644 --- a/geolocator_android/example/pubspec.yaml +++ b/geolocator_android/example/pubspec.yaml @@ -6,12 +6,13 @@ description: Demonstrates how to use the geolocator_android plugin. publish_to: 'none' # Remove this line if you wish to publish to pub.dev environment: - sdk: ">=2.15.0 <3.0.0" + sdk: ^3.5.0 dependencies: baseflow_plugin_template: ^2.1.2 flutter: sdk: flutter + geolocator_platform_interface: ^4.2.4 geolocator_android: # When depending on this package from a real application you should use: diff --git a/geolocator_android/lib/src/types/android_position.dart b/geolocator_android/lib/src/types/android_position.dart index 4105b8d0..d44396b5 100644 --- a/geolocator_android/lib/src/types/android_position.dart +++ b/geolocator_android/lib/src/types/android_position.dart @@ -1,3 +1,5 @@ +// ignore_for_file: use_super_parameters + import 'package:geolocator_platform_interface/geolocator_platform_interface.dart'; // ignore: depend_on_referenced_packages import 'package:meta/meta.dart'; @@ -21,7 +23,7 @@ class AndroidPosition extends Position { required headingAccuracy, required speed, required speedAccuracy, - int? floor, + super.floor, isMocked = false, }) : super( longitude: longitude, @@ -34,7 +36,6 @@ class AndroidPosition extends Position { headingAccuracy: headingAccuracy, speed: speed, speedAccuracy: speedAccuracy, - floor: floor, isMocked: isMocked, ); diff --git a/geolocator_android/lib/src/types/android_settings.dart b/geolocator_android/lib/src/types/android_settings.dart index fea5dfb0..0cd39923 100644 --- a/geolocator_android/lib/src/types/android_settings.dart +++ b/geolocator_android/lib/src/types/android_settings.dart @@ -11,16 +11,13 @@ class AndroidSettings extends LocationSettings { /// - forceLocationManager: false AndroidSettings({ this.forceLocationManager = false, - LocationAccuracy accuracy = LocationAccuracy.best, - int distanceFilter = 0, + super.accuracy, + super.distanceFilter, this.intervalDuration, - Duration? timeLimit, + super.timeLimit, this.foregroundNotificationConfig, this.useMSLAltitude = false, - }) : super( - accuracy: accuracy, - distanceFilter: distanceFilter, - timeLimit: timeLimit); + }); /// Forces the Geolocator plugin to use the legacy LocationManager instead of /// the FusedLocationProviderClient (Android only). diff --git a/geolocator_android/lib/src/types/foreground_settings.dart b/geolocator_android/lib/src/types/foreground_settings.dart index 09ad60f8..21cf35b5 100644 --- a/geolocator_android/lib/src/types/foreground_settings.dart +++ b/geolocator_android/lib/src/types/foreground_settings.dart @@ -119,6 +119,8 @@ class ForegroundNotificationConfig { 'notificationText': notificationText, 'notificationChannelName': notificationChannelName, 'setOngoing': setOngoing, + // Temporary ignored for release 4.6.1 (remove in future versions) + // ignore: deprecated_member_use 'color': color?.value, }; } diff --git a/geolocator_android/pubspec.yaml b/geolocator_android/pubspec.yaml index 8841c116..b20769cb 100644 --- a/geolocator_android/pubspec.yaml +++ b/geolocator_android/pubspec.yaml @@ -2,11 +2,11 @@ name: geolocator_android description: Geolocation plugin for Flutter. This plugin provides the Android implementation for the geolocator. repository: https://github.com/baseflow/flutter-geolocator/tree/main/geolocator_android issue_tracker: https://github.com/baseflow/flutter-geolocator/issues?q=is%3Aissue+is%3Aopen -version: 4.6.1 +version: 4.6.2 environment: - sdk: ">=2.15.0 <4.0.0" - flutter: ">=2.8.0" + sdk: ^3.5.0 + flutter: ">=2.17.0" flutter: plugin: diff --git a/geolocator_android/test/geolocator_android_test.dart b/geolocator_android/test/geolocator_android_test.dart index 6611a6ba..4fb57500 100644 --- a/geolocator_android/test/geolocator_android_test.dart +++ b/geolocator_android/test/geolocator_android_test.dart @@ -1511,6 +1511,8 @@ void main() { ); expect( jsonMap['foregroundNotificationConfig']['color'], + // Temporary ignored for release 4.6.1 (remove in future versions) + // ignore: deprecated_member_use settings.foregroundNotificationConfig!.color!.value, ); }); From c08b6ca13d70cc980efb41473bb36aeb45763950 Mon Sep 17 00:00:00 2001 From: TimHoogstrate Date: Tue, 4 Mar 2025 12:56:59 +0100 Subject: [PATCH 08/29] updates Apple package (#1642) --- geolocator_apple/CHANGELOG.md | 5 +++++ geolocator_apple/example/lib/main.dart | 2 +- geolocator_apple/example/pubspec.yaml | 2 +- geolocator_apple/lib/src/types/apple_settings.dart | 12 ++++-------- geolocator_apple/pubspec.yaml | 4 ++-- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/geolocator_apple/CHANGELOG.md b/geolocator_apple/CHANGELOG.md index 28f13d10..c8cb80a2 100644 --- a/geolocator_apple/CHANGELOG.md +++ b/geolocator_apple/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2.3.10 + +* Updated dart sdk to sdk: `^3.5.0` +* Fixed example project warnings + ## 2.3.9 * Adds privacy manifest for macOS. diff --git a/geolocator_apple/example/lib/main.dart b/geolocator_apple/example/lib/main.dart index 442e0b2c..154ac6f2 100644 --- a/geolocator_apple/example/lib/main.dart +++ b/geolocator_apple/example/lib/main.dart @@ -18,7 +18,7 @@ void main() { /// Example [Widget] showing the functionalities of the geolocator plugin class GeolocatorWidget extends StatefulWidget { /// Creates a new GeolocatorWidget. - const GeolocatorWidget({Key? key}) : super(key: key); + const GeolocatorWidget({super.key}); /// Utility method to create a page with the Baseflow templating. static ExamplePage createPage() { diff --git a/geolocator_apple/example/pubspec.yaml b/geolocator_apple/example/pubspec.yaml index bdaed10f..a891083b 100644 --- a/geolocator_apple/example/pubspec.yaml +++ b/geolocator_apple/example/pubspec.yaml @@ -6,7 +6,7 @@ description: Demonstrates how to use the geolocator_ios plugin. publish_to: 'none' # Remove this line if you wish to publish to pub.dev environment: - sdk: ">=2.15.0 <4.0.0" + sdk: ^3.5.0 dependencies: baseflow_plugin_template: ^2.1.2 diff --git a/geolocator_apple/lib/src/types/apple_settings.dart b/geolocator_apple/lib/src/types/apple_settings.dart index e954df2a..b265ca7d 100644 --- a/geolocator_apple/lib/src/types/apple_settings.dart +++ b/geolocator_apple/lib/src/types/apple_settings.dart @@ -13,16 +13,12 @@ class AppleSettings extends LocationSettings { AppleSettings({ this.pauseLocationUpdatesAutomatically = false, this.activityType = ActivityType.other, - LocationAccuracy accuracy = LocationAccuracy.best, - int distanceFilter = 0, - Duration? timeLimit, + super.accuracy, + super.distanceFilter, + super.timeLimit, this.showBackgroundLocationIndicator = false, this.allowBackgroundLocationUpdates = true, - }) : super( - accuracy: accuracy, - distanceFilter: distanceFilter, - timeLimit: timeLimit, - ); + }); /// Allows the location manager to pause updates to improve battery life /// on the target device without sacrificing location data. diff --git a/geolocator_apple/pubspec.yaml b/geolocator_apple/pubspec.yaml index 195b6b22..ea3be0d5 100644 --- a/geolocator_apple/pubspec.yaml +++ b/geolocator_apple/pubspec.yaml @@ -2,10 +2,10 @@ name: geolocator_apple description: Geolocation Apple plugin for Flutter. This plugin provides the Apple implementation for the geolocator. repository: https://github.com/baseflow/flutter-geolocator/tree/main/geolocator_apple issue_tracker: https://github.com/baseflow/flutter-geolocator/issues?q=is%3Aissue+is%3Aopen -version: 2.3.9 +version: 2.3.10 environment: - sdk: ">=2.15.0 <4.0.0" + sdk: ^3.5.0 flutter: ">=2.8.0" flutter: From 443115159164d91a205015bd297b08e52b0c5c5f Mon Sep 17 00:00:00 2001 From: TimHoogstrate Date: Thu, 6 Mar 2025 09:55:56 +0100 Subject: [PATCH 09/29] Updates linux project (#1643) --- geolocator_linux/CHANGELOG.md | 5 +++++ geolocator_linux/example/lib/main.dart | 2 +- geolocator_linux/example/pubspec.yaml | 2 +- geolocator_linux/lib/src/geoclue_x.dart | 2 -- geolocator_linux/lib/src/geolocator_gnome.dart | 6 ++---- geolocator_linux/pubspec.yaml | 4 ++-- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/geolocator_linux/CHANGELOG.md b/geolocator_linux/CHANGELOG.md index ab4a8481..371fbb84 100644 --- a/geolocator_linux/CHANGELOG.md +++ b/geolocator_linux/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.2.2 + +- Updates dart sdk to `sdk: ^3.5.0` +- Fixes analyzer issues + ## 0.2.1 - Updates dependency on package_info_plus to version 8.0.0. diff --git a/geolocator_linux/example/lib/main.dart b/geolocator_linux/example/lib/main.dart index 780d6a0f..599d4f39 100644 --- a/geolocator_linux/example/lib/main.dart +++ b/geolocator_linux/example/lib/main.dart @@ -21,7 +21,7 @@ void main() { /// Example [Widget] showing the functionalities of the geolocator plugin class GeolocatorWidget extends StatefulWidget { /// Create a GeolocatorWidget. - const GeolocatorWidget({Key? key}) : super(key: key); + const GeolocatorWidget({super.key}); /// Utility method to create a page with the Baseflow templating. static ExamplePage createPage() { diff --git a/geolocator_linux/example/pubspec.yaml b/geolocator_linux/example/pubspec.yaml index bb0d1c19..75035a60 100644 --- a/geolocator_linux/example/pubspec.yaml +++ b/geolocator_linux/example/pubspec.yaml @@ -6,7 +6,7 @@ description: Demonstrates how to use the geolocator_linux plugin. publish_to: 'none' # Remove this line if you wish to publish to pub.dev environment: - sdk: ">=2.15.0 <3.0.0" + sdk: ^3.5.0 dependencies: baseflow_plugin_template: ^2.1.2 diff --git a/geolocator_linux/lib/src/geoclue_x.dart b/geolocator_linux/lib/src/geoclue_x.dart index 8ada4947..4f45fa85 100644 --- a/geolocator_linux/lib/src/geoclue_x.dart +++ b/geolocator_linux/lib/src/geoclue_x.dart @@ -45,8 +45,6 @@ extension GeoClueLocationAccuracy on LocationAccuracy { case LocationAccuracy.best: case LocationAccuracy.bestForNavigation: return GeoClueAccuracyLevel.exact; - default: - return GeoClueAccuracyLevel.none; } } } diff --git a/geolocator_linux/lib/src/geolocator_gnome.dart b/geolocator_linux/lib/src/geolocator_gnome.dart index ed238b28..05cc48fe 100644 --- a/geolocator_linux/lib/src/geolocator_gnome.dart +++ b/geolocator_linux/lib/src/geolocator_gnome.dart @@ -1,4 +1,3 @@ -import 'package:geoclue/geoclue.dart'; import 'package:geolocator_platform_interface/geolocator_platform_interface.dart'; import 'package:gsettings/gsettings.dart'; import 'package:dbus/dbus.dart'; @@ -6,9 +5,8 @@ import 'package:dbus/dbus.dart'; import 'geolocator_linux.dart'; class GeolocatorGnome extends GeolocatorLinux { - GeolocatorGnome(GeoClueManager manager, {GSettings? settings}) - : _settings = settings ?? GSettings('org.gnome.system.location'), - super(manager); + GeolocatorGnome(super.manager, {GSettings? settings}) + : _settings = settings ?? GSettings('org.gnome.system.location'); final GSettings _settings; diff --git a/geolocator_linux/pubspec.yaml b/geolocator_linux/pubspec.yaml index 897f9026..9e9c74cd 100644 --- a/geolocator_linux/pubspec.yaml +++ b/geolocator_linux/pubspec.yaml @@ -3,10 +3,10 @@ description: Geolocation Linux plugin for Flutter. This plugin provides the Linux implementation for the geolocator. repository: https://github.com/baseflow/flutter-geolocator/tree/main/geolocator_linux issue_tracker: https://github.com/baseflow/flutter-geolocator/issues?q=is%3Aissue+is%3Aopen -version: 0.2.1 +version: 0.2.2 environment: - sdk: '>=2.15.0 <4.0.0' + sdk: ^3.5.0 flutter: ">=2.8.0" flutter: From 29fc15dcf4566b2096548ff0a92726a1a58a8ff4 Mon Sep 17 00:00:00 2001 From: TimHoogstrate Date: Thu, 6 Mar 2025 16:02:24 +0100 Subject: [PATCH 10/29] Updates windows project (#1644) --- geolocator_windows/CHANGELOG.md | 5 +++++ geolocator_windows/example/lib/main.dart | 2 +- geolocator_windows/example/pubspec.yaml | 2 +- geolocator_windows/pubspec.yaml | 4 ++-- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/geolocator_windows/CHANGELOG.md b/geolocator_windows/CHANGELOG.md index 7fd8ebe6..7fb62291 100644 --- a/geolocator_windows/CHANGELOG.md +++ b/geolocator_windows/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.2.4 + +* Updates dart SDk to `sdk: ^3.5.0` +* Fixed analyzzer issues example project + ## 0.2.3 * Fixes crash under Windows when RequestAcess is called while the Geolocation Service is disabled. (#1455) diff --git a/geolocator_windows/example/lib/main.dart b/geolocator_windows/example/lib/main.dart index 2e09b1da..d5520fc8 100644 --- a/geolocator_windows/example/lib/main.dart +++ b/geolocator_windows/example/lib/main.dart @@ -16,7 +16,7 @@ void main() { /// Example [Widget] showing the functionalities of the geolocator plugin class GeolocatorWidget extends StatefulWidget { /// Creates a new GeolocatorWidget. - const GeolocatorWidget({Key? key}) : super(key: key); + const GeolocatorWidget({super.key}); /// Utility method to create a page with the Baseflow templating. static ExamplePage createPage() { diff --git a/geolocator_windows/example/pubspec.yaml b/geolocator_windows/example/pubspec.yaml index 90fa2905..862788cf 100644 --- a/geolocator_windows/example/pubspec.yaml +++ b/geolocator_windows/example/pubspec.yaml @@ -6,7 +6,7 @@ description: Demonstrates how to use the geolocator_windows plugin. publish_to: 'none' # Remove this line if you wish to publish to pub.dev environment: - sdk: ">=2.15.0 <3.0.0" + sdk: ^3.5.0 dependencies: baseflow_plugin_template: ^2.1.2 diff --git a/geolocator_windows/pubspec.yaml b/geolocator_windows/pubspec.yaml index 5ae18655..41d3ead3 100644 --- a/geolocator_windows/pubspec.yaml +++ b/geolocator_windows/pubspec.yaml @@ -2,10 +2,10 @@ 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.3 +version: 0.2.4 environment: - sdk: ">=2.15.0 <4.0.0" + sdk: ^3.5.0 flutter: ">=2.8.0" flutter: From 83de9fcf121b81536ef85c9ad200184a9aabe7d6 Mon Sep 17 00:00:00 2001 From: TimHoogstrate Date: Fri, 7 Mar 2025 14:52:11 +0100 Subject: [PATCH 11/29] updates web package (#1645) * updates web package * updates platform interface * Revert "updates platform interface" This reverts commit 76af1489c14125b352aa62ac34b7c80d8fb1ee47. --- geolocator_web/CHANGELOG.md | 7 ++++++- geolocator_web/example/lib/main.dart | 2 +- geolocator_web/example/pubspec.yaml | 2 +- geolocator_web/pubspec.yaml | 4 ++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/geolocator_web/CHANGELOG.md b/geolocator_web/CHANGELOG.md index 6f60bf79..5d6b6fa0 100644 --- a/geolocator_web/CHANGELOG.md +++ b/geolocator_web/CHANGELOG.md @@ -1,4 +1,9 @@ -## 4.1.1 +## 4.1.2 + +- Updates dart SDK to `sdk: ^3.5.0` +- Fixes analyzer issues + +# 4.1.1 - Exposes the `WebSettings` class as a public type. diff --git a/geolocator_web/example/lib/main.dart b/geolocator_web/example/lib/main.dart index 5ae3467c..400a7684 100644 --- a/geolocator_web/example/lib/main.dart +++ b/geolocator_web/example/lib/main.dart @@ -21,7 +21,7 @@ void main() { /// Example [Widget] showing the functionalities of the geolocator plugin class GeolocatorWidget extends StatefulWidget { /// Create a GeolocatorWidget. - const GeolocatorWidget({Key? key}) : super(key: key); + const GeolocatorWidget({super.key}); /// Utility method to create a page with the Baseflow templating. static ExamplePage createPage() { diff --git a/geolocator_web/example/pubspec.yaml b/geolocator_web/example/pubspec.yaml index e0da5627..e72dd6fc 100644 --- a/geolocator_web/example/pubspec.yaml +++ b/geolocator_web/example/pubspec.yaml @@ -6,7 +6,7 @@ description: Demonstrates how to use the geolocator plugin on the web platform. publish_to: 'none' # Remove this line if you wish to publish to pub.dev environment: - sdk: ">=2.15.0-0 <3.0.0" + sdk: ^3.5.0 dependencies: baseflow_plugin_template: ^2.1.2 diff --git a/geolocator_web/pubspec.yaml b/geolocator_web/pubspec.yaml index c3b8dde2..4d8183f7 100644 --- a/geolocator_web/pubspec.yaml +++ b/geolocator_web/pubspec.yaml @@ -2,7 +2,7 @@ name: geolocator_web description: Official web implementation of the geolocator plugin. repository: https://github.com/baseflow/flutter-geolocator/tree/main/geolocator_web issue_tracker: https://github.com/baseflow/flutter-geolocator/issues?q=is%3Aissue+is%3Aopen -version: 4.1.1 +version: 4.1.2 flutter: plugin: @@ -28,5 +28,5 @@ dev_dependencies: mockito: ^5.4.0 environment: - sdk: ">=3.4.0 <4.0.0" + sdk: ^3.5.0 flutter: ">=3.16.0" From 4a193c6c07cf4f9cb3e7495dbfda73b6aaf6a00d Mon Sep 17 00:00:00 2001 From: TimHoogstrate Date: Mon, 17 Mar 2025 12:25:59 +0100 Subject: [PATCH 12/29] Adds macOS privacy manifest to the podspec (#1660) --- geolocator_apple/CHANGELOG.md | 4 ++++ geolocator_apple/macos/geolocator_apple.podspec | 2 ++ geolocator_apple/pubspec.yaml | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/geolocator_apple/CHANGELOG.md b/geolocator_apple/CHANGELOG.md index c8cb80a2..4aef1d51 100644 --- a/geolocator_apple/CHANGELOG.md +++ b/geolocator_apple/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.3.11 + +* Adds privacy manifest for macOS to the podspec. + ## 2.3.10 * Updated dart sdk to sdk: `^3.5.0` diff --git a/geolocator_apple/macos/geolocator_apple.podspec b/geolocator_apple/macos/geolocator_apple.podspec index 6a91c2a7..6564f28f 100644 --- a/geolocator_apple/macos/geolocator_apple.podspec +++ b/geolocator_apple/macos/geolocator_apple.podspec @@ -18,4 +18,6 @@ Pod::Spec.new do |s| s.dependency 'FlutterMacOS' s.platform = :osx, '10.11' s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } + s.resource_bundles = {'geolocator_apple_privacy' => ['Resources/PrivacyInfo.xcprivacy']} + end diff --git a/geolocator_apple/pubspec.yaml b/geolocator_apple/pubspec.yaml index ea3be0d5..ecfdca68 100644 --- a/geolocator_apple/pubspec.yaml +++ b/geolocator_apple/pubspec.yaml @@ -2,7 +2,7 @@ name: geolocator_apple description: Geolocation Apple plugin for Flutter. This plugin provides the Apple implementation for the geolocator. repository: https://github.com/baseflow/flutter-geolocator/tree/main/geolocator_apple issue_tracker: https://github.com/baseflow/flutter-geolocator/issues?q=is%3Aissue+is%3Aopen -version: 2.3.10 +version: 2.3.11 environment: sdk: ^3.5.0 From 60ba98cb7b7ed90ab7b0775c2bc91555dc72757d Mon Sep 17 00:00:00 2001 From: Jenn Magder Date: Mon, 17 Mar 2025 07:33:47 -0700 Subject: [PATCH 13/29] Remove < iOS 11 fallback API calls in openSettings: (#1653) * Remove < iOS 11 fallback API calls in openSettings: * Tests * CHANGELOG --------- Co-authored-by: TimHoogstrate --- geolocator_apple/CHANGELOG.md | 4 + .../ios/RunnerTests/GeolocatorPluginTests.m | 105 +++--------------- .../ios/Classes/GeolocatorPlugin.m | 18 +-- 3 files changed, 25 insertions(+), 102 deletions(-) diff --git a/geolocator_apple/CHANGELOG.md b/geolocator_apple/CHANGELOG.md index 4aef1d51..d2c0786d 100644 --- a/geolocator_apple/CHANGELOG.md +++ b/geolocator_apple/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.3.12 + +* Removed deprecated `-[UIApplication openURL:]` dead code. + ## 2.3.11 * Adds privacy manifest for macOS to the podspec. diff --git a/geolocator_apple/example/ios/RunnerTests/GeolocatorPluginTests.m b/geolocator_apple/example/ios/RunnerTests/GeolocatorPluginTests.m index 72c5cfe1..3c661293 100644 --- a/geolocator_apple/example/ios/RunnerTests/GeolocatorPluginTests.m +++ b/geolocator_apple/example/ios/RunnerTests/GeolocatorPluginTests.m @@ -311,56 +311,20 @@ - (void)testRequestTemporaryFullAccuracyWithInvalidArgument { #pragma mark - Test open setting related methods - (void)testOpenAppSettings { - if (@available(iOS 10, *)) - { - id mockApplication = OCMClassMock([UIApplication class]); - OCMStub([mockApplication openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] - options:@{} - completionHandler:([OCMArg invokeBlockWithArgs:@(YES), nil])]); - OCMStub(ClassMethod([mockApplication sharedApplication])).andReturn(mockApplication); - - - FlutterMethodCall *call = [FlutterMethodCall methodCallWithMethodName:@"openAppSettings" - arguments:@{}]; - - XCTestExpectation *expectation = [self expectationWithDescription:@"openAppSettings should return yes."]; - GeolocatorPlugin *plugin = [[GeolocatorPlugin alloc] init]; - [plugin handleMethodCall:call result:^(id _Nullable result) { - XCTAssertTrue(result); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:5.0 handler:nil]; - return; - } - - if (@available(iOS 8, *)) { - id mockApplication = OCMClassMock([UIApplication class]); - OCMStub([(UIApplication *)mockApplication openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]).andReturn(YES); - OCMStub(ClassMethod([mockApplication sharedApplication])).andReturn(mockApplication); - - - FlutterMethodCall *call = [FlutterMethodCall methodCallWithMethodName:@"openAppSettings" - arguments:@{}]; - - XCTestExpectation *expectation = [self expectationWithDescription:@"openAppSettings should return yes."]; - GeolocatorPlugin *plugin = [[GeolocatorPlugin alloc] init]; - [plugin handleMethodCall:call result:^(id _Nullable result) { - XCTAssertTrue(result); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:5.0 handler:nil]; - return; - } - + id mockApplication = OCMClassMock([UIApplication class]); + OCMStub([mockApplication openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] + options:@{} + completionHandler:([OCMArg invokeBlockWithArgs:@(YES), nil])]); + OCMStub(ClassMethod([mockApplication sharedApplication])).andReturn(mockApplication); + + FlutterMethodCall *call = [FlutterMethodCall methodCallWithMethodName:@"openAppSettings" arguments:@{}]; XCTestExpectation *expectation = [self expectationWithDescription:@"openAppSettings should return yes."]; GeolocatorPlugin *plugin = [[GeolocatorPlugin alloc] init]; [plugin handleMethodCall:call result:^(id _Nullable result) { - XCTAssertFalse(result); + XCTAssertTrue(result); [expectation fulfill]; }]; @@ -369,61 +333,24 @@ - (void)testOpenAppSettings { } - (void)testOpenLocationSettings { - if (@available(iOS 10, *)) - { - id mockApplication = OCMClassMock([UIApplication class]); - OCMStub([mockApplication openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] - options:@{} - completionHandler:([OCMArg invokeBlockWithArgs:@(YES), nil])]); - OCMStub(ClassMethod([mockApplication sharedApplication])).andReturn(mockApplication); - - - FlutterMethodCall *call = [FlutterMethodCall methodCallWithMethodName:@"openLocationSettings" - arguments:@{}]; - - XCTestExpectation *expectation = [self expectationWithDescription:@"openLocationSettings should return yes."]; - GeolocatorPlugin *plugin = [[GeolocatorPlugin alloc] init]; - [plugin handleMethodCall:call result:^(id _Nullable result) { - XCTAssertTrue(result); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:5.0 handler:nil]; - return; - } - - if (@available(iOS 8, *)) { - id mockApplication = OCMClassMock([UIApplication class]); - OCMStub([(UIApplication *)mockApplication openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]).andReturn(YES); - OCMStub(ClassMethod([mockApplication sharedApplication])).andReturn(mockApplication); - - - FlutterMethodCall *call = [FlutterMethodCall methodCallWithMethodName:@"openLocationSettings" - arguments:@{}]; - - XCTestExpectation *expectation = [self expectationWithDescription:@"openLocationSettings should return yes."]; - GeolocatorPlugin *plugin = [[GeolocatorPlugin alloc] init]; - [plugin handleMethodCall:call result:^(id _Nullable result) { - XCTAssertTrue(result); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:5.0 handler:nil]; - return; - } - + id mockApplication = OCMClassMock([UIApplication class]); + OCMStub([mockApplication openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] + options:@{} + completionHandler:([OCMArg invokeBlockWithArgs:@(YES), nil])]); + OCMStub(ClassMethod([mockApplication sharedApplication])).andReturn(mockApplication); + + FlutterMethodCall *call = [FlutterMethodCall methodCallWithMethodName:@"openLocationSettings" arguments:@{}]; XCTestExpectation *expectation = [self expectationWithDescription:@"openLocationSettings should return yes."]; GeolocatorPlugin *plugin = [[GeolocatorPlugin alloc] init]; [plugin handleMethodCall:call result:^(id _Nullable result) { - XCTAssertFalse(result); + XCTAssertTrue(result); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:5.0 handler:nil]; - return; } @end diff --git a/geolocator_apple/ios/Classes/GeolocatorPlugin.m b/geolocator_apple/ios/Classes/GeolocatorPlugin.m index 0e3687a9..18655922 100644 --- a/geolocator_apple/ios/Classes/GeolocatorPlugin.m +++ b/geolocator_apple/ios/Classes/GeolocatorPlugin.m @@ -175,20 +175,12 @@ - (void)openSettings:(FlutterResult)result { BOOL success = [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:urlString]]; result([[NSNumber alloc] initWithBool:success]); #else - if (@available(iOS 10, *)) { - [[UIApplication sharedApplication] - openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] - options:[[NSDictionary alloc] init] - completionHandler:^(BOOL success) { - result([[NSNumber alloc] initWithBool:success]); - }]; - } else if (@available(iOS 8.0, *)) { - BOOL success = [[UIApplication sharedApplication] - openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]; + [[UIApplication sharedApplication] + openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] + options:[[NSDictionary alloc] init] + completionHandler:^(BOOL success) { result([[NSNumber alloc] initWithBool:success]); - } else { - result([[NSNumber alloc] initWithBool:NO]); - } + }]; #endif } @end From 582874e339f72a7dea13962cbe5c9699c2131f21 Mon Sep 17 00:00:00 2001 From: TimHoogstrate Date: Mon, 17 Mar 2025 15:48:22 +0100 Subject: [PATCH 14/29] updated version number in pubspec (#1661) --- geolocator_apple/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geolocator_apple/pubspec.yaml b/geolocator_apple/pubspec.yaml index ecfdca68..14669288 100644 --- a/geolocator_apple/pubspec.yaml +++ b/geolocator_apple/pubspec.yaml @@ -2,7 +2,7 @@ name: geolocator_apple description: Geolocation Apple plugin for Flutter. This plugin provides the Apple implementation for the geolocator. repository: https://github.com/baseflow/flutter-geolocator/tree/main/geolocator_apple issue_tracker: https://github.com/baseflow/flutter-geolocator/issues?q=is%3Aissue+is%3Aopen -version: 2.3.11 +version: 2.3.12 environment: sdk: ^3.5.0 From d37e6c298830b7ded7265bec694d3f9d4f3593b1 Mon Sep 17 00:00:00 2001 From: TimHoogstrate Date: Mon, 17 Mar 2025 16:15:49 +0100 Subject: [PATCH 15/29] update platform interface package (#1647) * update platform interface package * updated version number of the platform_interface in pubspec and changelog to 4.2.5 --- geolocator_platform_interface/CHANGELOG.md | 4 ++++ geolocator_platform_interface/pubspec.yaml | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/geolocator_platform_interface/CHANGELOG.md b/geolocator_platform_interface/CHANGELOG.md index 245e8e0a..64f1836f 100644 --- a/geolocator_platform_interface/CHANGELOG.md +++ b/geolocator_platform_interface/CHANGELOG.md @@ -1,3 +1,7 @@ +## 4.2.5 + +- Updates dart sdk to `>3.5.0` + ## 4.2.4 - Correctly handle integer-like numbers when decoding `Position` from JSON. diff --git a/geolocator_platform_interface/pubspec.yaml b/geolocator_platform_interface/pubspec.yaml index 736507cc..3a9689de 100644 --- a/geolocator_platform_interface/pubspec.yaml +++ b/geolocator_platform_interface/pubspec.yaml @@ -3,7 +3,7 @@ description: A common platform interface for the geolocator plugin. repository: https://github.com/baseflow/flutter-geolocator/tree/main/geolocator_platform_interface # NOTE: We strongly prefer non-breaking changes, even at the expense of a # less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes -version: 4.2.4 +version: 4.2.5 dependencies: flutter: @@ -21,5 +21,5 @@ dev_dependencies: mockito: ^5.4.2 environment: - sdk: ">=2.15.0 <4.0.0" + sdk: ^3.5.0 flutter: ">=2.8.0" From 40acbc23edaa7e4afadfac6567a570d0e293e888 Mon Sep 17 00:00:00 2001 From: TimHoogstrate Date: Tue, 18 Mar 2025 13:39:16 +0100 Subject: [PATCH 16/29] Fix android deprecation warnings (#1648) * Android updates * Format Android * fixed analyzer issues * update * update * update settings * change java version form 11 to 17 * update * update * cleanup * cleanup * cleanup * Update build.gradle * Update build.gradle * update * update * Update CHANGELOG.md * Update build.gradle * Update build.gradle * update * reverts breaking changes when you use Flutter 3.27.0 * updated build script * Temporary omit deprecation warnings. * fixes deprecation warning * updated changelog * updated message --- geolocator_android/CHANGELOG.md | 5 +++++ geolocator_android/lib/src/types/foreground_settings.dart | 4 +--- geolocator_android/pubspec.yaml | 2 +- geolocator_android/test/geolocator_android_test.dart | 4 +--- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/geolocator_android/CHANGELOG.md b/geolocator_android/CHANGELOG.md index 304a9766..ac5eadb1 100644 --- a/geolocator_android/CHANGELOG.md +++ b/geolocator_android/CHANGELOG.md @@ -1,3 +1,8 @@ +## 5.0.0 + +- **BREAKING CHANGE:** for Flutter `3.27.0` and below. Make sure you'll upgrade Flutter to `3.29.0` or above before using this version. +* Fixes deprecation warnings + ## 4.6.2 * Updates compileSDKVersion to 35 diff --git a/geolocator_android/lib/src/types/foreground_settings.dart b/geolocator_android/lib/src/types/foreground_settings.dart index 21cf35b5..22983e09 100644 --- a/geolocator_android/lib/src/types/foreground_settings.dart +++ b/geolocator_android/lib/src/types/foreground_settings.dart @@ -119,9 +119,7 @@ class ForegroundNotificationConfig { 'notificationText': notificationText, 'notificationChannelName': notificationChannelName, 'setOngoing': setOngoing, - // Temporary ignored for release 4.6.1 (remove in future versions) - // ignore: deprecated_member_use - 'color': color?.value, + 'color': color?.toARGB32(), }; } } diff --git a/geolocator_android/pubspec.yaml b/geolocator_android/pubspec.yaml index b20769cb..fae08d03 100644 --- a/geolocator_android/pubspec.yaml +++ b/geolocator_android/pubspec.yaml @@ -2,7 +2,7 @@ name: geolocator_android description: Geolocation plugin for Flutter. This plugin provides the Android implementation for the geolocator. repository: https://github.com/baseflow/flutter-geolocator/tree/main/geolocator_android issue_tracker: https://github.com/baseflow/flutter-geolocator/issues?q=is%3Aissue+is%3Aopen -version: 4.6.2 +version: 5.0.0 environment: sdk: ^3.5.0 diff --git a/geolocator_android/test/geolocator_android_test.dart b/geolocator_android/test/geolocator_android_test.dart index 4fb57500..67c8a60c 100644 --- a/geolocator_android/test/geolocator_android_test.dart +++ b/geolocator_android/test/geolocator_android_test.dart @@ -1511,9 +1511,7 @@ void main() { ); expect( jsonMap['foregroundNotificationConfig']['color'], - // Temporary ignored for release 4.6.1 (remove in future versions) - // ignore: deprecated_member_use - settings.foregroundNotificationConfig!.color!.value, + settings.foregroundNotificationConfig!.color!.toARGB32, ); }); From b58d6574236ad80d15b355f98a101cf44ac92b05 Mon Sep 17 00:00:00 2001 From: TimHoogstrate Date: Tue, 18 Mar 2025 14:30:30 +0100 Subject: [PATCH 17/29] Updates AFP (#1646) * updates * updated buildscript * updates * updated manifest --- .github/workflows/geolocator.yaml | 8 ++++---- geolocator/CHANGELOG.md | 5 +++++ geolocator/README.md | 4 ++-- geolocator/example/android/app/build.gradle | 4 ++-- .../example/android/app/src/main/AndroidManifest.xml | 3 ++- .../android/gradle/wrapper/gradle-wrapper.properties | 2 +- geolocator/example/android/settings.gradle | 2 +- geolocator/example/lib/main.dart | 2 +- geolocator/example/pubspec.yaml | 2 +- geolocator/pubspec.yaml | 4 ++-- 10 files changed, 21 insertions(+), 15 deletions(-) diff --git a/.github/workflows/geolocator.yaml b/.github/workflows/geolocator.yaml index 9e06a30e..3ac3bfca 100644 --- a/.github/workflows/geolocator.yaml +++ b/.github/workflows/geolocator.yaml @@ -33,11 +33,11 @@ jobs: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v4 - # Ensures JAVA 11 is installed on the build agent. + # Ensures JAVA 17 is installed on the build agent. - uses: actions/setup-java@v4 with: distribution: 'temurin' - java-version: '11' + java-version: '17' # Make sure the stable version of Flutter is available - uses: subosito/flutter-action@v2 @@ -49,8 +49,8 @@ jobs: run: flutter pub get working-directory: ${{env.source-directory}} - # Run Flutter Format to ensure formatting is valid - - name: Run Flutter Format + # Run Dart Format to ensure formatting is valid + - name: Run Dart Format run: dart format --set-exit-if-changed . working-directory: ${{env.source-directory}} diff --git a/geolocator/CHANGELOG.md b/geolocator/CHANGELOG.md index dfe7dcd9..c6f2dec0 100644 --- a/geolocator/CHANGELOG.md +++ b/geolocator/CHANGELOG.md @@ -1,3 +1,8 @@ +## 13.0.3 + +- Updates dart sdk to `sdk: ^3.5.0` +- Updates example project and fixes analyzer issues + ## 13.0.2 - Updates dependency on geolocator_apple to version 2.3.8. diff --git a/geolocator/README.md b/geolocator/README.md index f1eaef8e..d703b5dd 100644 --- a/geolocator/README.md +++ b/geolocator/README.md @@ -42,11 +42,11 @@ The TL;DR version is: android.useAndroidX=true android.enableJetifier=true ``` -2. Make sure you set the `compileSdkVersion` in your "android/app/build.gradle" file to 34: +2. Make sure you set the `compileSdkVersion` in your "android/app/build.gradle" file to 35: ``` android { - compileSdkVersion 34 + compileSdkVersion 35 ... } diff --git a/geolocator/example/android/app/build.gradle b/geolocator/example/android/app/build.gradle index 1a5fe61f..870f1d3f 100644 --- a/geolocator/example/android/app/build.gradle +++ b/geolocator/example/android/app/build.gradle @@ -28,14 +28,14 @@ project.getTasks().withType(JavaCompile) { } android { - compileSdkVersion 34 + compileSdkVersion flutter.compileSdkVersion defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.baseflow.geolocator_example" minSdkVersion flutter.minSdkVersion - targetSdkVersion 30 + targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName } diff --git a/geolocator/example/android/app/src/main/AndroidManifest.xml b/geolocator/example/android/app/src/main/AndroidManifest.xml index 829fcb8c..3e48a8e8 100644 --- a/geolocator/example/android/app/src/main/AndroidManifest.xml +++ b/geolocator/example/android/app/src/main/AndroidManifest.xml @@ -19,7 +19,8 @@ android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" - android:windowSoftInputMode="adjustResize"> + android:windowSoftInputMode="adjustResize" + android:exported="true">