mirror of
https://gitee.com/shuto/cordova-plugin-file-opener2.git
synced 2025-01-31 12:02:49 +08:00
Merge pull request #72 from VincentRoth/master
Positioning dialog for iOS
This commit is contained in:
commit
b969aa748a
@ -24,10 +24,12 @@ cordova.plugins.fileOpener2.open(
|
||||
fileMIMEType,
|
||||
{
|
||||
error : function(){ },
|
||||
success : function(){ }
|
||||
success : function(){ },
|
||||
position : [x, y]
|
||||
}
|
||||
);
|
||||
```
|
||||
`position` array of coordinates from top-left device screen, use for iOS dialog positioning.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
@ -39,6 +39,14 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
showPreview = [[command.arguments objectAtIndex:2] boolValue];
|
||||
}
|
||||
|
||||
CGRect rect;
|
||||
if ([command.arguments count] >= 4) {
|
||||
NSArray *positionValues = command.arguments[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);
|
||||
}
|
||||
|
||||
CDVViewController* cont = (CDVViewController*)[super viewController];
|
||||
self.cdvViewController = cont;
|
||||
NSString *uti = nil;
|
||||
@ -80,7 +88,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
wasOpened = [docController presentPreviewAnimated: NO];
|
||||
} else {
|
||||
CDVViewController* cont = self.cdvViewController;
|
||||
CGRect rect = CGRectMake(0, 0, cont.view.bounds.size.width, cont.view.bounds.size.height);
|
||||
wasOpened = [docController presentOpenInMenuFromRect:rect inView:cont.view animated:YES];
|
||||
}
|
||||
|
||||
|
@ -26,10 +26,10 @@ var exec = require('cordova/exec');
|
||||
|
||||
function FileOpener2() {}
|
||||
|
||||
FileOpener2.prototype.open = function (fileName, contentType, callbackContext) {
|
||||
FileOpener2.prototype.open = function (fileName, contentType, options) {
|
||||
contentType = contentType || '';
|
||||
callbackContext = callbackContext || {};
|
||||
exec(callbackContext.success || null, callbackContext.error || null, 'FileOpener2', 'open', [fileName, contentType]);
|
||||
options = options || {};
|
||||
exec(callbackContext.success || null, callbackContext.error || null, 'FileOpener2', 'open', [fileName, contentType, false, options.position]);
|
||||
};
|
||||
|
||||
FileOpener2.prototype.showOpenWithDialog = function (fileName, contentType, callbackContext) {
|
||||
|
Loading…
Reference in New Issue
Block a user