mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
adding following check in profile badge
This commit is contained in:
parent
098a19e27f
commit
4b016471a6
3 changed files with 35 additions and 35 deletions
|
@ -482,7 +482,7 @@
|
|||
[self.shareViewController.commentField resignFirstResponder];
|
||||
} else {
|
||||
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
|
||||
if (UIInterfaceOrientationIsPortrait(orientation)) {
|
||||
if (UIInterfaceOrientationIsPortrait(orientation) && !self.storyTitlesOnLeft) {
|
||||
self.storyNavigationController.view.frame = CGRectMake(self.storyNavigationController.view.frame.origin.x,
|
||||
0,
|
||||
self.storyNavigationController.view.frame.size.width,
|
||||
|
@ -578,12 +578,12 @@
|
|||
|
||||
if ([notification.name isEqualToString:@"UIKeyboardWillShowNotification"]) {
|
||||
if (UIInterfaceOrientationIsPortrait(orientation)) {
|
||||
|
||||
int newStoryNavigationFrameHeight = vb.size.height - NB_DEFAULT_SHARE_HEIGHT - keyboardFrame.size.height + 44;
|
||||
if (storyNavigationFrame.size.height < newStoryNavigationFrameHeight) {
|
||||
storyNavigationFrame.size.height = newStoryNavigationFrameHeight;
|
||||
if (!self.storyTitlesOnLeft) {
|
||||
int newStoryNavigationFrameHeight = vb.size.height - NB_DEFAULT_SHARE_HEIGHT - keyboardFrame.size.height + 44;
|
||||
if (storyNavigationFrame.size.height < newStoryNavigationFrameHeight) {
|
||||
storyNavigationFrame.size.height = newStoryNavigationFrameHeight;
|
||||
}
|
||||
}
|
||||
|
||||
shareViewFrame.origin.y = vb.size.height - NB_DEFAULT_SHARE_HEIGHT - keyboardFrame.size.height;
|
||||
} else {
|
||||
storyNavigationFrame.size.height = vb.size.height - NB_DEFAULT_SHARE_HEIGHT - keyboardFrame.size.width + 44;
|
||||
|
@ -599,8 +599,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
// CASE: when dismissing the keyboard but not dismissing the share view
|
||||
if ([notification.name isEqualToString:@"UIKeyboardWillHideNotification"] && !self.isHidingStory) {
|
||||
self.storyNavigationController.view.frame = storyNavigationFrame;
|
||||
// CASE: when dismissing the keyboard AND dismissing the share view
|
||||
} else if ([notification.name isEqualToString:@"UIKeyboardWillHideNotification"] && self.isHidingStory) {
|
||||
self.storyNavigationController.view.frame = CGRectMake(self.storyNavigationController.view.frame.origin.x,
|
||||
0,
|
||||
|
|
|
@ -90,24 +90,14 @@
|
|||
follow.frame = CGRectMake(20, 96, 80, 24);
|
||||
|
||||
// check follow button status
|
||||
NSString *currentUserId = [NSString stringWithFormat:@"%@", [self.appDelegate.dictUserProfile objectForKey:@"user_id"]];
|
||||
BOOL isFollowing = NO;
|
||||
BOOL isSelf = NO;
|
||||
NSArray *followingUserIds = [self.appDelegate.dictUserProfile objectForKey:@"following_user_ids"];
|
||||
for (int i = 0; i < followingUserIds.count ; i++) {
|
||||
NSString *followingUserId = [NSString stringWithFormat:@"%@", [followingUserIds objectAtIndex:i]];
|
||||
if ([currentUserId isEqualToString:[NSString stringWithFormat:@"%@", [profile objectForKey:@"user_id"]]]) {
|
||||
isSelf = YES;
|
||||
}
|
||||
if ([followingUserId isEqualToString:[NSString stringWithFormat:@"%@", [profile objectForKey:@"user_id"]]]) {
|
||||
isFollowing = YES;
|
||||
}
|
||||
}
|
||||
NSString *currentUserId = [NSString stringWithFormat:@"%@", [self.appDelegate.dictUserProfile objectForKey:@"user_id"]];
|
||||
NSString *profileUserId = [NSString stringWithFormat:@"%@", [profile objectForKey:@"user_id"]];
|
||||
NSLog(@"is following you %@", [profile objectForKey:@"following_you"]);
|
||||
|
||||
if (isSelf) {
|
||||
if ([currentUserId isEqualToString:profileUserId]) {
|
||||
[follow setTitle:@"You" forState:UIControlStateNormal];
|
||||
follow.enabled = NO;
|
||||
} else if (isFollowing) {
|
||||
} else if ([profile objectForKey:@"following_you"]) {
|
||||
[follow setTitle:@"Following" forState:UIControlStateNormal];
|
||||
} else {
|
||||
[follow setTitle:@"Follow" forState:UIControlStateNormal];
|
||||
|
|
|
@ -39,6 +39,21 @@
|
|||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view from its nib.
|
||||
self.appDelegate = (NewsBlurAppDelegate *)[[UIApplication sharedApplication] delegate];
|
||||
|
||||
self.view.frame = CGRectMake(0, 0, 320, 416);
|
||||
self.view.backgroundColor = UIColorFromRGB(0xd7dadf);
|
||||
self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:0.16f green:0.36f blue:0.46 alpha:0.9];
|
||||
|
||||
UITableView *profiles = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) style:UITableViewStyleGrouped];
|
||||
self.profileTable = profiles;
|
||||
self.profileTable.dataSource = self;
|
||||
self.profileTable.delegate = self;
|
||||
self.profileTable.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
||||
|
||||
ProfileBadge *badge = [[ProfileBadge alloc] init];
|
||||
badge.frame = CGRectMake(0, 0, self.view.frame.size.width, 140);
|
||||
self.profileBadge = badge;
|
||||
|
||||
}
|
||||
|
||||
- (void)viewDidUnload
|
||||
|
@ -53,20 +68,7 @@
|
|||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
self.view.frame = CGRectMake(0, 0, 320, 416);
|
||||
self.view.backgroundColor = UIColorFromRGB(0xd7dadf);
|
||||
self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:0.16f green:0.36f blue:0.46 alpha:0.9];
|
||||
|
||||
UITableView *profiles = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) style:UITableViewStyleGrouped];
|
||||
self.profileTable = profiles;
|
||||
self.profileTable.dataSource = self;
|
||||
self.profileTable.delegate = self;
|
||||
self.profileTable.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
||||
|
||||
ProfileBadge *badge = [[ProfileBadge alloc] init];
|
||||
badge.frame = CGRectMake(0, 0, self.view.frame.size.width, 140);
|
||||
self.profileBadge = badge;
|
||||
|
||||
|
||||
[self getUserProfile];
|
||||
}
|
||||
|
||||
|
@ -219,6 +221,12 @@
|
|||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
int activitiesCount = [self.activitiesArray count];
|
||||
|
||||
// badge is not tappable
|
||||
if (indexPath.section == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (indexPath.row < activitiesCount) {
|
||||
NSDictionary *activity = [self.activitiesArray objectAtIndex:indexPath.row];
|
||||
NSString *category = [activity objectForKey:@"category"];
|
||||
|
|
Loading…
Add table
Reference in a new issue