diff --git a/Mac/Bungloo.xcodeproj/project.pbxproj b/Mac/Bungloo.xcodeproj/project.pbxproj index 42d4390..6e453be 100644 --- a/Mac/Bungloo.xcodeproj/project.pbxproj +++ b/Mac/Bungloo.xcodeproj/project.pbxproj @@ -22,6 +22,8 @@ 1F880B6B165EE0F60022A84D /* NSData+Base64.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F880B6A165EE0F60022A84D /* NSData+Base64.m */; }; 1F880B6E165FE8890022A84D /* MimeType.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F880B6D165FE8890022A84D /* MimeType.m */; }; 1FA09847144602530079E258 /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 1FA09846144602530079E258 /* libicucore.dylib */; }; + 1FADDCED171DCBF400502891 /* NewConversationWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1FADDCEB171DCBF400502891 /* NewConversationWindowController.m */; }; + 1FADDCEE171DCBF400502891 /* NewConversationWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1FADDCEC171DCBF400502891 /* NewConversationWindowController.xib */; }; 1FC254A01427DFAD0035D84B /* AccessToken.m in Sources */ = {isa = PBXBuildFile; fileRef = 1FC2549B1427D9930035D84B /* AccessToken.m */; }; 1FDEF722164EFE9100F927F3 /* Growl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1FDEF721164EFE9100F927F3 /* Growl.framework */; }; 1FDEF723164EFF3100F927F3 /* Growl.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1FDEF721164EFE9100F927F3 /* Growl.framework */; }; @@ -77,6 +79,9 @@ 1F880B6C165FE8890022A84D /* MimeType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MimeType.h; sourceTree = ""; }; 1F880B6D165FE8890022A84D /* MimeType.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MimeType.m; sourceTree = ""; }; 1FA09846144602530079E258 /* libicucore.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libicucore.dylib; path = usr/lib/libicucore.dylib; sourceTree = SDKROOT; }; + 1FADDCEA171DCBF400502891 /* NewConversationWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NewConversationWindowController.h; sourceTree = ""; }; + 1FADDCEB171DCBF400502891 /* NewConversationWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NewConversationWindowController.m; sourceTree = ""; }; + 1FADDCEC171DCBF400502891 /* NewConversationWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NewConversationWindowController.xib; sourceTree = ""; }; 1FC2549A1427D9930035D84B /* AccessToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = AccessToken.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 1FC2549B1427D9930035D84B /* AccessToken.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = AccessToken.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 1FDEF721164EFE9100F927F3 /* Growl.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Growl.framework; sourceTree = ""; }; @@ -185,6 +190,8 @@ 1F880B6A165EE0F60022A84D /* NSData+Base64.m */, 1F880B6C165FE8890022A84D /* MimeType.h */, 1F880B6D165FE8890022A84D /* MimeType.m */, + 1FADDCEA171DCBF400502891 /* NewConversationWindowController.h */, + 1FADDCEB171DCBF400502891 /* NewConversationWindowController.m */, ); name = Classes; sourceTree = ""; @@ -210,6 +217,7 @@ 089C165FFE840EACC02AAC07 /* InfoPlist.strings */, 1DDD58280DA1D0D100B32029 /* NewMessageWindow.xib */, 1DDD582A0DA1D0D100B32029 /* MainMenu.xib */, + 1FADDCEC171DCBF400502891 /* NewConversationWindowController.xib */, 1FDEF724164F079800F927F3 /* Growl Registration Ticket.growlRegDict */, ); name = Resources; @@ -287,6 +295,7 @@ 1F122D49118E1DE100E83B77 /* Icon.icns in Resources */, 1F1C80F916482A250010B409 /* WebKit in Resources */, 1F132C791666CD9700E4E661 /* TB_SendTemplate.png in Resources */, + 1FADDCEE171DCBF400502891 /* NewConversationWindowController.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -306,6 +315,7 @@ 1F618ECA12DB5E6100E500D9 /* PostModel.m in Sources */, 1F880B6B165EE0F60022A84D /* NSData+Base64.m in Sources */, 1F880B6E165FE8890022A84D /* MimeType.m in Sources */, + 1FADDCED171DCBF400502891 /* NewConversationWindowController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Mac/Controller.h b/Mac/Controller.h index 7197357..d93ffbd 100644 --- a/Mac/Controller.h +++ b/Mac/Controller.h @@ -68,6 +68,7 @@ - (IBAction)showSearch:(id)sender; - (IBAction)showAbout:(id)sender; - (IBAction)showNext:(id)sender; +- (IBAction)showConversationViewForPostId:(NSString *)postId andEntity:(NSString *)entity; - (void)notificateViewsAboutDeletedPostWithId:(NSString *)postId byEntity:(NSString*)entity; diff --git a/Mac/Controller.m b/Mac/Controller.m index 9c5986e..ce81fd8 100644 --- a/Mac/Controller.m +++ b/Mac/Controller.m @@ -10,6 +10,7 @@ #import "NewMessageWindow.h" #import "PostModel.h" #import "NSData+Base64.h" +#import "NewConversationWindowController.h" @implementation Controller @synthesize showProfileTextField; @@ -387,6 +388,12 @@ [timelineView stringByEvaluatingJavaScriptFromString:@"bungloo.sidebar.onConversation();"]; } +- (IBAction)showConversationViewForPostId:(NSString *)postId andEntity:(NSString *)entity +{ + NewConversationWindowController *conversationView = [[NewConversationWindowController alloc] initWithPostId:postId entity:entity andViewDelegate:viewDelegate]; + [conversationView showWindow:conversationView.window]; +} + - (IBAction)showProfile:(id)sender { if ([sender isKindOfClass:[NSMenuItem class]]) { diff --git a/Mac/English.lproj/MainMenu.xib b/Mac/English.lproj/MainMenu.xib index 818374b..9e8566b 100644 --- a/Mac/English.lproj/MainMenu.xib +++ b/Mac/English.lproj/MainMenu.xib @@ -887,6 +887,7 @@ YES YES + 13WebKitAllowAnimatedImageLoopingPreferenceKey 13WebKitJavaEnabled 13WebKitJavaScriptCanOpenWindowsAutomatically 13WebKitPluginsEnabled @@ -896,6 +897,7 @@ + @@ -1052,6 +1054,7 @@ {{391, 46}, {75, 32}} + _NS:9 YES @@ -1160,6 +1163,7 @@ {{285, 13}, {74, 32}} + _NS:9 YES @@ -2812,15 +2816,11 @@ clearCache: login: logout: - openNewMessageWindow: - sendPost: showAbout: showConversation: - showConversationForPostId:andEntity: showMentions: showNext: showProfile: - showProfileForEntity: showSearch: showTimeline: @@ -2833,13 +2833,9 @@ id id id - NSString id id id - NSString - id - id @@ -2849,15 +2845,11 @@ clearCache: login: logout: - openNewMessageWindow: - sendPost: showAbout: showConversation: - showConversationForPostId:andEntity: showMentions: showNext: showProfile: - showProfileForEntity: showSearch: showTimeline: @@ -2875,14 +2867,6 @@ logout: id - - openNewMessageWindow: - id - - - sendPost: - id - showAbout: id @@ -2891,10 +2875,6 @@ showConversation: id - - showConversationForPostId:andEntity: - NSString - showMentions: id @@ -2907,10 +2887,6 @@ showProfile: id - - showProfileForEntity: - NSString - showSearch: id diff --git a/Mac/English.lproj/NewMessageWindow.xib b/Mac/English.lproj/NewMessageWindow.xib index 14100db..9814cec 100644 --- a/Mac/English.lproj/NewMessageWindow.xib +++ b/Mac/English.lproj/NewMessageWindow.xib @@ -42,7 +42,7 @@ 15 2 {{133, 535}, {299, 113}} - 1886913536 + 813171712 New Post NSWindow View diff --git a/Mac/NewConversationWindowController.h b/Mac/NewConversationWindowController.h new file mode 100644 index 0000000..d4d166d --- /dev/null +++ b/Mac/NewConversationWindowController.h @@ -0,0 +1,27 @@ +// +// NewConversationWindowController.h +// Bungloo +// +// Created by Jeena on 16/04/2013. +// +// + +#import +#import +#import "ViewDelegate.h" + +@interface NewConversationWindowController : NSWindowController { + NSString *postId; + NSString *entity; + IBOutlet WebView *timelineView; + ViewDelegate *viewDelegate; +} + +@property (nonatomic, retain) NSString *postId; +@property (nonatomic, retain) NSString *entity; +@property (nonatomic, retain) IBOutlet WebView *timelineView; +@property (nonatomic, retain) ViewDelegate *viewDelegate; + +- (id)initWithPostId:(NSString *)postId entity:(NSString *)entity andViewDelegate:(ViewDelegate *)viewDelegate; + +@end diff --git a/Mac/NewConversationWindowController.m b/Mac/NewConversationWindowController.m new file mode 100644 index 0000000..77bffc8 --- /dev/null +++ b/Mac/NewConversationWindowController.m @@ -0,0 +1,70 @@ +// +// NewConversationWindowController.m +// Bungloo +// +// Created by Jeena on 16/04/2013. +// +// + +#import "NewConversationWindowController.h" +#import "Controller.h" + +@implementation NewConversationWindowController + +@synthesize postId, entity, timelineView, viewDelegate; + +- (id)initWithWindow:(NSWindow *)window +{ + self = [super initWithWindow:window]; + if (self) { + // Initialization code here. + } + + return self; +} + +- (id)initWithPostId:(NSString *)_postId entity:(NSString *)_entity andViewDelegate:(ViewDelegate *)_viewDelegate; +{ + self = [super initWithWindowNibName:@"NewConversationWindowController"]; + if (self) { + self.postId = _postId; + self.entity = _entity; + self.viewDelegate = _viewDelegate; + } + + return self; +} + +- (void)windowDidLoad +{ + [super windowDidLoad]; + + // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file. + NSString *index_string; + NSURL *url; + + + Controller *controller = (Controller *)[[NSApplication sharedApplication] delegate]; + [controller stringFromFile: @"index.html" url: &url content: &index_string]; + + [self.viewDelegate.conversationViews addObject:timelineView]; + [[timelineView mainFrame] loadHTMLString:index_string baseURL:url]; + [timelineView setFrameLoadDelegate:viewDelegate]; + [timelineView setPolicyDelegate:viewDelegate]; + [timelineView setUIDelegate:viewDelegate]; + [[timelineView windowScriptObject] setValue:controller forKey:@"controller"]; + [[timelineView windowScriptObject] setValue:self forKey:@"conversationViewController"]; + +} + ++ (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector +{ + return NO; +} + ++ (BOOL)isKeyExcludedFromWebScript:(const char *)name +{ + return NO; +} + +@end diff --git a/Mac/NewConversationWindowController.xib b/Mac/NewConversationWindowController.xib new file mode 100644 index 0000000..877eff6 --- /dev/null +++ b/Mac/NewConversationWindowController.xib @@ -0,0 +1,327 @@ + + + + 1080 + 12D78 + 3084 + 1187.37 + 626.00 + + 3084 + 2053 + + + IBNSLayoutConstraint + NSCustomObject + NSView + NSWindowTemplate + WebView + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.WebKitIBPlugin + + + PluginDependencyRecalculationVersion + + + + + NewConversationWindowController + + + FirstResponder + + + NSApplication + + + 15 + 2 + {{712, 280}, {397, 581}} + 880280576 + Conversation + NSWindow + + + + + 256 + + + + 274 + + Apple HTML pasteboard type + Apple PDF pasteboard type + Apple PICT pasteboard type + Apple URL pasteboard type + Apple Web Archive pasteboard type + NSColor pasteboard type + NSFilenamesPboardType + NSStringPboardType + NeXT RTFD pasteboard type + NeXT Rich Text Format v1.0 pasteboard type + NeXT TIFF v4.0 pasteboard type + WebURLsWithTitlesPboardType + public.png + public.url + public.url-name + + {397, 581} + + + + + + + 13 + + + + + + + + NO + YES + + + {397, 581} + + + + + {{0, 0}, {2560, 1418}} + {10000000000000, 10000000000000} + conversationWindow + YES + + + + + + + window + + + + 12 + + + + timelineView + + + + 15 + + + + delegate + + + + 13 + + + + + + 0 + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 5 + + + + + + Timeline + + + 6 + + + + + + 4 + 0 + + 4 + 1 + + 0.0 + + 1000 + + 8 + 29 + 3 + + + + 5 + 0 + + 5 + 1 + + 0.0 + + 1000 + + 8 + 29 + 3 + + + + 6 + 0 + + 6 + 1 + + 0.0 + + 1000 + + 8 + 29 + 3 + + + + 3 + 0 + + 3 + 1 + + 0.0 + + 1000 + + 8 + 29 + 3 + + + + + + 7 + + + timeline + + + 8 + + + + + 9 + + + + + 10 + + + + + 11 + + + + + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{202, 175}, {397, 581}} + + + + + + + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.WebKitIBPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + + + 15 + + + + + NSLayoutConstraint + NSObject + + IBProjectSource + ./Classes/NSLayoutConstraint.h + + + + NewConversationWindowController + NSWindowController + + timelineView + WebView + + + timelineView + + timelineView + WebView + + + + IBProjectSource + ./Classes/NewConversationWindowController.h + + + + + 0 + IBCocoaFramework + YES + 3 + YES + + diff --git a/Mac/ViewDelegate.h b/Mac/ViewDelegate.h index 689b094..e89b091 100644 --- a/Mac/ViewDelegate.h +++ b/Mac/ViewDelegate.h @@ -11,9 +11,12 @@ #import "Constants.h" @interface ViewDelegate : NSObject { - WebView *timelineView; WebView *oauthView; + WebView *timelineView; + WebView *oauthView; + NSMutableArray *conversationViews; } -@property (nonatomic, assign) WebView *timelineView;@property (nonatomic, assign) WebView *oauthView; - +@property (nonatomic, assign) WebView *timelineView; +@property (nonatomic, assign) WebView *oauthView; +@property (nonatomic, assign) NSMutableArray *conversationViews; @end diff --git a/Mac/ViewDelegate.m b/Mac/ViewDelegate.m index c10a6ad..ca50f18 100644 --- a/Mac/ViewDelegate.m +++ b/Mac/ViewDelegate.m @@ -11,7 +11,16 @@ @implementation ViewDelegate -@synthesize timelineView, oauthView; +@synthesize timelineView, oauthView, conversationViews; + +- (id)init +{ + self = [super init]; + if (self) { + self.conversationViews = [[NSMutableArray alloc] init]; + } + return self; +} - (void)webView:(WebView *)sender addMessageToConsole:(NSDictionary *)message { @@ -19,6 +28,7 @@ NSString *viewName = @"TimelineView"; if (sender == oauthView) viewName = @"OauthView"; + else if(sender != timelineView) viewName = @"ConversationView"; NSLog(@"js<%@>: %@:%@: %@", viewName, @@ -31,6 +41,7 @@ - (void)webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame { NSString *viewName = @"TimelineView"; if (sender == oauthView) viewName = @"OauthView"; + else if (sender != timelineView) viewName = @"ConversationView"; NSLog(@"jsa<%@>: %@", viewName, message); } @@ -75,11 +86,15 @@ } [sender stringByEvaluatingJavaScriptFromString:@"var OS_TYPE = 'mac';"]; - + if (sender == oauthView) { [oauthView stringByEvaluatingJavaScriptFromString:@"function HostAppGo() { start('oauth') }"]; + } else if([conversationViews containsObject:sender]) { + + [sender stringByEvaluatingJavaScriptFromString:@"function HostAppGo() { start('conversation-standalone', function() { bungloo.conversation.showStatusFromController(); }) }"]; + } else { [sender stringByEvaluatingJavaScriptFromString:@"function HostAppGo() { start('timeline') }"]; diff --git a/WebKit/scripts/controller/Conversation.js b/WebKit/scripts/controller/Conversation.js index f4e6633..cb49aeb 100644 --- a/WebKit/scripts/controller/Conversation.js +++ b/WebKit/scripts/controller/Conversation.js @@ -50,6 +50,11 @@ function(HostApp, Core, Paths, URI) { this.append(id, entity); } + // Hack for OS X + Conversation.prototype.showStatusFromController = function() { + this.showStatus(conversationViewController.postId, conversationViewController.entity); + } + Conversation.prototype.append = function(id, entity, node, add_after) { var _this = this; diff --git a/WebKit/scripts/controller/Profile.js b/WebKit/scripts/controller/Profile.js index fea2e33..584a046 100644 --- a/WebKit/scripts/controller/Profile.js +++ b/WebKit/scripts/controller/Profile.js @@ -14,6 +14,8 @@ function(HostApp, Core, Paths, URI) { this.action = "profile"; + this.posts_limit = 25; + this.container = document.createElement("div"); this.container.className = this.action; document.getElementById("content").appendChild(this.container); @@ -390,7 +392,7 @@ function(HostApp, Core, Paths, URI) { add_search = add_search || {}; var url = URI(root_url + "/posts"); - url.addSearch("limit", 20); + url.addSearch("limit", this.posts_limit); var post_types = [ "https://tent.io/types/post/repost/v0.1.0", diff --git a/WebKit/scripts/controller/Timeline.js b/WebKit/scripts/controller/Timeline.js index 6469d0b..fbd1383 100644 --- a/WebKit/scripts/controller/Timeline.js +++ b/WebKit/scripts/controller/Timeline.js @@ -14,7 +14,8 @@ function(Core, Paths, HostApp, URI) { this.action = "timeline"; this.reload_blocked = false; - this.max_length = 25; + this.posts_limit = 25; + this.max_length = 200; this.timeout = 10 * 1000; // every 10 seconds this.since_id = null; this.since_id_entity = null; @@ -109,7 +110,7 @@ function(Core, Paths, HostApp, URI) { ]; url.addSearch("post_types", post_types.join(",")); //url.addSearch("sort_by", "published_at"); - url.addSearch("limit", this.max_length); + url.addSearch("limit", this.posts_limit); if(this.since_id && !append) { url.addSearch("since_id", this.since_id);