(iOS) improve the DOM tree inspection
MODIFY
plugin.xml
plugin.xml
<?xml version='1.0' encoding='utf-8'?>
-<plugin id="cordova-plugin-googlemaps" version="2.1.2-beta-20171120-0000" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
+<plugin id="cordova-plugin-googlemaps" version="2.1.2-beta-20171120-1042" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<name>cordova-plugin-googlemaps</name>
<js-module name="BaseClass" src="www/BaseClass.js">
<runs />

MODIFY
src/ios/GoogleMaps/CordovaGoogleMaps.m
src/ios/GoogleMaps/CordovaGoogleMaps.m
- (void)resume:(CDVInvokedUrlCommand *)command {
if (self.pluginLayer != nil) {
self.pluginLayer.isSuspended = false;
+ dispatch_semaphore_signal(self.pluginLayer.semaphore);
}
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
self.pluginLayer.isSuspended = false;
+ dispatch_semaphore_signal(self.pluginLayer.semaphore);
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
[self.pluginLayer resizeTask:nil];
}];

MODIFY
src/ios/GoogleMaps/MyPluginLayer.h
src/ios/GoogleMaps/MyPluginLayer.h
@property (nonatomic) BOOL isSuspended;
@property (nonatomic) BOOL stopFlag;
@property (nonatomic) NSOperationQueue *executeQueue;
+@property (nonatomic) dispatch_semaphore_t semaphore;
- (id)initWithWebView:(UIView *)webView;
- (void)resizeTask:(NSTimer *)timer;
- (void)putHTMLElements:(NSDictionary *)elementsDic;
- (void)addMapView:(GoogleMapsViewController *)mapCtrl;
- (void)removeMapView:(GoogleMapsViewController *)mapCtrl;
+- (void)updateViewPosition:(GoogleMapsViewController *)mapCtrl;
@end

MODIFY
src/ios/GoogleMaps/MyPluginLayer.m
src/ios/GoogleMaps/MyPluginLayer.m
[self addSubview:self.pluginScrollView];
[self addSubview:self.webView];
+ dispatch_queue_t q_background = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0);
+ dispatch_async(q_background, ^{
+ self.semaphore = dispatch_semaphore_create(0);
self.redrawTimer = [NSTimer scheduledTimerWithTimeInterval:0.1
target:self
selector:@selector(resizeTask:)
userInfo:nil
repeats:YES];
+ });
+
return self;
}
- (void)resizeTask:(NSTimer *)timer {
if (self.isSuspended) {
- // Assumes all touches for the browser
- return;
+ @synchronized (self.semaphore) {
+ dispatch_semaphore_wait(self.semaphore, DISPATCH_TIME_FOREVER);
+ }
+ //return;
}
if (self.stopFlag) {
return;

MODIFY
src/ios/GoogleMaps/PluginMap.m
src/ios/GoogleMaps/PluginMap.m
CDVViewController *cdvViewController = (CDVViewController*)self.viewController;
CordovaGoogleMaps *googlemaps = [cdvViewController getCommandInstance:@"CordovaGoogleMaps"];
-
// Save the map rectangle.
if (![googlemaps.pluginLayer.pluginScrollView.debugView.HTMLNodes objectForKey:self.mapCtrl.mapDivId]) {
NSMutableDictionary *dummyInfo = [[NSMutableDictionary alloc] init];;
[googlemaps.pluginLayer.pluginScrollView.debugView.HTMLNodes setObject:dummyInfo forKey:self.mapCtrl.mapDivId];
}
+
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [googlemaps.pluginLayer updateViewPosition:self.mapCtrl];
+
//[googlemaps.pluginLayer updateViewPosition:self.mapCtrl];
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ });
+
}];
}

(iOS) improve the DOM tree inspection