Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ There is a special failure condition on Android, if the system doesn't have any
The plugin downloads the document and provides a preview of the document using the Quick Look framework,
including the corresponding actions such as copy, print, etc.

## Events (only iOS)

* documentHandlerOnDismiss - it fires after QuickLook window is closed

## Example usage

handleDocumentWithURL(
Expand All @@ -38,3 +42,11 @@ including the corresponding actions such as copy, print, etc.
},
'http://www.example.com/path/to/document.pdf'
);

document.addEventListener(
'documentHandlerOnDismiss',
function() {
console.log('document handler was closed');
},
false,
);
6 changes: 6 additions & 0 deletions src/ios/DocumentHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ - (void)previewControllerWillDismiss:(QLPreviewController *)controller {
}
}

- (void)previewControllerDidDismiss:(QLPreviewController *)controller {
NSLog(@"handler dismiss");
NSString *pluginReadyJSCallbackCommand = [NSString stringWithFormat:@"cordova.fireDocumentEvent('documentHandlerOnDismiss');"];
[self.commandDelegate evalJs:pluginReadyJSCallbackCommand];
}

- (id <QLPreviewItem>) previewController: (QLPreviewController *) controller previewItemAtIndex: (NSInteger) index
{
return self;
Expand Down