Updating WYPopoverController to fix Add Site keyboard focus bug.

This commit is contained in:
Samuel Clay 2015-09-07 19:56:44 -07:00
parent 8ed49c165f
commit 9af421c687
7 changed files with 2461 additions and 2775 deletions

View file

@ -652,7 +652,23 @@
NSString *comment = [self getComment:[friendsCommentsArray objectAtIndex:i]];
comments = [comments stringByAppendingString:comment];
}
}
}
if ([[story objectForKey:@"comment_count_friends"] intValue] > 0 ) {
NSString *commentHeader = [NSString stringWithFormat:@
"<div class=\"NB-story-comments-friends-header-wrapper\">"
" <div class=\"NB-story-comments-friends-header\">%i comment%@</div>"
"</div>",
[[story objectForKey:@"comment_count_friends"] intValue],
[[story objectForKey:@"comment_count_friends"] intValue] == 1 ? @"" : @"s"];
comments = [comments stringByAppendingString:commentHeader];
// add friends comments
for (int i = 0; i < friendsCommentsArray.count; i++) {
NSString *comment = [self getComment:[friendsCommentsArray objectAtIndex:i]];
comments = [comments stringByAppendingString:comment];
}
}
if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"show_public_comments"] boolValue] &&
[[story objectForKey:@"comment_count_public"] intValue] > 0 ) {

View file

@ -3177,7 +3177,7 @@
ORGANIZATIONNAME = NewsBlur;
TargetAttributes = {
1D6058900D05DD3D006BFB54 = {
DevelopmentTeam = HR7P97SD72;
DevelopmentTeam = U92APKK285;
};
};
};
@ -3948,7 +3948,8 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CLANG_ENABLE_OBJC_ARC = YES;
CODE_SIGN_IDENTITY = "";
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@ -3975,7 +3976,7 @@
"-all_load",
);
PRODUCT_NAME = NewsBlur;
PROVISIONING_PROFILE = "45143eee-33c3-4c7b-82e2-4b3ac0eb2170";
PROVISIONING_PROFILE = "";
STRIP_INSTALLED_PRODUCT = NO;
TARGETED_DEVICE_FAMILY = "1,2";
"WARNING_CFLAGS[arch=*]" = "-Wall";
@ -3989,7 +3990,8 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CLANG_ENABLE_OBJC_ARC = YES;
CODE_SIGN_IDENTITY = "";
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@ -4014,7 +4016,7 @@
"-all_load",
);
PRODUCT_NAME = NewsBlur;
PROVISIONING_PROFILE = "45143eee-33c3-4c7b-82e2-4b3ac0eb2170";
PROVISIONING_PROFILE = "";
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
@ -4024,6 +4026,7 @@
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_C_LANGUAGE_STANDARD = "compiler-default";
@ -4045,6 +4048,7 @@
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_C_LANGUAGE_STANDARD = "compiler-default";

View file

@ -1,27 +1,27 @@
/*
Version 0.2.2
Version 0.3.6
WYPopoverController is available under the MIT license.
Copyright © 2013 Nicolas CHENG
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
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
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
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>
@ -31,63 +31,68 @@
@class WYPopoverTheme;
#ifndef WY_POPOVER_DEFAULT_ANIMATION_DURATION
#define WY_POPOVER_DEFAULT_ANIMATION_DURATION .25f
#define WY_POPOVER_DEFAULT_ANIMATION_DURATION .25f
#endif
#ifndef WY_POPOVER_MIN_SIZE
#define WY_POPOVER_MIN_SIZE CGSizeMake(240, 160)
#define WY_POPOVER_MIN_SIZE CGSizeMake(240, 160)
#endif
typedef NS_OPTIONS(NSUInteger, WYPopoverArrowDirection) {
WYPopoverArrowDirectionUp = 1UL << 0,
WYPopoverArrowDirectionDown = 1UL << 1,
WYPopoverArrowDirectionLeft = 1UL << 2,
WYPopoverArrowDirectionRight = 1UL << 3,
WYPopoverArrowDirectionNone = 1UL << 4,
WYPopoverArrowDirectionAny = WYPopoverArrowDirectionUp | WYPopoverArrowDirectionDown | WYPopoverArrowDirectionLeft | WYPopoverArrowDirectionRight,
WYPopoverArrowDirectionUnknown = NSUIntegerMax
WYPopoverArrowDirectionUp = 1UL << 0,
WYPopoverArrowDirectionDown = 1UL << 1,
WYPopoverArrowDirectionLeft = 1UL << 2,
WYPopoverArrowDirectionRight = 1UL << 3,
WYPopoverArrowDirectionNone = 1UL << 4,
WYPopoverArrowDirectionAny = WYPopoverArrowDirectionUp | WYPopoverArrowDirectionDown | WYPopoverArrowDirectionLeft | WYPopoverArrowDirectionRight,
WYPopoverArrowDirectionUnknown = NSUIntegerMax
};
typedef NS_OPTIONS(NSUInteger, WYPopoverAnimationOptions) {
WYPopoverAnimationOptionFade = 1UL << 0, // default
WYPopoverAnimationOptionScale = 1UL << 1,
WYPopoverAnimationOptionFadeWithScale = WYPopoverAnimationOptionFade | WYPopoverAnimationOptionScale
WYPopoverAnimationOptionFade = 1UL << 0, // default
WYPopoverAnimationOptionScale = 1UL << 1,
WYPopoverAnimationOptionFadeWithScale = WYPopoverAnimationOptionFade | WYPopoverAnimationOptionScale
};
////////////////////////////////////////////////////////////////////////////////////////////////////////
@interface WYPopoverBackgroundView : UIView
@property (nonatomic, strong) NSNumber *usesRoundedArrow UI_APPEARANCE_SELECTOR;
@property (nonatomic, strong) NSNumber *adjustsTintColor UI_APPEARANCE_SELECTOR;
@property (nonatomic, strong) UIColor *tintColor UI_APPEARANCE_SELECTOR;
@property (nonatomic, strong) UIColor *fillTopColor UI_APPEARANCE_SELECTOR;
@property (nonatomic, strong) UIColor *fillBottomColor UI_APPEARANCE_SELECTOR;
// UI_APPEARANCE_SELECTOR doesn't support BOOLs on iOS 7,
// so these two need to be NSUInteger instead
@property (nonatomic, assign) NSUInteger usesRoundedArrow UI_APPEARANCE_SELECTOR;
@property (nonatomic, assign) NSUInteger dimsBackgroundViewsTintColor UI_APPEARANCE_SELECTOR;
@property (nonatomic, strong) UIColor *glossShadowColor UI_APPEARANCE_SELECTOR;
@property (nonatomic, assign) CGSize glossShadowOffset UI_APPEARANCE_SELECTOR;
@property (nonatomic, assign) NSUInteger glossShadowBlurRadius UI_APPEARANCE_SELECTOR;
@property (nonatomic, strong) UIColor *tintColor UI_APPEARANCE_SELECTOR;
@property (nonatomic, strong) UIColor *fillTopColor UI_APPEARANCE_SELECTOR;
@property (nonatomic, strong) UIColor *fillBottomColor UI_APPEARANCE_SELECTOR;
@property (nonatomic, assign) NSUInteger borderWidth UI_APPEARANCE_SELECTOR;
@property (nonatomic, assign) NSUInteger arrowBase UI_APPEARANCE_SELECTOR;
@property (nonatomic, assign) NSUInteger arrowHeight UI_APPEARANCE_SELECTOR;
@property (nonatomic, strong) UIColor *glossShadowColor UI_APPEARANCE_SELECTOR;
@property (nonatomic, assign) CGSize glossShadowOffset UI_APPEARANCE_SELECTOR;
@property (nonatomic, assign) NSUInteger glossShadowBlurRadius UI_APPEARANCE_SELECTOR;
@property (nonatomic, strong) UIColor *outerShadowColor UI_APPEARANCE_SELECTOR;
@property (nonatomic, strong) UIColor *outerStrokeColor UI_APPEARANCE_SELECTOR;
@property (nonatomic, assign) NSUInteger outerShadowBlurRadius UI_APPEARANCE_SELECTOR;
@property (nonatomic, assign) CGSize outerShadowOffset UI_APPEARANCE_SELECTOR;
@property (nonatomic, assign) NSUInteger outerCornerRadius UI_APPEARANCE_SELECTOR;
@property (nonatomic, assign) NSUInteger minOuterCornerRadius UI_APPEARANCE_SELECTOR;
@property (nonatomic, assign) NSUInteger borderWidth UI_APPEARANCE_SELECTOR;
@property (nonatomic, assign) NSUInteger arrowBase UI_APPEARANCE_SELECTOR;
@property (nonatomic, assign) NSUInteger arrowHeight UI_APPEARANCE_SELECTOR;
@property (nonatomic, strong) UIColor *innerShadowColor UI_APPEARANCE_SELECTOR;
@property (nonatomic, strong) UIColor *innerStrokeColor UI_APPEARANCE_SELECTOR;
@property (nonatomic, assign) NSUInteger innerShadowBlurRadius UI_APPEARANCE_SELECTOR;
@property (nonatomic, assign) CGSize innerShadowOffset UI_APPEARANCE_SELECTOR;
@property (nonatomic, assign) NSUInteger innerCornerRadius UI_APPEARANCE_SELECTOR;
@property (nonatomic, strong) UIColor *outerShadowColor UI_APPEARANCE_SELECTOR;
@property (nonatomic, strong) UIColor *outerStrokeColor UI_APPEARANCE_SELECTOR;
@property (nonatomic, assign) NSUInteger outerShadowBlurRadius UI_APPEARANCE_SELECTOR;
@property (nonatomic, assign) CGSize outerShadowOffset UI_APPEARANCE_SELECTOR;
@property (nonatomic, assign) NSUInteger outerCornerRadius UI_APPEARANCE_SELECTOR;
@property (nonatomic, assign) NSUInteger minOuterCornerRadius UI_APPEARANCE_SELECTOR;
@property (nonatomic, assign) UIEdgeInsets viewContentInsets UI_APPEARANCE_SELECTOR;
@property (nonatomic, strong) UIColor *innerShadowColor UI_APPEARANCE_SELECTOR;
@property (nonatomic, strong) UIColor *innerStrokeColor UI_APPEARANCE_SELECTOR;
@property (nonatomic, assign) NSUInteger innerShadowBlurRadius UI_APPEARANCE_SELECTOR;
@property (nonatomic, assign) CGSize innerShadowOffset UI_APPEARANCE_SELECTOR;
@property (nonatomic, assign) NSUInteger innerCornerRadius UI_APPEARANCE_SELECTOR;
@property (nonatomic, strong) UIColor *overlayColor UI_APPEARANCE_SELECTOR;
@property (nonatomic, assign) UIEdgeInsets viewContentInsets UI_APPEARANCE_SELECTOR;
@property (nonatomic, strong) UIColor *overlayColor UI_APPEARANCE_SELECTOR;
@property(nonatomic) CGFloat preferredAlpha UI_APPEARANCE_SELECTOR;
@end
@ -97,16 +102,21 @@ typedef NS_OPTIONS(NSUInteger, WYPopoverAnimationOptions) {
@property (nonatomic, weak) id <WYPopoverControllerDelegate> delegate;
@property (nonatomic, assign) BOOL dismissOnTap;
@property (nonatomic, copy) NSArray *passthroughViews;
@property (nonatomic, assign) BOOL dismissOnPassthroughViewTap;
@property (nonatomic, assign) BOOL wantsDefaultContentAppearance;
@property (nonatomic, assign) UIEdgeInsets popoverLayoutMargins;
@property (nonatomic, readonly, getter=isPopoverVisible) BOOL popoverVisible;
@property (nonatomic, strong, readonly) UIViewController *contentViewController;
@property (nonatomic, assign) CGSize popoverContentSize;
@property (nonatomic, assign) float animationDuration;
@property (nonatomic, assign) BOOL implicitAnimationsDisabled;
@property (nonatomic, strong) WYPopoverTheme *theme;
@property (nonatomic, copy) void (^dismissCompletionBlock)(WYPopoverController *dimissedController);
+ (void)setDefaultTheme:(WYPopoverTheme *)theme;
+ (WYPopoverTheme *)defaultTheme;
@ -195,6 +205,11 @@ typedef NS_OPTIONS(NSUInteger, WYPopoverAnimationOptions) {
options:(WYPopoverAnimationOptions)aOptions
completion:(void (^)(void))completion;
// Misc
- (void)setPopoverContentSize:(CGSize)size animated:(BOOL)animated;
- (void)performWithoutAnimation:(void (^)(void))aBlock;
@end
////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -220,8 +235,11 @@ typedef NS_OPTIONS(NSUInteger, WYPopoverAnimationOptions) {
@interface WYPopoverTheme : NSObject
@property (nonatomic, strong) NSNumber *usesRoundedArrow;
@property (nonatomic, strong) NSNumber *adjustsTintColor;
// These two can be BOOLs, because implicit casting
// between BOOLs and NSUIntegers works fine
@property (nonatomic, assign) BOOL usesRoundedArrow;
@property (nonatomic, assign) BOOL dimsBackgroundViewsTintColor;
@property (nonatomic, strong) UIColor *tintColor;
@property (nonatomic, strong) UIColor *fillTopColor;
@property (nonatomic, strong) UIColor *fillBottomColor;
@ -251,6 +269,8 @@ typedef NS_OPTIONS(NSUInteger, WYPopoverAnimationOptions) {
@property (nonatomic, strong) UIColor *overlayColor;
@property (nonatomic) CGFloat preferredAlpha;
+ (instancetype)theme;
+ (instancetype)themeForIOS6;
+ (instancetype)themeForIOS7;

View file

@ -1,5 +1,5 @@
/*
Version 0.2.2
Version 0.3.6
WYPopoverController is available under the MIT license.

View file

@ -1,5 +1,5 @@
/*
Version 0.2.2
Version 0.3.6
WYPopoverController is available under the MIT license.
@ -30,11 +30,11 @@
@interface WYStoryboardPopoverSegue()
{
WYPopoverController *popoverController;
id sender;
WYPopoverArrowDirection arrowDirections;
WYPopoverAnimationOptions options;
BOOL animated;
WYPopoverController *_popoverController;
id _sender;
WYPopoverArrowDirection _arrowDirections;
WYPopoverAnimationOptions _options;
BOOL _animated;
}
@end
@ -45,32 +45,32 @@
- (void)perform
{
if ([sender isKindOfClass:[UIBarButtonItem class]])
{
[popoverController presentPopoverFromBarButtonItem:(UIBarButtonItem*)sender
permittedArrowDirections:arrowDirections
animated:animated
options:options];
}
else
{
UIView *view = (UIView *)sender;
[popoverController presentPopoverFromRect:view.bounds
inView:view
permittedArrowDirections:arrowDirections
animated:animated
options:options];
}
if ([_sender isKindOfClass:[UIBarButtonItem class]])
{
[_popoverController presentPopoverFromBarButtonItem:(UIBarButtonItem*)_sender
permittedArrowDirections:_arrowDirections
animated:_animated
options:_options];
}
else
{
UIView *view = (UIView *)_sender;
[_popoverController presentPopoverFromRect:view.bounds
inView:view
permittedArrowDirections:_arrowDirections
animated:_animated
options:_options];
}
}
- (WYPopoverController *)popoverControllerWithSender:(id)aSender
permittedArrowDirections:(WYPopoverArrowDirection)aArrowDirections
animated:(BOOL)aAnimated
{
return [self popoverControllerWithSender:aSender
permittedArrowDirections:aArrowDirections
animated:aAnimated
options:WYPopoverAnimationOptionFade];
return [self popoverControllerWithSender:aSender
permittedArrowDirections:aArrowDirections
animated:aAnimated
options:WYPopoverAnimationOptionFade];
}
- (WYPopoverController *)popoverControllerWithSender:(id)aSender
@ -78,20 +78,20 @@
animated:(BOOL)aAnimated
options:(WYPopoverAnimationOptions)aOptions
{
sender = aSender;
arrowDirections = aArrowDirections;
animated = aAnimated;
options = aOptions;
popoverController = [[WYPopoverController alloc] initWithContentViewController:self.destinationViewController];
return popoverController;
_sender = aSender;
_arrowDirections = aArrowDirections;
_animated = aAnimated;
_options = aOptions;
_popoverController = [[WYPopoverController alloc] initWithContentViewController:self.destinationViewController];
return _popoverController;
}
- (void)dealloc
{
sender = nil;
popoverController = nil;
_sender = nil;
_popoverController = nil;
}
@end

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6250" systemVersion="14B25" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6751" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6244"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6736"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="AddSiteViewController">