Skip to content

Commit

Permalink
Revert "to test old mode wrapped"
Browse files Browse the repository at this point in the history
This reverts commit e224b3e.
  • Loading branch information
nasli committed Jan 24, 2018
1 parent 7a4123f commit 5b22f5a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 88 deletions.
7 changes: 0 additions & 7 deletions Owncloud iOs Client/Tabs/FileTab/OpenWith/OpenWith.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@
@property(nonatomic,weak) __weak id<OpenWithDelegate> delegate;
@property(nonatomic, strong) UIView *parentView;
@property(nonatomic, strong) UIDocumentInteractionController *documentInteractionController;

/* Use UIActivityViewController and UIPopoverController instead of UIDocumentInteractionController
* for open with option until fix for UIDocumentInteractionController in iOS11
*/
@property(nonatomic, strong) UIActivityViewController *activityView;
@property (nonatomic, strong) UIPopoverController *activityPopoverController;

@property(nonatomic, strong) UIBarButtonItem *parentButton;
@property(nonatomic, strong) Download *download;
@property(nonatomic, strong) NSString *currentLocalFolder;
Expand Down
92 changes: 11 additions & 81 deletions Owncloud iOs Client/Tabs/FileTab/OpenWith/OpenWith.m
Original file line number Diff line number Diff line change
Expand Up @@ -90,96 +90,26 @@ - (void)openWithFile: (FileDto *) file{
if (file.localFolder) {

DLog(@"File path is %@", file.localFolder);
if (!IS_IOS11) {
//Pass path to url
NSURL *url = [NSURL fileURLWithPath:file.localFolder];
self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:url];
[self.documentInteractionController setDelegate:self];

if (_isTheParentViewACell) {

[self.documentInteractionController presentOptionsMenuFromRect:self.cellFrame inView:self.parentView animated:YES];

} else {

if (IS_IPHONE) {
[self.documentInteractionController presentOptionsMenuFromRect:CGRectZero inView:self.parentView animated:YES];

} else {
[self.documentInteractionController presentOptionsMenuFromBarButtonItem:self.parentButton animated:YES];
}
}
}else {

AppDelegate *app = (AppDelegate *)[[UIApplication sharedApplication]delegate];

DLog(@"File path is %@", file.localFolder);

//Pass path to url
NSURL *url = [NSURL fileURLWithPath:file.localFolder];

TTOpenInAppActivity *openInAppActivity;

if (_isTheParentViewACell) {
openInAppActivity = [[TTOpenInAppActivity alloc] initWithView:self.parentView andRect:_cellFrame];

}else{
openInAppActivity = [[TTOpenInAppActivity alloc] initWithView:self.parentView andBarButtonItem:self.parentButton];
}


if (self.activityView) {
[self.activityView dismissViewControllerAnimated:YES completion:nil];
self.activityView = nil;
}

//Pass path to url
NSURL *url = [NSURL fileURLWithPath:file.localFolder];
self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:url];
[self.documentInteractionController setDelegate:self];

if (_isTheParentViewACell) {

if (self.activityPopoverController) {
[self.activityPopoverController dismissPopoverAnimated:YES];
self.activityPopoverController = nil;
}
[self.documentInteractionController presentOptionsMenuFromRect:self.cellFrame inView:self.parentView animated:YES];

self.activityView = [[UIActivityViewController alloc] initWithActivityItems:@[url] applicationActivities:@[openInAppActivity]];
} else {

if (IS_IPHONE) {
[self.documentInteractionController presentOptionsMenuFromRect:CGRectZero inView:self.parentView animated:YES];

openInAppActivity.superViewController = self.activityView;

[app.ocTabBarController presentViewController:self.activityView animated:YES completion:nil];
} else {

if (self.activityPopoverController) {
[self.activityPopoverController setContentViewController:self.activityView];
} else {
self.activityPopoverController = [[UIPopoverController alloc] initWithContentViewController:self.activityView];
}

openInAppActivity.superViewController = self.activityPopoverController;

if (_isTheParentViewACell && IS_PORTRAIT) {

[self.activityPopoverController presentPopoverFromRect:CGRectMake(app.detailViewController.view.frame.size.width/2, app.detailViewController.view.frame.size.width/2, 100, 100) inView:app.detailViewController.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

}else{

if (_isTheParentViewACell) {
//Present view from cell from file list
[self.activityPopoverController presentPopoverFromRect:_cellFrame inView:_parentView permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES];

} else if (_parentButton) {
//Present view from bar button item
[self.activityPopoverController presentPopoverFromBarButtonItem:_parentButton permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

} else {
//Present view from rect
[self.activityPopoverController presentPopoverFromRect:CGRectMake(100, 100, 200, 400) inView:_parentView permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES];
}
}
[self.documentInteractionController presentOptionsMenuFromBarButtonItem:self.parentButton animated:YES];
}

}
}


}

#pragma mark - UIDocumentInteractionControllerDelegate methods
Expand Down

0 comments on commit 5b22f5a

Please sign in to comment.