Skip to content

Commit

Permalink
#1247 (Mac Catalyst edition)
Browse files Browse the repository at this point in the history
- Added Mute, Organize, Widget Sites etc commands to the File menu.
- Added Columns, Text Size, and Spacing commands to the View menu.
- Investigated nav bar theming; appears to be outside scope of window.
- Investigated menu disabling; WIP.
  • Loading branch information
Dejal committed Dec 13, 2023
1 parent 377e2b1 commit e7c5377
Show file tree
Hide file tree
Showing 6 changed files with 244 additions and 6 deletions.
14 changes: 14 additions & 0 deletions clients/ios/Classes/FeedDetailObjCViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -3125,6 +3125,16 @@ - (void)updateTheme {
[self reload];
}

//- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
// NSLog(@"canPerformAction: %@ withSender: %@", NSStringFromSelector(action), sender); // log
//
// if (action == @selector(deleteSite:)) {
// return NO;
// }
//
// return YES;
//}

#pragma mark -
#pragma mark Story Actions - save

Expand Down Expand Up @@ -3184,6 +3194,10 @@ - (IBAction)instafetchFeed {
}
}

- (IBAction)deleteSite:(id)sender {
//TODO
}

#pragma mark -
#pragma mark PullToRefresh

Expand Down
13 changes: 13 additions & 0 deletions clients/ios/Classes/FeedsObjCViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,22 @@ UIGestureRecognizerDelegate, UISearchBarDelegate> {
- (void)didSelectSectionHeader:(UIButton *)button;
- (void)didSelectSectionHeaderWithTag:(NSInteger)tag;
- (void)selectNextFolderOrFeed;

- (IBAction)reloadFeeds:(id)sender;
- (IBAction)selectIntelligence;
- (IBAction)showMuteSites:(id)sender;
- (IBAction)showOrganizeSites:(id)sender;
- (IBAction)showWidgetSites:(id)sender;
- (IBAction)showNotifications:(id)sender;
- (IBAction)showFindFriends:(id)sender;
- (IBAction)showPremium:(id)sender;
- (IBAction)showSupportForum:(id)sender;
- (IBAction)showLogout:(id)sender;
- (IBAction)chooseColumns:(id)sender;
- (IBAction)chooseFontSize:(id)sender;
- (IBAction)chooseSpacing:(id)sender;
- (IBAction)chooseTheme:(id)sender;

- (void)markFeedRead:(NSString *)feedId cutoffDays:(NSInteger)days;
- (void)markFeedsRead:(NSArray *)feedIds cutoffDays:(NSInteger)days;
- (void)markEverythingReadWithDays:(NSInteger)days;
Expand Down
70 changes: 70 additions & 0 deletions clients/ios/Classes/FeedsObjCViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -2864,6 +2864,76 @@ - (void)finishRefreshingFeedList:(NSDictionary *)results feedId:(NSString *)feed
});
}

//- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
// NSLog(@"canPerformAction: %@ withSender: %@", NSStringFromSelector(action, sender); // log
// return YES;
//}

- (IBAction)showMuteSites:(id)sender {
[self.appDelegate showMuteSites];
}

- (IBAction)showOrganizeSites:(id)sender {
[self.appDelegate showOrganizeSites];
}

- (IBAction)showWidgetSites:(id)sender {
[self.appDelegate showWidgetSites];
}

- (IBAction)showNotifications:(id)sender {
[self.appDelegate openNotificationsWithFeed:nil];
}

- (IBAction)showFindFriends:(id)sender {
[self.appDelegate showFindFriends];
}

- (IBAction)showPremium:(id)sender {
[self.appDelegate showPremiumDialog];
}

- (IBAction)showSupportForum:(id)sender {
NSURL *url = [NSURL URLWithString:@"https://forum.newsblur.com"];
[[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];
}

- (IBAction)showLogout:(id)sender {
[self.appDelegate confirmLogout];
}

- (IBAction)chooseColumns:(id)sender {
UICommand *command = sender;
NSString *string = command.propertyList;

[[NSUserDefaults standardUserDefaults] setObject:string forKey:@"split_behavior"];

[UIView animateWithDuration:0.5 animations:^{
[self.appDelegate updateSplitBehavior:YES];
}];

[self.appDelegate.detailViewController updateLayoutWithReload:NO fetchFeeds:YES];
}

- (IBAction)chooseFontSize:(id)sender {
UICommand *command = sender;
NSString *string = command.propertyList;

[[NSUserDefaults standardUserDefaults] setObject:string forKey:@"feed_list_font_size"];

[self.appDelegate resizeFontSize];
}

- (IBAction)chooseSpacing:(id)sender {
UICommand *command = sender;
NSString *string = command.propertyList;

[[NSUserDefaults standardUserDefaults] setObject:string forKey:@"feed_list_spacing"];

[self reloadFeedTitlesTable];
[self.appDelegate.feedDetailViewController reloadWithSizing];
}

- (IBAction)chooseTheme:(id)sender {
UICommand *command = sender;
NSString *string = command.propertyList;
Expand Down
1 change: 0 additions & 1 deletion clients/ios/Classes/NewsBlurAppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,6 @@ SFSafariViewControllerDelegate> {
- (void)showPopoverWithViewController:(UIViewController *)viewController contentSize:(CGSize)contentSize barButtonItem:(UIBarButtonItem *)barButtonItem;
- (void)showPopoverWithViewController:(UIViewController *)viewController contentSize:(CGSize)contentSize sourceView:(UIView *)sourceView sourceRect:(CGRect)sourceRect;
- (void)showPopoverWithViewController:(UIViewController *)viewController contentSize:(CGSize)contentSize sourceView:(UIView *)sourceView sourceRect:(CGRect)sourceRect permittedArrowDirections:(UIPopoverArrowDirection)permittedArrowDirections;
//- (void)showPopoverWithViewController:(UIViewController *)viewController contentSize:(CGSize)contentSize sourceNavigationController:(UINavigationController *)sourceNavigationController barButtonItem:(UIBarButtonItem *)barButtonItem sourceView:(UIView *)sourceView sourceRect:(CGRect)sourceRect permittedArrowDirections:(UIPopoverArrowDirection)permittedArrowDirections;

- (void)hidePopoverAnimated:(BOOL)animated completion:(void (^)(void))completion;
- (BOOL)hidePopoverAnimated:(BOOL)animated;
Expand Down
6 changes: 1 addition & 5 deletions clients/ios/Classes/NewsBlurAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -3320,11 +3320,7 @@ - (void)showPopoverWithViewController:(UIViewController *)viewController content
[self showPopoverWithViewController:viewController contentSize:contentSize barButtonItem:nil sourceView:sourceView sourceRect:sourceRect permittedArrowDirections:permittedArrowDirections];
}

//- (void)showPopoverWithViewController:(UIViewController *)viewController contentSize:(CGSize)contentSize barButtonItem:(UIBarButtonItem *)barButtonItem sourceView:(UIView *)sourceView sourceRect:(CGRect)sourceRect permittedArrowDirections:(UIPopoverArrowDirection)permittedArrowDirections {
// [self showPopoverWithViewController:viewController contentSize:contentSize sourceNavigationController:self.navigationControllerForPopover barButtonItem:barButtonItem sourceView:sourceView sourceRect:sourceRect permittedArrowDirections:permittedArrowDirections];
//}

- (void)showPopoverWithViewController:(UIViewController *)viewController contentSize:(CGSize)contentSize /*sourceNavigationController:(UINavigationController *)sourceNavigationController*/ barButtonItem:(UIBarButtonItem *)barButtonItem sourceView:(UIView *)sourceView sourceRect:(CGRect)sourceRect permittedArrowDirections:(UIPopoverArrowDirection)permittedArrowDirections {
- (void)showPopoverWithViewController:(UIViewController *)viewController contentSize:(CGSize)contentSize barButtonItem:(UIBarButtonItem *)barButtonItem sourceView:(UIView *)sourceView sourceRect:(CGRect)sourceRect permittedArrowDirections:(UIPopoverArrowDirection)permittedArrowDirections {
if (viewController == self.navigationControllerForPopover.presentedViewController) {
return; // nothing to do, already showing this controller
}
Expand Down
146 changes: 146 additions & 0 deletions clients/ios/Resources/MainInterface.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,67 @@
</command>
</children>
</menu>
<menu anchor="com.apple.menu.document" id="6cc-W3-a06">
<menuOptions key="menuOptions" displayInline="YES"/>
<children>
<command title="Mute Sites" input="M" id="M7P-gv-spA">
<keyModifierFlags key="modifierFlags" command="YES"/>
<connections>
<action selector="showMuteSites:" destination="J28-e1-gcC" id="sE9-iR-0dr"/>
</connections>
</command>
<command title="Organize Sites" input="O" id="Wte-kG-AH2">
<keyModifierFlags key="modifierFlags" command="YES"/>
<connections>
<action selector="showOrganizeSites:" destination="J28-e1-gcC" id="9cl-DR-gBb"/>
</connections>
</command>
<command title="Widget Sites" input="W" id="4CD-Pc-fDT">
<keyModifierFlags key="modifierFlags" command="YES"/>
<connections>
<action selector="showWidgetSites:" destination="J28-e1-gcC" id="V7w-If-8Cv"/>
</connections>
</command>
</children>
</menu>
<menu anchor="com.apple.menu.document" id="obB-Ib-5UM">
<menuOptions key="menuOptions" displayInline="YES"/>
<children>
<command title="Notifications" input="N" id="2ax-3D-3zm">
<keyModifierFlags key="modifierFlags" command="YES"/>
<connections>
<action selector="showNotifications:" destination="J28-e1-gcC" id="GHY-vF-j44"/>
</connections>
</command>
<command title="Find Friends" input="F" id="0eN-vR-Gok">
<keyModifierFlags key="modifierFlags" command="YES"/>
<connections>
<action selector="showFindFriends:" destination="J28-e1-gcC" id="b0r-KD-HkV"/>
</connections>
</command>
</children>
</menu>
<menu anchor="com.apple.menu.document" id="WdP-hc-0fU">
<menuOptions key="menuOptions" displayInline="YES"/>
<children>
<command title="NewsBlur Premium" id="HGH-9Q-Dzh">
<connections>
<action selector="showPremium:" destination="J28-e1-gcC" id="adm-3i-APm"/>
</connections>
</command>
</children>
</menu>
<menu anchor="com.apple.menu.document" id="cRW-qu-7aj">
<menuOptions key="menuOptions" displayInline="YES"/>
<children>
<command title="Logout NewsBlur" input="L" id="kvb-M9-tEl">
<keyModifierFlags key="modifierFlags" command="YES"/>
<connections>
<action selector="showLogout:" destination="J28-e1-gcC" id="wkE-Rx-OAt"/>
</connections>
</command>
</children>
</menu>
<menu isSystemItem="YES" title="Print" identifier="com.apple.menu.print" id="L8Z-gR-6rG">
<menuOptions key="menuOptions" displayInline="YES"/>
<systemMenuChildDeletions>
Expand All @@ -282,6 +343,82 @@
</menu>
<menu isSystemItem="YES" title="View" identifier="com.apple.menu.view" id="pdl-gx-X6C">
<children>
<menu title="Columns" id="Zsw-UK-Yxk">
<children>
<command title="Automatic" propertyListString="auto" input="4" id="6Vl-Xq-5Ko">
<keyModifierFlags key="modifierFlags" option="YES" command="YES"/>
<connections>
<action selector="chooseColumns:" destination="J28-e1-gcC" id="vNz-nO-9sE"/>
</connections>
</command>
<command title="Three" propertyListString="tile" input="3" id="UGQ-RS-mbs">
<keyModifierFlags key="modifierFlags" option="YES" command="YES"/>
<connections>
<action selector="chooseColumns:" destination="J28-e1-gcC" id="ihd-Wz-zxe"/>
</connections>
</command>
<command title="Two" propertyListString="displace" input="2" id="coF-9M-sfo">
<keyModifierFlags key="modifierFlags" option="YES" command="YES"/>
<connections>
<action selector="chooseColumns:" destination="J28-e1-gcC" id="ejV-aM-O5L"/>
</connections>
</command>
<command title="One" propertyListString="overlay" input="1" id="uQ4-TQ-9rv">
<keyModifierFlags key="modifierFlags" option="YES" command="YES"/>
<connections>
<action selector="chooseColumns:" destination="J28-e1-gcC" id="hwz-R7-v1M"/>
</connections>
</command>
</children>
</menu>
<menu title="Text Size" id="si2-4b-JdU">
<children>
<command title="Extra Small" propertyListString="xs" input="5" id="1J1-HG-ovw">
<keyModifierFlags key="modifierFlags" option="YES" command="YES"/>
<connections>
<action selector="chooseFontSize:" destination="J28-e1-gcC" id="Fq4-fK-3Bs"/>
</connections>
</command>
<command title="Small" propertyListString="small" input="6" id="M7K-32-93Q">
<keyModifierFlags key="modifierFlags" option="YES" command="YES"/>
<connections>
<action selector="chooseFontSize:" destination="J28-e1-gcC" id="syn-70-bmd"/>
</connections>
</command>
<command title="Medium" propertyListString="medium" input="7" id="EOM-3c-Cjp">
<keyModifierFlags key="modifierFlags" option="YES" command="YES"/>
<connections>
<action selector="chooseFontSize:" destination="J28-e1-gcC" id="Qe4-E0-Qhz"/>
</connections>
</command>
<command title="Large" propertyListString="large" input="8" id="PWP-X9-KBw">
<keyModifierFlags key="modifierFlags" option="YES" command="YES"/>
<connections>
<action selector="chooseFontSize:" destination="J28-e1-gcC" id="Lnl-mp-hOV"/>
</connections>
</command>
<command title="Extra Large" propertyListString="xl" input="9" id="yfW-eZ-Rax">
<keyModifierFlags key="modifierFlags" option="YES" command="YES"/>
<connections>
<action selector="chooseFontSize:" destination="J28-e1-gcC" id="cl8-ay-saj"/>
</connections>
</command>
</children>
</menu>
<menu title="Spacing" id="MQ7-6f-UwT">
<children>
<command title="Compact" propertyListString="compact" id="FEf-Wk-caC">
<connections>
<action selector="chooseSpacing:" destination="J28-e1-gcC" id="qx2-aa-FAd"/>
</connections>
</command>
<command title="Comfortable" propertyListString="comfortable" id="A5r-hu-lBP">
<connections>
<action selector="chooseSpacing:" destination="J28-e1-gcC" id="Idm-Ge-25T"/>
</connections>
</command>
</children>
</menu>
<menu title="Theme" id="k0L-se-kpA">
<menuOptions key="menuOptions" singleSelection="YES"/>
<children>
Expand Down Expand Up @@ -401,6 +538,15 @@
</command>
</children>
</menu>
<menu isSystemItem="YES" title="Help" identifier="com.apple.menu.help" id="2fJ-ya-vwD">
<children>
<command title="Support Forum" anchorAction="showHelp:" id="eDw-yh-3PE">
<connections>
<action selector="showSupportForum:" destination="J28-e1-gcC" id="sW1-ne-jja"/>
</connections>
</command>
</children>
</menu>
</children>
<systemMenuChildDeletions>
<menuDeletion anchor="com.apple.menu.format"/>
Expand Down

0 comments on commit e7c5377

Please sign in to comment.