mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
#1238 (statistics)
- Added Statistics to the preferences for the left swipe in the feeds list. - A bit of refactoring to support displaying the popover from a cell on iPad.
This commit is contained in:
parent
617ec8e45c
commit
ed30ad75e2
7 changed files with 54 additions and 23 deletions
|
@ -2500,11 +2500,7 @@ didEndSwipingSwipingWithState:(MCSwipeTableViewCellState)state
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)openStatisticsWithFeed:(NSString *)feedId {
|
- (void)openStatisticsWithFeed:(NSString *)feedId {
|
||||||
NSString *urlString = [NSString stringWithFormat:@"%@/rss_feeds/statistics_embedded/%@", appDelegate.url, feedId];
|
[appDelegate openStatisticsWithFeed:feedId sender:settingsBarButton];
|
||||||
NSURL *url = [NSURL URLWithString:urlString];
|
|
||||||
NSString *title = appDelegate.storiesCollection.activeFeed[@"feed_title"];
|
|
||||||
|
|
||||||
[appDelegate showInAppBrowser:url withCustomTitle:title fromBarButtonItem:settingsBarButton];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)openRenameSite {
|
- (void)openRenameSite {
|
||||||
|
|
|
@ -90,12 +90,21 @@ static UIFont *textFont = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults];
|
NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults];
|
||||||
BOOL isNotifications = [[preferences stringForKey:@"feed_swipe_left"]
|
NSString *swipe = [preferences stringForKey:@"feed_swipe_left"];
|
||||||
isEqualToString:@"notifications"];
|
NSString *iconName;
|
||||||
|
|
||||||
|
if (self.isSocial) {
|
||||||
|
iconName = @"menu_icn_fetch_subscribers.png";
|
||||||
|
} else if ([swipe isEqualToString:@"notifications"]) {
|
||||||
|
iconName = @"menu_icn_notifications.png";
|
||||||
|
} else if ([swipe isEqualToString:@"statistics"]) {
|
||||||
|
iconName = @"menu_icn_statistics.png";
|
||||||
|
} else {
|
||||||
|
iconName = @"train.png";
|
||||||
|
}
|
||||||
|
|
||||||
[self setDelegate:(NewsBlurViewController <MCSwipeTableViewCellDelegate> *)appDelegate.feedsViewController];
|
[self setDelegate:(NewsBlurViewController <MCSwipeTableViewCellDelegate> *)appDelegate.feedsViewController];
|
||||||
[self setFirstStateIconName:(self.isSocial ? @"menu_icn_fetch_subscribers.png" :
|
[self setFirstStateIconName:(iconName)
|
||||||
isNotifications ? @"menu_icn_notifications.png" :
|
|
||||||
@"train.png")
|
|
||||||
firstColor:UIColorFromRGB(0xA4D97B)
|
firstColor:UIColorFromRGB(0xA4D97B)
|
||||||
secondStateIconName:nil
|
secondStateIconName:nil
|
||||||
secondColor:nil
|
secondColor:nil
|
||||||
|
|
|
@ -321,6 +321,7 @@ SFSafariViewControllerDelegate> {
|
||||||
- (void)openNotificationsWithFeed:(NSString *)feedId sender:(id)sender;
|
- (void)openNotificationsWithFeed:(NSString *)feedId sender:(id)sender;
|
||||||
- (void)updateNotifications:(NSDictionary *)params feed:(NSString *)feedId;
|
- (void)updateNotifications:(NSDictionary *)params feed:(NSString *)feedId;
|
||||||
- (void)checkForFeedNotifications;
|
- (void)checkForFeedNotifications;
|
||||||
|
- (void)openStatisticsWithFeed:(NSString *)feedId sender:(id)sender;
|
||||||
- (void)openTrainSiteWithFeedLoaded:(BOOL)feedLoaded from:(id)sender;
|
- (void)openTrainSiteWithFeedLoaded:(BOOL)feedLoaded from:(id)sender;
|
||||||
- (void)openTrainStory:(id)sender;
|
- (void)openTrainStory:(id)sender;
|
||||||
- (void)openUserTagsStory:(id)sender;
|
- (void)openUserTagsStory:(id)sender;
|
||||||
|
@ -357,7 +358,7 @@ SFSafariViewControllerDelegate> {
|
||||||
- (void)reloadFeedsView:(BOOL)showLoader;
|
- (void)reloadFeedsView:(BOOL)showLoader;
|
||||||
- (void)setTitle:(NSString *)title;
|
- (void)setTitle:(NSString *)title;
|
||||||
- (void)showOriginalStory:(NSURL *)url;
|
- (void)showOriginalStory:(NSURL *)url;
|
||||||
- (void)showInAppBrowser:(NSURL *)url withCustomTitle:(NSString *)customTitle fromBarButtonItem:(UIBarButtonItem *)barButtonItem;
|
- (void)showInAppBrowser:(NSURL *)url withCustomTitle:(NSString *)customTitle fromSender:(id)sender;
|
||||||
- (void)showSafariViewControllerWithURL:(NSURL *)url useReader:(BOOL)useReader;
|
- (void)showSafariViewControllerWithURL:(NSURL *)url useReader:(BOOL)useReader;
|
||||||
- (void)closeOriginalStory;
|
- (void)closeOriginalStory;
|
||||||
- (void)hideStoryDetailView;
|
- (void)hideStoryDetailView;
|
||||||
|
|
|
@ -1272,6 +1272,15 @@
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)openStatisticsWithFeed:(NSString *)feedId sender:(id)sender {
|
||||||
|
NSString *urlString = [NSString stringWithFormat:@"%@/rss_feeds/statistics_embedded/%@", self.url, feedId];
|
||||||
|
NSURL *url = [NSURL URLWithString:urlString];
|
||||||
|
NSDictionary *feed = self.dictFeeds[feedId];
|
||||||
|
NSString *title = feed[@"feed_title"];
|
||||||
|
|
||||||
|
[self showInAppBrowser:url withCustomTitle:title fromSender:sender];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)openUserTagsStory:(id)sender {
|
- (void)openUserTagsStory:(id)sender {
|
||||||
if (!self.userTagsViewController) {
|
if (!self.userTagsViewController) {
|
||||||
self.userTagsViewController = [[UserTagsViewController alloc] init];
|
self.userTagsViewController = [[UserTagsViewController alloc] init];
|
||||||
|
@ -2066,11 +2075,11 @@
|
||||||
} else if ([storyBrowser isEqualToString:@"inappsafarireader"]) {
|
} else if ([storyBrowser isEqualToString:@"inappsafarireader"]) {
|
||||||
[self showSafariViewControllerWithURL:url useReader:YES];
|
[self showSafariViewControllerWithURL:url useReader:YES];
|
||||||
} else {
|
} else {
|
||||||
[self showInAppBrowser:url withCustomTitle:nil fromBarButtonItem:nil];
|
[self showInAppBrowser:url withCustomTitle:nil fromSender:nil];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)showInAppBrowser:(NSURL *)url withCustomTitle:(NSString *)customTitle fromBarButtonItem:(UIBarButtonItem *)barButtonItem {
|
- (void)showInAppBrowser:(NSURL *)url withCustomTitle:(NSString *)customTitle fromSender:(id)sender {
|
||||||
if (!originalStoryViewController) {
|
if (!originalStoryViewController) {
|
||||||
originalStoryViewController = [[OriginalStoryViewController alloc] init];
|
originalStoryViewController = [[OriginalStoryViewController alloc] init];
|
||||||
}
|
}
|
||||||
|
@ -2079,10 +2088,16 @@
|
||||||
originalStoryViewController.customPageTitle = customTitle;
|
originalStoryViewController.customPageTitle = customTitle;
|
||||||
|
|
||||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
||||||
if (barButtonItem) {
|
if ([sender isKindOfClass:[UIBarButtonItem class]]) {
|
||||||
[originalStoryViewController view]; // Force viewDidLoad
|
[originalStoryViewController view]; // Force viewDidLoad
|
||||||
[originalStoryViewController loadInitialStory];
|
[originalStoryViewController loadInitialStory];
|
||||||
[self showPopoverWithViewController:originalStoryViewController contentSize:CGSizeMake(600.0, 1000.0) barButtonItem:barButtonItem];
|
[self showPopoverWithViewController:originalStoryViewController contentSize:CGSizeMake(600.0, 1000.0) barButtonItem:sender];
|
||||||
|
} else if ([sender isKindOfClass:[UITableViewCell class]]) {
|
||||||
|
UITableViewCell *cell = (UITableViewCell *)sender;
|
||||||
|
|
||||||
|
[originalStoryViewController view]; // Force viewDidLoad
|
||||||
|
[originalStoryViewController loadInitialStory];
|
||||||
|
[self showPopoverWithViewController:originalStoryViewController contentSize:CGSizeMake(600.0, 1000.0) sourceView:cell sourceRect:cell.bounds];
|
||||||
} else {
|
} else {
|
||||||
[self.masterContainerViewController transitionToOriginalView];
|
[self.masterContainerViewController transitionToOriginalView];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1553,12 +1553,18 @@ heightForHeaderInSection:(NSInteger)section {
|
||||||
appDelegate.activeUserProfileId = [NSString stringWithFormat:@"%@", [feed objectForKey:@"user_id"]];
|
appDelegate.activeUserProfileId = [NSString stringWithFormat:@"%@", [feed objectForKey:@"user_id"]];
|
||||||
appDelegate.activeUserProfileName = [NSString stringWithFormat:@"%@", [feed objectForKey:@"username"]];
|
appDelegate.activeUserProfileName = [NSString stringWithFormat:@"%@", [feed objectForKey:@"username"]];
|
||||||
[appDelegate showUserProfileModal:cell];
|
[appDelegate showUserProfileModal:cell];
|
||||||
} else if ([[preferences stringForKey:@"feed_swipe_left"] isEqualToString:@"notifications"]) {
|
|
||||||
[appDelegate openNotificationsWithFeed:feedId sender:cell];
|
|
||||||
} else {
|
} else {
|
||||||
// Train
|
NSString *swipe = [preferences stringForKey:@"feed_swipe_left"];
|
||||||
appDelegate.storiesCollection.activeFeed = [appDelegate.dictFeeds objectForKey:feedId];
|
|
||||||
[appDelegate openTrainSiteWithFeedLoaded:NO from:cell];
|
if ([swipe isEqualToString:@"notifications"]) {
|
||||||
|
[appDelegate openNotificationsWithFeed:feedId sender:cell];
|
||||||
|
} else if ([swipe isEqualToString:@"statistics"]) {
|
||||||
|
[appDelegate openStatisticsWithFeed:feedId sender:cell];
|
||||||
|
} else {
|
||||||
|
// Train
|
||||||
|
appDelegate.storiesCollection.activeFeed = [appDelegate.dictFeeds objectForKey:feedId];
|
||||||
|
[appDelegate openTrainSiteWithFeedLoaded:NO from:cell];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (state == MCSwipeTableViewCellState3) {
|
} else if (state == MCSwipeTableViewCellState3) {
|
||||||
// Mark read
|
// Mark read
|
||||||
|
|
|
@ -672,14 +672,16 @@
|
||||||
<key>Titles</key>
|
<key>Titles</key>
|
||||||
<array>
|
<array>
|
||||||
<string>Train intelligence</string>
|
<string>Train intelligence</string>
|
||||||
<string>Notifications</string>
|
<string>Notifications</string>
|
||||||
|
<string>Statistics</string>
|
||||||
</array>
|
</array>
|
||||||
<key>DefaultValue</key>
|
<key>DefaultValue</key>
|
||||||
<string>notifications</string>
|
<string>notifications</string>
|
||||||
<key>Values</key>
|
<key>Values</key>
|
||||||
<array>
|
<array>
|
||||||
<string>trainer</string>
|
<string>trainer</string>
|
||||||
<string>notifications</string>
|
<string>notifications</string>
|
||||||
|
<string>statistics</string>
|
||||||
</array>
|
</array>
|
||||||
<key>Key</key>
|
<key>Key</key>
|
||||||
<string>feed_swipe_left</string>
|
<string>feed_swipe_left</string>
|
||||||
|
|
|
@ -693,13 +693,15 @@
|
||||||
<array>
|
<array>
|
||||||
<string>Train intelligence</string>
|
<string>Train intelligence</string>
|
||||||
<string>Notifications</string>
|
<string>Notifications</string>
|
||||||
|
<string>Statistics</string>
|
||||||
</array>
|
</array>
|
||||||
<key>DefaultValue</key>
|
<key>DefaultValue</key>
|
||||||
<string>notifications</string>
|
<string>notifications</string>
|
||||||
<key>Values</key>
|
<key>Values</key>
|
||||||
<array>
|
<array>
|
||||||
<string>trainer</string>
|
<string>trainer</string>
|
||||||
<string>notifications</string>
|
<string>notifications</string>
|
||||||
|
<string>statistics</string>
|
||||||
</array>
|
</array>
|
||||||
<key>Key</key>
|
<key>Key</key>
|
||||||
<string>feed_swipe_left</string>
|
<string>feed_swipe_left</string>
|
||||||
|
|
Loading…
Add table
Reference in a new issue