Clearing share/reply comments correctly, as well as keeping them around in between cancel/re-opens.

This commit is contained in:
Samuel Clay 2013-09-23 15:07:25 -07:00
parent 3244af13c4
commit bbe6ef9015
6 changed files with 20 additions and 11 deletions

View file

@ -201,6 +201,7 @@
}
[self.notifier setNeedsLayout];
[appDelegate hideShareView:YES];
}
- (void)viewDidAppear:(BOOL)animated {

View file

@ -22,6 +22,7 @@
@property (nonatomic) IBOutlet UIBarButtonItem *submitButton;
@property (nonatomic) IBOutlet UILabel *storyTitle;
@property (nonatomic) NSString * activeReplyId;
@property (nonatomic) NSString * activeCommentId;
@property (nonatomic) NSString* currentType;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *keyboardHeight;

View file

@ -25,6 +25,7 @@
@synthesize commentField;
@synthesize appDelegate;
@synthesize activeReplyId;
@synthesize activeCommentId;
@synthesize currentType;
@synthesize storyTitle;
@ -267,7 +268,12 @@
appdotnetButton.hidden = YES;
[submitButton setAction:(@selector(doReplyToComment:))];
self.commentField.text = @"";
// Don't bother to reset comment field for replies while on the same story.
// It'll get cleared out on a new story and when posting a reply.
if (!self.activeCommentId || ![self.activeCommentId isEqualToString:userId]) {
self.activeCommentId = userId;
self.commentField.text = @"";
}
} else if ([type isEqualToString: @"edit-share"]) {
facebookButton.hidden = NO;
twitterButton.hidden = NO;
@ -403,7 +409,7 @@
[request setDidFinishSelector:@selector(finishAddReply:)];
[request setDidFailSelector:@selector(requestFailed:)];
[request startAsynchronous];
[appDelegate hideShareView:YES];
[appDelegate hideShareView:NO];
}
- (void)finishAddReply:(ASIHTTPRequest *)request {
@ -465,7 +471,6 @@
[appDelegate.storyPageControl.currentPage setActiveStoryAtIndex:-1];
[appDelegate.storyPageControl.currentPage refreshComments:replyId];
[appDelegate changeActiveFeedDetailRow];
}

View file

@ -97,15 +97,12 @@
#pragma mark Story setup
- (void)initStory {
appDelegate.inStoryDetail = YES;
self.noStorySelectedLabel.hidden = YES;
self.noStorySelectedImage.hidden = YES;
appDelegate.shareViewController.commentField.text = nil;
self.webView.hidden = NO;
[appDelegate hideShareView:YES];
[appDelegate resetShareComments];
[appDelegate hideShareView:NO];
}
- (void)hideNoStoryMessage {
@ -275,6 +272,7 @@
- (void)showStory {
id storyId = [self.activeStory objectForKey:@"id"];
[appDelegate pushReadStory:storyId];
[appDelegate resetShareComments];
}
- (void)clearStory {
@ -1227,6 +1225,9 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
[[friendComments objectAtIndex:i] objectForKey:@"user_id"]];
if([userId isEqualToString:currentUserId]){
appDelegate.activeComment = [friendComments objectAtIndex:i];
break;
} else {
appDelegate.activeComment = nil;
}
}

View file

@ -3,7 +3,7 @@
#import <UIKit/UIKit.h>
#import "Underscore.h"
//#define DEBUG 1
#define DEBUG 1
#ifdef DEBUG
#define BACKGROUND_REFRESH_SECONDS -5

View file

@ -2,10 +2,10 @@
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1552</int>
<string key="IBDocument.SystemVersion">12C3006</string>
<string key="IBDocument.SystemVersion">12F37</string>
<string key="IBDocument.InterfaceBuilderVersion">3084</string>
<string key="IBDocument.AppKitVersion">1187.34</string>
<string key="IBDocument.HIToolboxVersion">625.00</string>
<string key="IBDocument.AppKitVersion">1187.39</string>
<string key="IBDocument.HIToolboxVersion">626.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">2083</string>
@ -157,6 +157,7 @@
<int key="NSvFlags">265</int>
<string key="NSFrame">{{252, 121}, {48, 36}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<int key="IBUITag">2</int>