Bug fix: Bug fix: MAP_READY event is not fired when the mapType = NONE and the camere option are specified
MODIFY
src/ios/GoogleMaps/CordovaGoogleMaps.m
src/ios/GoogleMaps/CordovaGoogleMaps.m
mapCtrl.isFullScreen = YES;
mapCtrl.mapId = mapId;
mapCtrl.mapDivId = nil;
+ mapCtrl.view.alpha = 0;
// Create an instance of the Map class everytime.
PluginMap *pluginMap = [[PluginMap alloc] init];
}
}
- if (pluginMap.mapCtrl.map.mapType != kGMSTypeNone) {
- [pluginMap.mapCtrl.view setHidden:YES];
- }
+ //[pluginMap.mapCtrl.view setHidden:YES];
}
camera = [GMSCameraPosition cameraWithLatitude:latitude
longitude:longitude
mapType = caseBlock();
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
- pluginMap.mapCtrl.map.mapType = mapType;
if (mapType != kGMSTypeNone) {
- [pluginMap.mapCtrl.view setHidden:YES];
+ pluginMap.mapCtrl.map.mapType = mapType;
+ } else {
+ NSError *error;
+ pluginMap.mapCtrl.map.mapStyle = [GMSMapStyle styleWithJSONString:@"[{\"stylers\":[{\"color\":\"#EFEDE6\"}]}]" error:&error];
+ //NSLog(@"-->error: %@", error);
}
}];
}
}
-
pluginMap.mapCtrl.map.delegate = mapCtrl;
pluginMap.mapCtrl.map.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

MODIFY
src/ios/GoogleMaps/GoogleMapsViewController.m
src/ios/GoogleMaps/GoogleMapsViewController.m
- (void)mapView:(GMSMapView *)mapView didCloseInfoWindowOfMarker:(nonnull GMSMarker *)marker {
-
// Get the marker plugin
- NSString *pluginId = [NSString stringWithFormat:@"%@-marker", self.mapId];
- CDVPlugin<MyPlgunProtocol> *plugin = [self.plugins objectForKey:pluginId];
-
- // Get the marker properties
- NSString *markerPropertyId = [NSString stringWithFormat:@"marker_property_%lu", (unsigned long)marker.hash];
- NSDictionary *properties = [plugin.objects objectForKey:markerPropertyId];
-
-
BOOL useHtmlInfoWnd = marker.title == nil &&
marker.snippet == nil;
* Map tiles are loaded
*/
- (void) mapViewDidFinishTileRendering:(GMSMapView *)mapView {
+ self.view.alpha = 1;
[self triggerMapEvent:@"map_loaded"];
}

MODIFY
src/ios/GoogleMaps/PluginMap.m
src/ios/GoogleMaps/PluginMap.m
// case: plugin.google.maps.getMap([options]) (no the mapDiv is given)
//-----------------------------------------------------------------------
[self setOptions:command];
- [self.mapCtrl.view setHidden:NO];
//[self.mapCtrl.view setHidden:true];
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
NSDictionary *initOptions = [command.arguments objectAtIndex:1];
+ [initOptions setValue:@"getMap" forKeyPath:@"method"];
if ([initOptions valueForKey:@"camera"]) {
double delayInSeconds = 1;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
GMSCoordinateBounds *bounds = [[GMSCoordinateBounds alloc] initWithRegion:self.mapCtrl.map.projection.visibleRegion];
[self.mapCtrl.map cameraForBounds:bounds insets:paddingUiEdgeInsets];
}
- [self.mapCtrl.view setHidden:NO];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}];
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
GMSCoordinateBounds *bounds = [[GMSCoordinateBounds alloc] initWithRegion:self.mapCtrl.map.projection.visibleRegion];
[self.mapCtrl.map cameraForBounds:bounds insets:paddingUiEdgeInsets];
- [self.mapCtrl.view setHidden:NO];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
-
- if (self.mapCtrl.map.mapType == kGMSTypeNone) {
- double delayInSeconds = 2;
- dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
- dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
- [self.mapCtrl mapViewDidFinishTileRendering:self.mapCtrl.map];
- });
- }
});
});
} else {
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
- [self.mapCtrl.view setHidden:NO];
- if (self.mapCtrl.map.mapType == kGMSTypeNone) {
- double delayInSeconds = 2;
- dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
- dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
- [self.mapCtrl mapViewDidFinishTileRendering:self.mapCtrl.map];
- });
- }
}
}
NSDictionary *cameraOpts = [initOptions objectForKey:@"camera"];
[self _changeCameraPosition:@"moveCamera" params:cameraOpts command:command];
} else {
- [self.mapCtrl.view setHidden:NO];
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)setOptions:(CDVInvokedUrlCommand *)command {
NSDictionary *initOptions = [command.arguments objectAtIndex:0];
+ [initOptions setValue:@"setOptions" forKeyPath:@"method"];
[self _setOptions:initOptions command:command];
}

Bug fix: Bug fix: MAP_READY event is not fired when the mapType = NONE and the camere option are specified