Change MyCompany stuff to Two Toasters

This commit is contained in:
Blake Watters
2011-01-16 21:51:39 -05:00
parent 319f7355af
commit 91e7f947fd
25 changed files with 73 additions and 70 deletions

View File

@@ -3,7 +3,7 @@
// DiscussionBoard
//
// Created by Jeremy Ellison on 1/10/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
// Copyright 2011 Two Toasters. All rights reserved.
//
#import <Foundation/Foundation.h>

View File

@@ -3,7 +3,7 @@
// DiscussionBoard
//
// Created by Jeremy Ellison on 1/10/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
// Copyright 2011 Two Toasters. All rights reserved.
//
#import "DBAuthenticatedTableViewController.h"
@@ -18,12 +18,12 @@
- (void)loadView {
[super loadView];
// Check if we are authenticated. If not, pop in login view controller.
if (_requiresLoggedInUser) {
BOOL isAuthenticated = NO;
if (_requiredUserID &&
[DBUser currentUser].singleAccessToken &&
[DBUser currentUser].singleAccessToken &&
// Put current user id first because it might be nil.
[[DBUser currentUser].userID isEqualToNumber:_requiredUserID]) {
isAuthenticated = YES;

View File

@@ -3,7 +3,7 @@
// DiscussionBoard
//
// Created by Jeremy Ellison on 1/10/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
// Copyright 2011 Two Toasters. All rights reserved.
//
#import <Three20/Three20.h>
@@ -13,7 +13,7 @@
@interface DBLoginViewController : TTTableViewController <UITextFieldDelegate, RKObjectLoaderDelegate> {
UIBarButtonItem* _signupOrLoginButtonItem;
BOOL _showingSignup;
UITextField* _usernameField;
UITextField* _passwordField;
UITextField* _passwordConfirmationField;

View File

@@ -3,7 +3,7 @@
// DiscussionBoard
//
// Created by Jeremy Ellison on 1/10/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
// Copyright 2011 Two Toasters. All rights reserved.
//
#import "DBLoginViewController.h"
@@ -30,34 +30,34 @@
- (void)loadView {
[super loadView];
UIBarButtonItem* cancelItem = [[[UIBarButtonItem alloc] initWithTitle:@"Cancel"
style:UIBarButtonItemStyleBordered
UIBarButtonItem* cancelItem = [[[UIBarButtonItem alloc] initWithTitle:@"Cancel"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(cancelButtonWasPressed:)] autorelease];
self.navigationItem.leftBarButtonItem = cancelItem;
_signupOrLoginButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Signup"
style:UIBarButtonItemStyleBordered
target:self
target:self
action:@selector(signupOrLoginButtonItemWasPressed:)];
_showingSignup = NO;
self.navigationItem.rightBarButtonItem = _signupOrLoginButtonItem;
_usernameField = [[UITextField alloc] initWithFrame:CGRectZero];
_usernameField.autocapitalizationType = UITextAutocapitalizationTypeNone;
_usernameField.delegate = self;
_usernameField.returnKeyType = UIReturnKeyNext;
_passwordField = [[UITextField alloc] initWithFrame:CGRectZero];
[_passwordField setSecureTextEntry:YES];
_passwordField.delegate = self;
_passwordConfirmationField = [[UITextField alloc] initWithFrame:CGRectZero];
[_passwordConfirmationField setSecureTextEntry:YES];
_passwordConfirmationField.delegate = self;
_passwordConfirmationField.returnKeyType = UIReturnKeyGo;
_emailField = [[UITextField alloc] initWithFrame:CGRectZero];
_emailField.autocapitalizationType = UITextAutocapitalizationTypeNone;
_emailField.delegate = self;
@@ -78,7 +78,7 @@
_passwordField.returnKeyType = UIReturnKeyGo;
}
self.dataSource = [TTListDataSource dataSourceWithItems:items];
[_usernameField becomeFirstResponder];
}
@@ -106,7 +106,7 @@
user.email = _emailField.text;
user.password = _passwordField.text;
user.passwordConfirmation = _passwordConfirmationField.text;
[[RKObjectManager sharedManager] postObject:user delegate:self];
} else {
// Login

View File

@@ -3,7 +3,7 @@
// DiscussionBoard
//
// Created by Jeremy Ellison on 1/10/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
// Copyright 2011 Two Toasters. All rights reserved.
//
#import <Foundation/Foundation.h>
@@ -13,10 +13,10 @@
@interface DBPostTableViewController : DBAuthenticatedTableViewController <RKObjectLoaderDelegate, TTTextEditorDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate> {
DBPost* _post;
NSNumber* _topicID;
TTTextEditor* _bodyTextEditor;
TTImageView* _currentAttachmentImageView;
UIImage* _newAttachment;
}

View File

@@ -3,7 +3,7 @@
// DiscussionBoard
//
// Created by Jeremy Ellison on 1/10/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
// Copyright 2011 Two Toasters. All rights reserved.
//
#import "DBPostTableViewController.h"

View File

@@ -3,7 +3,7 @@
// DiscussionBoard
//
// Created by Jeremy Ellison on 1/7/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
// Copyright 2011 Two Toasters. All rights reserved.
//
#import <Foundation/Foundation.h>

View File

@@ -3,7 +3,7 @@
// DiscussionBoard
//
// Created by Jeremy Ellison on 1/7/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
// Copyright 2011 Two Toasters. All rights reserved.
//
#import "DBPostsTableViewController.h"
@@ -16,7 +16,7 @@
- (id)initWithTopicID:(NSString*)topicID {
if (self = [super initWithStyle:UITableViewStylePlain]) {
_topicID = [topicID retain];
self.title = @"Posts";
_resourcePath = [[NSString stringWithFormat:@"/topics/%@/posts", _topicID] retain];
_resourceClass = [DBPost class];
@@ -32,7 +32,7 @@
- (void)loadView {
[super loadView];
self.variableHeightRows = YES;
UIBarButtonItem* newItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addButtonWasPressed:)] autorelease];
self.navigationItem.rightBarButtonItem = newItem;
}
@@ -57,18 +57,18 @@
RKRequestTTModel* model = (RKRequestTTModel*)self.model;
NSMutableArray* postItems = [NSMutableArray arrayWithCapacity:[model.objects count]];
NSMutableArray* topicItems = [NSMutableArray arrayWithCapacity:2];
[topicItems addObject:[TTTableTextItem itemWithText:self.topic.name]];
// only add edit item if there is no current user (lazy login) or
// the current user id == topic user id.
NSNumber* topicUserId = self.topic.userID;
// if topicUserId is nil, the topic has no user for some reason (perhaps they got deleted).
if ([DBUser currentUser] == nil ||
if ([DBUser currentUser] == nil ||
(topicUserId && [[DBUser currentUser].userID isEqualToNumber:topicUserId])) {
NSString* editURL = [NSString stringWithFormat:@"db://topics/%@/edit", _topicID];
[topicItems addObject:[TTTableTextItem itemWithText:@"Edit" URL:editURL]];
}
for(DBPost* post in model.objects) {
NSString* url = [NSString stringWithFormat:@"db://posts/%@", post.postID];
NSString* imageURL = post.attachmentPath;
@@ -77,7 +77,7 @@
URL:url];
[postItems addObject:item];
}
TTSectionedDataSource* dataSource = [TTSectionedDataSource dataSourceWithArrays:@"Topic",
topicItems,
@"Posts",

View File

@@ -3,7 +3,7 @@
// DiscussionBoard
//
// Created by Jeremy Ellison on 1/10/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
// Copyright 2011 Two Toasters. All rights reserved.
//
#import <Foundation/Foundation.h>
@@ -12,7 +12,7 @@
@interface DBResourceListTableViewController : TTTableViewController {
UILabel* _loadedAtLabel;
NSString* _resourcePath;
Class _resourceClass;
}

View File

@@ -3,7 +3,7 @@
// DiscussionBoard
//
// Created by Jeremy Ellison on 1/10/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
// Copyright 2011 Two Toasters. All rights reserved.
//
#import "DBResourceListTableViewController.h"
@@ -13,7 +13,7 @@
- (void)loadView {
[super loadView];
UIView* tableHeaderView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 90)] autorelease];
_loadedAtLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 300, 20)];
_loadedAtLabel.textAlignment = UITextAlignmentCenter;
@@ -23,9 +23,9 @@
[reloadButton addTarget:self action:@selector(reloadButtonWasPressed:) forControlEvents:UIControlEventTouchUpInside];
reloadButton.frame = CGRectMake(100, 40, 100, 40);
[tableHeaderView addSubview:reloadButton];
self.tableView.tableHeaderView = tableHeaderView;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(userStateChanged:) name:kUserLoggedInNotificationName object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(userStateChanged:) name:kUserLoggedOutNotificationName object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reloadNotification:) name:kObjectCreatedUpdatedOrDestroyedNotificationName object:nil];
@@ -39,7 +39,7 @@
[super viewDidUnload];
[_loadedAtLabel release];
_loadedAtLabel = nil;
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
@@ -63,7 +63,7 @@
[super didLoadModel:firstTime];
if ([self.model isKindOfClass:[RKRequestTTModel class]]) {
RKRequestTTModel* model = (RKRequestTTModel*)self.model;
NSDateFormatter* formatter = [[[NSDateFormatter alloc] init] autorelease];
[formatter setDateFormat:@"hh:mm:ss MM/dd/yy"];
_loadedAtLabel.text = [NSString stringWithFormat:@"Loaded At: %@", [formatter stringFromDate:model.loadedTime]];

View File

@@ -3,7 +3,7 @@
// DiscussionBoard
//
// Created by Jeremy Ellison on 1/10/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
// Copyright 2011 Two Toasters. All rights reserved.
//
#import <Three20/Three20.h>

View File

@@ -3,7 +3,7 @@
// DiscussionBoard
//
// Created by Jeremy Ellison on 1/10/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
// Copyright 2011 Two Toasters. All rights reserved.
//
#import "DBTopicViewController.h"
@@ -34,28 +34,28 @@
- (void)loadView {
self.tableViewStyle = UITableViewStyleGrouped;
if (nil == _topic) {
_topic = [[DBTopic object] retain];
_topic.name = @"";
}
_requiresLoggedInUser = YES;
if (![self isNewRecord]) {
_requiredUserID = _topic.userID;
}
[super loadView];
_topicNameField = [[UITextField alloc] initWithFrame:CGRectZero];
}
- (void)createModel {
NSMutableArray* items = [NSMutableArray array];
_topicNameField.text = _topic.name;
[items addObject:[TTTableControlItem itemWithCaption:@"Name" control:_topicNameField]];
if ([self isNewRecord]) {
self.title = @"New Topic";
[items addObject:[TTTableButton itemWithText:@"Create" delegate:self selector:@selector(createButtonWasPressed:)]];

View File

@@ -3,7 +3,7 @@
// DiscussionBoard
//
// Created by Jeremy Ellison on 1/7/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
// Copyright 2011 Two Toasters. All rights reserved.
//
#import <Foundation/Foundation.h>

View File

@@ -3,7 +3,7 @@
// DiscussionBoard
//
// Created by Jeremy Ellison on 1/7/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
// Copyright 2011 Two Toasters. All rights reserved.
//
#import "DBTopicsTableViewController.h"
@@ -24,13 +24,13 @@
- (void)createModel {
[super createModel];
UIBarButtonItem* item = nil;
if ([DBUser currentUser]) {
item = [[[UIBarButtonItem alloc] initWithTitle:@"Logout" style:UIBarButtonItemStyleBordered target:self action:@selector(logoutButtonWasPressed:)] autorelease];
}
self.navigationItem.leftBarButtonItem = item;
UIBarButtonItem* newItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addButtonWasPressed:)] autorelease];
self.navigationItem.rightBarButtonItem = newItem;
}
@@ -46,14 +46,14 @@
- (void)didLoadModel:(BOOL)firstTime {
[super didLoadModel:firstTime];
RKRequestTTModel* model = (RKRequestTTModel*)self.model;
NSMutableArray* items = [NSMutableArray arrayWithCapacity:[model.objects count]];
for(DBTopic* topic in model.objects) {
NSString* url = [NSString stringWithFormat:@"db://topics/%@/posts", topic.topicID];
[items addObject:[TTTableTextItem itemWithText:topic.name URL:url]];
}
NSLog(@"Items: %@", items);
// Ensure that the datasource's model is still the RKRequestTTModel;
// Otherwise isOutdated will not work.

View File

@@ -3,7 +3,7 @@
// DiscussionBoard
//
// Created by Jeremy Ellison on 1/12/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
// Copyright 2011 Two Toasters. All rights reserved.
//
#import <Foundation/Foundation.h>

View File

@@ -3,7 +3,7 @@
// DiscussionBoard
//
// Created by Jeremy Ellison on 1/12/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
// Copyright 2011 Two Toasters. All rights reserved.
//
#import "UIViewController+RKLoading.h"
@@ -18,7 +18,7 @@
overlayView.backgroundColor = [UIColor blackColor];
overlayView.alpha = 0.5;
overlayView.tag = 66;
[self.view addSubview:overlayView];
}
}

View File

@@ -3,7 +3,7 @@
// DiscussionBoard
//
// Created by Jeremy Ellison on 1/10/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
// Copyright 2011 Two Toasters. All rights reserved.
//
#import <RestKit/CoreData/RKManagedObjectCache.h>

View File

@@ -3,7 +3,7 @@
// DiscussionBoard
//
// Created by Jeremy Ellison on 1/10/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
// Copyright 2011 Two Toasters. All rights reserved.
//
#import "DBManagedObjectCache.h"
@@ -33,7 +33,7 @@
[request setSortDescriptors:[NSArray arrayWithObject:sortDescriptor]];
return [NSArray arrayWithObject:request];
}
return nil;
}

View File

@@ -3,7 +3,7 @@
// DiscussionBoard
//
// Created by Jeremy Ellison on 1/7/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
// Copyright 2011 Two Toasters. All rights reserved.
//
#import <Foundation/Foundation.h>
@@ -28,4 +28,4 @@
@property (nonatomic, retain) UIImage* newAttachment;
@end
@end

View File

@@ -3,7 +3,7 @@
// DiscussionBoard
//
// Created by Jeremy Ellison on 1/7/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
// Copyright 2011 Two Toasters. All rights reserved.
//
#import "DBPost.h"
@@ -28,10 +28,10 @@
+ (NSDictionary*)elementToPropertyMappings {
return [NSDictionary dictionaryWithKeysAndObjects:
@"id",@"postID",
@"id",@"postID",
@"topic_id",@"topicID",
@"user_id",@"userID",
@"created_at",@"createdAt",
@"created_at",@"createdAt",
@"updated_at",@"updatedAt",
@"attachment_content_type", @"attachmentContentType",
@"attachment_file_name", @"attachmentFileName",
@@ -57,7 +57,7 @@
RKParamsAttachment* attachment = [params setData:data MIMEType:@"application/octet-stream" forParam:@"post[attachment]"];
attachment.fileName = @"image.png";
}
return params;
}

View File

@@ -3,7 +3,7 @@
// DiscussionBoard
//
// Created by Jeremy Ellison on 1/10/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
// Copyright 2011 Two Toasters. All rights reserved.
//
#import <RestKit/RestKit.h>

View File

@@ -3,7 +3,7 @@
// DiscussionBoard
//
// Created by Jeremy Ellison on 1/10/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
// Copyright 2011 Two Toasters. All rights reserved.
//
#import "DBUser.h"
@@ -21,7 +21,7 @@
+ (NSDictionary*)elementToPropertyMappings {
return [NSDictionary dictionaryWithKeysAndObjects:
@"id",@"userID",
@"id",@"userID",
@"email",@"email",
@"login",@"login",
@"single_access_token",@"singleAccessToken",

View File

@@ -3,7 +3,7 @@
// DiscussionBoard
//
// Created by Jeremy Ellison on 1/12/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
// Copyright 2011 Two Toasters. All rights reserved.
//
#import <Foundation/Foundation.h>

View File

@@ -3,7 +3,7 @@
// DiscussionBoard
//
// Created by Jeremy Ellison on 1/12/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
// Copyright 2011 Two Toasters. All rights reserved.
//
#import "RKRequestTTModel+Loading.h"

View File

@@ -1027,6 +1027,9 @@
/* Begin PBXProject section */
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
attributes = {
ORGANIZATIONNAME = "Two Toasters";
};
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "DiscussionBoard" */;
compatibilityVersion = "Xcode 3.1";
developmentRegion = English;