diff --git a/android/build.gradle b/android/build.gradle index 11eef99..85159d7 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -34,7 +34,7 @@ android { } dependencies { - implementation 'io.radar:sdk:3.9.8' + implementation 'io.radar:sdk:3.11.0' implementation 'com.google.android.gms:play-services-location:21.0.1' implementation 'com.google.code.gson:gson:2.8.6' } diff --git a/android/src/main/java/io/radar/flutter/RadarFlutterPlugin.java b/android/src/main/java/io/radar/flutter/RadarFlutterPlugin.java index 0ab9c9f..bb72b51 100644 --- a/android/src/main/java/io/radar/flutter/RadarFlutterPlugin.java +++ b/android/src/main/java/io/radar/flutter/RadarFlutterPlugin.java @@ -324,7 +324,7 @@ private void initialize(MethodCall call, Result result) { String publishableKey = call.argument("publishableKey"); SharedPreferences.Editor editor = mContext.getSharedPreferences("RadarSDK", Context.MODE_PRIVATE).edit(); editor.putString("x_platform_sdk_type", "Flutter"); - editor.putString("x_platform_sdk_version", "3.9.1"); + editor.putString("x_platform_sdk_version", "3.9.2-beta.5"); editor.apply(); Radar.initialize(mContext, publishableKey); result.success(true); @@ -847,13 +847,10 @@ public void run() { String[] tags = (String[])tagsList.toArray(new String[0]); HashMap metadataMap = (HashMap)call.argument("metadata"); JSONObject metadata = jsonForMap(metadataMap); - int limit = call.hasArgument("limit") ? (int)call.argument("limit") : 10; + int limit = call.hasArgument("limit") ? (int)call.argument("limit") : -1; - if (near != null) { - Radar.searchGeofences(near, radius, tags, metadata, limit, callback); - } else { - Radar.searchGeofences(radius, tags, metadata, limit, callback); - } + boolean includeGeometry = call.hasArgument("includeGeometry") ? (boolean)call.argument("includeGeometry") : false; + Radar.searchGeofences(near, radius, tags, metadata, limit, includeGeometry, callback); } public void searchPlaces(MethodCall call, final Result result) { @@ -908,7 +905,10 @@ public void run() { public void autocomplete(MethodCall call, final Result result) { String query = call.argument("query"); HashMap nearMap = (HashMap)call.argument("near"); - Location near = locationForMap(nearMap); + Location near = null; + if (nearMap != null) { + near = locationForMap(nearMap); + } int limit = call.hasArgument("limit") ? (int)call.argument("limit") : 10; String country = call.argument("country"); ArrayList layersList = (ArrayList)call.argument("layers"); diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index fb4140f..c16a0c8 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -34,7 +34,7 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "io.radar.example" - minSdkVersion 16 + minSdkVersion flutter.minSdkVersion targetSdkVersion 29 versionCode flutterVersionCode.toInteger() versionName flutterVersionName @@ -49,7 +49,7 @@ android { } dependencies { - implementation 'io.radar:sdk:3.9.8' + implementation 'io.radar:sdk:3.11.0' implementation "com.google.android.play:integrity:1.2.0" } } diff --git a/example/android/build.gradle b/example/android/build.gradle index 21d7749..9881192 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -24,6 +24,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/example/ios/Flutter/AppFrameworkInfo.plist index 4f8d4d2..8c6e561 100644 --- a/example/ios/Flutter/AppFrameworkInfo.plist +++ b/example/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 11.0 + 12.0 diff --git a/example/ios/Podfile b/example/ios/Podfile index bfd60c4..b331c7b 100644 --- a/example/ios/Podfile +++ b/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' diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 3c16ff9..c6180ec 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 51; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -149,6 +149,7 @@ 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + 6DC24095C2EFCA483D13C630 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -165,7 +166,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1300; + LastUpgradeCheck = 1510; ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { @@ -208,10 +209,12 @@ /* Begin PBXShellScriptBuildPhase section */ 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", ); name = "Thin Binary"; outputPaths = ( @@ -220,6 +223,23 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin\n"; }; + 6DC24095C2EFCA483D13C630 /* [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; + }; 8AED107CD2EAE06C6755A899 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -244,6 +264,7 @@ }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); diff --git a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 3db53b6..e67b280 100644 --- a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ $(FLUTTER_BUILD_NUMBER) LSRequiresIPhoneOS + NSBluetoothAlwaysUsageDescription + YOUR TEXT + NSBluetoothPeripheralUsageDescription + YOUR TEXT NSLocationAlwaysAndWhenInUseUsageDescription Your iOS 11 and higher background location usage description goes here. e.g., "This app uses your location in the background to recommend places nearby." NSLocationAlwaysUsageDescription Your iOS 10 and lower background location usage description goes here. e.g., "This app uses your location in the background to recommend places nearby." NSLocationWhenInUseUsageDescription Your foreground location usage description goes here. e.g., "This app uses your location in the foreground to recommend places nearby." + NSMotionUsageDescription + We use motion data to improve the accuracy of locations UIBackgroundModes fetch @@ -78,5 +84,7 @@ + UIApplicationSupportsIndirectInputEvents + diff --git a/example/lib/main.dart b/example/lib/main.dart index 4cbeaaa..eed49a0 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -40,6 +40,7 @@ class _MyAppState extends State with WidgetsBindingObserver { @pragma('vm:entry-point') static void onLocation(Map res) { print('📍📍 onLocation: $res'); + print("METADATA: $res['locationMetadata']"); } @pragma('vm:entry-point') @@ -255,7 +256,7 @@ class _MyAppState extends State with WidgetsBindingObserver { style: raisedButtonStyle, onPressed: () async { var resp = await Radar.autocomplete( - query: 'brooklyn roasting', + query: '841 Broadwa', near: { 'latitude': 40.783826, 'longitude': -73.975363, @@ -269,6 +270,22 @@ class _MyAppState extends State with WidgetsBindingObserver { }, child: Text('autocomplete'), ), + ElevatedButton( + style: raisedButtonStyle, + onPressed: () async { + var resp = await Radar.autocomplete( + query: '841 Broadwa', + near: {}, + limit: 10, + layers: ['address', 'street'], + country: 'US', + mailable: false + ); + print("autocomplete: $resp"); + }, + child: Text('autocomplete without near'), + ), + ElevatedButton( style: raisedButtonStyle, onPressed: () async { diff --git a/ios/Classes/RadarFlutterPlugin.m b/ios/Classes/RadarFlutterPlugin.m index 487b8fe..1f6b818 100644 --- a/ios/Classes/RadarFlutterPlugin.m +++ b/ios/Classes/RadarFlutterPlugin.m @@ -148,7 +148,7 @@ - (void)initialize:(FlutterMethodCall *)call withResult:(FlutterResult)result { NSString *publishableKey = argsDict[@"publishableKey"]; [[NSUserDefaults standardUserDefaults] setObject:@"Flutter" forKey:@"radar-xPlatformSDKType"]; - [[NSUserDefaults standardUserDefaults] setObject:@"3.9.1" forKey:@"radar-xPlatformSDKVersion"]; + [[NSUserDefaults standardUserDefaults] setObject:@"3.9.2-beta.5" forKey:@"radar-xPlatformSDKVersion"]; [Radar initializeWithPublishableKey:publishableKey]; result(nil); } @@ -637,14 +637,17 @@ - (void)searchGeofences:(FlutterMethodCall *)call withResult:(FlutterResult)resu if (limitNumber != nil && [limitNumber isKindOfClass:[NSNumber class]]) { limit = [limitNumber intValue]; } else { - limit = 10; + limit = -1; } - if (near != nil) { - [Radar searchGeofencesNear:near radius:radius tags:tags metadata:metadata limit:limit completionHandler:completionHandler]; - } else { - [Radar searchGeofencesWithRadius:radius tags:tags metadata:metadata limit:limit completionHandler:completionHandler]; + // boolean for includeGeometry + BOOL includeGeometry = NO; + NSNumber *includeGeometryNumber = argsDict[@"includeGeometry"]; + if (includeGeometryNumber != nil && [includeGeometryNumber isKindOfClass:[NSNumber class]]) { + includeGeometry = [includeGeometryNumber boolValue]; } + + [Radar searchGeofencesNear:near radius:radius tags:tags metadata:metadata limit:limit includeGeometry:includeGeometry completionHandler:completionHandler]; } - (void)searchPlaces:(FlutterMethodCall *)call withResult:(FlutterResult)result { @@ -705,12 +708,14 @@ - (void)autocomplete:(FlutterMethodCall *)call withResult:(FlutterResult)result NSString *query = argsDict[@"query"]; CLLocation *near; NSDictionary *nearDict = argsDict[@"near"]; - if (nearDict) { + if (nearDict != nil && [nearDict isKindOfClass:[NSDictionary class]]) { NSNumber *latitudeNumber = nearDict[@"latitude"]; NSNumber *longitudeNumber = nearDict[@"longitude"]; double latitude = [latitudeNumber doubleValue]; double longitude = [longitudeNumber doubleValue]; near = [[CLLocation alloc] initWithCoordinate:CLLocationCoordinate2DMake(latitude, longitude) altitude:-1 horizontalAccuracy:5 verticalAccuracy:-1 timestamp:[NSDate date]]; + } else { + near = nil; } NSNumber *limitNumber = argsDict[@"limit"]; int limit; @@ -1067,8 +1072,19 @@ - (void)didReceiveEvents:(NSArray *)events user:(RadarUser *)user [self.backgroundChannel invokeMethod:@"" arguments:args]; } -- (void)didUpdateLocation:(CLLocation *)location user:(RadarUser *)user { - NSDictionary *dict = @{@"location": [Radar dictionaryForLocation:location], @"user": [user dictionaryValue]}; +- (void)didUpdateLocation:(CLLocation *)location user:(RadarUser *)user locationMetadata:(NSDictionary *)locationMetadata{ + + NSMutableDictionary *dict = [NSMutableDictionary new]; + if ([Radar dictionaryForLocation:location]) { + [dict setObject:[Radar dictionaryForLocation:location] forKey:@"location"]; + } + if ([user dictionaryValue]) { + [dict setObject:[user dictionaryValue] forKey:@"user"]; + } + if (locationMetadata) { + [dict setObject:locationMetadata forKey:@"locationMetadata"]; + } + NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; NSInteger callbackHandle = [userDefaults integerForKey:@"location"]; if (callbackHandle == 0) { diff --git a/ios/flutter_radar.podspec b/ios/flutter_radar.podspec index 63f63da..8eb870f 100644 --- a/ios/flutter_radar.podspec +++ b/ios/flutter_radar.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'flutter_radar' - s.version = '3.9.1' + s.version = '3.9.2-beta.5' s.summary = 'Flutter package for Radar, the leading geofencing and location tracking platform' s.description = 'Flutter package for Radar, the leading geofencing and location tracking platform' s.homepage = 'http://example.com' @@ -10,7 +10,7 @@ Pod::Spec.new do |s| s.source_files = 'Classes/**/*' s.public_header_files = 'Classes/**/*.h' s.dependency 'Flutter' - s.dependency 'RadarSDK', '3.9.14' + s.dependency 'RadarSDK', '3.10.2-beta.1' s.platform = :ios, '10.0' s.static_framework = true diff --git a/pubspec.yaml b/pubspec.yaml index 482f01e..8f95f84 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_radar description: Flutter package for Radar, the leading geofencing and location tracking platform -version: 3.9.1 +version: 3.9.2-beta.5 homepage: https://github.com/radarlabs/flutter-radar environment: