added add/show geolocation and changed name from TweetModel to PostModel

This commit is contained in:
Jeena Paradies 2012-11-22 19:21:38 +01:00
parent d39b643844
commit 76b63d5c68
12 changed files with 398 additions and 50 deletions

View file

@ -8,7 +8,7 @@
#import "Controller.h"
#import "NewMessageWindow.h"
#import "TweetModel.h"
#import "PostModel.h"
@implementation Controller
@synthesize loginViewWindow;
@ -74,6 +74,10 @@
}
}
# pragma mark Init
- (void)initOauth
{
if (!oauthView) {
@ -280,13 +284,19 @@
- (IBAction)sendTweet:(id)sender
{
TweetModel *tweet = (TweetModel *)[sender object];
NSString *text = [[tweet.text stringByReplacingOccurrencesOfString:@"\\" withString:@"\\\\"] stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""];
PostModel *post = (PostModel *)[sender object];
NSString *text = [[post.text stringByReplacingOccurrencesOfString:@"\\" withString:@"\\\\"] stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""];
text = [text stringByReplacingOccurrencesOfString:@"\n" withString:@"\\n"];
NSString *func = [NSString stringWithFormat:@"tentia_instance.sendNewMessage(\"%@\", \"%@\", \"%@\")",
NSString *locationObject = @"null";
if (post.location) {
locationObject = [NSString stringWithFormat:@"[%f, %f]", post.location.coordinate.latitude, post.location.coordinate.longitude];
}
NSString *func = [NSString stringWithFormat:@"tentia_instance.sendNewMessage(\"%@\", \"%@\", \"%@\", %@)",
text,
tweet.inReplyTostatusId,
tweet.inReplyToEntity];
post.inReplyTostatusId,
post.inReplyToEntity,
locationObject];
[timelineView stringByEvaluatingJavaScriptFromString:func];
}