Browse Source

remove old code

marinofaggiana 4 years ago
parent
commit
72b2c8082d
22 changed files with 7 additions and 1293 deletions
  1. 0 19
      Libraries external/PKDownloadButton/CALayer+PKDownloadButtonAnimations.h
  2. 0 60
      Libraries external/PKDownloadButton/CALayer+PKDownloadButtonAnimations.m
  3. 0 18
      Libraries external/PKDownloadButton/NSLayoutConstraint+PKDownloadButton.h
  4. 0 99
      Libraries external/PKDownloadButton/NSLayoutConstraint+PKDownloadButton.m
  5. 0 20
      Libraries external/PKDownloadButton/PKBorderedButton.h
  6. 0 49
      Libraries external/PKDownloadButton/PKBorderedButton.m
  7. 0 20
      Libraries external/PKDownloadButton/PKCircleProgressView.h
  8. 0 180
      Libraries external/PKDownloadButton/PKCircleProgressView.m
  9. 0 18
      Libraries external/PKDownloadButton/PKCircleView.h
  10. 0 91
      Libraries external/PKDownloadButton/PKCircleView.m
  11. 0 52
      Libraries external/PKDownloadButton/PKDownloadButton.h
  12. 0 219
      Libraries external/PKDownloadButton/PKDownloadButton.m
  13. 0 42
      Libraries external/PKDownloadButton/PKMacros.h
  14. 0 25
      Libraries external/PKDownloadButton/PKPendingView.h
  15. 0 134
      Libraries external/PKDownloadButton/PKPendingView.m
  16. 0 18
      Libraries external/PKDownloadButton/PKStopDownloadButton.h
  17. 0 96
      Libraries external/PKDownloadButton/PKStopDownloadButton.m
  18. 0 16
      Libraries external/PKDownloadButton/UIImage+PKDownloadButton.h
  19. 0 49
      Libraries external/PKDownloadButton/UIImage+PKDownloadButton.m
  20. 0 64
      Nextcloud.xcodeproj/project.pbxproj
  21. 0 2
      iOSClient/Nextcloud-Bridging-Header.h
  22. 7 2
      iOSClient/Viewer/NCViewerImage/NCViewerImagePageContainer.swift

+ 0 - 19
Libraries external/PKDownloadButton/CALayer+PKDownloadButtonAnimations.h

@@ -1,19 +0,0 @@
-//
-//  CALayer+PKDownloadButtonAnimations.h
-//  Download
-//
-//  Created by Pavel on 31/05/15.
-//  Copyright (c) 2015 Katunin. All rights reserved.
-//
-
-#import <QuartzCore/QuartzCore.h>
-
-@interface CALayer (PKDownloadButtonAnimations)
-
-- (void)addRotationAnimationWithKey:(NSString *)animationKey
-               fullRotationDuration:(NSTimeInterval)fullRotationDuration;
-- (void)removeRotationAnimationWithKey:(NSString *)animationKey;
-- (void)removeRotationAnimationWithKey:(NSString *)animationKey
-                  fullRotationDuration:(NSTimeInterval)fullRotationDuration;
-
-@end

+ 0 - 60
Libraries external/PKDownloadButton/CALayer+PKDownloadButtonAnimations.m

@@ -1,60 +0,0 @@
-//
-//  CALayer+PKDownloadButtonAnimations.m
-//  Download
-//
-//  Created by Pavel on 31/05/15.
-//  Copyright (c) 2015 Katunin. All rights reserved.
-//
-
-#import "CALayer+PKDownloadButtonAnimations.h"
-
-static NSString *kRorationEndKey = @"PKLayerRorationEndKey";
-
-@implementation CALayer (PKDownloadButtonAnimations)
-
-- (void)addRotationAnimationWithKey:(NSString *)animationKey fullRotationDuration:(NSTimeInterval)fullRotationDuration {
-    NSNumber *fromValue = [self.presentationLayer valueForKeyPath:@"transform.rotation"];
-    [self removeAnimationForKey:kRorationEndKey];
-    
-    CABasicAnimation *rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
-    rotationAnimation.fromValue = fromValue;
-    rotationAnimation.toValue = @([rotationAnimation.fromValue floatValue] + (2. * M_PI));
-    rotationAnimation.duration = fullRotationDuration;
-    rotationAnimation.repeatCount = HUGE_VALF;
-    rotationAnimation.removedOnCompletion = NO;
-    
-    [self addAnimation:rotationAnimation forKey:animationKey];
-}
-
-- (void)removeRotationAnimationWithKey:(NSString *)animationKey {
-    [self removeRotationAnimationWithKey:animationKey fullRotationDuration:0.0];
-}
-
-- (void)removeRotationAnimationWithKey:(NSString *)animationKey fullRotationDuration:(NSTimeInterval)fullRotationDuration {
-    NSNumber *fromValue = [self.presentationLayer valueForKeyPath:@"transform.rotation"];
-    NSNumber *toValue = @((fromValue.doubleValue < 0.0) ? 0.0 : 2.0 * M_PI);
-    
-    [self removeAnimationForKey:animationKey];
-    
-    const NSTimeInterval animationDuration = ABS(toValue.doubleValue - fromValue.doubleValue) * (fullRotationDuration / (2.0 * M_PI));
-    
-    if (fromValue.doubleValue != 0.0 && ![fromValue isEqualToNumber:toValue] && animationDuration > 0.0) {
-        [CATransaction begin];
-        CABasicAnimation *rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
-        rotationAnimation.fromValue = fromValue;
-        rotationAnimation.toValue = toValue;
-        rotationAnimation.duration = animationDuration;
-        
-        [CATransaction setCompletionBlock:^{
-            [self removeAnimationForKey:kRorationEndKey];
-        }];
-        
-        [self addAnimation:rotationAnimation forKey:kRorationEndKey];
-        [CATransaction commit];
-    }
-    else {
-        [self removeAnimationForKey:kRorationEndKey];
-    }
-}
-
-@end

+ 0 - 18
Libraries external/PKDownloadButton/NSLayoutConstraint+PKDownloadButton.h

@@ -1,18 +0,0 @@
-#import <UIKit/UIKit.h>
-
-@interface NSLayoutConstraint (PKDownloadButton)
-
-+ (NSArray *)constraintsForWrappedSubview:(UIView *)view withInsets:(UIEdgeInsets)insets;
-+ (NSArray *)horizontalConstraintsForWrappedSubview:(UIView *)view withInsets:(UIEdgeInsets)insets;
-+ (NSArray *)verticalConstraintsForWrappedSubview:(UIView *)view withInsets:(UIEdgeInsets)insets;
-+ (NSLayoutConstraint *)constraintForView:(UIView *)view withWidth:(CGFloat)width;
-+ (NSLayoutConstraint *)constraintForView:(UIView *)view withHeight:(CGFloat)height;
-+ (NSArray *)constraintsForView:(UIView *)view withSize:(CGSize)size;
-+ (NSArray *)constraintsWithVisualFormat:(NSString *)format views:(NSDictionary *)views;
-+ (NSLayoutConstraint *)constraintForCenterByYView:(UIView *)overlay withView:(UIView *)view;
-+ (NSLayoutConstraint *)constraintForCenterByXView:(UIView *)overlay withView:(UIView *)view;
-// Constraints for center view above it's superview
-+ (NSArray *)constraintsForCenterView:(UIView *)overlay;
-+ (NSArray *)constraintsForCenterView:(UIView *)overlay withView:(UIView *)view;
-
-@end

+ 0 - 99
Libraries external/PKDownloadButton/NSLayoutConstraint+PKDownloadButton.m

@@ -1,99 +0,0 @@
-#import "NSLayoutConstraint+PKDownloadButton.h"
-
-@implementation NSLayoutConstraint (PKDownloadButton)
-
-+ (NSArray *)constraintsForWrappedSubview:(UIView *)view withInsets:(UIEdgeInsets)insets {
-    NSArray *horizontalConstraints = [self horizontalConstraintsForWrappedSubview:view withInsets:insets];
-    NSArray *verticalConstraints = [self verticalConstraintsForWrappedSubview:view withInsets:insets];
-    NSMutableArray *resultArray = [NSMutableArray arrayWithCapacity:[horizontalConstraints count] + [verticalConstraints count]];
-    [resultArray addObjectsFromArray:horizontalConstraints];
-    [resultArray addObjectsFromArray:verticalConstraints];
-    return resultArray;
-}
-
-+ (NSArray *)horizontalConstraintsForWrappedSubview:(UIView *)view withInsets:(UIEdgeInsets)insets {
-    NSString *horizontalConstraintsFormat = [NSString stringWithFormat:@"H:|-(%d)-[view]-(%d)-|",
-                                             (int)insets.left,
-                                             (int)roundf(insets.right)];
-    NSArray *horizontalConstraints = [NSLayoutConstraint constraintsWithVisualFormat:horizontalConstraintsFormat
-                                                                             options:0
-                                                                             metrics:nil
-                                                                               views:NSDictionaryOfVariableBindings(view)];
-    return horizontalConstraints;
-}
-
-+ (NSArray *)verticalConstraintsForWrappedSubview:(UIView *)view withInsets:(UIEdgeInsets)insets {
-    NSString *verticalConstraintsFormat = [NSString stringWithFormat:@"V:|-(%d)-[view]-(%d)-|", (int)insets.top, (int)insets.bottom];
-    NSArray *verticalConstraints = [NSLayoutConstraint constraintsWithVisualFormat:verticalConstraintsFormat
-                                                                           options:0
-                                                                           metrics:nil
-                                                                             views:NSDictionaryOfVariableBindings(view)];
-    return verticalConstraints;
-}
-
-+ (NSLayoutConstraint *)constraintForView:(UIView *)view withWidth:(CGFloat)width {
-    return [NSLayoutConstraint constraintWithItem:view
-                                        attribute:NSLayoutAttributeWidth
-                                        relatedBy:NSLayoutRelationEqual
-                                           toItem:nil
-                                        attribute:NSLayoutAttributeNotAnAttribute
-                                       multiplier:1.0
-                                         constant:width];
-}
-
-+ (NSLayoutConstraint *)constraintForView:(UIView *)view withHeight:(CGFloat)height {
-    return [NSLayoutConstraint constraintWithItem:view
-                                        attribute:NSLayoutAttributeHeight
-                                        relatedBy:NSLayoutRelationEqual
-                                           toItem:nil
-                                        attribute:NSLayoutAttributeNotAnAttribute
-                                       multiplier:1.0
-                                         constant:height];
-}
-
-+ (NSArray *)constraintsForView:(UIView *)view withSize:(CGSize)size {
-    NSLayoutConstraint *width = [NSLayoutConstraint constraintForView:view
-                                                            withWidth:size.width];
-    NSLayoutConstraint *height = [NSLayoutConstraint constraintForView:view
-                                                             withHeight:size.height];
-    return @[width, height];
-}
-
-+ (NSArray *)constraintsWithVisualFormat:(NSString *)format views:(NSDictionary *)views {
-    return [self constraintsWithVisualFormat:format options:0 metrics:nil views:views];
-}
-
-+ (NSLayoutConstraint *)constraintForCenterByXView:(UIView *)overlay withView:(UIView *)view {
-    return [NSLayoutConstraint constraintWithItem:overlay
-                                          attribute:NSLayoutAttributeCenterX
-                                          relatedBy:NSLayoutRelationEqual
-                                             toItem:view
-                                          attribute:NSLayoutAttributeCenterX
-                                         multiplier:1.0
-                                           constant:0.0];
-}
-
-+ (NSLayoutConstraint *)constraintForCenterByYView:(UIView *)overlay withView:(UIView *)view {
-    return [NSLayoutConstraint constraintWithItem:overlay
-                                          attribute:NSLayoutAttributeCenterY
-                                          relatedBy:NSLayoutRelationEqual
-                                             toItem:view
-                                          attribute:NSLayoutAttributeCenterY
-                                         multiplier:1.0
-                                           constant:0.0];
-}
-
-+ (NSArray *)constraintsForCenterView:(UIView *)overlay {
-    return [self constraintsForCenterView:overlay withView:overlay.superview];
-}
-
-+ (NSArray *)constraintsForCenterView:(UIView *)overlay withView:(UIView *)view {
-    NSMutableArray *constraints = [NSMutableArray array];
-    
-    [constraints addObject:[self constraintForCenterByXView:overlay withView:view]];
-    [constraints addObject:[self constraintForCenterByYView:overlay withView:view]];
-    
-    return constraints;
-}
-
-@end

+ 0 - 20
Libraries external/PKDownloadButton/PKBorderedButton.h

@@ -1,20 +0,0 @@
-//
-//  PKBorderedButton.h
-//  Pods
-//
-//  Created by Holden, Ryan on 2/7/16.
-//
-//
-
-#import <UIKit/UIKit.h>
-
-@interface PKBorderedButton : UIButton
-
-@property (nonatomic) CGFloat cornerRadius;
-@property (nonatomic) CGFloat lineWidth;
-
-- (void)configureDefaultAppearance;
-
-- (void)cleanDefaultAppearance;
-
-@end

+ 0 - 49
Libraries external/PKDownloadButton/PKBorderedButton.m

@@ -1,49 +0,0 @@
-//
-//  PKBorderedButton.m
-//  Pods
-//
-//  Created by Holden, Ryan on 2/7/16.
-//
-//
-
-#import "PKBorderedButton.h"
-#import "UIImage+PKDownloadButton.h"
-
-@implementation PKBorderedButton
-
-- (void)setCornerRadius:(CGFloat)cornerRadius {
-    _cornerRadius = cornerRadius;
-    [self updateBackgroundImage];
-}
-
-- (void)setLineWidth:(CGFloat)lineWidth {
-    _lineWidth = lineWidth;
-    [self updateBackgroundImage];
-}
-
-- (void)configureDefaultAppearance {
-    [self setCornerRadius:4];
-    [self setLineWidth:1];
-}
-
-- (void)updateBackgroundImage {
-    [self setBackgroundImage:[UIImage borderedImageWithFill:nil radius:self.cornerRadius lineColor:self.tintColor lineWidth:self.lineWidth]
-                    forState:UIControlStateNormal];
-
-    [self setBackgroundImage:[UIImage borderedImageWithFill:self.tintColor radius:self.cornerRadius lineColor:self.tintColor lineWidth:self.lineWidth]
-                    forState:UIControlStateHighlighted];
-}
-
-- (void)tintColorDidChange {
-    [super tintColorDidChange];
-    [self updateBackgroundImage];
-}
-
-- (void)cleanDefaultAppearance {
-    [self setBackgroundImage:nil forState:UIControlStateNormal];
-    [self setBackgroundImage:nil forState:UIControlStateHighlighted];
-    [self setAttributedTitle:nil forState:UIControlStateNormal];
-    [self setAttributedTitle:nil forState:UIControlStateHighlighted];
-}
-
-@end

+ 0 - 20
Libraries external/PKDownloadButton/PKCircleProgressView.h

@@ -1,20 +0,0 @@
-//
-//  PKCircleProgressView.h
-//  PKDownloadButton
-//
-//  Created by Pavel on 28/05/15.
-//  Copyright (c) 2015 Katunin. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-IB_DESIGNABLE
-@interface PKCircleProgressView : UIView
-
-@property (nonatomic, assign) IBInspectable CGFloat progress; /// 0.f - 1.0f
-@property (nonatomic, assign) IBInspectable CGFloat filledLineWidth; /// 0.f +
-@property (nonatomic, assign) IBInspectable CGFloat emptyLineWidth; /// 0.f +
-@property (nonatomic, assign) IBInspectable CGFloat radius; /// 0.f +
-@property (nonatomic, assign) IBInspectable BOOL filledLineStyleOuter;
-
-@end

+ 0 - 180
Libraries external/PKDownloadButton/PKCircleProgressView.m

@@ -1,180 +0,0 @@
-//
-//  PKCircleProgressView.m
-//  PKDownloadButton
-//
-//  Created by Pavel on 28/05/15.
-//  Copyright (c) 2015 Katunin. All rights reserved.
-//
-
-#import "PKCircleProgressView.h"
-#import "PKCircleView.h"
-#import "NSLayoutConstraint+PKDownloadButton.h"
-
-static const CGFloat kDefaultRaduis = 13.f;
-static const CGFloat kDefaultFilledLineWidth = 3.f;
-static const CGFloat kDefaultEmptyLineWidth = 1.f;
-static const CGFloat kStartAngle = M_PI * 1.5;
-
-@interface PKCircleProgressView ()
-
-@property (nonatomic, assign) CGFloat startAngle;
-@property (nonatomic, assign) CGFloat endAngle;
-
-@property (nonatomic, weak) PKCircleView *emptyLineCircleView;
-@property (nonatomic, weak) PKCircleView *filledLineCircleView;
-
-@property (nonatomic, weak) NSLayoutConstraint *emptyLineCircleWidth;
-@property (nonatomic, weak) NSLayoutConstraint *emptyLineCircleHeight;
-
-@property (nonatomic, weak) NSLayoutConstraint *filledLineCircleWidth;
-@property (nonatomic, weak) NSLayoutConstraint *filledLineCircleHeight;
-
-@property (nonatomic, assign) CGFloat emptyLineCircleSize;
-@property (nonatomic, assign) CGFloat filledLineCircleSize;
-
-- (PKCircleView *)createEmptyLineCircleView;
-- (PKCircleView *)createFilledLineCircleView;
-
-- (NSArray *)createCircleConstraints;
-
-@end
-
-static PKCircleProgressView *CommonInit(PKCircleProgressView *self) {
-    if (self != nil) {
-        self.backgroundColor = [UIColor clearColor];
-        self.startAngle = kStartAngle;
-        self.endAngle = self.startAngle + (M_PI * 2);
-        self.clipsToBounds = NO;
-        
-        PKCircleView *emptyLineCircleView = [self createEmptyLineCircleView];
-        self.emptyLineCircleView = emptyLineCircleView;
-        emptyLineCircleView.translatesAutoresizingMaskIntoConstraints = NO;
-        [self addSubview:emptyLineCircleView];
-        
-        PKCircleView *filledLineCircleView = [self createFilledLineCircleView];
-        self.filledLineCircleView = filledLineCircleView;
-        filledLineCircleView.translatesAutoresizingMaskIntoConstraints = NO;
-        [self addSubview:filledLineCircleView];
-        
-        [self addConstraints:[self createCircleConstraints]];
-        
-        self.emptyLineWidth = kDefaultEmptyLineWidth;
-        self.filledLineWidth = kDefaultFilledLineWidth;
-        self.radius = kDefaultRaduis;
-    }
-    return self;
-}
-
-@implementation PKCircleProgressView
-
-#pragma mark - initilaization / deallocation
-
-- (id)initWithCoder:(NSCoder *)decoder {
-    return CommonInit([super initWithCoder:decoder]);
-}
-
-- (instancetype)initWithFrame:(CGRect)frame {
-    return CommonInit([super initWithFrame:frame]);
-}
-
-#pragma mark - properties
-
-- (void)setEmptyLineCircleSize:(CGFloat)emptyLineCircleSize {
-    self.emptyLineCircleWidth.constant = emptyLineCircleSize;
-    self.emptyLineCircleHeight.constant = emptyLineCircleSize;
-}
-
-- (void)setFilledLineCircleSize:(CGFloat)filledLineCircleSize {
-    self.filledLineCircleWidth.constant = filledLineCircleSize;
-    self.filledLineCircleHeight.constant = filledLineCircleSize;
-}
-
-- (void)setProgress:(CGFloat)progress {
-    _progress = progress;
-    self.filledLineCircleView.startAngleRadians = self.startAngle;
-    self.filledLineCircleView.endAngleRadians = (self.endAngle - self.startAngle) * progress + self.startAngle;
-    
-    [self setNeedsDisplay];
-}
-
-- (void)setFilledLineWidth:(CGFloat)filledLineWidth {
-    _filledLineWidth = filledLineWidth;
-    self.filledLineCircleView.lineWidth = filledLineWidth;
-    [self setNeedsUpdateConstraints];
-}
-
-- (void)setEmptyLineWidth:(CGFloat)emptyLineWidth {
-    _emptyLineWidth = emptyLineWidth;
-    self.emptyLineCircleView.lineWidth = emptyLineWidth;
-    [self setNeedsUpdateConstraints];
-}
-
-- (void)setRadius:(CGFloat)radius {
-    _radius = radius;
-    [self setNeedsUpdateConstraints];
-}
-
-- (void)setFilledLineStyleOuter:(BOOL)filledLineStyleOuter {
-    _filledLineStyleOuter = filledLineStyleOuter;
-    [self setNeedsUpdateConstraints];
-}
-
-#pragma mark - UIView
-
-- (void)updateConstraints {
-    [super updateConstraints];
-    self.emptyLineCircleSize = self.radius * 2.f;
-    CGFloat deltaRaduis = 0.f;
-    if (self.filledLineStyleOuter) {
-        deltaRaduis = - self.emptyLineCircleView.lineWidth / 2.f + self.filledLineCircleView.lineWidth;
-    }
-    else {
-        deltaRaduis = - self.emptyLineCircleView.lineWidth / 2.f;
-    }
-    self.filledLineCircleSize = self.radius * 2.f + deltaRaduis * 2.f;
-}
-
-#pragma mark - private methods
-
-- (PKCircleView *)createEmptyLineCircleView {
-    PKCircleView *emptyCircelView = [[PKCircleView alloc] init];
-    
-    NSLayoutConstraint *widthConstraint = [NSLayoutConstraint constraintForView:emptyCircelView
-                                                                      withWidth:0.f];
-    self.emptyLineCircleWidth = widthConstraint;
-    [emptyCircelView addConstraint:widthConstraint];
-    
-    NSLayoutConstraint *heightConstraint = [NSLayoutConstraint constraintForView:emptyCircelView
-                                                                      withHeight:0.f];
-    self.emptyLineCircleHeight = heightConstraint;
-    [emptyCircelView addConstraint:heightConstraint];
-    
-    return emptyCircelView;
-}
-
-- (PKCircleView *)createFilledLineCircleView {
-    PKCircleView *filledCircelView = [[PKCircleView alloc] init];
-    
-    NSLayoutConstraint *widthConstraint = [NSLayoutConstraint constraintForView:filledCircelView
-                                                                      withWidth:0.f];
-    self.filledLineCircleWidth = widthConstraint;
-    [filledCircelView addConstraint:widthConstraint];
-    
-    NSLayoutConstraint *heightConstraint = [NSLayoutConstraint constraintForView:filledCircelView
-                                                                      withHeight:0.f];
-    self.filledLineCircleHeight = heightConstraint;
-    [filledCircelView addConstraint:heightConstraint];
-    
-    return filledCircelView;
-}
-
-- (NSArray *)createCircleConstraints {
-    NSMutableArray *constraints = [NSMutableArray array];
-    [constraints addObjectsFromArray:[NSLayoutConstraint constraintsForCenterView:self.emptyLineCircleView
-                                                                         withView:self]];
-    [constraints addObjectsFromArray:[NSLayoutConstraint constraintsForWrappedSubview:self.filledLineCircleView
-                                                                           withInsets:UIEdgeInsetsZero]];
-    return constraints;
-}
-
-@end

+ 0 - 18
Libraries external/PKDownloadButton/PKCircleView.h

@@ -1,18 +0,0 @@
-//
-//  PKCircleView.h
-//  Download
-//
-//  Created by Pavel on 30/05/15.
-//  Copyright (c) 2015 Katunin. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-IB_DESIGNABLE
-@interface PKCircleView : UIView
-
-@property (nonatomic, assign) IBInspectable CGFloat startAngleRadians;
-@property (nonatomic, assign) IBInspectable CGFloat endAngleRadians;
-@property (nonatomic, assign) IBInspectable CGFloat lineWidth;
-
-@end

+ 0 - 91
Libraries external/PKDownloadButton/PKCircleView.m

@@ -1,91 +0,0 @@
-//
-//  PKCircleView.m
-//  Download
-//
-//  Created by Pavel on 30/05/15.
-//  Copyright (c) 2015 Katunin. All rights reserved.
-//
-
-#import "PKCircleView.h"
-
-static const CGFloat kDefaultLineWidth = 1.f;
-
-@interface PKCircleView ()
-
-- (void)drawCircleRadius:(CGFloat)radius
-                    rect:(CGRect)rect
-              startAngle:(CGFloat)startAngle
-                endAngle:(CGFloat)endAngel
-               lineWidth:(CGFloat)lineWidth;
-
-@end
-
-static PKCircleView *CommonInit(PKCircleView *self) {
-    if (self != nil) {
-        self.backgroundColor = [UIColor clearColor];
-        self.startAngleRadians = M_PI * 1.5;
-        self.endAngleRadians = self.startAngleRadians + (M_PI * 2);
-        self.lineWidth = kDefaultLineWidth;
-    }
-    return self;
-}
-
-@implementation PKCircleView
-
-#pragma mark - initialization
-
-- (id)initWithCoder:(NSCoder *)decoder {
-    return CommonInit([super initWithCoder:decoder]);
-}
-
-- (instancetype)initWithFrame:(CGRect)frame {
-    return CommonInit([super initWithFrame:frame]);
-}
-
-#pragma mark - properties
-
-- (void)setLineWidth:(CGFloat)lineWidth {
-    _lineWidth = lineWidth;
-    [self setNeedsDisplay];
-}
-
-- (void)setStartAngleRadians:(CGFloat)startAngleRadians {
-    _startAngleRadians = startAngleRadians;
-    [self setNeedsDisplay];
-}
-
-- (void)setEndAngleRadians:(CGFloat)endAngleRadians {
-    _endAngleRadians = endAngleRadians;
-    [self setNeedsDisplay];
-}
-
-#pragma mark - UIView
-
-- (void)drawRect:(CGRect)rect {
-    [self drawCircleRadius:MIN(rect.size.width / 2, rect.size.height / 2) - self.lineWidth / 2.f
-                      rect:rect
-                startAngle:self.startAngleRadians
-                  endAngle:self.endAngleRadians
-                 lineWidth:self.lineWidth];
-}
-
-#pragma mark - private methods
-
-- (void)drawCircleRadius:(CGFloat)radius
-                    rect:(CGRect)rect
-              startAngle:(CGFloat)startAngle
-                endAngle:(CGFloat)endAngel
-               lineWidth:(CGFloat)lineWidth {
-    UIBezierPath* bezierPath = [UIBezierPath bezierPath];
-    [self.tintColor setStroke];
-    [bezierPath addArcWithCenter:CGPointMake(rect.size.width / 2, rect.size.height / 2)
-                          radius:radius
-                      startAngle:startAngle
-                        endAngle:endAngel
-                       clockwise:YES];
-    
-    bezierPath.lineWidth = lineWidth;
-    [bezierPath stroke];
-}
-
-@end

+ 0 - 52
Libraries external/PKDownloadButton/PKDownloadButton.h

@@ -1,52 +0,0 @@
-//
-//  PKDownloadButton.h
-//  PKDownloadButton
-//
-//  Created by Pavel on 28/05/15.
-//  Copyright (c) 2015 Katunin. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-#import "PKStopDownloadButton.h"
-#import "PKBorderedButton.h"
-#import "PKCircleProgressView.h"
-#import "PKPendingView.h"
-
-typedef NS_ENUM(NSUInteger, PKDownloadButtonState) {
-    kPKDownloadButtonState_StartDownload,
-    kPKDownloadButtonState_Pending,
-    kPKDownloadButtonState_Downloading,
-    kPKDownloadButtonState_Downloaded
-};
-
-@class PKDownloadButton;
-
-typedef void(^DownloadButtonTappedCallback)(PKDownloadButton *downloadButton, PKDownloadButtonState state);
-
-@protocol PKDownloadButtonDelegate <NSObject>
-
-- (void)downloadButtonTapped:(PKDownloadButton *)downloadButton
-                currentState:(PKDownloadButtonState)state;
-
-@end
-
-IB_DESIGNABLE
-@interface PKDownloadButton : UIView
-
-@property (nonatomic, weak) IBOutlet id <PKDownloadButtonDelegate> delegate;
-@property (nonatomic, copy) DownloadButtonTappedCallback callback;
-
-@property (nonatomic, weak, readonly) PKBorderedButton *startDownloadButton;
-@property (nonatomic, weak, readonly) PKStopDownloadButton *stopDownloadButton;
-@property (nonatomic, weak, readonly) PKBorderedButton *downloadedButton;
-@property (nonatomic, weak, readonly) PKPendingView *pendingView;
-
-@property (nonatomic, assign) PKDownloadButtonState state;
-
--(void)updateStartDownloadButtonText:(NSString *)title;
--(void)updateDownloadedButtonText:(NSString *)title;
--(void)updateStartDownloadButtonText:(NSString *)title font:(UIFont *)font;
--(void)updateDownloadedButtonText:(NSString *)title font:(UIFont *)font;
-
-@end

+ 0 - 219
Libraries external/PKDownloadButton/PKDownloadButton.m

@@ -1,219 +0,0 @@
-//
-//  PKDownloadButton.m
-//  PKDownloadButton
-//
-//  Created by Pavel on 28/05/15.
-//  Copyright (c) 2015 Katunin. All rights reserved.
-//
-
-#import "PKDownloadButton.h"
-#import "PKMacros.h"
-#import "NSLayoutConstraint+PKDownloadButton.h"
-#import "UIImage+PKDownloadButton.h"
-#import "PKPendingView.h"
-
-@interface PKDownloadButton ()
-
-@property (nonatomic, weak) PKBorderedButton *startDownloadButton;
-@property (nonatomic, weak) PKStopDownloadButton *stopDownloadButton;
-@property (nonatomic, weak) PKBorderedButton *downloadedButton;
-@property (nonatomic, weak) PKPendingView *pendingView;
-
-@property (nonatomic, strong) NSMutableArray *stateViews;
-
-- (PKBorderedButton *)createStartDownloadButton;
-- (PKStopDownloadButton *)createStopDownloadButton;
-- (PKBorderedButton *)createDownloadedButton;
-- (PKPendingView *)createPendingView;
-
-- (void)currentButtonTapped:(id)sender;
-
-- (void)createSubviews;
-- (NSArray *)createConstraints;
-
-@end
-
-static PKDownloadButton *CommonInit(PKDownloadButton *self) {
-    if (self != nil) {
-        [self createSubviews];
-        [self addConstraints:[self createConstraints]];
-        
-        self.state = kPKDownloadButtonState_StartDownload;
-        self.backgroundColor = [UIColor clearColor];
-    }
-    return self;
-}
-
-@implementation PKDownloadButton
-
-#pragma mark - Properties
-
-- (void)setState:(PKDownloadButtonState)state {
-    _state = state;
-    
-    [self.stateViews enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
-        SafeObjClassCast(UIView, view, obj);
-        view.hidden = YES;
-    }];
-    
-    switch (state) {
-        case kPKDownloadButtonState_StartDownload:
-            self.startDownloadButton.hidden = NO;
-            break;
-        case kPKDownloadButtonState_Pending:
-            self.pendingView.hidden = NO;
-            [self.pendingView startSpin];
-            break;
-        case kPKDownloadButtonState_Downloading:
-            self.stopDownloadButton.hidden = NO;
-            self.stopDownloadButton.progress = 0.f;
-            break;
-        case kPKDownloadButtonState_Downloaded:
-            self.downloadedButton.hidden = NO;
-            break;
-        default:
-            NSAssert(NO, @"unsupported state");
-            break;
-    }
-}
-
-#pragma mark - Initialization
-
-- (id)initWithCoder:(NSCoder *)decoder {
-    return CommonInit([super initWithCoder:decoder]);
-}
-
-- (instancetype)initWithFrame:(CGRect)frame {
-    return CommonInit([super initWithFrame:frame]);
-}
-
-- (void)tintColorDidChange {
-	[super tintColorDidChange];
-	
-    [self updateButton:self.startDownloadButton title:[self.startDownloadButton titleForState:UIControlStateNormal] font:self.startDownloadButton.titleLabel.font];
-	[self updateButton:self.downloadedButton title:[self.downloadedButton titleForState:UIControlStateNormal] font:self.downloadedButton.titleLabel.font];
-}
-
-
-#pragma mark - appearance
-
--(void)updateStartDownloadButtonText:(NSString *)title {
-    [self updateButton:self.startDownloadButton title:title];
-}
-
--(void)updateDownloadedButtonText:(NSString *)title {
-    [self updateButton:self.downloadedButton title:title];
-}
-
-
--(void)updateStartDownloadButtonText:(NSString *)title font:(UIFont *)font {
-    [self updateButton:self.startDownloadButton title:title font: font];
-}
-
--(void)updateDownloadedButtonText:(NSString *)title font:(UIFont *)font {
-    [self updateButton:self.downloadedButton title:title font: font];
-}
-
-
-- (void)updateButton:(UIButton *)button title:(NSString *)title {
-    [self updateButton:button title:title font:[UIFont systemFontOfSize:14.f]];
-}
-
-- (void)updateButton:(UIButton *)button title:(NSString *)title font:(UIFont *)font {
-    if (title == nil) {
-        title = @"";
-    }
-    
-    [button setTitle:title forState:UIControlStateNormal];
-    [button setTitleColor:self.tintColor forState:UIControlStateNormal];
-    [button setTitleColor:UIColor.whiteColor forState:UIControlStateHighlighted];
-    
-    button.titleLabel.font = font;
-}
-
-#pragma mark - private methods
-
-- (PKBorderedButton *)createStartDownloadButton {
-    PKBorderedButton *startDownloadButton = [PKBorderedButton buttonWithType:UIButtonTypeCustom];
-    [startDownloadButton configureDefaultAppearance];
-    
-	[self updateButton:startDownloadButton title:@"DOWNLOAD"];
-	
-    [startDownloadButton addTarget:self
-                            action:@selector(currentButtonTapped:)
-                  forControlEvents:UIControlEventTouchUpInside];
-    return startDownloadButton;
-}
-
-- (PKStopDownloadButton *)createStopDownloadButton {
-    PKStopDownloadButton *stopDownloadButton = [[PKStopDownloadButton alloc] init];
-    [stopDownloadButton.stopButton addTarget:self action:@selector(currentButtonTapped:)
-                            forControlEvents:UIControlEventTouchUpInside];
-    return stopDownloadButton;
-}
-
-- (PKBorderedButton *)createDownloadedButton {
-    PKBorderedButton *downloadedButton = [PKBorderedButton buttonWithType:UIButtonTypeCustom];
-    [downloadedButton configureDefaultAppearance];
-
-	[self updateButton:downloadedButton title:@"REMOVE"];
-    
-    [downloadedButton addTarget:self
-                         action:@selector(currentButtonTapped:)
-               forControlEvents:UIControlEventTouchUpInside];
-    return downloadedButton;
-}
-
-- (PKPendingView *)createPendingView {
-    PKPendingView *pendingView = [[PKPendingView alloc] init];
-    [pendingView addTarget:self action:@selector(currentButtonTapped:) forControlEvents:UIControlEventTouchUpInside];
-    return pendingView;
-}
-
-- (void)currentButtonTapped:(id)sender {
-    [self.delegate downloadButtonTapped:self currentState:self.state];
-    BlockSafeRun(self.callback, self, self.state);
-}
-
-- (void)createSubviews {
-    self.stateViews = (__bridge_transfer NSMutableArray *)CFArrayCreateMutable(nil, 0, nil);
-    
-    PKBorderedButton *startDownloadButton = [self createStartDownloadButton];
-    startDownloadButton.translatesAutoresizingMaskIntoConstraints = NO;
-    [self addSubview:startDownloadButton];
-    self.startDownloadButton = startDownloadButton;
-    [self.stateViews addObject:startDownloadButton];
-    
-    PKStopDownloadButton *stopDownloadButton = [self createStopDownloadButton];
-    stopDownloadButton.translatesAutoresizingMaskIntoConstraints = NO;
-    [self addSubview:stopDownloadButton];
-    self.stopDownloadButton = stopDownloadButton;
-    [self.stateViews addObject:stopDownloadButton];
-    
-    PKBorderedButton *downloadedButton = [self createDownloadedButton];
-    downloadedButton.translatesAutoresizingMaskIntoConstraints = NO;
-    [self addSubview:downloadedButton];
-    self.downloadedButton = downloadedButton;
-    [self.stateViews addObject:downloadedButton];
-    
-    PKPendingView *pendingView = [self createPendingView];
-    pendingView.translatesAutoresizingMaskIntoConstraints = NO;
-    [self addSubview:pendingView];
-    self.pendingView = pendingView;
-    [self.stateViews addObject:pendingView];
-}
-
-- (NSArray *)createConstraints {
-    NSMutableArray *constraints = [NSMutableArray array];
-    
-    [self.stateViews enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
-        SafeObjClassCast(UIView, view, obj);
-        [constraints addObjectsFromArray:[NSLayoutConstraint constraintsForWrappedSubview:view
-                                                                               withInsets:UIEdgeInsetsZero]];
-    }];
-    
-    return constraints;
-}
-
-@end
-

+ 0 - 42
Libraries external/PKDownloadButton/PKMacros.h

@@ -1,42 +0,0 @@
-//
-//  PKMacros.h
-//  Download
-//
-//  Created by Pavel on 30/05/15.
-//  Copyright (c) 2015 Katunin. All rights reserved.
-//
-
-#ifndef Download_PKMacros_h
-#define Download_PKMacros_h
-
-#pragma mark - Block helpers
-
-#define BlockSafeRun(block_, ...) do { if ((block_) != NULL) (block_)(__VA_ARGS__); } while (NO)
-#define BlockSafeRunEx(defaultValue_, block_, ...) (((block_) != NULL) ? (block_)(__VA_ARGS__) : (defaultValue_))
-#define BlockSafeRunOnTargetQueue(queue, block, ...) do { if ((block) != NULL) dispatch_async(queue, ^{ (block)(__VA_ARGS__); }); } while (0)
-#define BlockSafeRunOnMainQueue(block, ...) BlockSafeRunOnTargetQueue(dispatch_get_main_queue(), (block), __VA_ARGS__)
-
-#if __has_feature(objc_arc)
-#define BlockWeakObject(o) __typeof__(o) __weak
-#define BlockWeakSelf BlockWeakObject(self)
-#define BlockStrongObject(o) __typeof__(o) __strong
-#define BlockStrongSelf BlockStrongObject(self)
-#define WeakifySelf BlockWeakSelf ___weakSelf___ = self; do {} while (0)
-#define StrongifySelf BlockStrongSelf self = ___weakSelf___; do {} while (0)
-
-#endif // __has_feature(objc_arc)
-
-#define SafeObjClassCast(destClass_, resultObj_, originalObj_) \
-destClass_ *resultObj_ = (destClass_ *)originalObj_;\
-NSAssert2((resultObj_) == nil || [(resultObj_) isKindOfClass:[destClass_ class]],\
-@"Incorrect cast: original object (%@) could not be casted to the destination class (%@)", \
-(originalObj_), NSStringFromClass([destClass_ class]))
-
-#define SafeObjProtocolCast(destProtocol_, resultObj_, originalObj_) \
-id <destProtocol_> resultObj_ = (id <destProtocol_>)originalObj_;\
-NSAssert2((resultObj_) == nil || [(resultObj_) conformsToProtocol:@protocol(destProtocol_)],\
-@"Incorrect cast: original object (%@) could not be casted to the destination protocol (%@)", \
-(originalObj_), NSStringFromProtocol(@protocol(destProtocol_)))
-
-
-#endif // Download_PKMacros_h

+ 0 - 25
Libraries external/PKDownloadButton/PKPendingView.h

@@ -1,25 +0,0 @@
-//
-//  PKPendingView.h
-//  Download
-//
-//  Created by Pavel on 30/05/15.
-//  Copyright (c) 2015 Katunin. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-#import "PKCircleView.h"
-
-IB_DESIGNABLE
-@interface PKPendingView : UIControl
-
-@property (nonatomic, weak, readonly) PKCircleView *circleView;
-
-@property (nonatomic, assign) IBInspectable CGFloat radius;
-@property (nonatomic, assign) IBInspectable CGFloat lineWidth;
-@property (nonatomic, assign) IBInspectable CGFloat emptyLineRadians;
-@property (nonatomic, assign) IBInspectable CGFloat spinTime;
-
-- (void)startSpin;
-- (void)stopSpin;
-
-@end

+ 0 - 134
Libraries external/PKDownloadButton/PKPendingView.m

@@ -1,134 +0,0 @@
-//
-//  PKPendingView.m
-//  Download
-//
-//  Created by Pavel on 30/05/15.
-//  Copyright (c) 2015 Katunin. All rights reserved.
-//
-
-#import "PKPendingView.h"
-#import "NSLayoutConstraint+PKDownloadButton.h"
-#import "CALayer+PKDownloadButtonAnimations.h"
-
-static NSString *const kSpinAnimationKey = @"PKSpin";
-static const CGFloat kDefaultRaduis = 13.f;
-static const CGFloat kDefaultEmptyLineRadians = 0.4f;
-static const CGFloat kDefaultSpinTime = 1.f;
-
-@interface PKPendingView ()
-
-@property (nonatomic, weak) PKCircleView *circleView;
-@property (nonatomic, weak) NSLayoutConstraint *width;
-@property (nonatomic, weak) NSLayoutConstraint *height;
-@property (nonatomic, assign) BOOL isSpinning;
-
-- (PKCircleView *)createCircleView;
-
-- (NSArray *)createConstraints;
-
-@end
-
-static PKPendingView *CommonInit(PKPendingView *self) {
-    if (self != nil) {
-        PKCircleView *circleView = [self createCircleView];
-        circleView.translatesAutoresizingMaskIntoConstraints = NO;
-        [self addSubview:circleView];
-        self.circleView = circleView;
-        self.circleView.userInteractionEnabled = NO;
-        [self addConstraints:[self createConstraints]];
-        
-        self.emptyLineRadians = kDefaultEmptyLineRadians;
-        self.radius = kDefaultRaduis;
-        self.clipsToBounds = NO;
-        
-        self.spinTime = kDefaultSpinTime;
-        [self startSpin];
-    }
-    return self;
-}
-
-@implementation PKPendingView
-
-#pragma mark - initialization
-
-- (id)initWithCoder:(NSCoder *)decoder {
-    return CommonInit([super initWithCoder:decoder]);
-}
-
-- (instancetype)initWithFrame:(CGRect)frame {
-    return CommonInit([super initWithFrame:frame]);
-}
-
-#pragma mark - properties
-
-- (void)setSpinTime:(CGFloat)spinTime {
-    _spinTime = spinTime;
-    [self.circleView.layer removeRotationAnimationWithKey:kSpinAnimationKey];
-    if (self.isSpinning) {
-        [self startSpin];
-    }
-}
-
-- (void)setRadius:(CGFloat)radius {
-    self.width.constant = radius * 2;
-    self.height.constant = radius * 2;
-    [self setNeedsLayout];
-}
-
-- (void)setLineWidth:(CGFloat)lineWidth {
-    self.circleView.lineWidth = lineWidth;
-    [self setNeedsDisplay];
-}
-
-- (CGFloat)lineWidth {
-    return self.circleView.lineWidth;
-}
-
-- (void)setEmptyLineRadians:(CGFloat)emptyLineRadians {
-    _emptyLineRadians = emptyLineRadians;
-    self.circleView.startAngleRadians = 1.5f * M_PI + emptyLineRadians / 2.f;
-    self.circleView.endAngleRadians = self.circleView.startAngleRadians + 2 * M_PI - emptyLineRadians;
-    [self setNeedsDisplay];
-}
-
-- (void)setTintColor:(UIColor *)tintColor {
-    self.circleView.tintColor = tintColor;
-    [self setNeedsDisplay];
-}
-
-#pragma mark - private methods
-
-- (PKCircleView *)createCircleView {
-    PKCircleView *circleView = [[PKCircleView alloc] init];
-    NSLayoutConstraint *heightConstraint = [NSLayoutConstraint constraintForView:circleView
-                                                                      withHeight:0.f];
-    NSLayoutConstraint *widthConstraint = [NSLayoutConstraint constraintForView:circleView
-                                                                      withWidth:0.f];
-    
-    [circleView addConstraints:@[heightConstraint, widthConstraint]];
-    
-    self.width = widthConstraint;
-    self.height = heightConstraint;
-    
-    return circleView;
-}
-
-- (NSArray *)createConstraints {
-    NSMutableArray *constraints = [NSMutableArray array];
-    [constraints addObjectsFromArray:[NSLayoutConstraint constraintsForWrappedSubview:self.circleView
-                                                                           withInsets:UIEdgeInsetsZero]];
-    return constraints;
-}
-
-- (void)startSpin {
-    self.isSpinning = YES;
-    [self.circleView.layer addRotationAnimationWithKey:kSpinAnimationKey
-                                  fullRotationDuration:self.spinTime];
-}
-
-- (void)stopSpin {
-    [self.circleView.layer removeRotationAnimationWithKey:kSpinAnimationKey];
-    self.isSpinning = NO;
-}
-
-@end

+ 0 - 18
Libraries external/PKDownloadButton/PKStopDownloadButton.h

@@ -1,18 +0,0 @@
-//
-//  PKStopDownloadButton.h
-//  PKDownloadButton
-//
-//  Created by Pavel on 28/05/15.
-//  Copyright (c) 2015 Katunin. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-#import "PKCircleProgressView.h"
-
-IB_DESIGNABLE
-@interface PKStopDownloadButton : PKCircleProgressView
-
-@property (nonatomic, assign) IBInspectable CGFloat stopButtonWidth;
-@property (nonatomic, weak, readonly) UIButton *stopButton;
-
-@end

+ 0 - 96
Libraries external/PKDownloadButton/PKStopDownloadButton.m

@@ -1,96 +0,0 @@
-//
-//  PKStopDownloadButton.m
-//  PKDownloadButton
-//
-//  Created by Pavel on 28/05/15.
-//  Copyright (c) 2015 Katunin. All rights reserved.
-//
-
-#import "PKStopDownloadButton.h"
-#import "NSLayoutConstraint+PKDownloadButton.h"
-#import "UIImage+PKDownloadButton.h"
-
-static const CGFloat kDefaultStopButtonWidth = 8.f;
-
-@interface PKStopDownloadButton ()
-
-@property (nonatomic, weak) UIButton *stopButton;
-
-- (UIButton *)createStopButton;
-- (NSArray *)createStopButtonConstraints;
-- (void)updateAppearance;
-- (PKCircleProgressView *)createCircleProgressView;
-
-@end
-
-static PKStopDownloadButton *CommonInit(PKStopDownloadButton *self) {
-    if (self != nil) {
-        UIButton *stopButton = [self createStopButton];
-        stopButton.translatesAutoresizingMaskIntoConstraints = NO;
-        [self addSubview:stopButton];
-        self.stopButton = stopButton;
-        
-        [self addConstraints:[self createStopButtonConstraints]];
-        [self updateAppearance];
-        [self setNeedsDisplay];
-    }
-    return self;
-}
-
-@implementation PKStopDownloadButton
-
-#pragma mark - properties
-
-- (void)setStopButtonWidth:(CGFloat)stopButtonWidth {
-    _stopButtonWidth = stopButtonWidth;
-    [self.stopButton setImage:[UIImage stopImageOfSize:stopButtonWidth
-                                                 color:self.tintColor]
-                     forState:UIControlStateNormal];
-    [self setNeedsDisplay];
-}
-
-#pragma mark - initialization
-
-- (instancetype)initWithCoder:(NSCoder *)decoder {
-    return CommonInit([super initWithCoder:decoder]);
-}
-
-- (instancetype)initWithFrame:(CGRect)frame {
-    return CommonInit([super initWithFrame:frame]);
-}
-
-#pragma mark - private methods
-
-- (UIButton *)createStopButton {
-    UIButton *stopButton = [UIButton buttonWithType:UIButtonTypeCustom];
-	stopButton.tintColor = [UIColor clearColor];
-    _stopButtonWidth = kDefaultStopButtonWidth;
-    return stopButton;
-}
-
-- (NSArray *)createStopButtonConstraints {
-    NSMutableArray *constraints = [NSMutableArray array];
-    [constraints addObjectsFromArray:[NSLayoutConstraint constraintsForWrappedSubview:self.stopButton
-                                                                           withInsets:UIEdgeInsetsZero]];
-    
-    return constraints;
-}
-
-- (PKCircleProgressView *)createCircleProgressView {
-    PKCircleProgressView *circleProgressView = [[PKCircleProgressView alloc] init];
-    
-    return circleProgressView;
-}
-
-#pragma mark - appearance
-
-- (void)updateAppearance {
-	[self.stopButton setImage:[UIImage stopImageOfSize:_stopButtonWidth color:self.tintColor]
-				forState:UIControlStateNormal];
-}
-
-- (void)tintColorDidChange {
-	[super tintColorDidChange];
-	[self updateAppearance];
-}
-@end

+ 0 - 16
Libraries external/PKDownloadButton/UIImage+PKDownloadButton.h

@@ -1,16 +0,0 @@
-//
-//  UIImage+PKDownloadButton.h
-//  Download
-//
-//  Created by Pavel on 31/05/15.
-//  Copyright (c) 2015 Katunin. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-@interface UIImage (PKDownloadButton)
-
-+ (UIImage *)stopImageOfSize:(CGFloat)size color:(UIColor *)color;
-+ (UIImage *)borderedImageWithFill:(UIColor *)fillColor radius:(CGFloat)radius lineColor:(UIColor *)lineColor lineWidth:(CGFloat)lineWidth;
-
-@end

+ 0 - 49
Libraries external/PKDownloadButton/UIImage+PKDownloadButton.m

@@ -1,49 +0,0 @@
-//
-//  UIImage+PKDownloadButton.m
-//  Download
-//
-//  Created by Pavel on 31/05/15.
-//  Copyright (c) 2015 Katunin. All rights reserved.
-//
-
-#import "UIImage+PKDownloadButton.h"
-
-@implementation UIImage (PKDownloadButton)
-
-+ (UIImage *)stopImageOfSize:(CGFloat)size color:(UIColor *)color {
-    UIGraphicsBeginImageContextWithOptions(CGSizeMake(size, size), NO, 1.0f);
-    
-    CGContextRef context = UIGraphicsGetCurrentContext();
-    [color setStroke];
-    
-    CGRect stopImageRect = CGRectMake(0.f, 0.f, size, size);
-    CGContextSetFillColorWithColor(context, color.CGColor);
-    CGContextAddRect(context, stopImageRect);
-    CGContextFillRect(context, stopImageRect);
-    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
-    
-    UIGraphicsEndImageContext();
-    return image;
-}
-
-+ (UIImage *)borderedImageWithFill:(UIColor *)fillColor radius:(CGFloat)radius lineColor:(UIColor *)lineColor lineWidth:(CGFloat)lineWidth {
-
-    UIGraphicsBeginImageContextWithOptions(CGSizeMake(radius * 2, radius * 2), NO, 0.0f);
-
-    UIBezierPath *bezierPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(lineWidth,lineWidth,(radius - lineWidth) * 2, (radius - lineWidth) * 2)
-                                                          cornerRadius:radius];
-    bezierPath.lineWidth = lineWidth;
-
-    if (lineColor) [lineColor setStroke];
-    if (fillColor) [fillColor setFill];
-
-    [bezierPath stroke];
-    
-    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
-
-    UIGraphicsEndImageContext();
-
-    return [image resizableImageWithCapInsets:UIEdgeInsetsMake(radius, radius, radius, radius)];
-}
-
-@end

+ 0 - 64
Nextcloud.xcodeproj/project.pbxproj

@@ -267,15 +267,6 @@
 		F7C7B489245EBA4100D93E60 /* NCViewerQuickLook.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7C7B488245EBA4100D93E60 /* NCViewerQuickLook.swift */; };
 		F7C9555321F0C4CA0024296E /* NCActivity.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7C9555221F0C4CA0024296E /* NCActivity.storyboard */; };
 		F7C9555521F0C5470024296E /* NCActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7C9555421F0C5470024296E /* NCActivity.swift */; };
-		F7CA1ED020E7E3FE002CC65E /* UIImage+PKDownloadButton.m in Sources */ = {isa = PBXBuildFile; fileRef = F7CA1EBC20E7E3FE002CC65E /* UIImage+PKDownloadButton.m */; };
-		F7CA1ED120E7E3FE002CC65E /* PKCircleProgressView.m in Sources */ = {isa = PBXBuildFile; fileRef = F7CA1EBE20E7E3FE002CC65E /* PKCircleProgressView.m */; };
-		F7CA1ED220E7E3FE002CC65E /* PKCircleView.m in Sources */ = {isa = PBXBuildFile; fileRef = F7CA1EC120E7E3FE002CC65E /* PKCircleView.m */; };
-		F7CA1ED320E7E3FE002CC65E /* PKStopDownloadButton.m in Sources */ = {isa = PBXBuildFile; fileRef = F7CA1EC220E7E3FE002CC65E /* PKStopDownloadButton.m */; };
-		F7CA1ED420E7E3FE002CC65E /* PKPendingView.m in Sources */ = {isa = PBXBuildFile; fileRef = F7CA1EC320E7E3FE002CC65E /* PKPendingView.m */; };
-		F7CA1ED620E7E3FE002CC65E /* CALayer+PKDownloadButtonAnimations.m in Sources */ = {isa = PBXBuildFile; fileRef = F7CA1EC720E7E3FE002CC65E /* CALayer+PKDownloadButtonAnimations.m */; };
-		F7CA1ED720E7E3FE002CC65E /* PKDownloadButton.m in Sources */ = {isa = PBXBuildFile; fileRef = F7CA1EC820E7E3FE002CC65E /* PKDownloadButton.m */; };
-		F7CA1ED820E7E3FE002CC65E /* PKBorderedButton.m in Sources */ = {isa = PBXBuildFile; fileRef = F7CA1ECA20E7E3FE002CC65E /* PKBorderedButton.m */; };
-		F7CA1ED920E7E3FE002CC65E /* NSLayoutConstraint+PKDownloadButton.m in Sources */ = {isa = PBXBuildFile; fileRef = F7CA1ECE20E7E3FE002CC65E /* NSLayoutConstraint+PKDownloadButton.m */; };
 		F7CB689A2541676B0050EC94 /* NCMore.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7CB68992541676B0050EC94 /* NCMore.storyboard */; };
 		F7CB68A0254169530050EC94 /* NCSettings.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7CB689F254169530050EC94 /* NCSettings.storyboard */; };
 		F7CBC31C24F78E79004D3812 /* NCSortMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7CBC31B24F78E79004D3812 /* NCSortMenu.swift */; };
@@ -646,25 +637,6 @@
 		F7C8C1901B482CEA0048180E /* CCGlobal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCGlobal.h; sourceTree = "<group>"; };
 		F7C9555221F0C4CA0024296E /* NCActivity.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = NCActivity.storyboard; sourceTree = "<group>"; };
 		F7C9555421F0C5470024296E /* NCActivity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCActivity.swift; sourceTree = "<group>"; };
-		F7CA1EBC20E7E3FE002CC65E /* UIImage+PKDownloadButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+PKDownloadButton.m"; sourceTree = "<group>"; };
-		F7CA1EBD20E7E3FE002CC65E /* PKBorderedButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PKBorderedButton.h; sourceTree = "<group>"; };
-		F7CA1EBE20E7E3FE002CC65E /* PKCircleProgressView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PKCircleProgressView.m; sourceTree = "<group>"; };
-		F7CA1EBF20E7E3FE002CC65E /* PKDownloadButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PKDownloadButton.h; sourceTree = "<group>"; };
-		F7CA1EC020E7E3FE002CC65E /* CALayer+PKDownloadButtonAnimations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CALayer+PKDownloadButtonAnimations.h"; sourceTree = "<group>"; };
-		F7CA1EC120E7E3FE002CC65E /* PKCircleView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PKCircleView.m; sourceTree = "<group>"; };
-		F7CA1EC220E7E3FE002CC65E /* PKStopDownloadButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PKStopDownloadButton.m; sourceTree = "<group>"; };
-		F7CA1EC320E7E3FE002CC65E /* PKPendingView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PKPendingView.m; sourceTree = "<group>"; };
-		F7CA1EC420E7E3FE002CC65E /* NSLayoutConstraint+PKDownloadButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSLayoutConstraint+PKDownloadButton.h"; sourceTree = "<group>"; };
-		F7CA1EC620E7E3FE002CC65E /* PKMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PKMacros.h; sourceTree = "<group>"; };
-		F7CA1EC720E7E3FE002CC65E /* CALayer+PKDownloadButtonAnimations.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CALayer+PKDownloadButtonAnimations.m"; sourceTree = "<group>"; };
-		F7CA1EC820E7E3FE002CC65E /* PKDownloadButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PKDownloadButton.m; sourceTree = "<group>"; };
-		F7CA1EC920E7E3FE002CC65E /* PKCircleProgressView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PKCircleProgressView.h; sourceTree = "<group>"; };
-		F7CA1ECA20E7E3FE002CC65E /* PKBorderedButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PKBorderedButton.m; sourceTree = "<group>"; };
-		F7CA1ECB20E7E3FE002CC65E /* UIImage+PKDownloadButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+PKDownloadButton.h"; sourceTree = "<group>"; };
-		F7CA1ECC20E7E3FE002CC65E /* PKStopDownloadButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PKStopDownloadButton.h; sourceTree = "<group>"; };
-		F7CA1ECD20E7E3FE002CC65E /* PKCircleView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PKCircleView.h; sourceTree = "<group>"; };
-		F7CA1ECE20E7E3FE002CC65E /* NSLayoutConstraint+PKDownloadButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSLayoutConstraint+PKDownloadButton.m"; sourceTree = "<group>"; };
-		F7CA1ECF20E7E3FE002CC65E /* PKPendingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PKPendingView.h; sourceTree = "<group>"; };
 		F7CB68992541676B0050EC94 /* NCMore.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = NCMore.storyboard; sourceTree = "<group>"; };
 		F7CB689F254169530050EC94 /* NCSettings.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = NCSettings.storyboard; sourceTree = "<group>"; };
 		F7CBC31B24F78E79004D3812 /* NCSortMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCSortMenu.swift; sourceTree = "<group>"; };
@@ -840,7 +812,6 @@
 			children = (
 				F704FA5A232A341800BBA952 /* Imagemeter */,
 				F7B2DEEB1F976785007CF4D2 /* NYMnemonic */,
-				F7CA1EBB20E7E3FE002CC65E /* PKDownloadButton */,
 			);
 			path = "Libraries external";
 			sourceTree = SOURCE_ROOT;
@@ -1339,32 +1310,6 @@
 			name = "Supporting Files";
 			sourceTree = "<group>";
 		};
-		F7CA1EBB20E7E3FE002CC65E /* PKDownloadButton */ = {
-			isa = PBXGroup;
-			children = (
-				F7CA1EBC20E7E3FE002CC65E /* UIImage+PKDownloadButton.m */,
-				F7CA1EBD20E7E3FE002CC65E /* PKBorderedButton.h */,
-				F7CA1EBE20E7E3FE002CC65E /* PKCircleProgressView.m */,
-				F7CA1EBF20E7E3FE002CC65E /* PKDownloadButton.h */,
-				F7CA1EC020E7E3FE002CC65E /* CALayer+PKDownloadButtonAnimations.h */,
-				F7CA1EC120E7E3FE002CC65E /* PKCircleView.m */,
-				F7CA1EC220E7E3FE002CC65E /* PKStopDownloadButton.m */,
-				F7CA1EC320E7E3FE002CC65E /* PKPendingView.m */,
-				F7CA1EC420E7E3FE002CC65E /* NSLayoutConstraint+PKDownloadButton.h */,
-				F7CA1EC620E7E3FE002CC65E /* PKMacros.h */,
-				F7CA1EC720E7E3FE002CC65E /* CALayer+PKDownloadButtonAnimations.m */,
-				F7CA1EC820E7E3FE002CC65E /* PKDownloadButton.m */,
-				F7CA1EC920E7E3FE002CC65E /* PKCircleProgressView.h */,
-				F7CA1ECA20E7E3FE002CC65E /* PKBorderedButton.m */,
-				F7CA1ECB20E7E3FE002CC65E /* UIImage+PKDownloadButton.h */,
-				F7CA1ECC20E7E3FE002CC65E /* PKStopDownloadButton.h */,
-				F7CA1ECD20E7E3FE002CC65E /* PKCircleView.h */,
-				F7CA1ECE20E7E3FE002CC65E /* NSLayoutConstraint+PKDownloadButton.m */,
-				F7CA1ECF20E7E3FE002CC65E /* PKPendingView.h */,
-			);
-			path = PKDownloadButton;
-			sourceTree = "<group>";
-		};
 		F7CADB3D23CCDDA1000EEC78 /* RichWorkspace */ = {
 			isa = PBXGroup;
 			children = (
@@ -2068,15 +2013,12 @@
 				3757A35523D9D76300EC369E /* NCMenuPanelController.swift in Sources */,
 				F77A697D250A0FBC00FF1708 /* NCCollectionViewCommon+Menu.swift in Sources */,
 				F72928A0253B0937009CA4FD /* NCMainNavigationController.swift in Sources */,
-				F7CA1ED320E7E3FE002CC65E /* PKStopDownloadButton.m in Sources */,
 				F755E6472525946C008DAB45 /* NCCollectionCommon.swift in Sources */,
 				F704B5E92430C0B800632F5F /* NCCreateFormUploadConflictCell.swift in Sources */,
 				F72D404923D2082500A97FD0 /* NCViewerNextcloudText.swift in Sources */,
 				F77B0E221D118A16002130FE /* CCManageLocation.m in Sources */,
 				F700510522DF6A89003A3356 /* NCShare.swift in Sources */,
-				F7CA1ED120E7E3FE002CC65E /* PKCircleProgressView.m in Sources */,
 				F72D1007210B6882009C96B7 /* NCPushNotificationEncryption.m in Sources */,
-				F7CA1ED420E7E3FE002CC65E /* PKPendingView.m in Sources */,
 				F769454222E9F0EE000A798A /* NCShareLinkMenuView.swift in Sources */,
 				F785EE9D246196DF00B3F945 /* NCNetworkingE2EE.swift in Sources */,
 				F77B0E301D118A16002130FE /* CCHud.m in Sources */,
@@ -2115,12 +2057,10 @@
 				F76B3CCE1EAE01BD00921AC9 /* NCBrand.swift in Sources */,
 				F7BF1B431D51E893000854F6 /* CCLogin.m in Sources */,
 				F769454422E9F142000A798A /* NCShareUserMenuView.swift in Sources */,
-				F7CA1ED720E7E3FE002CC65E /* PKDownloadButton.m in Sources */,
 				F77B0E981D118A16002130FE /* CCManageAccount.m in Sources */,
 				F755BD9B20594AC7008C5FBB /* NCService.swift in Sources */,
 				F7B7504B2397D38F004E13EC /* UIImage+fixedOrientation.swift in Sources */,
 				F77B0EA61D118A16002130FE /* NSString+TruncateToWidth.m in Sources */,
-				F7CA1ED020E7E3FE002CC65E /* UIImage+PKDownloadButton.m in Sources */,
 				F7DFB7F4219C5CA800680748 /* NCCreateFormUploadScanDocument.swift in Sources */,
 				F710D1FF24057E5E00A6033D /* NCActionSheetHeaderView.swift in Sources */,
 				F7020FCE2233D7F700B7297D /* NCCreateFormUploadVoiceNote.swift in Sources */,
@@ -2137,21 +2077,17 @@
 				F7BAADCB1ED5A87C00B7EAD4 /* NCManageDatabase.swift in Sources */,
 				F70968A424212C4E00ED60E5 /* NCLivePhoto.swift in Sources */,
 				F704FA5C232A343F00BBA952 /* IMImagemeterViewer.swift in Sources */,
-				F7CA1ED220E7E3FE002CC65E /* PKCircleView.m in Sources */,
 				F745B253222D88AE00346520 /* NCLoginQRCode.swift in Sources */,
 				F7CBC31C24F78E79004D3812 /* NCSortMenu.swift in Sources */,
 				F769454822E9F20D000A798A /* NCShareNetworking.swift in Sources */,
 				F7C9555521F0C5470024296E /* NCActivity.swift in Sources */,
 				F7725A60251F33BB00D125E0 /* NCFiles.swift in Sources */,
-				F7CA1ED820E7E3FE002CC65E /* PKBorderedButton.m in Sources */,
 				F704B5E52430AA8000632F5F /* NCCreateFormUploadConflict.swift in Sources */,
 				F765608F23BF813600765969 /* NCContentPresenter.swift in Sources */,
 				F70CEF5623E9C7E50007035B /* UIColor+adjust.swift in Sources */,
 				F75AC2431F1F62450073EC19 /* NCManageAutoUploadFileName.swift in Sources */,
-				F7CA1ED620E7E3FE002CC65E /* CALayer+PKDownloadButtonAnimations.m in Sources */,
 				F7C7B489245EBA4100D93E60 /* NCViewerQuickLook.swift in Sources */,
 				F758B45E212C569D00515F55 /* ScanCell.swift in Sources */,
-				F7CA1ED920E7E3FE002CC65E /* NSLayoutConstraint+PKDownloadButton.m in Sources */,
 				F77B0ED11D118A16002130FE /* Acknowledgements.m in Sources */,
 				F70D8D8124A4A9BF000A5756 /* NCNetworkingAutoUpload.swift in Sources */,
 				F7D96FCC246ED7E200536D73 /* NCNetworkingCheckRemoteUser.swift in Sources */,

+ 0 - 2
iOSClient/Nextcloud-Bridging-Header.h

@@ -8,6 +8,4 @@
 #import "NCAutoUpload.h"
 #import "NCEndToEndEncryption.h"
 #import "NYMnemonic.h"
-#import "PKStopDownloadButton.h"
-#import <DZNEmptyDataSet/UIScrollView+EmptyDataSet.h>
 #import "CCPeekPop.h"

+ 7 - 2
iOSClient/Viewer/NCViewerImage/NCViewerImagePageContainer.swift

@@ -328,8 +328,11 @@ class NCViewerImagePageContainer: UIViewController, UIGestureRecognizerDelegate
                         if errorCode == 0 && account == metadata.account {
                             
                             NCManageDatabase.sharedInstance.addLocalFile(metadata: metadata)
-                            AudioServicesPlaySystemSound(1519) // peek feedback
-                            self.playerMov(metadata: metadata)
+                            
+                            if gestureRecognizer.state == .began {
+                                AudioServicesPlaySystemSound(1519) // peek feedback
+                                self.playerMov(metadata: metadata)
+                            }
                         }
                     }
                 }
@@ -483,6 +486,8 @@ class NCViewerImagePageContainer: UIViewController, UIGestureRecognizerDelegate
         }
     }
     
+    
+    
     //MARK: - Action
     
     @objc func openMenuMore() {