diff --git a/media/ios/Classes/FeedDetailViewController.m b/media/ios/Classes/FeedDetailViewController.m index d4d97679b..784c807f6 100644 --- a/media/ios/Classes/FeedDetailViewController.m +++ b/media/ios/Classes/FeedDetailViewController.m @@ -460,13 +460,13 @@ cell.imageView.image = resizedSpacer; [cell.imageView addSubview:spinner]; [spinner startAnimating]; - - UIView *topBorder = [[UIView alloc] init]; - topBorder.frame = CGRectMake(0, 0, self.view.frame.size.width, 1); - topBorder.backgroundColor = [UIColor colorWithRed:.9 green:.9 blue:.9 alpha:1.0]; - [cell addSubview:topBorder]; } + UIView *topBorder = [[UIView alloc] init]; + topBorder.frame = CGRectMake(0, 0, self.view.frame.size.width, 1); + topBorder.backgroundColor = [UIColor colorWithRed:.9 green:.9 blue:.9 alpha:1.0]; + [cell addSubview:topBorder]; + return cell; } diff --git a/media/ios/Classes/NewsBlurAppDelegate.m b/media/ios/Classes/NewsBlurAppDelegate.m index ce2f99ec9..4729dc0a9 100644 --- a/media/ios/Classes/NewsBlurAppDelegate.m +++ b/media/ios/Classes/NewsBlurAppDelegate.m @@ -266,32 +266,32 @@ setUsername:(NSString *)username setCommentIndex:(NSString *)commentIndex { self.isShowingShare = YES; + if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { // add shareViewController to storyDetail - [self.storyDetailViewController.view addSubview:self.shareViewController.view]; + [self.storyDetailContainerViewController.view addSubview:self.shareViewController.view]; [self.shareViewController setSiteInfo:type setUserId:userId setUsername:username setCommentIndex:commentIndex]; self.shareViewController.view.frame = CGRectMake(0, - self.storyDetailViewController.view.frame.size.height, - self.storyDetailViewController.view.frame.size.width, + self.storyDetailContainerViewController.view.frame.size.height, + self.storyDetailContainerViewController.view.frame.size.width, 0); - int newShareYCoordinate = self.storyDetailViewController.view.frame.size.height - SHARE_MODAL_HEIGHT; - int newStoryHeight = self.storyDetailViewController.view.frame.size.height - SHARE_MODAL_HEIGHT; + int newShareYCoordinate = self.storyDetailContainerViewController.view.frame.size.height - SHARE_MODAL_HEIGHT; + int newStoryHeight = self.storyDetailContainerViewController.view.frame.size.height - SHARE_MODAL_HEIGHT + 44; - [UIView animateWithDuration:0.35 animations:^{ + [UIView animateWithDuration:0.35 animations:^{ self.shareViewController.view.frame = CGRectMake(0, newShareYCoordinate, - self.storyDetailViewController.view.frame.size.width, + self.storyDetailContainerViewController.view.frame.size.width, SHARE_MODAL_HEIGHT); + self.storyDetailViewController.view.frame = CGRectMake(0, + 0, + self.storyDetailContainerViewController.view.frame.size.width, + newStoryHeight); } completion:^(BOOL finished) { - self.storyDetailViewController.webView.frame = CGRectMake(0, - 0, - self.storyDetailViewController.view.frame.size.width, - newStoryHeight); [self.shareViewController.commentField becomeFirstResponder]; - [self.storyDetailViewController scrolltoBottom]; }]; } else { [self.navigationController presentModalViewController:self.shareViewController animated:YES]; @@ -323,17 +323,16 @@ self.isShowingShare = NO; - if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { - storyDetailViewController.webView.frame = CGRectMake(0, - 0, - storyDetailViewController.view.frame.size.width, - storyDetailViewController.view.frame.size.height - 44); - + if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { [UIView animateWithDuration:0.35 animations:^{ shareViewController.view.frame = CGRectMake(0, - storyDetailViewController.view.frame.size.height, - storyDetailViewController.view.frame.size.width, + storyDetailContainerViewController.view.frame.size.height, + storyDetailContainerViewController.view.frame.size.width, 0); + storyDetailViewController.view.frame = CGRectMake(0, + 0, + storyDetailContainerViewController.view.frame.size.width, + storyDetailContainerViewController.view.frame.size.height); } completion:^(BOOL finished) { [shareViewController.view removeFromSuperview]; }]; diff --git a/media/ios/Classes/ShareViewController.h b/media/ios/Classes/ShareViewController.h index 7c2e6e2b7..a1ca64c37 100644 --- a/media/ios/Classes/ShareViewController.h +++ b/media/ios/Classes/ShareViewController.h @@ -30,6 +30,7 @@ - (IBAction)doReplyToComment:(id)sender; - (void)finishAddComment:(ASIHTTPRequest *)request; - (void)finishAddReply:(ASIHTTPRequest *)request; -- (void)replaceStory:(NSDictionary *)newStory; +- (void)requestFailed:(ASIHTTPRequest *)request;- (void)replaceStory:(NSDictionary *)newStory; +- (NSString *) stringByStrippingHTML:(NSString *)s; @end diff --git a/media/ios/Classes/ShareViewController.m b/media/ios/Classes/ShareViewController.m index 52100b053..34a21e089 100644 --- a/media/ios/Classes/ShareViewController.m +++ b/media/ios/Classes/ShareViewController.m @@ -111,6 +111,7 @@ - (void)setSiteInfo:(NSString *)type setUserId:(NSString *)userId setUsername:(NSString *)username setCommentIndex:(NSString *)commentIndex { + if ([type isEqualToString: @"edit-reply"]) { [submitButton setTitle:@"Save"]; facebookButton.hidden = YES; @@ -122,7 +123,7 @@ // get old comment NSArray *replies = [appDelegate.activeComment objectForKey:@"replies"]; int commentIdx = [commentIndex intValue]; - self.commentField.text = [[replies objectAtIndex:commentIdx] objectForKey:@"comments"]; + self.commentField.text = [self stringByStrippingHTML:[[replies objectAtIndex:commentIdx] objectForKey:@"comments"]]; } else if ([type isEqualToString: @"reply"]) { self.activeCommentIndex = -1; [submitButton setTitle:@"Reply"]; @@ -136,7 +137,7 @@ twitterButton.hidden = NO; // get old comment - self.commentField.text = [appDelegate.activeComment objectForKey:@"comments"]; + self.commentField.text = [self stringByStrippingHTML:[appDelegate.activeComment objectForKey:@"comments"]]; if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { [toolbarTitle setTitle:@"Edit Your Comment"]; @@ -211,7 +212,7 @@ if (self.activeCommentIndex != -1) { NSDictionary *activeComment = [[appDelegate.activeComment objectForKey:@"replies"] objectAtIndex:self.activeCommentIndex]; - [request setPostValue:[activeComment objectForKey:@"comments"] forKey:@"original_message"]; + [request setPostValue:[self stringByStrippingHTML:[activeComment objectForKey:@"comments"]] forKey:@"original_message"]; } [request setDelegate:self]; @@ -226,7 +227,6 @@ NSString *responseString = [request responseString]; NSDictionary *results = [[NSDictionary alloc] initWithDictionary:[responseString JSONValue]]; - // add the comment into the activeStory dictionary NSDictionary *comment = [results objectForKey:@"comment"]; NSArray *userProfiles = [results objectForKey:@"user_profiles"]; @@ -285,6 +285,12 @@ [self replaceStory:[results objectForKey:@"story"]]; } +- (void)requestFailed:(ASIHTTPRequest *)request +{ + NSError *error = [request error]; + NSLog(@"Error: %@", error); +} + - (void)replaceStory:(NSDictionary *)newStory { [commentField resignFirstResponder]; [appDelegate hideShareView:YES]; @@ -310,12 +316,6 @@ self.commentField.text = nil; [appDelegate refreshComments]; - -} - -- (void)requestFailed:(ASIHTTPRequest *)request { - NSError *error = [request error]; - NSLog(@"Error: %@", error); } -(void)keyboardWillShowOrHide:(NSNotification*)notification { @@ -360,4 +360,12 @@ }]; } +-(NSString *)stringByStrippingHTML:(NSString *)s { + NSRange r; + + while ((r = [s rangeOfString:@"<[^>]+>" options:NSRegularExpressionSearch]).location != NSNotFound) + s = [s stringByReplacingCharactersInRange:r withString:@""]; + return s; +} + @end diff --git a/media/ios/Classes/StoryDetailViewController.m b/media/ios/Classes/StoryDetailViewController.m index c38a030e0..ec207730a 100644 --- a/media/ios/Classes/StoryDetailViewController.m +++ b/media/ios/Classes/StoryDetailViewController.m @@ -276,6 +276,8 @@ "", [sourceUser objectForKey:@"photo_url"]]; } + + NSString *commentContent = [self textToHtml:[commentDict objectForKey:@"comments"]]; NSString *comment = [NSString stringWithFormat:@ "
The latest reports say the suspect accused of the shooting, which killed 12 and injured over 50, declared himself the Joker to police. That last bit of information is still only coming from an anonymous source. Aurora Police are now attempting to figure out the best approach to enter the suspect’s apartment, which was set with explosives. ”It is a very vexing problem how to enter that apartment safely. I personally have never seen anything like what the pictures show us is in there,” Police Chief Dan Oates told the press.
Anyone looking to help can contact the local Red Cross chapter or volunteer if you’re in the area. You can also help by donating to the Colorado Organization for Victim Assistance. Our thoughts go out to the victims, their friends, family, and the community at large.
UPDATE: TDKR actor, Christian Bale, has released a statement:
-