Skip to content

Commit c6a30bc

Browse files
authored
[google_maps_flutter_ios] iOS changes to support heatmaps (#7314)
Sequel to: - #7312 Prequel to: - #3257
1 parent 89d28fd commit c6a30bc

26 files changed

+1044
-97
lines changed

packages/google_maps_flutter/google_maps_flutter_ios/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.11.0
2+
3+
* Adds support for heatmap layers.
4+
15
## 2.10.0
26

37
* Converts Obj-C->Dart calls to Pigeon.

packages/google_maps_flutter/google_maps_flutter_ios/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,15 @@ your app when you do, so you do not need to add it to your `pubspec.yaml`.
1111
However, if you `import` this package to use any of its APIs directly, you
1212
should add it to your `pubspec.yaml` as usual.
1313

14+
## Supported Heatmap Options
15+
16+
| Field | Supported |
17+
| ---------------------------- | :-------: |
18+
| Heatmap.dissipating | x |
19+
| Heatmap.maxIntensity | x |
20+
| Heatmap.minimumZoomIntensity ||
21+
| Heatmap.maximumZoomIntensity ||
22+
| HeatmapGradient.colorMapSize ||
23+
1424
[1]: https://pub.dev/packages/google_maps_flutter
1525
[2]: https://flutter.dev/to/endorsed-federated-plugin

packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Podfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelpe
2828
flutter_ios_podfile_setup
2929

3030
target 'Runner' do
31+
use_frameworks!
32+
use_modular_headers!
33+
3134
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
3235
target 'RunnerTests' do
3336
inherit! :search_paths

packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@
99
/* Begin PBXBuildFile section */
1010
0DD7B6C32B744EEF00E857FD /* FLTTileProviderControllerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0DD7B6C22B744EEF00E857FD /* FLTTileProviderControllerTests.m */; };
1111
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
12+
2BDE99378062AE3E60B40021 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3ACE0AFE8D82CD5962486AFD /* Pods_RunnerTests.framework */; };
1213
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
13-
4510D964F3B1259FEDD3ABA6 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7755F8F4BABC3D6A0BD4048B /* libPods-Runner.a */; };
1414
478116522BEF8F47002F593E /* GoogleMapsPolylinesControllerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 478116512BEF8F47002F593E /* GoogleMapsPolylinesControllerTests.m */; };
15-
6851F3562835BC180032B7C8 /* FLTGoogleMapJSONConversionsConversionTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6851F3552835BC180032B7C8 /* FLTGoogleMapJSONConversionsConversionTests.m */; };
1615
521AB0032B876A76005F460D /* ExtractIconFromDataTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 521AB0022B876A76005F460D /* ExtractIconFromDataTests.m */; };
16+
6851F3562835BC180032B7C8 /* FLTGoogleMapJSONConversionsConversionTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6851F3552835BC180032B7C8 /* FLTGoogleMapJSONConversionsConversionTests.m */; };
1717
68E4726A2836FF0C00BDDDAC /* MapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 68E472692836FF0C00BDDDAC /* MapKit.framework */; };
1818
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
1919
97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
2020
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
2121
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
2222
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
2323
982F2A6C27BADE17003C81F4 /* PartiallyMockedMapView.m in Sources */ = {isa = PBXBuildFile; fileRef = 982F2A6B27BADE17003C81F4 /* PartiallyMockedMapView.m */; };
24+
B3A7FA04ABB7B84780729949 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61A9A8623F5CA9BBC813DC6B /* Pods_Runner.framework */; };
2425
F269303B2BB389BF00BF17C4 /* assets in Resources */ = {isa = PBXBuildFile; fileRef = F269303A2BB389BF00BF17C4 /* assets */; };
2526
F7151F13265D7ED70028CB91 /* GoogleMapsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F7151F12265D7ED70028CB91 /* GoogleMapsTests.m */; };
2627
F7151F21265D7EE50028CB91 /* GoogleMapsUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = F7151F20265D7EE50028CB91 /* GoogleMapsUITests.m */; };
27-
FC8F35FC8CD533B128950487 /* libPods-RunnerTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F267F68029D1A4E2E4C572A7 /* libPods-RunnerTests.a */; };
2828
/* End PBXBuildFile section */
2929

3030
/* Begin PBXContainerItemProxy section */
@@ -61,13 +61,14 @@
6161
0DD7B6C22B744EEF00E857FD /* FLTTileProviderControllerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FLTTileProviderControllerTests.m; sourceTree = "<group>"; };
6262
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
6363
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
64+
3ACE0AFE8D82CD5962486AFD /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
6465
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
6566
478116512BEF8F47002F593E /* GoogleMapsPolylinesControllerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GoogleMapsPolylinesControllerTests.m; sourceTree = "<group>"; };
66-
6851F3552835BC180032B7C8 /* FLTGoogleMapJSONConversionsConversionTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FLTGoogleMapJSONConversionsConversionTests.m; sourceTree = "<group>"; };
6767
521AB0022B876A76005F460D /* ExtractIconFromDataTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ExtractIconFromDataTests.m; sourceTree = "<group>"; };
68+
61A9A8623F5CA9BBC813DC6B /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
69+
6851F3552835BC180032B7C8 /* FLTGoogleMapJSONConversionsConversionTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FLTGoogleMapJSONConversionsConversionTests.m; sourceTree = "<group>"; };
6870
68E472692836FF0C00BDDDAC /* MapKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MapKit.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/System/iOSSupport/System/Library/Frameworks/MapKit.framework; sourceTree = DEVELOPER_DIR; };
6971
733AFAB37683A9DA7512F09C /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = "<group>"; };
70-
7755F8F4BABC3D6A0BD4048B /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; };
7172
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
7273
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
7374
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
@@ -84,7 +85,6 @@
8485
B7AFC65E3DD5AC60D834D83D /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
8586
E52C6A6210A56F027C582EF9 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = "<group>"; };
8687
EA0E91726245EDC22B97E8B9 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
87-
F267F68029D1A4E2E4C572A7 /* libPods-RunnerTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RunnerTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
8888
F269303A2BB389BF00BF17C4 /* assets */ = {isa = PBXFileReference; lastKnownFileType = folder; path = assets; sourceTree = "<group>"; };
8989
F7151F10265D7ED70028CB91 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
9090
F7151F12265D7ED70028CB91 /* GoogleMapsTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GoogleMapsTests.m; sourceTree = "<group>"; };
@@ -99,7 +99,7 @@
9999
isa = PBXFrameworksBuildPhase;
100100
buildActionMask = 2147483647;
101101
files = (
102-
4510D964F3B1259FEDD3ABA6 /* libPods-Runner.a in Frameworks */,
102+
B3A7FA04ABB7B84780729949 /* Pods_Runner.framework in Frameworks */,
103103
);
104104
runOnlyForDeploymentPostprocessing = 0;
105105
};
@@ -108,7 +108,7 @@
108108
buildActionMask = 2147483647;
109109
files = (
110110
68E4726A2836FF0C00BDDDAC /* MapKit.framework in Frameworks */,
111-
FC8F35FC8CD533B128950487 /* libPods-RunnerTests.a in Frameworks */,
111+
2BDE99378062AE3E60B40021 /* Pods_RunnerTests.framework in Frameworks */,
112112
);
113113
runOnlyForDeploymentPostprocessing = 0;
114114
};
@@ -126,8 +126,8 @@
126126
isa = PBXGroup;
127127
children = (
128128
68E472692836FF0C00BDDDAC /* MapKit.framework */,
129-
7755F8F4BABC3D6A0BD4048B /* libPods-Runner.a */,
130-
F267F68029D1A4E2E4C572A7 /* libPods-RunnerTests.a */,
129+
61A9A8623F5CA9BBC813DC6B /* Pods_Runner.framework */,
130+
3ACE0AFE8D82CD5962486AFD /* Pods_RunnerTests.framework */,
131131
);
132132
name = Frameworks;
133133
sourceTree = "<group>";
@@ -241,6 +241,7 @@
241241
9705A1C41CF9048500538489 /* Embed Frameworks */,
242242
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
243243
BB6BD9A1101E970BEF85B6D2 /* [CP] Copy Pods Resources */,
244+
A7D3A643E249522B15BA2B1D /* [CP] Embed Pods Frameworks */,
244245
);
245246
buildRules = (
246247
);
@@ -259,6 +260,7 @@
259260
F7151F0C265D7ED70028CB91 /* Sources */,
260261
F7151F0D265D7ED70028CB91 /* Frameworks */,
261262
F7151F0E265D7ED70028CB91 /* Resources */,
263+
DF182F6A1B9E41DA05BFCB87 /* [CP] Embed Pods Frameworks */,
262264
);
263265
buildRules = (
264266
);
@@ -411,6 +413,24 @@
411413
shellPath = /bin/sh;
412414
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
413415
};
416+
A7D3A643E249522B15BA2B1D /* [CP] Embed Pods Frameworks */ = {
417+
isa = PBXShellScriptBuildPhase;
418+
buildActionMask = 2147483647;
419+
files = (
420+
);
421+
inputPaths = (
422+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
423+
"${BUILT_PRODUCTS_DIR}/integration_test/integration_test.framework",
424+
);
425+
name = "[CP] Embed Pods Frameworks";
426+
outputPaths = (
427+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/integration_test.framework",
428+
);
429+
runOnlyForDeploymentPostprocessing = 0;
430+
shellPath = /bin/sh;
431+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
432+
showEnvVarsInLog = 0;
433+
};
414434
BB6BD9A1101E970BEF85B6D2 /* [CP] Copy Pods Resources */ = {
415435
isa = PBXShellScriptBuildPhase;
416436
buildActionMask = 2147483647;
@@ -453,6 +473,24 @@
453473
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
454474
showEnvVarsInLog = 0;
455475
};
476+
DF182F6A1B9E41DA05BFCB87 /* [CP] Embed Pods Frameworks */ = {
477+
isa = PBXShellScriptBuildPhase;
478+
buildActionMask = 2147483647;
479+
files = (
480+
);
481+
inputPaths = (
482+
"${PODS_ROOT}/Target Support Files/Pods-RunnerTests/Pods-RunnerTests-frameworks.sh",
483+
"${BUILT_PRODUCTS_DIR}/OCMock/OCMock.framework",
484+
);
485+
name = "[CP] Embed Pods Frameworks";
486+
outputPaths = (
487+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OCMock.framework",
488+
);
489+
runOnlyForDeploymentPostprocessing = 0;
490+
shellPath = /bin/sh;
491+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RunnerTests/Pods-RunnerTests-frameworks.sh\"\n";
492+
showEnvVarsInLog = 0;
493+
};
456494
/* End PBXShellScriptBuildPhase section */
457495

458496
/* Begin PBXSourcesBuildPhase section */

packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/FLTGoogleMapJSONConversionsConversionTests.m

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,4 +319,54 @@ - (void)testLengthsFromPatterns {
319319
XCTAssertEqual(secondSpanLength.doubleValue, 6.4);
320320
}
321321

322+
- (void)testWeightedLatLngFromArray {
323+
NSArray *weightedLatLng = @[ @[ @1, @2 ], @3 ];
324+
325+
GMUWeightedLatLng *weightedLocation =
326+
[FLTGoogleMapJSONConversions weightedLatLngFromArray:weightedLatLng];
327+
328+
// The location gets projected to different values
329+
XCTAssertEqual([weightedLocation intensity], 3);
330+
}
331+
332+
- (void)testWeightedLatLngFromArrayThrowsForInvalidInput {
333+
NSArray *weightedLatLng = @[];
334+
335+
XCTAssertThrows([FLTGoogleMapJSONConversions weightedLatLngFromArray:weightedLatLng]);
336+
}
337+
338+
- (void)testWeightedDataFromArray {
339+
NSNumber *intensity1 = @3;
340+
NSNumber *intensity2 = @6;
341+
NSArray *data = @[ @[ @[ @1, @2 ], intensity1 ], @[ @[ @4, @5 ], intensity2 ] ];
342+
343+
NSArray<GMUWeightedLatLng *> *weightedData =
344+
[FLTGoogleMapJSONConversions weightedDataFromArray:data];
345+
XCTAssertEqual([weightedData[0] intensity], [intensity1 floatValue]);
346+
XCTAssertEqual([weightedData[1] intensity], [intensity2 floatValue]);
347+
}
348+
349+
- (void)testGradientFromDictionary {
350+
NSNumber *startPoint = @0.6;
351+
NSNumber *colorMapSize = @200;
352+
NSDictionary *gradientData = @{
353+
@"colors" : @[
354+
// Color.fromARGB(255, 0, 255, 255)
355+
@4278255615,
356+
],
357+
@"startPoints" : @[ startPoint ],
358+
@"colorMapSize" : colorMapSize,
359+
};
360+
361+
GMUGradient *gradient = [FLTGoogleMapJSONConversions gradientFromDictionary:gradientData];
362+
CGFloat red, green, blue, alpha;
363+
[[gradient colors][0] getRed:&red green:&green blue:&blue alpha:&alpha];
364+
XCTAssertEqual(red, 0);
365+
XCTAssertEqual(green, 1);
366+
XCTAssertEqual(blue, 1);
367+
XCTAssertEqual(alpha, 1);
368+
XCTAssertEqualWithAccuracy([[gradient startPoints][0] doubleValue], [startPoint doubleValue], 0);
369+
XCTAssertEqual([gradient mapSize], [colorMapSize intValue]);
370+
}
371+
322372
@end

packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dependencies:
1818
# The example app is bundled with the plugin so we use a path dependency on
1919
# the parent directory to use the current plugin's version.
2020
path: ../../
21-
google_maps_flutter_platform_interface: ^2.7.0
21+
google_maps_flutter_platform_interface: ^2.9.0
2222
maps_example_dart:
2323
path: ../shared/maps_example_dart/
2424

packages/google_maps_flutter/google_maps_flutter_ios/example/ios15/ios/Podfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelpe
2828
flutter_ios_podfile_setup
2929

3030
target 'Runner' do
31+
use_frameworks!
32+
use_modular_headers!
33+
3134
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
3235
target 'RunnerTests' do
3336
inherit! :search_paths

0 commit comments

Comments
 (0)