Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.15.9

* Converts top-level plugin implementation to Swift.

## 2.15.8

* Replaces internal use of deprecated methods.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// found in the LICENSE file.

@import google_maps_flutter_ios;
@import google_maps_flutter_ios.Test;
@import XCTest;

#import <OCMock/OCMock.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// found in the LICENSE file.

@import google_maps_flutter_ios;
@import google_maps_flutter_ios.Test;
@import XCTest;
@import GoogleMaps;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// found in the LICENSE file.

@import google_maps_flutter_ios;
@import google_maps_flutter_ios.Test;
@import XCTest;
@import GoogleMaps;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// found in the LICENSE file.

@import google_maps_flutter_ios;
@import google_maps_flutter_ios.Test;
@import XCTest;
@import GoogleMaps;
@import GoogleMapsUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// found in the LICENSE file.

@import google_maps_flutter_ios;
@import google_maps_flutter_ios.Test;
@import XCTest;
@import GoogleMaps;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// found in the LICENSE file.

@import google_maps_flutter_ios;
@import google_maps_flutter_ios.Test;
@import XCTest;
@import GoogleMaps;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// found in the LICENSE file.

@import google_maps_flutter_ios;
@import google_maps_flutter_ios.Test;
@import XCTest;
@import GoogleMaps;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// found in the LICENSE file.

@import google_maps_flutter_ios;
@import google_maps_flutter_ios.Test;
@import XCTest;
@import GoogleMaps;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// found in the LICENSE file.

@import google_maps_flutter_ios;
@import google_maps_flutter_ios.Test;
@import XCTest;
@import GoogleMaps;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,13 @@
// found in the LICENSE file.

@import google_maps_flutter_ios;
@import google_maps_flutter_ios.Test;
@import XCTest;
@import GoogleMaps;

#import <OCMock/OCMock.h>
#import "FGMCATransactionWrapper.h"
#import "PartiallyMockedMapView.h"

@interface FLTGoogleMapFactory (Test)
@property(strong, nonatomic, readonly) id<NSObject> sharedMapServices;
@end

@interface GoogleMapsTests : XCTestCase
@end

Expand All @@ -25,7 +20,7 @@ - (UIImage *)handleResultTile:(nullable UIImage *)tileImage;
@implementation GoogleMapsTests

- (void)testPlugin {
FLTGoogleMapsPlugin *plugin = [[FLTGoogleMapsPlugin alloc] init];
GoogleMapsPlugin *plugin = [[GoogleMapsPlugin alloc] init];
XCTAssertNotNil(plugin);
}

Expand Down Expand Up @@ -56,18 +51,6 @@ - (void)testFrameObserver {
XCTAssertEqual(mapView.frameObserverCount, 0);
}

- (void)testMapsServiceSync {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is removed because it was testing that this code and its supported declarations were all wired up correctly, and in Swift having a lazy type (class-level) variable is a built-in language feature and all of that code is just this line now, so there's nothing meaningful to test now.

id registrar = OCMProtocolMock(@protocol(FlutterPluginRegistrar));
FLTGoogleMapFactory *factory1 = [[FLTGoogleMapFactory alloc] initWithRegistrar:registrar];
XCTAssertNotNil(factory1.sharedMapServices);
FLTGoogleMapFactory *factory2 = [[FLTGoogleMapFactory alloc] initWithRegistrar:registrar];
// Test pointer equality, should be same retained singleton +[GMSServices sharedServices] object.
// Retaining the opaque object should be enough to avoid multiple internal initializations,
// but don't test the internals of the GoogleMaps API. Assume that it does what is documented.
// https://developers.google.com/maps/documentation/ios-sdk/reference/interface_g_m_s_services#a436e03c32b1c0be74e072310a7158831
XCTAssertEqual(factory1.sharedMapServices, factory2.sharedMapServices);
}

- (void)testHandleResultTileDownsamplesWideGamutImages {
FLTTileProviderController *controller = [[FLTTileProviderController alloc] init];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// found in the LICENSE file.

@import google_maps_flutter_ios;
@import google_maps_flutter_ios.Test;
@import XCTest;
@import GoogleMaps;

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright 2013 The Flutter Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import Flutter
import GoogleMaps

public class GoogleMapsPlugin: NSObject, FlutterPlugin {

public static func register(with registrar: FlutterPluginRegistrar) {
let factory = GoogleMapFactory(registrar: registrar)
registrar.register(
factory, withId: "plugins.flutter.dev/google_maps_ios",
gestureRecognizersBlockingPolicy:
FlutterPlatformViewGestureRecognizersBlockingPolicyWaitUntilTouchesEnded)
}

}

class GoogleMapFactory: NSObject, FlutterPlatformViewFactory {
weak var registrar: FlutterPluginRegistrar?
static var sharedMapServices = GMSServices()
init(registrar: FlutterPluginRegistrar) {
self.registrar = registrar
}

func create(withFrame frame: CGRect, viewIdentifier viewId: Int64, arguments args: Any?)
-> any FlutterPlatformView
{
// Precache shared map services, if needed. Initializing this prepares GMSServices
// on a background thread controlled by the GoogleMaps framework.
_ = GoogleMapFactory.sharedMapServices

return FLTGoogleMapController(
frame: frame, viewIdentifier: viewId,
creationParameters: args as! FGMPlatformMapViewCreationParams, registrar: registrar!)
}

func createArgsCodec() -> any FlutterMessageCodec & NSObjectProtocol {
return FGMGetMessagesCodec()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,4 @@ NS_ASSUME_NONNULL_BEGIN
- (nullable GMSCameraPosition *)cameraPosition;
@end

// Allows the engine to create new Google Map instances.
@interface FLTGoogleMapFactory : NSObject <FlutterPlatformViewFactory>
- (instancetype)initWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar;
@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
Expand Up @@ -14,58 +14,6 @@
#import "FLTGoogleMapTileOverlayController.h"
#import "messages.g.h"

#pragma mark - Conversion of JSON-like values sent via platform channels. Forward declarations.

@interface FLTGoogleMapFactory ()

@property(weak, nonatomic) NSObject<FlutterPluginRegistrar> *registrar;
@property(strong, nonatomic, readonly) id<NSObject> sharedMapServices;

@end

@implementation FLTGoogleMapFactory

@synthesize sharedMapServices = _sharedMapServices;

- (instancetype)initWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar {
self = [super init];
if (self) {
_registrar = registrar;
}
return self;
}

- (NSObject<FlutterMessageCodec> *)createArgsCodec {
return FGMGetMessagesCodec();
}

- (NSObject<FlutterPlatformView> *)createWithFrame:(CGRect)frame
viewIdentifier:(int64_t)viewId
arguments:(id _Nullable)args {
// Precache shared map services, if needed.
// Retain the shared map services singleton, don't use the result for anything.
(void)[self sharedMapServices];

return [[FLTGoogleMapController alloc] initWithFrame:frame
viewIdentifier:viewId
creationParameters:args
registrar:self.registrar];
}

- (id<NSObject>)sharedMapServices {
if (_sharedMapServices == nil) {
// Calling this prepares GMSServices on a background thread controlled
// by the GoogleMaps framework.
// Retain the singleton to cache the initialization work across all map views.
_sharedMapServices = [GMSServices sharedServices];
}
return _sharedMapServices;
}

@end

#pragma mark -

/// Private declarations of the FGMMapCallHandler.
@interface FGMMapCallHandler ()
- (instancetype)initWithMapController:(nonnull FLTGoogleMapController *)controller
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ Downloaded by pub (not CocoaPods).
s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' }
s.source = { :http => 'https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter/ios' }
s.documentation_url = 'https://pub.dev/packages/google_maps_flutter_ios'
s.source_files = 'Classes/**/*.{h,m}'
s.source_files = 'Classes/**/*.{h,m,swift}'
s.public_header_files = 'Classes/**/*.h'
s.module_map = 'Classes/google_maps_flutter_ios.modulemap'
s.dependency 'Flutter'
# Allow any version up to the next breaking change after the latest version that
# has been confirmed to be compatible via an example in examples/. See discussion
Expand All @@ -37,5 +36,6 @@ Downloaded by pub (not CocoaPods).
'LIBRARY_SEARCH_PATHS' => '$(inherited) $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)/ $(SDKROOT)/usr/lib/swift',
'LD_RUNPATH_SEARCH_PATHS' => '$(inherited) /usr/lib/swift',
}
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
s.resource_bundles = {'google_maps_flutter_ios_privacy' => ['Resources/PrivacyInfo.xcprivacy']}
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: google_maps_flutter_ios
description: iOS implementation of the google_maps_flutter plugin.
repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter_ios
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22
version: 2.15.8
version: 2.15.9

environment:
sdk: ^3.8.0
Expand All @@ -13,7 +13,7 @@ flutter:
implements: google_maps_flutter
platforms:
ios:
pluginClass: FLTGoogleMapsPlugin
pluginClass: GoogleMapsPlugin
dartPluginClass: GoogleMapsFlutterIOS

dependencies:
Expand Down