diff options
author | Joris Bodin <joris.bodin@infomaniak.com> | 2020-01-27 19:38:00 +0300 |
---|---|---|
committer | Joris Bodin <joris.bodin@infomaniak.com> | 2020-01-27 19:38:00 +0300 |
commit | 2fd8082222026a7a855a1270a70693172193fafb (patch) | |
tree | 323647a3ddfaa594bf1eb1e027e449580eabc274 | |
parent | 451e3165391be2dbe3168a1bd9ea323a9563848d (diff) |
Fix new drawer2.25.5
Signed-off-by: Philippe Weidmann <philippe.weidmann@infomaniak.com>
Signed-off-by: Joris Bodin <joris.bodin@infomaniak.com>
21 files changed, 130 insertions, 1278 deletions
diff --git a/iOSClient/AppDelegate.h b/iOSClient/AppDelegate.h index b3ec6ac51..e25231823 100644 --- a/iOSClient/AppDelegate.h +++ b/iOSClient/AppDelegate.h @@ -26,7 +26,6 @@ #import <PushKit/PushKit.h> #import "BKPasscodeLockScreenManager.h" -#import "REMenu.h" #import "Reachability.h" #import "CCBKPasscode.h" #import "CCUtility.h" diff --git a/iOSClient/Library/REMenu/RECommonFunctions.h b/iOSClient/Library/REMenu/RECommonFunctions.h deleted file mode 100644 index ff5564d65..000000000 --- a/iOSClient/Library/REMenu/RECommonFunctions.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// RECommonFunctions.h -// REMenu -// -// Copyright (c) 2013 Roman Efimov (https://github.com/romaonthego) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -#import <Foundation/Foundation.h> -#import <UIKit/UIKit.h> - -#ifndef REUIKitIsFlatModeFunction -#define REUIKitIsFlatModeFunction -BOOL REUIKitIsFlatMode(); -#endif
\ No newline at end of file diff --git a/iOSClient/Library/REMenu/RECommonFunctions.m b/iOSClient/Library/REMenu/RECommonFunctions.m deleted file mode 100755 index 6197253b1..000000000 --- a/iOSClient/Library/REMenu/RECommonFunctions.m +++ /dev/null @@ -1,44 +0,0 @@ -// -// RECommonFunctions.m -// REMenu -// -// Copyright (c) 2013 Roman Efimov (https://github.com/romaonthego) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -#import "RECommonFunctions.h" - -BOOL REUIKitIsFlatMode() -{ - static BOOL isUIKitFlatMode = NO; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - if (floor(NSFoundationVersionNumber) > 993.0) { - // If your app is running in legacy mode, tintColor will be nil - else it must be set to some color. - if (UIApplication.sharedApplication.keyWindow) { - isUIKitFlatMode = [UIApplication.sharedApplication.delegate.window respondsToSelector:@selector(tintColor)]; - } else { - // Possible that we're called early on (e.g. when used in a Storyboard). Adapt and use a temporary window. - isUIKitFlatMode = [[UIWindow new] respondsToSelector:@selector(tintColor)]; - } - } - }); - return isUIKitFlatMode; -} diff --git a/iOSClient/Library/REMenu/REMenu.h b/iOSClient/Library/REMenu/REMenu.h deleted file mode 100644 index a039b751f..000000000 --- a/iOSClient/Library/REMenu/REMenu.h +++ /dev/null @@ -1,121 +0,0 @@ -// -// REMenu.h -// REMenu -// -// Copyright (c) 2013 Roman Efimov (https://github.com/romaonthego) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -#import <UIKit/UIKit.h> -#import <QuartzCore/QuartzCore.h> -#import "RECommonFunctions.h" -#import "REMenuItem.h" -#import "REMenuContainerView.h" - -@class REMenuItem; - -typedef NS_ENUM(NSInteger, REMenuImageAlignment) { - REMenuImageAlignmentLeft, - REMenuImageAlignmentRight -}; - -typedef NS_ENUM(NSInteger, REMenuLiveBackgroundStyle) { - REMenuLiveBackgroundStyleLight, - REMenuLiveBackgroundStyleDark -}; - -@interface REMenu : NSObject - -// Menu View -// -@property (strong, readwrite, nonatomic) UIView *menuView; - -// Data -// -@property (strong, readwrite, nonatomic) NSArray *items; -@property (strong, readwrite, nonatomic) UIView *backgroundView; -@property (assign, readonly, nonatomic) BOOL isOpen; -@property (assign, readonly, nonatomic) BOOL isAnimating; -@property (assign, readwrite, nonatomic) BOOL waitUntilAnimationIsComplete; -@property (copy, readwrite, nonatomic) void (^closeCompletionHandler)(void); -@property (copy, readwrite, nonatomic) void (^closePreparationBlock)(void); -@property (assign, readwrite, nonatomic) BOOL closeOnSelection; - -// Style -// -@property (assign, readwrite, nonatomic) CGFloat cornerRadius; -@property (strong, readwrite, nonatomic) UIColor *shadowColor; -@property (assign, readwrite, nonatomic) CGSize shadowOffset; -@property (assign, readwrite, nonatomic) CGFloat shadowOpacity; -@property (assign, readwrite, nonatomic) CGFloat shadowRadius; -@property (assign, readwrite, nonatomic) CGFloat itemHeight; -@property (assign, readwrite, nonatomic) CGFloat backgroundAlpha; -@property (strong, readwrite, nonatomic) UIColor *backgroundColor; -@property (strong, readwrite, nonatomic) UIColor *separatorColor; -@property (assign, readwrite, nonatomic) CGFloat separatorHeight; -@property (assign, readwrite, nonatomic) CGSize separatorOffset; -@property (strong, readwrite, nonatomic) UIFont *font; -@property (strong, readwrite, nonatomic) UIColor *textColor; -@property (strong, readwrite, nonatomic) UIColor *textShadowColor; -@property (assign, readwrite, nonatomic) CGSize textOffset; -@property (assign, readwrite, nonatomic) CGSize textShadowOffset; -@property (assign, readwrite, nonatomic) REMenuImageAlignment imageAlignment; -@property (strong, readwrite, nonatomic) UIColor *imageTintColor; -@property (assign, readwrite, nonatomic) CGSize imageOffset; -@property (strong, readwrite, nonatomic) UIColor *highlightedBackgroundColor; -@property (strong, readwrite, nonatomic) UIColor *highlightedSeparatorColor; -@property (strong, readwrite, nonatomic) UIColor *highlightedTextColor; -@property (strong, readwrite, nonatomic) UIColor *highlightedTextShadowColor; -@property (strong, readwrite, nonatomic) UIColor *highlightedImageTintColor; -@property (assign, readwrite, nonatomic) CGSize highlightedTextShadowOffset; -@property (assign, readwrite, nonatomic) CGFloat borderWidth; -@property (strong, readwrite, nonatomic) UIColor *borderColor; -@property (assign, readwrite, nonatomic) NSTextAlignment textAlignment; -@property (strong, readwrite, nonatomic) UIFont *subtitleFont; -@property (strong, readwrite, nonatomic) UIColor *subtitleTextColor; -@property (strong, readwrite, nonatomic) UIColor *subtitleTextShadowColor; -@property (assign, readwrite, nonatomic) CGSize subtitleTextOffset; -@property (assign, readwrite, nonatomic) CGSize subtitleTextShadowOffset; -@property (strong, readwrite, nonatomic) UIColor *subtitleHighlightedTextColor; -@property (strong, readwrite, nonatomic) UIColor *subtitleHighlightedTextShadowColor; -@property (assign, readwrite, nonatomic) CGSize subtitleHighlightedTextShadowOffset; -@property (assign, readwrite, nonatomic) NSTextAlignment subtitleTextAlignment; -@property (assign, readwrite, nonatomic) NSTimeInterval animationDuration; -@property (assign, readwrite, nonatomic) NSTimeInterval closeAnimationDuration; -@property (assign, readwrite, nonatomic) NSTimeInterval bounceAnimationDuration; -@property (assign, readwrite, nonatomic) BOOL appearsBehindNavigationBar; -@property (assign, readwrite, nonatomic) BOOL bounce; -@property (assign, readwrite, nonatomic) BOOL liveBlur; // Available only in iOS 7 -@property (strong, readwrite, nonatomic) UIColor *liveBlurTintColor; // Available only in iOS 7 -@property (assign, readwrite, nonatomic) REMenuLiveBackgroundStyle liveBlurBackgroundStyle; // Available only in iOS 7 -@property (copy, readwrite, nonatomic) void (^badgeLabelConfigurationBlock)(UILabel *badgeLabel, REMenuItem *item); - -- (id)initWithItems:(NSArray *)items; -- (void)showFromRect:(CGRect)rect inView:(UIView *)view; -- (void)showInView:(UIView *)view; -- (void)showFromNavigationController:(UINavigationController *)navigationController; -- (void)showFromNavigationController:(UINavigationController *)navigationController offsetX:(CGFloat)offsetX width:(CGFloat)width; -- (void)setNeedsLayout; -- (void)closeWithCompletion:(void (^)(void))completion; -- (void)close; - -- (CGFloat)computeNavigationBarOffset; - -@end diff --git a/iOSClient/Library/REMenu/REMenu.m b/iOSClient/Library/REMenu/REMenu.m deleted file mode 100644 index f06abc0b8..000000000 --- a/iOSClient/Library/REMenu/REMenu.m +++ /dev/null @@ -1,430 +0,0 @@ -// -// REMenu.m -// REMenu -// -// Copyright (c) 2013 Roman Efimov (https://github.com/romaonthego) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -#import "REMenu.h" -#import "REMenuItem.h" -#import "REMenuItemView.h" - -@interface REMenuItem () - -@property (assign, readwrite, nonatomic) REMenuItemView *itemView; - -@end - -@interface REMenu () - -@property (strong, readwrite, nonatomic) UIView *menuWrapperView; -@property (strong, readwrite, nonatomic) REMenuContainerView *containerView; -@property (strong, readwrite, nonatomic) UIButton *backgroundButton; -@property (assign, readwrite, nonatomic) BOOL isOpen; -@property (assign, readwrite, nonatomic) BOOL isAnimating; -@property (strong, readwrite, nonatomic) NSMutableArray *itemViews; -@property (weak, readwrite, nonatomic) UINavigationBar *navigationBar; -@property (strong, readwrite, nonatomic) UIToolbar *toolbar; - -@end - -@implementation REMenu - -- (id)init -{ - self = [super init]; - if (self) { - _imageAlignment = REMenuImageAlignmentLeft; - _closeOnSelection = YES; - _itemHeight = 48.0; - _separatorHeight = 2.0; - _separatorOffset = CGSizeMake(0.0, 0.0); - _waitUntilAnimationIsComplete = YES; - - _textOffset = CGSizeMake(0, 0); - _subtitleTextOffset = CGSizeMake(0, 0); - _font = [UIFont boldSystemFontOfSize:21.0]; - _subtitleFont = [UIFont systemFontOfSize:14.0]; - - _backgroundAlpha = 1.0; - _backgroundColor = [UIColor colorWithRed:53/255.0 green:53/255.0 blue:52/255.0 alpha:1.0]; - _separatorColor = [UIColor colorWithPatternImage:self.separatorImage]; - _textColor = [UIColor colorWithRed:128/255.0 green:126/255.0 blue:124/255.0 alpha:1.0]; - _textShadowColor = [UIColor blackColor]; - _textShadowOffset = CGSizeMake(0, -1.0); - _textAlignment = NSTextAlignmentCenter; - - _highlightedBackgroundColor = [UIColor colorWithRed:28/255.0 green:28/255.0 blue:27/255.0 alpha:1.0]; - _highlightedSeparatorColor = [UIColor colorWithRed:28/255.0 green:28/255.0 blue:27/255.0 alpha:1.0]; - _highlightedTextColor = [UIColor colorWithRed:128/255.0 green:126/255.0 blue:124/255.0 alpha:1.0]; - _highlightedTextShadowColor = [UIColor blackColor]; - _highlightedTextShadowOffset = CGSizeMake(0, -1.0); - - _subtitleTextColor = [UIColor colorWithWhite:0.425 alpha:1.000]; - _subtitleTextShadowColor = [UIColor blackColor]; - _subtitleTextShadowOffset = CGSizeMake(0, -1.0); - _subtitleHighlightedTextColor = [UIColor colorWithRed:0.389 green:0.384 blue:0.379 alpha:1.000]; - _subtitleHighlightedTextShadowColor = [UIColor blackColor]; - _subtitleHighlightedTextShadowOffset = CGSizeMake(0, -1.0); - _subtitleTextAlignment = NSTextAlignmentCenter; - - _borderWidth = 1.0; - _borderColor = [UIColor colorWithRed:28/255.0 green:28/255.0 blue:27/255.0 alpha:1.0]; - _animationDuration = 0.3; - _closeAnimationDuration = 0.2; - _bounce = YES; - _bounceAnimationDuration = 0.2; - - _appearsBehindNavigationBar = REUIKitIsFlatMode() ? YES : NO; - } - return self; -} - -- (id)initWithItems:(NSArray *)items -{ - self = [self init]; - if (self) { - _items = items; - } - return self; -} - -- (void)showFromRect:(CGRect)rect inView:(UIView *)view -{ - if (self.isAnimating) { - return; - } - - self.isOpen = YES; - self.isAnimating = YES; - - // Create views - // - self.containerView = ({ - REMenuContainerView *view = [[REMenuContainerView alloc] init]; - view.clipsToBounds = YES; - view.autoresizingMask = UIViewAutoresizingFlexibleWidth; - - if (self.backgroundView) { - self.backgroundView.alpha = 0; - [view addSubview:self.backgroundView]; - } - view; - }); - - self.menuView = ({ - UIView *view = [[UIView alloc] init]; - if (!self.liveBlur || !REUIKitIsFlatMode()) { - view.backgroundColor = self.backgroundColor; - } - view.layer.cornerRadius = self.cornerRadius; - view.layer.borderColor = self.borderColor.CGColor; - view.layer.borderWidth = self.borderWidth; - view.layer.masksToBounds = YES; - view.layer.shouldRasterize = YES; - view.layer.rasterizationScale = [UIScreen mainScreen].scale; - view.autoresizingMask = UIViewAutoresizingFlexibleWidth; - view; - }); - - if (REUIKitIsFlatMode()) { - self.toolbar = ({ - UIToolbar *toolbar = [[UIToolbar alloc] init]; - toolbar.barStyle = (UIBarStyle)self.liveBlurBackgroundStyle; - if ([toolbar respondsToSelector:@selector(setBarTintColor:)]) - [toolbar performSelector:@selector(setBarTintColor:) withObject:self.liveBlurTintColor]; - toolbar.autoresizingMask = UIViewAutoresizingFlexibleWidth; - toolbar.layer.cornerRadius = self.cornerRadius; - toolbar.layer.borderColor = self.borderColor.CGColor; - toolbar.layer.borderWidth = self.borderWidth; - toolbar.layer.masksToBounds = YES; - toolbar; - }); - } - - self.menuWrapperView = ({ - UIView *view = [[UIView alloc] init]; - view.autoresizingMask = UIViewAutoresizingFlexibleWidth; - if (!self.liveBlur || !REUIKitIsFlatMode()) { - view.layer.shadowColor = self.shadowColor.CGColor; - view.layer.shadowOffset = self.shadowOffset; - view.layer.shadowOpacity = self.shadowOpacity; - view.layer.shadowRadius = self.shadowRadius; - view.layer.shouldRasterize = YES; - view.layer.rasterizationScale = [UIScreen mainScreen].scale; - } - view; - }); - - self.backgroundButton = ({ - UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; - button.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - button.accessibilityLabel = NSLocalizedString(@"Menu background", @"Menu background"); - button.accessibilityHint = NSLocalizedString(@"Double tap to close", @"Double tap to close"); - [button addTarget:self action:@selector(close) forControlEvents:UIControlEventTouchUpInside]; - button; - }); - - CGFloat navigationBarOffset = [self computeNavigationBarOffset]; - - // Append new item views to REMenuView - // - for (REMenuItem *item in self.items) { - NSInteger index = [self.items indexOfObject:item]; - - CGFloat itemHeight = self.itemHeight; - if (index == self.items.count - 1) - itemHeight += self.cornerRadius; - - UIView *separatorView = [[UIView alloc] initWithFrame:CGRectMake(self.separatorOffset.width, - index * self.itemHeight + index * self.separatorHeight + 40.0 + navigationBarOffset + self.separatorOffset.height, - rect.size.width - self.separatorOffset.width, - self.separatorHeight)]; - separatorView.backgroundColor = self.separatorColor; - separatorView.autoresizingMask = UIViewAutoresizingFlexibleWidth; - [self.menuView addSubview:separatorView]; - - REMenuItemView *itemView = [[REMenuItemView alloc] initWithFrame:CGRectMake(0, - index * self.itemHeight + (index + 1.0) * self.separatorHeight + 40.0 + navigationBarOffset, - rect.size.width, - itemHeight) - menu:self item:item - hasSubtitle:item.subtitle.length > 0]; - itemView.autoresizingMask = UIViewAutoresizingFlexibleWidth; - item.itemView = itemView; - itemView.separatorView = separatorView; - itemView.autoresizesSubviews = YES; - if (item.customView) { - item.customView.frame = itemView.bounds; - [itemView addSubview:item.customView]; - } - [self.menuView addSubview:itemView]; - } - - // Set up frames - // - self.menuWrapperView.frame = CGRectMake(0, -self.combinedHeight - navigationBarOffset, rect.size.width, self.combinedHeight + navigationBarOffset); - self.menuView.frame = self.menuWrapperView.bounds; - if (REUIKitIsFlatMode() && self.liveBlur) { - self.toolbar.frame = self.menuWrapperView.bounds; - } - self.containerView.frame = CGRectMake(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height); - self.backgroundButton.frame = self.containerView.bounds; - - // Add subviews - // - if (REUIKitIsFlatMode() && self.liveBlur) { - [self.menuWrapperView addSubview:self.toolbar]; - } - [self.menuWrapperView addSubview:self.menuView]; - [self.containerView addSubview:self.backgroundButton]; - [self.containerView addSubview:self.menuWrapperView]; - [view addSubview:self.containerView]; - - // Animate appearance - // - if (self.bounce) { - self.isAnimating = YES; - if ([UIView respondsToSelector:@selector(animateWithDuration:delay:usingSpringWithDamping:initialSpringVelocity:options:animations:completion:)]) { - [UIView animateWithDuration:self.animationDuration+self.bounceAnimationDuration - delay:0.0 - usingSpringWithDamping:0.6 - initialSpringVelocity:4.0 - options:UIViewAnimationOptionBeginFromCurrentState|UIViewAnimationOptionCurveEaseInOut - animations:^{ - self.backgroundView.alpha = self.backgroundAlpha; - CGRect frame = self.menuView.frame; - frame.origin.y = -40.0 - self.separatorHeight; - self.menuWrapperView.frame = frame; - } completion:^(BOOL finished) { - self.isAnimating = NO; - }]; - } else { - [UIView animateWithDuration:self.animationDuration - delay:0.0 - options:UIViewAnimationOptionBeginFromCurrentState|UIViewAnimationOptionCurveEaseInOut - animations:^{ - self.backgroundView.alpha = self.backgroundAlpha; - CGRect frame = self.menuView.frame; - frame.origin.y = -40.0 - self.separatorHeight; - self.menuWrapperView.frame = frame; - } completion:^(BOOL finished) { - self.isAnimating = NO; - }]; - - } - } else { - [UIView animateWithDuration:self.animationDuration - delay:0.0 - options:UIViewAnimationOptionBeginFromCurrentState|UIViewAnimationOptionCurveEaseInOut - animations:^{ - self.backgroundView.alpha = self.backgroundAlpha; - CGRect frame = self.menuView.frame; - frame.origin.y = -40.0 - self.separatorHeight; - self.menuWrapperView.frame = frame; - } completion:^(BOOL finished) { - self.isAnimating = NO; - }]; - } -} - -- (void)showInView:(UIView *)view -{ - [self showFromRect:view.bounds inView:view]; -} - --(void)showFromNavigationController:(UINavigationController *)navigationController -{ - [self showFromNavigationController:navigationController offsetX:0 width:navigationController.navigationBar.frame.size.width]; -} - -- (void)showFromNavigationController:(UINavigationController *)navigationController offsetX:(CGFloat)offsetX width:(CGFloat)width -{ - if (self.isAnimating) { - return; - } - - self.navigationBar = navigationController.navigationBar; - - [self showFromRect:CGRectMake(offsetX, 0, width, navigationController.view.frame.size.height) inView:navigationController.view]; - self.containerView.appearsBehindNavigationBar = self.appearsBehindNavigationBar; - self.containerView.navigationBar = navigationController.navigationBar; - if (self.appearsBehindNavigationBar) { - [navigationController.view bringSubviewToFront:navigationController.navigationBar]; - } - - if(width != navigationController.navigationBar.frame.size.width) - { - self.containerView.autoresizingMask = UIViewAutoresizingFlexibleRightMargin; - } -} - -- (void)closeWithCompletion:(void (^)(void))completion -{ - if (self.isAnimating) return; - - self.isAnimating = YES; - - CGFloat navigationBarOffset = [self computeNavigationBarOffset]; - - void (^closeMenu)(void) = ^{ - [UIView animateWithDuration:self.closeAnimationDuration - delay:0.0 - options:UIViewAnimationOptionBeginFromCurrentState|UIViewAnimationOptionCurveEaseInOut - animations:^ { - CGRect frame = self.menuView.frame; - frame.origin.y = - self.combinedHeight - navigationBarOffset; - self.menuWrapperView.frame = frame; - self.backgroundView.alpha = 0; - } completion:^(BOOL finished) { - self.isOpen = NO; - self.isAnimating = NO; - - [self.menuView removeFromSuperview]; - [self.menuWrapperView removeFromSuperview]; - [self.backgroundButton removeFromSuperview]; - [self.backgroundView removeFromSuperview]; - [self.containerView removeFromSuperview]; - - if (completion) { - completion(); - } - - if (self.closeCompletionHandler) { - self.closeCompletionHandler(); - } - }]; - - }; - - if (self.closePreparationBlock) { - self.closePreparationBlock(); - } - - if (self.bounce) { - [UIView animateWithDuration:self.bounceAnimationDuration animations:^{ - CGRect frame = self.menuView.frame; - frame.origin.y = -20.0; - self.menuWrapperView.frame = frame; - } completion:^(BOOL finished) { - closeMenu(); - }]; - } else { - closeMenu(); - } -} - -- (void)close -{ - [self closeWithCompletion:nil]; -} - -- (CGFloat)combinedHeight -{ - return self.items.count * self.itemHeight + self.items.count * self.separatorHeight + 40.0 + self.cornerRadius; -} - -- (void)setNeedsLayout -{ - [UIView animateWithDuration:0.35 animations:^{ - [self.containerView layoutSubviews]; - }]; -} - -#pragma mark - -#pragma mark Setting style - -- (UIImage *)separatorImage -{ - UIGraphicsBeginImageContext(CGSizeMake(1, 4.0)); - CGContextRef context = UIGraphicsGetCurrentContext(); - UIGraphicsPushContext(context); - CGContextSetFillColorWithColor(context, [UIColor colorWithRed:28/255.0 green:28/255.0 blue:27/255.0 alpha:1.0].CGColor); - CGContextFillRect(context, CGRectMake(0, 0, 1.0, 2.0)); - CGContextSetFillColorWithColor(context, [UIColor colorWithRed:79/255.0 green:79/255.0 blue:77/255.0 alpha:1.0].CGColor); - CGContextFillRect(context, CGRectMake(0, 3.0, 1.0, 2.0)); - UIGraphicsPopContext(); - UIImage *outputImage = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - - return [UIImage imageWithCGImage:outputImage.CGImage scale:2.0 orientation:UIImageOrientationUp]; -} - -- (CGFloat)computeNavigationBarOffset -{ - //TWS - //CGFloat navigationBarOffset = self.appearsBehindNavigationBar && self.navigationBar ? ([UIApplication sharedApplication].statusBarHidden ? 44 : 64) : 0; - - CGFloat offsetY = 0; - - if (@available(iOS 11, *)) { - UIEdgeInsets insets = [UIApplication sharedApplication].delegate.window.safeAreaInsets; - if (insets.bottom > 0) - offsetY = 20; - } - - CGFloat navigationBarOffset = self.appearsBehindNavigationBar && self.navigationBar ? ([UIApplication sharedApplication].statusBarHidden ? 44+offsetY : 64+offsetY) : 0; - - return navigationBarOffset; -} - - -@end diff --git a/iOSClient/Library/REMenu/REMenuContainerView.h b/iOSClient/Library/REMenu/REMenuContainerView.h deleted file mode 100644 index 47f3492bd..000000000 --- a/iOSClient/Library/REMenu/REMenuContainerView.h +++ /dev/null @@ -1,33 +0,0 @@ -// -// REMenuContainerView.h -// REMenu -// -// Copyright (c) 2013 Roman Efimov (https://github.com/romaonthego) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -#import <UIKit/UIKit.h> - -@interface REMenuContainerView : UIView - -@property (strong, readwrite, nonatomic) UINavigationBar *navigationBar; -@property (assign, readwrite, nonatomic) BOOL appearsBehindNavigationBar; - -@end diff --git a/iOSClient/Library/REMenu/REMenuContainerView.m b/iOSClient/Library/REMenu/REMenuContainerView.m deleted file mode 100644 index e01b31c18..000000000 --- a/iOSClient/Library/REMenu/REMenuContainerView.m +++ /dev/null @@ -1,66 +0,0 @@ -// -// REMenuContainerView.m -// REMenu -// -// Copyright (c) 2013 Roman Efimov (https://github.com/romaonthego) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -#import "REMenuContainerView.h" -#import <QuartzCore/QuartzCore.h> - -@implementation REMenuContainerView - -- (void)layoutSubviews -{ - [super layoutSubviews]; - UIDeviceOrientation orientation = [UIDevice currentDevice].orientation; - - CGFloat landscapeOffset = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone ? 32.0 : 44.0; - - if (self.navigationBar && !self.appearsBehindNavigationBar) { - CGRect frame = self.frame; - frame.origin.y = self.navigationBar.frame.origin.y + (UIDeviceOrientationIsPortrait(orientation) ? 44.0 : landscapeOffset); - self.frame = frame; - } - - if (self.appearsBehindNavigationBar) { - CGRect frame = self.frame; - long height = [[UIScreen mainScreen] bounds].size.height; - - if (([[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationPortrait) || [[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationPortraitUpsideDown) { - frame.origin.y = 0; - frame.size.height = height; - } else { - // landscape - if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { - frame.origin.y = -12; - frame.size.height = height + 12; - } else { - frame.origin.y = 0; - frame.size.height = height; - } - } - - self.frame = frame; - } -} - -@end diff --git a/iOSClient/Library/REMenu/REMenuItem.h b/iOSClient/Library/REMenu/REMenuItem.h deleted file mode 100644 index 9fc5d8f5f..000000000 --- a/iOSClient/Library/REMenu/REMenuItem.h +++ /dev/null @@ -1,69 +0,0 @@ -// -// REMenuItem.h -// REMenu -// -// Copyright (c) 2013 Roman Efimov (https://github.com/romaonthego) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -#import <Foundation/Foundation.h> -#import <UIKit/UIKit.h> - -@interface REMenuItem : NSObject - -@property (strong, readwrite, nonatomic) UIColor *backgroundColor; -@property (strong, readwrite, nonatomic) UIColor *separatorColor; -@property (strong, readwrite, nonatomic) UIFont *font; -@property (strong, readwrite, nonatomic) UIColor *textColor; -@property (strong, readwrite, nonatomic) UIColor *textShadowColor; -@property (assign, readwrite, nonatomic) CGSize textOffset; -@property (assign, readwrite, nonatomic) CGSize textShadowOffset; -@property (strong, readwrite, nonatomic) UIColor *highlightedBackgroundColor; -@property (strong, readwrite, nonatomic) UIColor *highlightedSeparatorColor; -@property (strong, readwrite, nonatomic) UIColor *highlightedTextColor; -@property (strong, readwrite, nonatomic) UIColor *highlightedTextShadowColor; -@property (assign, readwrite, nonatomic) CGSize highlightedTextShadowOffset; -@property (assign, readwrite, nonatomic) NSTextAlignment textAlignment; -@property (strong, readwrite, nonatomic) UIFont *subtitleFont; -@property (strong, readwrite, nonatomic) UIColor *subtitleTextColor; -@property (strong, readwrite, nonatomic) UIColor *subtitleTextShadowColor; -@property (assign, readwrite, nonatomic) CGSize subtitleTextOffset; -@property (assign, readwrite, nonatomic) CGSize subtitleTextShadowOffset; -@property (strong, readwrite, nonatomic) UIColor *subtitleHighlightedTextColor; -@property (strong, readwrite, nonatomic) UIColor *subtitleHighlightedTextShadowColor; -@property (assign, readwrite, nonatomic) CGSize subtitleHighlightedTextShadowOffset; -@property (assign, readwrite, nonatomic) NSTextAlignment subtitleTextAlignment; - -@property (copy, readwrite, nonatomic) NSString *title; -@property (copy, readwrite, nonatomic) NSString *subtitle; -@property (copy, readwrite, nonatomic) NSString *badge; -@property (strong, readwrite, nonatomic) UIImage *image; -@property (strong, readwrite, nonatomic) UIImage *highlightedImage; -@property (copy, readwrite, nonatomic) void (^action)(REMenuItem *item); -@property (assign, readwrite, nonatomic) NSInteger tag; -@property (strong, readwrite, nonatomic) UIView *customView; - -- (id)initWithTitle:(NSString *)title image:(UIImage *)image highlightedImage:(UIImage *)highlightedImage action:(void (^)(REMenuItem *item))action; -- (id)initWithTitle:(NSString *)title subtitle:(NSString *)subtitle image:(UIImage *)image highlightedImage:(UIImage *)highlightedImage action:(void (^)(REMenuItem *item))action; -- (id)initWithCustomView:(UIView *)customView action:(void (^)(REMenuItem *item))action; -- (id)initWithCustomView:(UIView *)customView; -- (void)setNeedsLayout; - -@end diff --git a/iOSClient/Library/REMenu/REMenuItem.m b/iOSClient/Library/REMenu/REMenuItem.m deleted file mode 100644 index 3aaafe503..000000000 --- a/iOSClient/Library/REMenu/REMenuItem.m +++ /dev/null @@ -1,120 +0,0 @@ -// -// REMenuItem.m -// REMenu -// -// Copyright (c) 2013 Roman Efimov (https://github.com/romaonthego) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -#import "REMenuItem.h" -#import "REMenuItemView.h" - -@interface REMenuItem () -@property (assign, nonatomic) REMenuItemView *itemView; -@end - - -@implementation REMenuItem - -- (id)initWithTitle:(NSString *)title image:(UIImage *)image highlightedImage:(UIImage *)highlightedImage action:(void (^)(REMenuItem *item))action -{ - self = [super init]; - if (self) { - _title = title; - _image = image; - _highlightedImage = highlightedImage; - _action = action; - _textAlignment = -1; - _subtitleTextAlignment = -1; - } - return self; -} - -- (id)initWithTitle:(NSString *)title subtitle:(NSString *)subtitle image:(UIImage *)image highlightedImage:(UIImage *)highlightedImage action:(void (^)(REMenuItem *item))action -{ - self = [super init]; - if (self) { - _title = title; - _subtitle = subtitle; - _image = image; - _highlightedImage = highlightedImage; - _action = action; - _textAlignment = -1; - _subtitleTextAlignment = -1; - } - return self; -} - -- (id)initWithCustomView:(UIView *)customView action:(void (^)(REMenuItem *item))action -{ - self = [super init]; - if (self) { - _customView = customView; - _action = action; - } - return self; -} - -- (id)initWithCustomView:(UIView *)customView -{ - self = [super init]; - if (self) { - _customView = customView; - } - return self; -} - -- (NSString *)description -{ - return [NSString stringWithFormat:@"<title: %@; subtitle: %@; tag: %li>", self.title, self.subtitle, (long)self.tag]; -} - -- (void)setTitle:(NSString *)title -{ - _title = title; - self.itemView.titleLabel.text = title; - self.itemView.accessibilityLabel = title; -} - -- (void)setSubtitle:(NSString *)subtitle -{ - _subtitle = subtitle; - self.itemView.subtitleLabel.text = subtitle; - self.itemView.accessibilityLabel = [NSString stringWithFormat:@"%@, %@", self.itemView.titleLabel.text, subtitle]; -} - -- (void)setImage:(UIImage *)image -{ - _image = image; - self.itemView.imageView.image = image; -} - -- (void)setHighlightedImage:(UIImage *)highlightedImage -{ - _highlightedImage = highlightedImage; - self.itemView.imageView.highlightedImage = highlightedImage; -} - -- (void)setNeedsLayout -{ - [self.itemView layoutSubviews]; -} - -@end diff --git a/iOSClient/Library/REMenu/REMenuItemView.h b/iOSClient/Library/REMenu/REMenuItemView.h deleted file mode 100644 index 87900523d..000000000 --- a/iOSClient/Library/REMenu/REMenuItemView.h +++ /dev/null @@ -1,42 +0,0 @@ -// -// REMenuItemView.h -// REMenu -// -// Copyright (c) 2013 Roman Efimov (https://github.com/romaonthego) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -#import <UIKit/UIKit.h> -#import "REMenuItem.h" -#import "REMenu.h" - -@interface REMenuItemView : UIView - -@property (weak, readwrite, nonatomic) REMenu *menu; -@property (weak, readwrite, nonatomic) UIView *separatorView; -@property (strong, readwrite, nonatomic) UILabel *titleLabel; -@property (strong, readwrite, nonatomic) UILabel *subtitleLabel; -@property (strong, readwrite, nonatomic) UIImageView *imageView; -@property (strong, readwrite, nonatomic) UILabel *badgeLabel; -@property (strong, readwrite, nonatomic) REMenuItem *item; - -- (id)initWithFrame:(CGRect)frame menu:(REMenu *)menu item:(REMenuItem*) item hasSubtitle:(BOOL)hasSubtitle; - -@end diff --git a/iOSClient/Library/REMenu/REMenuItemView.m b/iOSClient/Library/REMenu/REMenuItemView.m deleted file mode 100644 index 68ee4078c..000000000 --- a/iOSClient/Library/REMenu/REMenuItemView.m +++ /dev/null @@ -1,240 +0,0 @@ -// -// REMenuItemView.m -// REMenu -// -// Copyright (c) 2013 Roman Efimov (https://github.com/romaonthego) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -#import "REMenuItemView.h" -#import "REMenuItem.h" - -@interface REMenuItemView () - -@property (strong, readwrite, nonatomic) UIView *backgroundView; - -@end - -@implementation REMenuItemView - -- (id)initWithFrame:(CGRect)frame menu:(REMenu *)menu item:(REMenuItem*) item hasSubtitle:(BOOL)hasSubtitle -{ - self = [super initWithFrame:frame]; - if (self) { - self.menu = menu; - self.item = item; - self.isAccessibilityElement = YES; - self.accessibilityTraits = UIAccessibilityTraitButton; - self.accessibilityHint = NSLocalizedString(@"Double tap to choose", @"Double tap to choose"); - - _backgroundView = ({ - UIView *view = [[UIView alloc] initWithFrame:self.bounds]; - view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - if (menu.liveBlur && REUIKitIsFlatMode()) - view.alpha = 0.5f; - view; - }); - [self addSubview:_backgroundView]; - - - CGRect titleFrame; - if (hasSubtitle) { - // Dividing lines at 1/1.725 (vs 1/2.000) results in labels about 28-top 20-bottom or 60/40 title/subtitle (for a 48 frame height) - // - titleFrame = CGRectMake(self.item.textOffset.width == 0.0 && self.item.textOffset.height == 0.0 ? self.menu.textOffset.width : self.item.textOffset.width, self.item.textOffset.width == 0.0 && self.item.textOffset.height == 0.0 ? self.menu.textOffset.height : self.item.textOffset.height, 0, floorf(frame.size.height / 1.725)); - - CGRect subtitleFrame = CGRectMake(self.item.subtitleTextOffset.width == 0.0 && self.item.subtitleTextOffset.height == 0.0 ? self.menu.subtitleTextOffset.width : self.item.subtitleTextOffset.width, (self.item.subtitleTextOffset.width == 0.0 && self.item.subtitleTextOffset.height == 0.0 ? self.menu.subtitleTextOffset.height : self.item.subtitleTextOffset.height) + titleFrame.size.height, 0, floorf(frame.size.height * (1.0 - 1.0 / 1.725))); - self.subtitleLabel = ({ - UILabel *label =[[UILabel alloc] initWithFrame:subtitleFrame]; - label.contentMode = UIViewContentModeCenter; - label.textAlignment = (NSInteger)self.item.subtitleTextAlignment == -1 ? self.menu.subtitleTextAlignment : self.item.subtitleTextAlignment; - label.backgroundColor = [UIColor clearColor]; - label.autoresizingMask = UIViewAutoresizingFlexibleWidth; - label.isAccessibilityElement = NO; - label; - }); - [self addSubview:_subtitleLabel]; - } else { - titleFrame = CGRectMake(self.item.textOffset.width == 0.0 && self.item.textOffset.height == 0.0 ? self.menu.textOffset.width : self.item.textOffset.width, self.item.textOffset.width == 0.0 && self.item.textOffset.height == 0.0 ? self.menu.textOffset.height : self.item.textOffset.height, 0, frame.size.height); - } - - _titleLabel = ({ - UILabel *label = [[UILabel alloc] initWithFrame:titleFrame]; - label.isAccessibilityElement = NO; - label.contentMode = UIViewContentModeCenter; - label.textAlignment = (NSInteger)self.item.textAlignment == -1 ? self.menu.textAlignment : self.item.subtitleTextAlignment; - label.backgroundColor = [UIColor clearColor]; - label.autoresizingMask = UIViewAutoresizingFlexibleWidth; - label; - }); - - _imageView = [[UIImageView alloc] initWithFrame:CGRectNull]; - - _badgeLabel = ({ - UILabel *label = [[UILabel alloc] init]; - label.backgroundColor = [UIColor colorWithWhite:0.559 alpha:1.000]; - label.font = [UIFont systemFontOfSize:11]; - label.textAlignment = NSTextAlignmentCenter; - label.textColor = [UIColor whiteColor]; - label.hidden = YES; - label.layer.cornerRadius = 4.0; - label.layer.borderColor = [UIColor colorWithWhite:0.630 alpha:1.000].CGColor; - label.layer.borderWidth = 1.0; - label.layer.masksToBounds = YES; - label; - }); - - [self addSubview:_titleLabel]; - [self addSubview:_imageView]; - [self addSubview:_badgeLabel]; - } - return self; -} - -- (void)layoutSubviews -{ - [super layoutSubviews]; - - self.imageView.image = self.item.image; - - // Adjust frames - // - CGFloat verticalOffset = floor((self.frame.size.height - self.item.image.size.height) / 2.0); - CGFloat horizontalOffset = floor((self.menu.itemHeight - self.item.image.size.height) / 2.0); - CGFloat x = (self.menu.imageAlignment == REMenuImageAlignmentLeft) ? horizontalOffset + self.menu.imageOffset.width : - self.titleLabel.frame.size.width - (horizontalOffset + self.menu.imageOffset.width + self.item.image.size.width); - self.imageView.frame = CGRectMake(x, verticalOffset + self.menu.imageOffset.height, self.item.image.size.width, self.item.image.size.height); - if ([self.imageView respondsToSelector:@selector(setTintColor:)]) { - self.imageView.tintColor = self.menu.imageTintColor; - } - - // Set up badge - // - self.badgeLabel.hidden = !self.item.badge; - if (self.item.badge) { - self.badgeLabel.text = self.item.badge; - NSAttributedString *badgeAttributedString = [[NSAttributedString alloc] initWithString:self.item.badge - attributes:@{NSFontAttributeName:self.badgeLabel.font}]; - CGRect rect = [badgeAttributedString boundingRectWithSize:CGSizeMake(CGRectGetMaxX(self.frame), CGRectGetMaxY(self.frame)) - options:NSStringDrawingUsesLineFragmentOrigin - context:nil]; - CGFloat x = self.menu.imageAlignment == REMenuImageAlignmentLeft ? CGRectGetMaxX(self.imageView.frame) - 2.0 : - CGRectGetMinX(self.imageView.frame) - rect.size.height - 4.0; - self.badgeLabel.frame = CGRectMake(x, self.imageView.frame.origin.y - 2.0, rect.size.width + 6.0, rect.size.height + 2.0); - - if (self.menu.badgeLabelConfigurationBlock) - self.menu.badgeLabelConfigurationBlock(self.badgeLabel, self.item); - } - - // Accessibility - // - self.accessibilityLabel = self.item.title; - if (self.subtitleLabel.text) - self.accessibilityLabel = [NSString stringWithFormat:@"%@, %@", self.item.title, self.item.subtitle]; - - // Adjust styles - // - self.backgroundView.backgroundColor = self.item.backgroundColor == nil ? [UIColor clearColor] : self.item.backgroundColor; - self.titleLabel.font = self.item.font == nil ? self.menu.font : self.item.font; - self.titleLabel.text = self.item.title; - self.titleLabel.textColor = self.item.textColor == nil ? self.menu.textColor : self.item.textColor; - self.titleLabel.shadowColor = self.item.textShadowColor ? self.menu.textShadowColor : self.item.textShadowColor; - self.titleLabel.shadowOffset = self.item.textShadowOffset.width == 0 && self.item.textShadowOffset.height == 0 ? self.menu.textShadowOffset : self.item.textShadowOffset; - self.titleLabel.textAlignment = (NSInteger)self.item.textAlignment == -1 ? self.menu.textAlignment : self.item.textAlignment; - self.subtitleLabel.font = self.item.subtitleFont == nil ? self.menu.subtitleFont : self.item.subtitleFont; - self.subtitleLabel.text = self.item.subtitle; - self.subtitleLabel.textColor = self.item.subtitleTextColor == nil ? self.menu.subtitleTextColor : self.item.subtitleTextColor; - self.subtitleLabel.shadowColor = self.item.subtitleTextShadowColor == nil ? self.menu.subtitleTextShadowColor : self.item.subtitleTextShadowColor; - self.subtitleLabel.shadowOffset = self.item.subtitleTextShadowOffset.width == 0 && self.item.subtitleTextShadowOffset.height == 0 ? self.menu.subtitleTextShadowOffset : self.item.subtitleTextShadowOffset; - self.subtitleLabel.textAlignment = (NSInteger)self.item.subtitleTextAlignment == -1 ? self.menu.subtitleTextAlignment : self.item.subtitleTextAlignment; - - self.item.customView.frame = CGRectMake(0, 0, self.titleLabel.frame.size.width, self.frame.size.height); -} - -- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event -{ - self.backgroundView.backgroundColor = self.item.highlightedBackgroundColor == nil ? self.menu.highlightedBackgroundColor : self.item.highlightedBackgroundColor; - self.separatorView.backgroundColor = self.item.highlightedSeparatorColor == nil ? self.menu.highlightedSeparatorColor : self.item.highlightedSeparatorColor; - self.imageView.image = self.item.highlightedImage ? self.item.highlightedImage : self.item.image; - if ([self.imageView respondsToSelector:@selector(setTintColor:)]) { - self.imageView.tintColor = self.menu.highlightedImageTintColor; - } - self.titleLabel.textColor = self.item.highlightedTextColor == nil ? self.menu.highlightedTextColor : self.item.highlightedTextColor; - self.titleLabel.shadowColor = self.item.highlightedTextShadowColor == nil ? self.menu.highlightedTextShadowColor : self.item.highlightedTextShadowColor; - self.titleLabel.shadowOffset = self.item.highlightedTextShadowOffset.width == 0 && self.item.highlightedTextShadowOffset.height == 0 ? self.menu.highlightedTextShadowOffset : self.item.highlightedTextShadowOffset; - self.subtitleLabel.textColor = self.item.subtitleHighlightedTextColor == nil ? self.menu.subtitleHighlightedTextColor : self.item.subtitleHighlightedTextColor; - self.subtitleLabel.shadowColor = self.item.subtitleHighlightedTextShadowColor == nil ? self.menu.subtitleHighlightedTextShadowColor : self.item.subtitleHighlightedTextShadowColor; - self.subtitleLabel.shadowOffset = self.item.subtitleHighlightedTextShadowOffset.width == 0 && self.item.subtitleHighlightedTextShadowOffset.height == 0 ? self.menu.subtitleHighlightedTextShadowOffset : self.item.subtitleHighlightedTextShadowOffset; -} - -- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event -{ - self.backgroundView.backgroundColor = self.item.backgroundColor == nil ? [UIColor clearColor] : self.item.backgroundColor; - self.separatorView.backgroundColor = self.menu.separatorColor; - self.imageView.image = self.item.image; - if ([self.imageView respondsToSelector:@selector(setTintColor:)]) { - self.imageView.tintColor = self.menu.imageTintColor; - } - self.titleLabel.textColor = self.item.textColor == nil ? self.menu.textColor : self.item.textColor; - self.titleLabel.shadowColor = self.item.textShadowColor == nil ?self.menu.textShadowColor : self.item.textShadowColor; - self.titleLabel.shadowOffset = self.item.textShadowOffset.width == 0 && self.item.textShadowOffset.height == 0 ? self.menu.textShadowOffset : self.item.textShadowOffset; - self.subtitleLabel.textColor = self.item.subtitleTextColor == nil ? self.menu.subtitleTextColor : self.item.subtitleTextColor; - self.subtitleLabel.shadowColor = self.item.subtitleTextShadowColor == nil ? self.menu.subtitleTextShadowColor : self.item.subtitleTextShadowColor; - self.subtitleLabel.shadowOffset = self.item.subtitleTextShadowOffset.width == 0 && self.item.subtitleTextShadowOffset.height == 0 ? self.menu.subtitleTextShadowOffset : self.item.subtitleTextShadowOffset; -} - -- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event -{ - self.backgroundView.backgroundColor = self.item.backgroundColor == nil ? [UIColor clearColor] : self.item.backgroundColor; - self.separatorView.backgroundColor = self.item.separatorColor == nil ? self.menu.separatorColor : self.item.separatorColor; - self.imageView.image = self.item.image; - if ([self.imageView respondsToSelector:@selector(setTintColor:)]) { - self.imageView.tintColor = self.menu.imageTintColor; - } - self.titleLabel.textColor = self.item.textColor == nil ? self.menu.textColor : self.item.textColor; - self.titleLabel.shadowColor = self.item.textShadowColor == nil ? self.menu.textShadowColor : self.item.textShadowColor; - self.titleLabel.shadowOffset = self.item.textShadowOffset.width == 0 && self.item.textShadowOffset.height ? self.menu.textShadowOffset : self.item.textShadowOffset; - self.subtitleLabel.textColor = self.item.subtitleTextColor == nil ? self.menu.subtitleTextColor : self.item.subtitleTextColor; - self.subtitleLabel.shadowColor = self.menu.subtitleTextShadowColor == nil ? self.menu.subtitleTextShadowColor : self.item.subtitleTextShadowColor; - self.subtitleLabel.shadowOffset = self.item.subtitleTextShadowOffset.width == 0 && self.item.subtitleTextShadowOffset.height == 0 ? self.menu.subtitleTextShadowOffset : self.item.subtitleTextShadowOffset; - - CGPoint endedPoint = [touches.anyObject locationInView:self]; - if (endedPoint.y < 0 || endedPoint.y > CGRectGetHeight(self.bounds)) - return; - - if (!self.menu.closeOnSelection) { - if (self.item.action) - self.item.action(self.item); - } else { - if (self.item.action) { - if (self.menu.waitUntilAnimationIsComplete) { - __typeof (&*self) __weak weakSelf = self; - [self.menu closeWithCompletion:^{ - weakSelf.item.action(weakSelf.item); - }]; - } else { - [self.menu close]; - self.item.action(self.item); - } - } - } -} - -@end diff --git a/iOSClient/Main/CCMain.h b/iOSClient/Main/CCMain.h index 2d2ebe9a0..b94badcc6 100644 --- a/iOSClient/Main/CCMain.h +++ b/iOSClient/Main/CCMain.h @@ -59,7 +59,6 @@ @property (nonatomic, strong) NSString *richWorkspaceText; @property (nonatomic, weak) CCDetail *detailViewController; @property (nonatomic, strong) UISearchController *searchController; -@property (nonatomic, strong) UIView *reMenuBackgroundView; @property (nonatomic, strong) UITapGestureRecognizer *singleFingerTap; @property (nonatomic, strong) NSString *blinkFileNamePath; @property (nonatomic, readonly, strong) UIImage *cellFavouriteImage; diff --git a/iOSClient/Main/CCMain.m b/iOSClient/Main/CCMain.m index a683dfb2e..fc3bfa71f 100644 --- a/iOSClient/Main/CCMain.m +++ b/iOSClient/Main/CCMain.m @@ -181,10 +181,6 @@ [self registerForPreviewingWithDelegate:self sourceView:self.view]; } - // reMenu Background - _reMenuBackgroundView = [UIView new]; - _reMenuBackgroundView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5]; - // if this is not Main (the Main uses inizializeMain) if (_isRoot == NO && appDelegate.activeAccount.length > 0) { // Read (File) Folder @@ -654,7 +650,7 @@ buttonMore = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"navigationSort"] style:UIBarButtonItemStylePlain target:self action:@selector(toggleReMainMenu)]; buttonMore.enabled = true; - buttonSelect = [[UIBarButtonItem alloc] initWithImage:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"select"] width:50 height:50 color:NCBrandColor.sharedInstance.textView] style:UIBarButtonItemStylePlain target:self action:@selector(tableViewSelect)]; + buttonSelect = [[UIBarButtonItem alloc] initWithImage:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"select"] width:50 height:50 color:NCBrandColor.sharedInstance.textView] style:UIBarButtonItemStylePlain target:self action:@selector(tableViewToggle)]; buttonSelect.enabled = true; // < @@ -689,7 +685,7 @@ - (void)cancelSelect { - [self tableViewSelect]; + [self tableViewSelect:false]; } #pragma -------------------------------------------------------------------------------------------- @@ -917,7 +913,7 @@ [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:self.serverUrl ocId:nil action:k_action_NULL]; }); - [self tableViewSelect]; + [self tableViewSelect:false]; } #pragma -------------------------------------------------------------------------------------------- @@ -1006,7 +1002,7 @@ [_hud hideHud]; }); - [self tableViewSelect]; + [self tableViewSelect:false]; } #pragma -------------------------------------------------------------------------------------------- @@ -1445,7 +1441,7 @@ }]; // End Select Table View - [self tableViewSelect]; + [self tableViewSelect:false]; } #pragma -------------------------------------------------------------------------------------------- @@ -1607,8 +1603,8 @@ [self presentViewController:alert animated:YES completion:nil]; // End Select Table View - [self tableViewSelect]; - + [self tableViewSelect:false]; + // reload Datasource [self readFileReloadFolder]; @@ -1646,8 +1642,8 @@ } else { // End Select Table View - [self tableViewSelect]; - + [self tableViewSelect:false]; + // reload Datasource if (self.searchController.isActive) [self readFolder:metadata.serverUrl]; @@ -1660,8 +1656,8 @@ [[NCContentPresenter shared] messageNotification:@"_move_" description:message delay:k_dismissAfterSecond type:messageTypeError errorCode:errorCode]; // End Select Table View - [self tableViewSelect]; - + [self tableViewSelect:false]; + // reload Datasource if (self.searchController.isActive) [self readFolder:metadata.serverUrl]; @@ -2345,7 +2341,7 @@ } } - [self tableViewSelect]; + [self tableViewSelect:false]; } - (void)copyFileToPasteboard:(tableMetadata *)metadata @@ -2852,9 +2848,14 @@ #pragma mark - ==== Table ==== #pragma -------------------------------------------------------------------------------------------- -- (void)tableViewSelect +- (void)tableViewToggle +{ + [self tableViewSelect:!_isSelectedMode]; +} + +- (void)tableViewSelect:(BOOL)toggle { - _isSelectedMode = !_isSelectedMode; + _isSelectedMode = toggle; // chiudiamo eventuali swipe aperti if (_isSelectedMode) [self.tableView setEditing:NO animated:NO]; diff --git a/iOSClient/Main/Menu/AppDelegate+Menu.swift b/iOSClient/Main/Menu/AppDelegate+Menu.swift index 9ce7fe7c0..9adad2a1e 100644 --- a/iOSClient/Main/Menu/AppDelegate+Menu.swift +++ b/iOSClient/Main/Menu/AppDelegate+Menu.swift @@ -3,7 +3,24 @@ // Nextcloud // // Created by Philippe Weidmann on 24.01.20. -// Copyright © 2020 TWS. All rights reserved. +// Copyright © 2020 Philippe Weidmann. All rights reserved. +// Copyright © 2020 Marino Faggiana All rights reserved. +// +// Author Philippe Weidmann <philippe.weidmann@infomaniak.com> +// Author Marino Faggiana <marino.faggiana@nextcloud.com> +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. // import FloatingPanel @@ -213,7 +230,7 @@ extension AppDelegate { mainMenuViewController.actions = self.initMenu() let menuPanelController = NCMenuPanelController() - menuPanelController.panelWidth = Int(viewController.view.frame.width) + menuPanelController.parentPresenter = viewController menuPanelController.delegate = mainMenuViewController menuPanelController.set(contentViewController: mainMenuViewController) menuPanelController.track(scrollView: mainMenuViewController.tableView) diff --git a/iOSClient/Main/Menu/CCFavorites+Menu.swift b/iOSClient/Main/Menu/CCFavorites+Menu.swift index 0cc1884c8..42cc77ab6 100644 --- a/iOSClient/Main/Menu/CCFavorites+Menu.swift +++ b/iOSClient/Main/Menu/CCFavorites+Menu.swift @@ -80,7 +80,7 @@ extension CCFavorites { mainMenuViewController.actions = self.initMoreMenu(indexPath: indexPath, metadata: metadata) let menuPanelController = NCMenuPanelController() - menuPanelController.panelWidth = Int(viewController.view.frame.width) + menuPanelController.parentPresenter = viewController menuPanelController.delegate = mainMenuViewController menuPanelController.set(contentViewController: mainMenuViewController) menuPanelController.track(scrollView: mainMenuViewController.tableView) diff --git a/iOSClient/Main/Menu/CCMain+Menu.swift b/iOSClient/Main/Menu/CCMain+Menu.swift index b0ac23c6f..df4d0d174 100644 --- a/iOSClient/Main/Menu/CCMain+Menu.swift +++ b/iOSClient/Main/Menu/CCMain+Menu.swift @@ -3,7 +3,24 @@ // Nextcloud // // Created by Philippe Weidmann on 24.01.20. -// Copyright © 2020 TWS. All rights reserved. +// Copyright © 2020 Philippe Weidmann. All rights reserved. +// Copyright © 2020 Marino Faggiana All rights reserved. +// +// Author Philippe Weidmann <philippe.weidmann@infomaniak.com> +// Author Marino Faggiana <marino.faggiana@nextcloud.com> +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. // import FloatingPanel @@ -97,7 +114,7 @@ extension CCMain { mainMenuViewController.actions = self.initSortMenu() let menuPanelController = NCMenuPanelController() - menuPanelController.panelWidth = Int(viewController.view.frame.width) + menuPanelController.parentPresenter = viewController menuPanelController.delegate = mainMenuViewController menuPanelController.set(contentViewController: mainMenuViewController) menuPanelController.track(scrollView: mainMenuViewController.tableView) @@ -110,7 +127,7 @@ extension CCMain { mainMenuViewController.actions = self.initSelectMenu() let menuPanelController = NCMenuPanelController() - menuPanelController.panelWidth = Int(viewController.view.frame.width) + menuPanelController.parentPresenter = viewController menuPanelController.delegate = mainMenuViewController menuPanelController.set(contentViewController: mainMenuViewController) menuPanelController.track(scrollView: mainMenuViewController.tableView) @@ -510,7 +527,7 @@ extension CCMain { mainMenuViewController.actions = self.initMoreMenu(indexPath: indexPath, metadata: metadata, metadataFolder: metadataFolder) let menuPanelController = NCMenuPanelController() - menuPanelController.panelWidth = Int(viewController.view.frame.width) + menuPanelController.parentPresenter = viewController menuPanelController.delegate = mainMenuViewController menuPanelController.set(contentViewController: mainMenuViewController) menuPanelController.track(scrollView: mainMenuViewController.tableView) diff --git a/iOSClient/Main/Menu/MenuAction.swift b/iOSClient/Main/Menu/MenuAction.swift index 0ae7442af..c690d0819 100644 --- a/iOSClient/Main/Menu/MenuAction.swift +++ b/iOSClient/Main/Menu/MenuAction.swift @@ -3,7 +3,24 @@ // Nextcloud // // Created by Philippe Weidmann on 16.01.20. -// Copyright © 2020 TWS. All rights reserved. +// Copyright © 2020 Philippe Weidmann. All rights reserved. +// Copyright © 2020 Marino Faggiana All rights reserved. +// +// Author Philippe Weidmann <philippe.weidmann@infomaniak.com> +// Author Marino Faggiana <marino.faggiana@nextcloud.com> +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. // import Foundation diff --git a/iOSClient/Main/Menu/NCMainMenuTableViewController.swift b/iOSClient/Main/Menu/NCMainMenuTableViewController.swift index 574a644b1..976e22ac6 100644 --- a/iOSClient/Main/Menu/NCMainMenuTableViewController.swift +++ b/iOSClient/Main/Menu/NCMainMenuTableViewController.swift @@ -3,8 +3,26 @@ // Nextcloud // // Created by Philippe Weidmann on 16.01.20. -// Copyright © 2020 TWS. All rights reserved. +// Copyright © 2020 Philippe Weidmann. All rights reserved. +// Copyright © 2020 Marino Faggiana All rights reserved. // +// Author Philippe Weidmann <philippe.weidmann@infomaniak.com> +// Author Marino Faggiana <marino.faggiana@nextcloud.com> +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// + import UIKit import FloatingPanel diff --git a/iOSClient/Main/Menu/NCMenu.storyboard b/iOSClient/Main/Menu/NCMenu.storyboard index 439dfc4da..be2e66d10 100644 --- a/iOSClient/Main/Menu/NCMenu.storyboard +++ b/iOSClient/Main/Menu/NCMenu.storyboard @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <device id="retina6_1" orientation="portrait" appearance="light"/> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <scenes> @@ -11,7 +11,7 @@ <scene sceneID="ibU-BJ-tlj"> <objects> <tableViewController storyboardIdentifier="NCMainMenuTableViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="dbT-V0-aXb" customClass="NCMainMenuTableViewController" customModule="Nextcloud" customModuleProvider="target" sceneMemberID="viewController"> - <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" bounces="NO" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="60" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="pvY-CD-sI6"> + <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" bounces="NO" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="60" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="pvY-CD-sI6"> <rect key="frame" x="0.0" y="0.0" width="414" height="896"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> diff --git a/iOSClient/Main/Menu/NCMenuPanelController.swift b/iOSClient/Main/Menu/NCMenuPanelController.swift index dfb3d7149..737b04ff7 100644 --- a/iOSClient/Main/Menu/NCMenuPanelController.swift +++ b/iOSClient/Main/Menu/NCMenuPanelController.swift @@ -3,18 +3,35 @@ // Nextcloud // // Created by Philippe Weidmann on 23.01.20. -// Copyright © 2020 TWS. All rights reserved. +// Copyright © 2020 Philippe Weidmann. All rights reserved. +// Copyright © 2020 Marino Faggiana All rights reserved. +// +// Author Philippe Weidmann <philippe.weidmann@infomaniak.com> +// Author Marino Faggiana <marino.faggiana@nextcloud.com> +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. // import FloatingPanel class NCMenuPanelController: FloatingPanelController { - var panelWidth: Int? = 0 - + var parentPresenter: UIViewController? + override func viewDidLoad() { super.viewDidLoad() - + self.surfaceView.grabberHandle.isHidden = true self.isRemovalInteractionEnabled = true if #available(iOS 11, *) { @@ -23,13 +40,15 @@ class NCMenuPanelController: FloatingPanelController { self.surfaceView.cornerRadius = 0 } } - - override func viewWillLayoutSubviews() { - super.viewWillLayoutSubviews() - - if let width = panelWidth { - self.view.frame = CGRect(x: 0, y: 0, width: width, height: Int(self.view.frame.height)) + + override func viewDidLayoutSubviews() { + super.viewDidLayoutSubviews() + if let presenter = parentPresenter { + self.view.frame = presenter.view.frame } } - + + override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { + self.dismiss(animated: true, completion: nil) + } } diff --git a/kDrive.xcodeproj/project.pbxproj b/kDrive.xcodeproj/project.pbxproj index 8cfe41ef8..f80d87188 100755 --- a/kDrive.xcodeproj/project.pbxproj +++ b/kDrive.xcodeproj/project.pbxproj @@ -320,11 +320,6 @@ F762CB191EACB66200B38484 /* XLFormValidator.m in Sources */ = {isa = PBXBuildFile; fileRef = F762CAF11EACB66200B38484 /* XLFormValidator.m */; }; F762CB1A1EACB66200B38484 /* XLForm.m in Sources */ = {isa = PBXBuildFile; fileRef = F762CAF41EACB66200B38484 /* XLForm.m */; }; F762CB1B1EACB66200B38484 /* XLForm.bundle in Resources */ = {isa = PBXBuildFile; fileRef = F762CAF51EACB66200B38484 /* XLForm.bundle */; }; - F762CB861EACB81000B38484 /* RECommonFunctions.m in Sources */ = {isa = PBXBuildFile; fileRef = F762CB7D1EACB81000B38484 /* RECommonFunctions.m */; }; - F762CB871EACB81000B38484 /* REMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = F762CB7F1EACB81000B38484 /* REMenu.m */; }; - F762CB881EACB81000B38484 /* REMenuContainerView.m in Sources */ = {isa = PBXBuildFile; fileRef = F762CB811EACB81000B38484 /* REMenuContainerView.m */; }; - F762CB891EACB81000B38484 /* REMenuItem.m in Sources */ = {isa = PBXBuildFile; fileRef = F762CB831EACB81000B38484 /* REMenuItem.m */; }; - F762CB8A1EACB81000B38484 /* REMenuItemView.m in Sources */ = {isa = PBXBuildFile; fileRef = F762CB851EACB81000B38484 /* REMenuItemView.m */; }; F7632FBF21832F8700721B71 /* NCTrashSectionHeaderMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = F7632FBE21832F8700721B71 /* NCTrashSectionHeaderMenu.xib */; }; F7632FC1218353AA00721B71 /* NCTrashSectionFooter.xib in Resources */ = {isa = PBXBuildFile; fileRef = F7632FC0218353AA00721B71 /* NCTrashSectionFooter.xib */; }; F7651A8A23A2A3F2001403D2 /* NCCreateFormUploadDocuments.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7651A8823A2A3F2001403D2 /* NCCreateFormUploadDocuments.storyboard */; }; @@ -1054,16 +1049,6 @@ F762CAF31EACB66200B38484 /* XLForm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLForm.h; sourceTree = "<group>"; }; F762CAF41EACB66200B38484 /* XLForm.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLForm.m; sourceTree = "<group>"; }; F762CAF51EACB66200B38484 /* XLForm.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = XLForm.bundle; sourceTree = "<group>"; }; - F762CB7C1EACB81000B38484 /* RECommonFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RECommonFunctions.h; sourceTree = "<group>"; }; - F762CB7D1EACB81000B38484 /* RECommonFunctions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RECommonFunctions.m; sourceTree = "<group>"; }; - F762CB7E1EACB81000B38484 /* REMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = REMenu.h; sourceTree = "<group>"; }; - F762CB7F1EACB81000B38484 /* REMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = REMenu.m; sourceTree = "<group>"; }; - F762CB801EACB81000B38484 /* REMenuContainerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = REMenuContainerView.h; sourceTree = "<group>"; }; - F762CB811EACB81000B38484 /* REMenuContainerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = REMenuContainerView.m; sourceTree = "<group>"; }; - F762CB821EACB81000B38484 /* REMenuItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = REMenuItem.h; sourceTree = "<group>"; }; - F762CB831EACB81000B38484 /* REMenuItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = REMenuItem.m; sourceTree = "<group>"; }; - F762CB841EACB81000B38484 /* REMenuItemView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = REMenuItemView.h; sourceTree = "<group>"; }; - F762CB851EACB81000B38484 /* REMenuItemView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = REMenuItemView.m; sourceTree = "<group>"; }; F7632FBE21832F8700721B71 /* NCTrashSectionHeaderMenu.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NCTrashSectionHeaderMenu.xib; sourceTree = "<group>"; }; F7632FC0218353AA00721B71 /* NCTrashSectionFooter.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NCTrashSectionFooter.xib; sourceTree = "<group>"; }; F76344751BF259A800188725 /* synchronized.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = synchronized.gif; sourceTree = "<group>"; }; @@ -2160,23 +2145,6 @@ path = "VFR Pdf Reader"; sourceTree = "<group>"; }; - F762CB7B1EACB81000B38484 /* REMenu */ = { - isa = PBXGroup; - children = ( - F762CB7C1EACB81000B38484 /* RECommonFunctions.h */, - F762CB7D1EACB81000B38484 /* RECommonFunctions.m */, - F762CB7E1EACB81000B38484 /* REMenu.h */, - F762CB7F1EACB81000B38484 /* REMenu.m */, - F762CB801EACB81000B38484 /* REMenuContainerView.h */, - F762CB811EACB81000B38484 /* REMenuContainerView.m */, - F762CB821EACB81000B38484 /* REMenuItem.h */, - F762CB831EACB81000B38484 /* REMenuItem.m */, - F762CB841EACB81000B38484 /* REMenuItemView.h */, - F762CB851EACB81000B38484 /* REMenuItemView.m */, - ); - path = REMenu; - sourceTree = "<group>"; - }; F7632FC32183667400721B71 /* Section */ = { isa = PBXGroup; children = ( @@ -2733,7 +2701,6 @@ F7F54CAD1E5B14C700E19C62 /* MWPhotoBrowser */, F7B4F1C51F44356F00B53B42 /* NCUchardet */, F760F75621F21F61006B1A73 /* PhotoEditor */, - F762CB7B1EACB81000B38484 /* REMenu */, F762CB1C1EACB7D400B38484 /* VFR Pdf Reader */, F762CA9F1EACB66200B38484 /* XLForm */, ); @@ -3550,7 +3517,6 @@ F78ACD4221903CE00088454D /* NCListCell.swift in Sources */, F78ACD4F2190440D0088454D /* NCLayout.swift in Sources */, F760F79C21F21F61006B1A73 /* GradientView.swift in Sources */, - F762CB881EACB81000B38484 /* REMenuContainerView.m in Sources */, F7D4237F1F0596C6009C9782 /* ReaderDocumentOutline.m in Sources */, F73F537F1E929C8500F8678D /* CCMore.swift in Sources */, F73B4EF71F470D9100BBEE4B /* LangBulgarianModel.cpp in Sources */, @@ -3562,7 +3528,6 @@ F760F79421F21F61006B1A73 /* ResizeControl.swift in Sources */, F7DFB7F2219C5C0000680748 /* NCCreateFormUploadFileText.swift in Sources */, 371B5A2E23D0B04500FAFAE9 /* NCMainMenuTableViewController.swift in Sources */, - F762CB861EACB81000B38484 /* RECommonFunctions.m in Sources */, F76C6F8E21943C8C0063591B /* NCActionSheetHeader.swift in Sources */, F760F79121F21F61006B1A73 /* EmojiCollectionViewCell.swift in Sources */, F750374F1DBFA91A008FB480 /* NSArray+PureLayout.m in Sources */, @@ -3690,7 +3655,6 @@ F73B4EF51F470D9100BBEE4B /* JpCntx.cpp in Sources */, F78071091EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.m in Sources */, F76B3CCE1EAE01BD00921AC9 /* NCBrand.swift in Sources */, - F762CB8A1EACB81000B38484 /* REMenuItemView.m in Sources */, F7BF1B431D51E893000854F6 /* CCLogin.m in Sources */, F760F79821F21F61006B1A73 /* StickerCollectionViewCell.swift in Sources */, F70022FB1EC4C9100080073F /* NSString+Encode.m in Sources */, @@ -3747,7 +3711,6 @@ F762CB0F1EACB66200B38484 /* NSObject+XLFormAdditions.m in Sources */, F7B2DEF01F976854007CF4D2 /* NYMnemonic.m in Sources */, F707C26521A2DC5200F6181E /* NCStoreReview.swift in Sources */, - F762CB891EACB81000B38484 /* REMenuItem.m in Sources */, F7D423791F0596C6009C9782 /* CGPDFDocument.m in Sources */, F73B4EFF1F470D9100BBEE4B /* LangRussianModel.cpp in Sources */, F7BAADCB1ED5A87C00B7EAD4 /* NCManageDatabase.swift in Sources */, @@ -3778,7 +3741,6 @@ F7D4237B1F0596C6009C9782 /* ReaderContentPage.m in Sources */, F73B4F0A1F470D9100BBEE4B /* nsEUCTWProber.cpp in Sources */, F765608F23BF813600765969 /* NCContentPresenter.swift in Sources */, - F762CB871EACB81000B38484 /* REMenu.m in Sources */, F762CB091EACB66200B38484 /* XLFormViewController.m in Sources */, F760F79621F21F61006B1A73 /* PhotoEditorViewController.swift in Sources */, F762CB161EACB66200B38484 /* XLFormTextView.m in Sources */, |