mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
#1655 (up/down keys no longer working)
This commit is contained in:
parent
facc8c375f
commit
f954bb1d75
6 changed files with 39 additions and 3 deletions
|
@ -10,6 +10,7 @@
|
|||
- (void)informLoadingMessage:(NSString *)message;
|
||||
|
||||
- (void)addKeyCommandWithInput:(NSString *)input modifierFlags:(UIKeyModifierFlags)modifierFlags action:(SEL)action discoverabilityTitle:(NSString *)discoverabilityTitle;
|
||||
- (void)addKeyCommandWithInput:(NSString *)input modifierFlags:(UIKeyModifierFlags)modifierFlags action:(SEL)action discoverabilityTitle:(NSString *)discoverabilityTitle wantPriority:(BOOL)wantPriority;
|
||||
- (void)addCancelKeyCommandWithAction:(SEL)action discoverabilityTitle:(NSString *)discoverabilityTitle;
|
||||
|
||||
- (void)updateTheme;
|
||||
|
|
|
@ -103,9 +103,16 @@
|
|||
#pragma mark -
|
||||
#pragma mark Keyboard support
|
||||
- (void)addKeyCommandWithInput:(NSString *)input modifierFlags:(UIKeyModifierFlags)modifierFlags action:(SEL)action discoverabilityTitle:(NSString *)discoverabilityTitle {
|
||||
[self addKeyCommandWithInput:input modifierFlags:modifierFlags action:action discoverabilityTitle:discoverabilityTitle wantPriority:NO];
|
||||
}
|
||||
|
||||
- (void)addKeyCommandWithInput:(NSString *)input modifierFlags:(UIKeyModifierFlags)modifierFlags action:(SEL)action discoverabilityTitle:(NSString *)discoverabilityTitle wantPriority:(BOOL)wantPriority {
|
||||
UIKeyCommand *keyCommand = [UIKeyCommand keyCommandWithInput:input modifierFlags:modifierFlags action:action];
|
||||
if ([keyCommand respondsToSelector:@selector(discoverabilityTitle)] && [self respondsToSelector:@selector(addKeyCommand:)]) {
|
||||
keyCommand.discoverabilityTitle = discoverabilityTitle;
|
||||
if (@available(iOS 15.0, *)) {
|
||||
keyCommand.wantsPriorityOverSystemBehavior = wantPriority;
|
||||
}
|
||||
[self addKeyCommand:keyCommand];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -229,9 +229,9 @@
|
|||
|
||||
_orientation = self.view.window.windowScene.interfaceOrientation;
|
||||
|
||||
[self addKeyCommandWithInput:UIKeyInputDownArrow modifierFlags:0 action:@selector(changeToNextPage:) discoverabilityTitle:@"Next Story"];
|
||||
[self addKeyCommandWithInput:UIKeyInputDownArrow modifierFlags:0 action:@selector(changeToNextPage:) discoverabilityTitle:@"Next Story" wantPriority:YES];
|
||||
[self addKeyCommandWithInput:@"j" modifierFlags:0 action:@selector(changeToNextPage:) discoverabilityTitle:@"Next Story"];
|
||||
[self addKeyCommandWithInput:UIKeyInputUpArrow modifierFlags:0 action:@selector(changeToPreviousPage:) discoverabilityTitle:@"Previous Story"];
|
||||
[self addKeyCommandWithInput:UIKeyInputUpArrow modifierFlags:0 action:@selector(changeToPreviousPage:) discoverabilityTitle:@"Previous Story" wantPriority:YES];
|
||||
[self addKeyCommandWithInput:@"k" modifierFlags:0 action:@selector(changeToPreviousPage:) discoverabilityTitle:@"Previous Story"];
|
||||
[self addKeyCommandWithInput:@"\r" modifierFlags:UIKeyModifierShift action:@selector(toggleTextView:) discoverabilityTitle:@"Text View"];
|
||||
[self addKeyCommandWithInput:@" " modifierFlags:0 action:@selector(scrollPageDown:) discoverabilityTitle:@"Page Down"];
|
||||
|
|
|
@ -24,3 +24,9 @@ void drawLinearGradient(CGContextRef context, CGRect rect, CGColorRef startColor
|
|||
+ (NSString *)formatShortDateFromTimestamp:(NSInteger)timestamp;
|
||||
|
||||
@end
|
||||
|
||||
@interface UIResponder (FirstResponder)
|
||||
|
||||
+(id)currentFirstResponder;
|
||||
|
||||
@end
|
||||
|
|
|
@ -263,3 +263,25 @@ void drawLinearGradient(CGContextRef context, CGRect rect, CGColorRef startColor
|
|||
*/
|
||||
|
||||
@end
|
||||
|
||||
|
||||
static __weak id currentFirstResponder;
|
||||
|
||||
@implementation UIResponder (FirstResponder)
|
||||
|
||||
/**
|
||||
This is primarily as a debugging aid.
|
||||
*/
|
||||
|
||||
+(id)currentFirstResponder {
|
||||
currentFirstResponder = nil;
|
||||
[[UIApplication sharedApplication] sendAction:@selector(findFirstResponder:) to:nil from:nil forEvent:nil];
|
||||
return currentFirstResponder;
|
||||
}
|
||||
|
||||
-(void)findFirstResponder:(id)sender {
|
||||
currentFirstResponder = self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<objects>
|
||||
<viewController storyboardIdentifier="DetailViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="djW-7k-haK" customClass="DetailViewController" customModule="NewsBlur" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jTZ-4O-xyT">
|
||||
<rect key="frame" x="0.0" y="0.0" width="1194" height="834"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="818.5" height="834"/>
|
||||
<subviews>
|
||||
<containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="bPa-u1-Aml">
|
||||
<rect key="frame" x="0.0" y="74" width="1194" height="580"/>
|
||||
|
|
Loading…
Add table
Reference in a new issue