mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-31 21:41:33 +00:00
adding in popover for actionsheet
This commit is contained in:
parent
4bbfa05920
commit
c19e7e6a4b
4 changed files with 87 additions and 7 deletions
|
@ -28,6 +28,12 @@
|
|||
#define kMarkReadActionSheet 1;
|
||||
#define kSettingsActionSheet 2;
|
||||
|
||||
@interface FeedDetailViewController ()
|
||||
|
||||
@property (nonatomic) UIActionSheet* actionSheet_; // add this line
|
||||
|
||||
@end
|
||||
|
||||
@implementation FeedDetailViewController
|
||||
|
||||
@synthesize popoverController;
|
||||
|
@ -39,6 +45,7 @@
|
|||
@synthesize pageFetching;
|
||||
@synthesize pageFinished;
|
||||
@synthesize intelligenceControl;
|
||||
@synthesize actionSheet_;
|
||||
|
||||
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
|
||||
|
||||
|
@ -117,11 +124,18 @@
|
|||
[super viewWillAppear:animated];
|
||||
|
||||
if ((appDelegate.isSocialRiverView || appDelegate.isRiverView || appDelegate.isSocialView) ||
|
||||
[appDelegate.activeFolder isEqualToString:@"Everything"]) {
|
||||
[appDelegate.activeFolder isEqualToString:@"ALL STORIES"]) {
|
||||
settingsButton.enabled = NO;
|
||||
} else {
|
||||
settingsButton.enabled = YES;
|
||||
}
|
||||
|
||||
if (appDelegate.isSocialRiverView ||
|
||||
[appDelegate.activeFolder isEqualToString:@"ALL STORIES"]) {
|
||||
feedMarkReadButton.enabled = NO;
|
||||
} else {
|
||||
feedMarkReadButton.enabled = YES;
|
||||
}
|
||||
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
|
||||
[self.storyTitlesTable reloadData];
|
||||
|
@ -876,6 +890,13 @@
|
|||
}
|
||||
|
||||
- (IBAction)doOpenMarkReadActionSheet:(id)sender {
|
||||
// already displaying action sheet?
|
||||
if (self.actionSheet_) {
|
||||
[self.actionSheet_ dismissWithClickedButtonIndex:-1 animated:YES];
|
||||
self.actionSheet_ = nil;
|
||||
return;
|
||||
}
|
||||
|
||||
// Individual sites just get marked as read, no action sheet needed.
|
||||
if (!appDelegate.isRiverView) {
|
||||
[self markFeedsReadWithAllStories:YES];
|
||||
|
@ -892,6 +913,8 @@
|
|||
destructiveButtonTitle:nil
|
||||
otherButtonTitles:nil];
|
||||
|
||||
self.actionSheet_ = options;
|
||||
|
||||
int visibleUnreadCount = appDelegate.visibleUnreadCount;
|
||||
int totalUnreadCount = [appDelegate unreadCount];
|
||||
NSArray *buttonTitles = nil;
|
||||
|
@ -924,7 +947,11 @@
|
|||
options.cancelButtonIndex = [options addButtonWithTitle:@"Cancel"];
|
||||
|
||||
options.tag = kMarkReadActionSheet;
|
||||
[options showInView:self.view];
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
||||
[options showFromBarButtonItem:self.feedMarkReadButton animated:YES];
|
||||
} else {
|
||||
[options showInView:self.view];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
|
||||
|
@ -964,7 +991,18 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex {
|
||||
// just set to nil
|
||||
actionSheet_ = nil;
|
||||
}
|
||||
|
||||
- (IBAction)doOpenSettingsActionSheet {
|
||||
// already displaying action sheet?
|
||||
if (self.actionSheet_) {
|
||||
[self.actionSheet_ dismissWithClickedButtonIndex:-1 animated:YES];
|
||||
self.actionSheet_ = nil;
|
||||
return;
|
||||
}
|
||||
NSString *title = appDelegate.isRiverView ?
|
||||
appDelegate.activeFolder :
|
||||
[appDelegate.activeFeed objectForKey:@"feed_title"];
|
||||
|
@ -975,6 +1013,8 @@
|
|||
destructiveButtonTitle:nil
|
||||
otherButtonTitles:nil];
|
||||
|
||||
self.actionSheet_ = options;
|
||||
|
||||
if (![title isEqualToString:@"Everything"]) {
|
||||
NSString *deleteText = [NSString stringWithFormat:@"Delete %@",
|
||||
appDelegate.isRiverView ?
|
||||
|
@ -993,7 +1033,11 @@
|
|||
|
||||
options.cancelButtonIndex = [options addButtonWithTitle:@"Cancel"];
|
||||
options.tag = kSettingsActionSheet;
|
||||
[options showInView:self.view];
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
||||
[options showFromBarButtonItem:self.settingsButton animated:YES];
|
||||
} else {
|
||||
[options showInView:self.view];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)confirmDeleteSite {
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
@property ( nonatomic) NSDictionary *activeProfile;
|
||||
|
||||
|
||||
- (void)refreshWithProfile:(NSDictionary *)profile showStats:(BOOL)showStats withWidth:(int)width;
|
||||
- (void)refreshWithProfile:(NSDictionary *)profile showStats:(BOOL)showStats withWidth:(int)newWidth;
|
||||
|
||||
- (IBAction)doFollowButton:(id)sender;
|
||||
- (void)finishFollowing:(ASIHTTPRequest *)request;
|
||||
|
|
|
@ -16,6 +16,11 @@
|
|||
#define kTopBadgeHeight 125
|
||||
#define kTopBadgeTextXCoordinate 100
|
||||
|
||||
@interface ProfileBadge ()
|
||||
@property (readwrite) int moduleWidth;
|
||||
|
||||
@end
|
||||
|
||||
@implementation ProfileBadge
|
||||
|
||||
@synthesize appDelegate;
|
||||
|
@ -27,6 +32,7 @@
|
|||
@synthesize followButton;
|
||||
@synthesize activeProfile;
|
||||
@synthesize activityIndicator;
|
||||
@synthesize moduleWidth;
|
||||
|
||||
|
||||
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
||||
|
@ -59,7 +65,18 @@
|
|||
[super layoutSubviews];
|
||||
}
|
||||
|
||||
- (void)refreshWithProfile:(NSDictionary *)profile showStats:(BOOL)showStats withWidth:(int)width {
|
||||
- (void)refreshWithProfile:(NSDictionary *)profile showStats:(BOOL)showStats withWidth:(int)newWidth {
|
||||
int width;
|
||||
|
||||
if (newWidth) {
|
||||
width = newWidth;
|
||||
self.moduleWidth = newWidth;
|
||||
} else {
|
||||
width = self.moduleWidth;
|
||||
for (UIView *subview in [self.contentView subviews]) {
|
||||
[subview removeFromSuperview];
|
||||
}
|
||||
}
|
||||
self.appDelegate = (NewsBlurAppDelegate *)[[UIApplication sharedApplication] delegate];
|
||||
self.activeProfile = profile;
|
||||
int yCoordinatePointer = 0;
|
||||
|
@ -314,6 +331,15 @@
|
|||
|
||||
[self.followButton setTitle:@"Following" forState:UIControlStateNormal];
|
||||
[appDelegate reloadFeedsView:NO];
|
||||
|
||||
NSMutableDictionary *newProfile = [self.activeProfile mutableCopy];
|
||||
NSNumber *count = [newProfile objectForKey:@"follower_count"];
|
||||
int value = [count intValue];
|
||||
count = [NSNumber numberWithInt:value + 1];
|
||||
|
||||
[newProfile setObject:count forKey:@"follower_count"];
|
||||
[newProfile setObject:[NSNumber numberWithInt:1] forKey:@"followed_by_you"];
|
||||
[self refreshWithProfile:newProfile showStats:YES withWidth:0];
|
||||
}
|
||||
|
||||
|
||||
|
@ -335,6 +361,15 @@
|
|||
NSLog(@"results %@", results);
|
||||
[self.followButton setTitle:@"Follow" forState:UIControlStateNormal];
|
||||
[appDelegate reloadFeedsView:NO];
|
||||
|
||||
NSMutableDictionary *newProfile = [self.activeProfile mutableCopy];
|
||||
NSNumber *count = [newProfile objectForKey:@"follower_count"];
|
||||
int value = [count intValue];
|
||||
count = [NSNumber numberWithInt:value - 1];
|
||||
|
||||
[newProfile setObject:count forKey:@"follower_count"];
|
||||
[newProfile setObject:[NSNumber numberWithInt:0] forKey:@"followed_by_you"];
|
||||
[self refreshWithProfile:newProfile showStats:YES withWidth:0];
|
||||
}
|
||||
|
||||
- (void)requestFailed:(ASIHTTPRequest *)request
|
||||
|
|
|
@ -454,14 +454,14 @@ a.NB-show-profile {
|
|||
}
|
||||
|
||||
.NB-button.NB-share-button div {
|
||||
padding: 8px 40px 8px 14px;
|
||||
padding: 8px 0px 8px;
|
||||
border-radius: 5px;
|
||||
text-align: center;
|
||||
background: -webkit-gradient(
|
||||
linear, left top, left bottom,
|
||||
from(#42aaff),
|
||||
to(#003366));
|
||||
padding-left: 40px;
|
||||
box-shadow: inset 0 0 1px 1px rgba(255, 255, 255, 1)
|
||||
}
|
||||
|
||||
.NB-button.NB-share-button div span {
|
||||
|
@ -470,6 +470,7 @@ a.NB-show-profile {
|
|||
display: inline-block;
|
||||
height: 16px;
|
||||
margin-bottom: -2px;
|
||||
margin-left: -23px;
|
||||
}
|
||||
|
||||
.NB-iphone .NB-button .NB-story-comment-like-button-wrapper,
|
||||
|
|
Loading…
Add table
Reference in a new issue