Closed ucsbricks closed 4 years ago
This change needs to check if the positions are passed in on the ios side not the javascript side. I am using ionic native and because that hasnt been updated , this change crashes the app.
if ([command.arguments count] >= 4) {
NSArray *positionValues = [command.arguments objectAtIndex:3];
rect = CGRectMake(0, 0, [[positionValues objectAtIndex:0] floatValue], [[positionValues objectAtIndex:1] floatValue]);
} else {
rect = CGRectMake(0, 0, cont.view.bounds.size.width, cont.view.bounds.size.height);
}
This is the code i have had to change just to pass in 0, 0 because positionValues doesnt contain any values at all, so it becomes this
if ([command.arguments count] >= 4) {
NSArray *positionValues = [command.arguments objectAtIndex:3];
if (![positionValues isEqual:[NSNull null]] && [positionValues count] >= 2) {
rect = CGRectMake(0, 0, [[positionValues objectAtIndex:0] floatValue], [[positionValues objectAtIndex:1] floatValue]);
} else {
rect = CGRectMake(0, 0, 0, 0);
}
} else {
rect = CGRectMake(0, 0, cont.view.bounds.size.width, cont.view.bounds.size.height);
}
Created a pull request for this https://github.com/pwlin/cordova-plugin-file-opener2/pull/299
This pull request makes the fix for the "invisible" open with dialog on iPads originally implemented by @shnist compatible to the new code structure. The user can set the dialog position now. The issue is described in issue #67