Răsfoiți Sursa

modify library AHKActionSheet

Marino Faggiana 8 ani în urmă
părinte
comite
61dfa73cbd

+ 13 - 4
Libraries external/AHKActionSheet/AHKActionSheet.h

@@ -12,7 +12,7 @@ typedef NS_ENUM(NSInteger, AHKActionSheetButtonType) {
     AHKActionSheetButtonTypeDefault = 0,
 	AHKActionSheetButtonTypeDisabled,
     AHKActionSheetButtonTypeDestructive,
-    AHKActionSheetButtonTypeCrypto
+    AHKActionSheetButtonTypeEncrypted
 };
 
 @class AHKActionSheet;
@@ -54,7 +54,7 @@ typedef void(^AHKActionSheetHandler)(AHKActionSheet *actionSheet);
 @property (copy, nonatomic) NSDictionary *buttonTextAttributes UI_APPEARANCE_SELECTOR;
 @property (copy, nonatomic) NSDictionary *disabledButtonTextAttributes UI_APPEARANCE_SELECTOR;
 @property (copy, nonatomic) NSDictionary *destructiveButtonTextAttributes UI_APPEARANCE_SELECTOR;
-@property (copy, nonatomic) NSDictionary *cryptoButtonTextAttributes UI_APPEARANCE_SELECTOR;
+@property (copy, nonatomic) NSDictionary *encryptedButtonTextAttributes UI_APPEARANCE_SELECTOR;
 @property (copy, nonatomic) NSDictionary *cancelButtonTextAttributes UI_APPEARANCE_SELECTOR;
 /// Duration of the show/dismiss animations. Defaults to 0.5.
 @property (nonatomic) NSTimeInterval animationDuration UI_APPEARANCE_SELECTOR;
@@ -75,8 +75,7 @@ typedef void(^AHKActionSheetHandler)(AHKActionSheet *actionSheet);
 @property (strong, nonatomic) UIView *headerView;
 /// Window visible before the actionSheet was presented.
 @property (weak, nonatomic, readonly) UIWindow *previousKeyWindow;
-
-///TWS
+/// View actionSheet was presented.
 @property (nonatomic, weak) UIView *view;
 
 /**
@@ -90,6 +89,16 @@ typedef void(^AHKActionSheetHandler)(AHKActionSheet *actionSheet);
  */
 - (instancetype)initWithTitle:(NSString *)title;
 
+/**
+ *  Initializes the action sheet with a specified view and title. `headerView` can be used if a string is insufficient for the title; set `title` as `nil` in this case.
+ *
+ *  It's the designated initializer.
+ *
+ *  @param view
+ *  @param title A string to display in the title area, above the buttons.
+ *
+ *  @return A newly initialized action sheet.
+ */
 - (instancetype)initWithView:(UIView *)view title:(NSString *)title;
 
 /**

+ 15 - 15
Libraries external/AHKActionSheet/AHKActionSheet.m

@@ -23,7 +23,7 @@ static const CGFloat kAutoDismissOffset = 80.0f;
 static const CGFloat kFlickDownHandlingOffset = 20.0f;
 static const CGFloat kFlickDownMinVelocity = 2000.0f;
 // How much free space to leave at the top (above the tableView's contents) when there's a lot of elements. It makes this control look similar to the UIActionSheet.
-static const CGFloat kTopSpaceMarginFraction = 0.0; //TWS 0.333f;
+static const CGFloat kTopSpaceMarginFraction = 0.0f;
 // cancelButton's shadow height as the ratio to the cancelButton's height
 static const CGFloat kCancelButtonShadowHeightRatio = 0.333f;
 
@@ -135,9 +135,8 @@ static const CGFloat kCancelButtonShadowHeightRatio = 0.333f;
 {
     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier forIndexPath:indexPath];
     
-    //TWS
     cell.separatorInset = UIEdgeInsetsMake(0.f, 55.f, 0.f, 0.f);
-
+    
     AHKActionSheetItem *item = self.items[(NSUInteger)indexPath.row];
 
     NSDictionary *attributes = nil;
@@ -153,8 +152,8 @@ static const CGFloat kCancelButtonShadowHeightRatio = 0.333f;
         case AHKActionSheetButtonTypeDestructive:
             attributes = self.destructiveButtonTextAttributes;
             break;
-        case AHKActionSheetButtonTypeCrypto:
-            attributes = self.cryptoButtonTextAttributes;
+        case AHKActionSheetButtonTypeEncrypted:
+            attributes = self.encryptedButtonTextAttributes;
             break;
     }
 
@@ -170,7 +169,7 @@ static const CGFloat kCancelButtonShadowHeightRatio = 0.333f;
         cell.imageView.tintColor = attributes[NSForegroundColorAttributeName] ? attributes[NSForegroundColorAttributeName] : [UIColor blackColor];
     }
 
-    //TWS
+    // Cganhe to White Color
     cell.backgroundColor = [UIColor whiteColor];
 
     if (self.selectedBackgroundColor && ![cell.selectedBackgroundView.backgroundColor isEqual:self.selectedBackgroundColor]) {
@@ -197,7 +196,6 @@ static const CGFloat kCancelButtonShadowHeightRatio = 0.333f;
     return self.buttonHeight;
 }
 
-//TWS
 /*
 -(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
 {
@@ -218,6 +216,8 @@ static const CGFloat kCancelButtonShadowHeightRatio = 0.333f;
 }
 */
 
+
+
 #pragma mark - UIScrollViewDelegate
 
 - (void)scrollViewDidScroll:(UIScrollView *)scrollView
@@ -299,7 +299,7 @@ static const CGFloat kCancelButtonShadowHeightRatio = 0.333f;
     [self setUpCancelButton];
     [self setUpTableView];
     
-    if (self.cancelOnPanGestureEnabled.boolValue) {
+    if (self.cancelOnTapEmptyAreaEnabled.boolValue) {
         [self setUpCancelTapGestureForView:self.tableView];
     }
     
@@ -313,10 +313,10 @@ static const CGFloat kCancelButtonShadowHeightRatio = 0.333f;
     void(^delayedAnimations)(void) = ^(void) {
         self.cancelButton.frame = CGRectMake(0,
                                              CGRectGetMaxY(self.bounds) - self.cancelButtonHeight,
-                                             CGRectGetWidth(_view.bounds),
+                                             CGRectGetWidth(self.bounds),
                                              self.cancelButtonHeight);
-        
-        //TWS
+    
+        // Add White color background
         self.cancelButton.backgroundColor = [UIColor whiteColor];
         
         self.tableView.transform = CGAffineTransformMakeTranslation(0, 0);
@@ -494,7 +494,7 @@ static const CGFloat kCancelButtonShadowHeightRatio = 0.333f;
     CGFloat statusBarHeight = CGRectGetHeight(statusBarViewRect);
     CGRect frame = CGRectMake(0,
                               statusBarHeight,
-                              CGRectGetWidth(_view.bounds),
+                              CGRectGetWidth(self.bounds),
                               CGRectGetHeight(self.bounds) - statusBarHeight - self.cancelButtonHeight);
 
     UITableView *tableView = [[UITableView alloc] initWithFrame:frame];
@@ -542,7 +542,7 @@ static const CGFloat kCancelButtonShadowHeightRatio = 0.333f;
         [headerView addSubview:label];
         
         self.tableView.tableHeaderView = headerView;
-        
+
     } else if (self.headerView) {
         self.tableView.tableHeaderView = self.headerView;
     }
@@ -558,10 +558,10 @@ static const CGFloat kCancelButtonShadowHeightRatio = 0.333f;
         UIView *separator = [[UIView alloc] initWithFrame:separatorFrame];
         separator.backgroundColor = self.tableView.separatorColor;
         
-        //TWS
+        // Add line
         UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.tableView.tableHeaderView.frame), 1 / UIScreen.mainScreen.scale)];
         line.backgroundColor = self.tableView.separatorColor;
-
+        
         [self.tableView.tableHeaderView addSubview:separator];
         [self.tableView.tableHeaderView addSubview:line];
     }

+ 0 - 1
Libraries external/AHKActionSheet/AHKActionSheetViewController.h

@@ -46,7 +46,6 @@
     return !self.viewAlreadyAppear;
 }
 
-//TWS
 #if __IPHONE_OS_VERSION_MAX_ALLOWED < 90000
 - (NSUInteger)supportedInterfaceOrientations
 #else

+ 2 - 2
Libraries external/AHKActionSheet/UIImage+AHKAdditions.h

@@ -35,7 +35,7 @@ class CreateMenu: NSObject {
         actionSheet?.cancelButtonHeight = 50.0
         actionSheet?.selectedBackgroundColor = UIColor(colorLiteralRed: 0.0/255.0, green: 130.0/255.0, blue: 201.0/255.0, alpha: 0.1)
         actionSheet?.buttonTextAttributes = [NSFontAttributeName:UIFont(name: "HelveticaNeue", size: 17)!, NSForegroundColorAttributeName:UIColor(colorLiteralRed: 65.0/255.0, green: 64.0/255.0, blue: 66.0/255.0, alpha: 1.0)]
-        actionSheet?.cryptoButtonTextAttributes = [NSFontAttributeName:UIFont(name: "HelveticaNeue", size: 17)!, NSForegroundColorAttributeName:UIColor(colorLiteralRed: 241.0/255.0, green: 90.0/255.0, blue: 34.0/255.0, alpha: 1.0)]
+        actionSheet?.encryptedButtonTextAttributes = [NSFontAttributeName:UIFont(name: "HelveticaNeue", size: 17)!, NSForegroundColorAttributeName:UIColor(colorLiteralRed: 241.0/255.0, green: 90.0/255.0, blue: 34.0/255.0, alpha: 1.0)]
         actionSheet?.separatorColor = UIColor(colorLiteralRed: 153.0/255.0, green: 153.0/255.0, blue: 153.0/255.0, alpha: 0.2)
         actionSheet?.cancelButtonTitle = NSLocalizedString("_cancel_", comment: "")
 
@@ -51,7 +51,7 @@ class CreateMenu: NSObject {
             appDelegate.activeMain.returnCreate(Int(returnCreateFilePlain))
         })
         
-        actionSheet?.addButton(withTitle: "Upload Encrypted file", image: UIImage(named: "actionSheetLock"), type: AHKActionSheetButtonType.crypto, handler: {(AHKActionSheet) -> Void in
+        actionSheet?.addButton(withTitle: "Upload Encrypted file", image: UIImage(named: "actionSheetLock"), type: AHKActionSheetButtonType.encrypted, handler: {(AHKActionSheet) -> Void in
             NSLog("Share tapped")
         })
         

+ 1 - 1
iOSClient/Favorite/CCFavorite.m

@@ -416,7 +416,7 @@
     actionSheet.buttonHeight = 50.0;
     actionSheet.cancelButtonHeight = 50.0f;
     actionSheet.selectedBackgroundColor = COLOR_SELECT_BACKGROUND;
-    actionSheet.cryptoButtonTextAttributes = @{ NSFontAttributeName:[UIFont systemFontOfSize:17], NSForegroundColorAttributeName:COLOR_BRAND };
+    actionSheet.encryptedButtonTextAttributes = @{ NSFontAttributeName:[UIFont systemFontOfSize:17], NSForegroundColorAttributeName:COLOR_BRAND };
     actionSheet.buttonTextAttributes = @{ NSFontAttributeName:[UIFont systemFontOfSize:17], NSForegroundColorAttributeName:COLOR_GRAY };
     actionSheet.separatorColor = COLOR_SEPARATOR_TABLE;
     actionSheet.cancelButtonTitle = NSLocalizedString(@"_cancel_",nil);

+ 6 - 6
iOSClient/Main/CCMain.m

@@ -4253,7 +4253,7 @@
         actionSheet.buttonHeight = 50.0;
         actionSheet.cancelButtonHeight = 50.0f;
         actionSheet.selectedBackgroundColor = COLOR_SELECT_BACKGROUND;
-        actionSheet.cryptoButtonTextAttributes = @{ NSFontAttributeName:[UIFont systemFontOfSize:17], NSForegroundColorAttributeName:COLOR_ENCRYPTED };
+        actionSheet.encryptedButtonTextAttributes = @{ NSFontAttributeName:[UIFont systemFontOfSize:17], NSForegroundColorAttributeName:COLOR_ENCRYPTED };
         actionSheet.buttonTextAttributes = @{ NSFontAttributeName:[UIFont systemFontOfSize:17], NSForegroundColorAttributeName:COLOR_GRAY };
         actionSheet.separatorColor = COLOR_SEPARATOR_TABLE;
         actionSheet.cancelButtonTitle = NSLocalizedString(@"_cancel_",nil);
@@ -4305,7 +4305,7 @@
             
             [actionSheet addButtonWithTitle:titoloCriptaDecripta
                                       image:[UIImage imageNamed:image_actionSheetCrypto]
-                                       type:AHKActionSheetButtonTypeCrypto
+                                       type:AHKActionSheetButtonTypeEncrypted
                                     handler:^(AHKActionSheet *as) {
                                         
                                         // close swipe
@@ -4319,7 +4319,7 @@
             
             [actionSheet addButtonWithTitle:titoloLock
                                       image:[UIImage imageNamed:image_actionSheetLock]
-                                       type:AHKActionSheetButtonTypeCrypto
+                                       type:AHKActionSheetButtonTypeEncrypted
                                     handler:^(AHKActionSheet *as) {
                                         
                                         // close swipe
@@ -4383,7 +4383,7 @@
         actionSheet.buttonHeight = 50.0;
         actionSheet.cancelButtonHeight = 50.0f;
         actionSheet.selectedBackgroundColor = COLOR_SELECT_BACKGROUND;
-        actionSheet.cryptoButtonTextAttributes = @{ NSFontAttributeName:[UIFont systemFontOfSize:17], NSForegroundColorAttributeName:COLOR_ENCRYPTED };
+        actionSheet.encryptedButtonTextAttributes = @{ NSFontAttributeName:[UIFont systemFontOfSize:17], NSForegroundColorAttributeName:COLOR_ENCRYPTED };
         actionSheet.buttonTextAttributes = @{ NSFontAttributeName:[UIFont systemFontOfSize:17], NSForegroundColorAttributeName:COLOR_GRAY };
         actionSheet.separatorColor = COLOR_SEPARATOR_TABLE;
         actionSheet.cancelButtonTitle = NSLocalizedString(@"_cancel_",nil);
@@ -4463,7 +4463,7 @@
 
         [actionSheet addButtonWithTitle:titoloCriptaDecripta
                                   image:[UIImage imageNamed:image_actionSheetCrypto]
-                                   type:AHKActionSheetButtonTypeCrypto
+                                   type:AHKActionSheetButtonTypeEncrypted
                                 handler:^(AHKActionSheet *as) {
                                     
                                     // close swipe
@@ -4513,7 +4513,7 @@
         actionSheet.buttonHeight = 50.0;
         actionSheet.cancelButtonHeight = 50.0f;
         actionSheet.selectedBackgroundColor = COLOR_SELECT_BACKGROUND;
-        actionSheet.cryptoButtonTextAttributes = @{ NSFontAttributeName:[UIFont systemFontOfSize:17], NSForegroundColorAttributeName:COLOR_ENCRYPTED };
+        actionSheet.encryptedButtonTextAttributes = @{ NSFontAttributeName:[UIFont systemFontOfSize:17], NSForegroundColorAttributeName:COLOR_ENCRYPTED };
         actionSheet.buttonTextAttributes = @{ NSFontAttributeName:[UIFont systemFontOfSize:17], NSForegroundColorAttributeName:COLOR_GRAY };
         actionSheet.separatorColor = COLOR_SEPARATOR_TABLE;
         actionSheet.cancelButtonTitle = NSLocalizedString(@"_cancel_",nil);