@@ -73,7 +73,7 @@ -(void)create:(CDVInvokedUrlCommand *)command
7373 [createResult setObject: markerId forKey: @" __pgmId" ];
7474
7575 [[NSOperationQueue mainQueue ] addOperationWithBlock: ^{
76- CDVCommandDelegateImpl *cmdDelegate = (CDVCommandDelegateImpl *) self. commandDelegate ;
76+ __weak __auto_type weakSelf = self;
7777 [self _create: markerId markerOptions: json callbackBlock: ^(BOOL successed, id result) {
7878 CDVPluginResult* pluginResult;
7979
@@ -93,7 +93,7 @@ -(void)create:(CDVInvokedUrlCommand *)command
9393
9494 pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK messageAsDictionary: createResult ];
9595 }
96- [cmdDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
96+ [weakSelf.commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
9797 }];
9898
9999 }];
@@ -255,7 +255,7 @@ -(void)showInfoWindow:(CDVInvokedUrlCommand *)command
255255 }
256256
257257 CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK];
258- [(CDVCommandDelegateImpl *) self .commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
258+ [self .commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
259259 }];
260260 }];
261261}
@@ -270,7 +270,7 @@ -(void)hideInfoWindow:(CDVInvokedUrlCommand *)command
270270 self.mapCtrl .map .selectedMarker = nil ;
271271 self.mapCtrl .activeMarker = nil ;
272272 CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK];
273- [(CDVCommandDelegateImpl *) self .commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
273+ [self .commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
274274 }];
275275 }];
276276}
@@ -295,7 +295,7 @@ -(void)getPosition:(CDVInvokedUrlCommand *)command
295295 [json setObject: longitude forKey: @" lng" ];
296296
297297 CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK messageAsDictionary: json];
298- [(CDVCommandDelegateImpl *) self .commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
298+ [self .commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
299299 }];
300300}
301301
@@ -319,7 +319,7 @@ -(void)setTitle:(CDVInvokedUrlCommand *)command
319319
320320
321321 CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK];
322- [(CDVCommandDelegateImpl *) self .commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
322+ [self .commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
323323 }];
324324 }];
325325}
@@ -338,7 +338,7 @@ -(void)setSnippet:(CDVInvokedUrlCommand *)command
338338 marker.snippet = [command.arguments objectAtIndex: 1 ];
339339
340340 CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK];
341- [(CDVCommandDelegateImpl *) self .commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
341+ [self .commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
342342 }];
343343 }];
344344}
@@ -358,7 +358,7 @@ -(void)remove:(CDVInvokedUrlCommand *)command
358358 marker = nil ;
359359
360360 CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK];
361- [(CDVCommandDelegateImpl *) self .commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
361+ [self .commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
362362 }];
363363 }];
364364}
@@ -424,7 +424,7 @@ -(void)setIconAnchor:(CDVInvokedUrlCommand *)command
424424 }
425425
426426 CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK];
427- [(CDVCommandDelegateImpl *) self .commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
427+ [self .commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
428428 }];
429429}
430430
@@ -450,7 +450,7 @@ -(void)setInfoWindowAnchor:(CDVInvokedUrlCommand *)command
450450 } else {
451451 pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR];
452452 }
453- [(CDVCommandDelegateImpl *) self .commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
453+ [self .commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
454454 }];
455455
456456 }];
@@ -470,7 +470,7 @@ -(void)setOpacity:(CDVInvokedUrlCommand *)command
470470 marker.opacity = [[command.arguments objectAtIndex: 1 ] floatValue ];
471471
472472 CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK];
473- [(CDVCommandDelegateImpl *) self .commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
473+ [self .commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
474474 }];
475475 }];
476476}
@@ -488,7 +488,7 @@ -(void)setZIndex:(CDVInvokedUrlCommand *)command
488488 marker.zIndex = [[command.arguments objectAtIndex: 1 ] intValue ];
489489
490490 CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK];
491- [(CDVCommandDelegateImpl *) self .commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
491+ [self .commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
492492 }];
493493 }];
494494}
@@ -507,7 +507,7 @@ -(void)setDraggable:(CDVInvokedUrlCommand *)command
507507 [marker setDraggable: isEnabled];
508508
509509 CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK];
510- [(CDVCommandDelegateImpl *) self .commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
510+ [self .commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
511511 }];
512512 }];
513513}
@@ -530,7 +530,7 @@ -(void)setDisableAutoPan:(CDVInvokedUrlCommand *)command
530530 NSLog (@" --->propertyId = %@ " , propertyId);
531531
532532 CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK];
533- [(CDVCommandDelegateImpl *) self .commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
533+ [self .commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
534534 }];
535535}
536536
@@ -560,7 +560,7 @@ -(void)setVisible:(CDVInvokedUrlCommand *)command
560560 [self .mapCtrl.objects setObject: properties forKey: propertyId];
561561
562562 CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK];
563- [(CDVCommandDelegateImpl *) self .commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
563+ [self .commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
564564 }];
565565 }];
566566}
@@ -582,7 +582,7 @@ -(void)setPosition:(CDVInvokedUrlCommand *)command
582582 [marker setPosition: position];
583583
584584 CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK];
585- [(CDVCommandDelegateImpl *) self .commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
585+ [self .commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
586586 }];
587587 }];
588588}
@@ -601,7 +601,7 @@ -(void)setFlat:(CDVInvokedUrlCommand *)command
601601 [marker setFlat: isFlat];
602602
603603 CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK];
604- [(CDVCommandDelegateImpl *) self .commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
604+ [self .commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
605605 }];
606606 }];
607607}
@@ -645,15 +645,15 @@ -(void)setIcon:(CDVInvokedUrlCommand *)command
645645 [iconProperty setObject: [rgbColor parsePluginColor ] forKey: @" iconColor" ];
646646 }
647647
648- CDVCommandDelegateImpl *cmdDelegate = (CDVCommandDelegateImpl *) self. commandDelegate ;
648+ __weak __auto_type weakSelf = self;
649649 [self setIcon_: marker iconProperty: iconProperty callbackBlock: ^(BOOL successed, id resultObj) {
650650 CDVPluginResult* pluginResult;
651651 if (successed == NO ) {
652652 pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: resultObj];
653653 } else {
654654 pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK];
655655 }
656- [cmdDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
656+ [weakSelf.commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
657657 }];
658658 }];
659659}
@@ -671,7 +671,7 @@ -(void)setRotation:(CDVInvokedUrlCommand *)command
671671 [marker setRotation: degrees];
672672
673673 CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK];
674- [(CDVCommandDelegateImpl *) self .commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
674+ [self .commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
675675 }];
676676 }];
677677}
@@ -686,11 +686,11 @@ -(void)setAnimation:(CDVInvokedUrlCommand *)command
686686 GMSMarker *marker = [self .mapCtrl.objects objectForKey: markerId];
687687
688688 NSString *animation = [command.arguments objectAtIndex: 1 ];
689- CDVCommandDelegateImpl *cmdDelegate = (CDVCommandDelegateImpl *) self. commandDelegate ;
689+ __weak __auto_type weakSelf = self;
690690
691691 [self setMarkerAnimation_: animation marker: marker callbackBlock: ^(void ) {
692692 CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK];
693- [cmdDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
693+ [weakSelf.commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
694694 }];
695695 }];
696696 }];
0 commit comments