Compare commits
2 commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
2046a74ba2 | ||
![]() |
b9563e1ebb |
8 changed files with 39 additions and 145 deletions
|
@ -42,7 +42,7 @@
|
|||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.2.0</string>
|
||||
<string>2.0.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleURLTypes</key>
|
||||
|
@ -57,7 +57,7 @@
|
|||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.2.0</string>
|
||||
<string>2.0.0</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.social-networking</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
|
|
|
@ -19,12 +19,6 @@
|
|||
@interface Controller : NSObject <GrowlApplicationBridgeDelegate> {
|
||||
IBOutlet WebView *timelineView;
|
||||
IBOutlet NSWindow *timelineViewWindow;
|
||||
IBOutlet WebView *mentionsView;
|
||||
IBOutlet NSWindow *mentionsViewWindow;
|
||||
IBOutlet WebView *conversationView;
|
||||
IBOutlet NSWindow *conversationViewWindow;
|
||||
WebView *profileView;
|
||||
NSWindow *profileViewWindow;
|
||||
NSPanel *openProfileWindow;
|
||||
NSWindow *loginViewWindow;
|
||||
NSTextField *loginEntityTextField;
|
||||
|
@ -40,12 +34,6 @@
|
|||
|
||||
@property (assign) IBOutlet WebView *timelineView;
|
||||
@property (assign) IBOutlet NSWindow *timelineViewWindow;
|
||||
@property (assign) IBOutlet WebView *mentionsView;
|
||||
@property (assign) IBOutlet NSWindow *mentionsViewWindow;
|
||||
@property (assign) IBOutlet WebView *conversationView;
|
||||
@property (assign) IBOutlet NSWindow *conversationViewWindow;
|
||||
@property (assign) IBOutlet WebView *profileView;
|
||||
@property (assign) IBOutlet NSWindow *profileViewWindow;
|
||||
@property (assign) IBOutlet NSPanel *openProfileWindow;
|
||||
|
||||
@property (assign) IBOutlet NSWindow *loginViewWindow;
|
||||
|
|
117
Mac/Controller.m
117
Mac/Controller.m
|
@ -17,7 +17,7 @@
|
|||
@synthesize loginViewWindow;
|
||||
@synthesize loginEntityTextField;
|
||||
@synthesize loginActivityIndicator;
|
||||
@synthesize timelineView, timelineViewWindow, mentionsView, mentionsViewWindow, conversationView, conversationViewWindow, profileView, profileViewWindow;
|
||||
@synthesize timelineView, timelineViewWindow;
|
||||
@synthesize globalHotkeyMenuItem, viewDelegate;
|
||||
@synthesize logoLayer;
|
||||
@synthesize oauthView, accessToken;
|
||||
|
@ -25,7 +25,6 @@
|
|||
- (void)awakeFromNib
|
||||
{
|
||||
[timelineViewWindow setExcludedFromWindowsMenu:YES];
|
||||
[mentionsViewWindow setExcludedFromWindowsMenu:YES];
|
||||
|
||||
[self initHotKeys];
|
||||
|
||||
|
@ -70,7 +69,6 @@
|
|||
|
||||
if (forceLogin || ![accessToken stringForKey:@"user_access_token"] || ![accessToken secret]) {
|
||||
[timelineViewWindow performClose:self];
|
||||
[mentionsViewWindow performClose:self];
|
||||
[self.loginViewWindow makeKeyAndOrderFront:self];
|
||||
[self initOauth];
|
||||
} else {
|
||||
|
@ -125,47 +123,11 @@
|
|||
[timelineView setPolicyDelegate:viewDelegate];
|
||||
[timelineView setUIDelegate:viewDelegate];
|
||||
[[timelineView windowScriptObject] setValue:self forKey:@"controller"];
|
||||
//WebPreferences* prefs = [timelineView preferences];
|
||||
//[prefs _setLocalStorageDatabasePath:localStoragePath];
|
||||
//[prefs setLocalStorageEnabled:YES];
|
||||
|
||||
viewDelegate.mentionsView = mentionsView;
|
||||
[[mentionsView mainFrame] loadHTMLString:index_string baseURL:url];
|
||||
[mentionsView setFrameLoadDelegate:viewDelegate];
|
||||
[mentionsView setPolicyDelegate:viewDelegate];
|
||||
[mentionsView setUIDelegate:viewDelegate];
|
||||
[[mentionsView windowScriptObject] setValue:self forKey:@"controller"];
|
||||
//prefs = [mentionsView preferences];
|
||||
//[prefs _setLocalStorageDatabasePath:localStoragePath];
|
||||
//[prefs setLocalStorageEnabled:YES];
|
||||
|
||||
viewDelegate.conversationView = conversationView;
|
||||
[[conversationView mainFrame] loadHTMLString:index_string baseURL:url];
|
||||
[conversationView setFrameLoadDelegate:viewDelegate];
|
||||
[conversationView setPolicyDelegate:viewDelegate];
|
||||
[conversationView setUIDelegate:viewDelegate];
|
||||
[[conversationView windowScriptObject] setValue:self forKey:@"controller"];
|
||||
//prefs = [conversationView preferences];
|
||||
//[prefs _setLocalStorageDatabasePath:localStoragePath];
|
||||
//[prefs setLocalStorageEnabled:YES];
|
||||
|
||||
viewDelegate.profileView = profileView;
|
||||
[[profileView mainFrame] loadHTMLString:index_string baseURL:url];
|
||||
[profileView setFrameLoadDelegate:viewDelegate];
|
||||
[profileView setPolicyDelegate:viewDelegate];
|
||||
[profileView setUIDelegate:viewDelegate];
|
||||
[[profileView windowScriptObject] setValue:self forKey:@"controller"];
|
||||
//prefs = [profileView preferences];
|
||||
//[prefs _setLocalStorageDatabasePath:localStoragePath];
|
||||
//[prefs setLocalStorageEnabled:YES];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
[timelineView stringByEvaluatingJavaScriptFromString:@"start('timeline')"];
|
||||
[mentionsView stringByEvaluatingJavaScriptFromString:@"start('mentions')"];
|
||||
[conversationView stringByEvaluatingJavaScriptFromString:@"start('conversation')"];
|
||||
[profileView stringByEvaluatingJavaScriptFromString:@"start('profile')"];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -312,7 +274,7 @@
|
|||
|
||||
if (range.length > 0)
|
||||
{
|
||||
[oauthView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"bungloo_instance.requestAccessToken('%@')", aString]];
|
||||
[oauthView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"bungloo.oauth.requestAccessToken('%@')", aString]];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -353,7 +315,7 @@
|
|||
isPrivate = @"true";
|
||||
}
|
||||
|
||||
NSString *func = [NSString stringWithFormat:@"bungloo_instance.sendNewMessage(\"%@\", \"%@\", \"%@\", %@, %@, %@)",
|
||||
NSString *func = [NSString stringWithFormat:@"bungloo.timeline.sendNewMessage(\"%@\", \"%@\", \"%@\", %@, %@, %@)",
|
||||
text,
|
||||
post.inReplyTostatusId,
|
||||
post.inReplyToEntity,
|
||||
|
@ -378,17 +340,17 @@
|
|||
|
||||
- (void)unreadMentions:(int)count
|
||||
{
|
||||
if (![mentionsViewWindow isVisible] && count > 0)
|
||||
if (count > 0)
|
||||
{
|
||||
[timelineViewWindow setTitle:[NSString stringWithFormat:@"Bungloo (^%i)", count]];
|
||||
[[[NSApplication sharedApplication] dockTile] setBadgeLabel:[NSString stringWithFormat:@"%i", count]];
|
||||
}
|
||||
else
|
||||
{
|
||||
[timelineViewWindow setTitle:[NSString stringWithFormat:@"Bungloo"]];
|
||||
[[[NSApplication sharedApplication] dockTile] setBadgeLabel:nil];
|
||||
[mentionsView stringByEvaluatingJavaScriptFromString:@"bungloo_instance.unread_mentions = 0;"];
|
||||
}
|
||||
|
||||
NSString *script = [NSString stringWithFormat:@"bungloo.sidebar.setUnreadMentions(%i);", count];
|
||||
[timelineView stringByEvaluatingJavaScriptFromString:script];
|
||||
}
|
||||
|
||||
- (void)notificateUserAboutMention:(NSString *)text fromName:(NSString *)name withPostId:(NSString *)postId andEntity:(NSString *)entity
|
||||
|
@ -414,35 +376,21 @@
|
|||
{
|
||||
NSString *entity = [self.showProfileTextField stringValue];
|
||||
if ([entity rangeOfString:@"."].location != NSNotFound && ([entity hasPrefix:@"http://"] || [entity hasPrefix:@"https://"])) {
|
||||
NSString *func = [NSString stringWithFormat:@"bungloo_instance.showProfileForEntity('%@')", entity];
|
||||
[profileView stringByEvaluatingJavaScriptFromString:func];
|
||||
[profileViewWindow makeKeyAndOrderFront:self];
|
||||
[openProfileWindow performClose:self];
|
||||
NSString *func = [NSString stringWithFormat:@"bungloo.sidebar.onEntityProfile(); bungloo.entityProfile.showProfileForEntity('%@')", entity];
|
||||
[timelineView stringByEvaluatingJavaScriptFromString:func];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)notificateViewsAboutDeletedPostWithId:(NSString *)postId byEntity:(NSString*)entity
|
||||
{
|
||||
NSString *fun = [NSString stringWithFormat:@"bungloo_instance.postDeleted('%@', '%@')", postId, entity];
|
||||
NSString *f = [NSString stringWithFormat:@".postDeleted('%@', '%@');", postId, entity];
|
||||
NSMutableString *fun = [NSMutableString stringWithFormat:@"bungloo.timeline%@", f];
|
||||
[fun appendFormat:@"bungloo.mentions%@", f];
|
||||
[fun appendFormat:@"bungloo.conversation%@", f];
|
||||
[fun appendFormat:@"bungloo.entityProfile%@", f];
|
||||
[timelineView stringByEvaluatingJavaScriptFromString:fun];
|
||||
[mentionsView stringByEvaluatingJavaScriptFromString:fun];
|
||||
[conversationView stringByEvaluatingJavaScriptFromString:fun];
|
||||
[profileView stringByEvaluatingJavaScriptFromString:fun];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
- (void)storeAccessToken:(NSString *)_accessToken secret:(NSString *)secret userId:(NSString *)userId andScreenName:(NSString *)screenName
|
||||
{
|
||||
self.accessToken.accessToken = _accessToken;
|
||||
self.accessToken.secret = secret;
|
||||
self.accessToken.userId = userId;
|
||||
self.accessToken.screenName = screenName;
|
||||
[timelineViewWindow makeKeyAndOrderFront:self];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"authentificationSucceded" object:nil];
|
||||
}*/
|
||||
|
||||
- (void)loggedIn
|
||||
{
|
||||
[loginActivityIndicator stopAnimation:self];
|
||||
|
@ -456,58 +404,47 @@
|
|||
if ([[loginEntityTextField stringValue] length] > 0) {
|
||||
[[loginEntityTextField window] makeFirstResponder:nil];
|
||||
[loginActivityIndicator startAnimation:self];
|
||||
[oauthView stringByEvaluatingJavaScriptFromString:@"bungloo_instance.authenticate();"];
|
||||
[oauthView stringByEvaluatingJavaScriptFromString:@"bungloo.oauth.authenticate();"];
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)logout:(id)sender
|
||||
{
|
||||
[oauthView stringByEvaluatingJavaScriptFromString:@"bungloo_instance.logout();"];
|
||||
[oauthView stringByEvaluatingJavaScriptFromString:@"bungloo.oauth.logout();"];
|
||||
|
||||
[timelineViewWindow performClose:self];
|
||||
[mentionsViewWindow performClose:self];
|
||||
[conversationViewWindow performClose:self];
|
||||
[profileViewWindow performClose:self];
|
||||
[self.loginViewWindow makeKeyAndOrderFront:self];
|
||||
|
||||
[timelineView stringByEvaluatingJavaScriptFromString:@"bungloo_instance.logout();"];
|
||||
[mentionsView stringByEvaluatingJavaScriptFromString:@"bungloo_instance.logout();"];
|
||||
[timelineView stringByEvaluatingJavaScriptFromString:@"bungloo.sidebar.logout();"];
|
||||
}
|
||||
|
||||
// Mentions window has been visible
|
||||
- (void)windowDidBecomeKey:(NSNotification *)notification
|
||||
{
|
||||
if ([notification object] == mentionsViewWindow)
|
||||
{
|
||||
//[self unreadMentions:0];
|
||||
[mentionsView stringByEvaluatingJavaScriptFromString:@"bungloo_instance.setAllMentionsRead();"];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void)getPostUpdates:(id)sender
|
||||
{
|
||||
[timelineView stringByEvaluatingJavaScriptFromString:@"bungloo_instance.getNewData(true)"];
|
||||
[mentionsView stringByEvaluatingJavaScriptFromString:@"bungloo_instance.getNewData(true)"];
|
||||
[timelineView stringByEvaluatingJavaScriptFromString:@"bungloo.timeline.getNewData(true)"];
|
||||
[timelineView stringByEvaluatingJavaScriptFromString:@"bungloo.mentions.getNewData(true)"];
|
||||
}
|
||||
|
||||
- (IBAction)showConversationForPostId:(NSString *)postId andEntity:(NSString *)entity
|
||||
{
|
||||
NSString *js = [NSString stringWithFormat:@"bungloo_instance.showStatus('%@', '%@');", postId, entity];
|
||||
[conversationView stringByEvaluatingJavaScriptFromString:js];
|
||||
[conversationViewWindow makeKeyAndOrderFront:self];
|
||||
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
|
||||
NSString *js = [NSString stringWithFormat:@"bungloo.sidebar.onConversation(); bungloo.conversation.showStatus('%@', '%@');", postId, entity];
|
||||
[timelineView stringByEvaluatingJavaScriptFromString:js];
|
||||
}
|
||||
|
||||
- (IBAction)clearCache:(id)sender
|
||||
{
|
||||
[timelineView stringByEvaluatingJavaScriptFromString:@"bungloo_instance.cache.clear()"];
|
||||
[timelineView stringByEvaluatingJavaScriptFromString:@"bungloo.timeline.cache.clear()"];
|
||||
}
|
||||
|
||||
- (IBAction)showProfileForEntity:(NSString *)entity
|
||||
{
|
||||
NSString *js = [NSString stringWithFormat:@"bungloo_instance.showProfileForEntity('%@');", entity];
|
||||
[profileView stringByEvaluatingJavaScriptFromString:js];
|
||||
[profileViewWindow makeKeyAndOrderFront:self];
|
||||
NSString *js = [NSString stringWithFormat:@"bungloo.sidebar.onEntityProfile(); bungloo.entityProfile.showProfileForEntity('%@');", entity];
|
||||
[timelineView stringByEvaluatingJavaScriptFromString:js];
|
||||
}
|
||||
|
||||
- (void)growlNotificationWasClicked:(id)clickContext
|
||||
|
@ -518,8 +455,8 @@
|
|||
|
||||
[self showConversationForPostId:postId andEntity:entity];
|
||||
|
||||
NSString *js = [NSString stringWithFormat:@"bungloo_instance.mentionRead('%@', '%@');", postId, entity];
|
||||
[mentionsView stringByEvaluatingJavaScriptFromString:js];
|
||||
NSString *js = [NSString stringWithFormat:@"bungloo.sidebar.onMentions(); bungloo.mentions.mentionRead('%@', '%@');", postId, entity];
|
||||
[timelineView stringByEvaluatingJavaScriptFromString:js];
|
||||
}
|
||||
|
||||
- (NSString *) applicationNameForGrowl
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf340
|
||||
{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370
|
||||
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
|
||||
{\colortbl;\red255\green255\blue255;}
|
||||
\viewkind0
|
||||
|
@ -16,7 +16,7 @@
|
|||
|
||||
\b Documentation:
|
||||
\b0 \
|
||||
http://github.com/jeena/bungloo/wiki\
|
||||
http://jabs.nu/bungloo\
|
||||
\
|
||||
|
||||
\b With special thanks to:
|
||||
|
|
|
@ -11,17 +11,9 @@
|
|||
#import "Constants.h"
|
||||
|
||||
@interface ViewDelegate : NSObject {
|
||||
WebView *timelineView;
|
||||
WebView *mentionsView;
|
||||
WebView *conversationView;
|
||||
WebView *profileView;
|
||||
WebView *oauthView;
|
||||
WebView *timelineView; WebView *oauthView;
|
||||
}
|
||||
|
||||
@property (nonatomic, assign) WebView *timelineView;
|
||||
@property (nonatomic, assign) WebView *mentionsView;
|
||||
@property (nonatomic, assign) WebView *conversationView;
|
||||
@property (nonatomic, assign) WebView *profileView;
|
||||
@property (nonatomic, assign) WebView *oauthView;
|
||||
@property (nonatomic, assign) WebView *timelineView;@property (nonatomic, assign) WebView *oauthView;
|
||||
|
||||
@end
|
||||
|
|
|
@ -11,18 +11,15 @@
|
|||
|
||||
@implementation ViewDelegate
|
||||
|
||||
@synthesize timelineView, mentionsView, conversationView, profileView, oauthView;
|
||||
@synthesize timelineView, oauthView;
|
||||
|
||||
- (void)webView:(WebView *)sender addMessageToConsole:(NSDictionary *)message {
|
||||
|
||||
if (![message isKindOfClass:[NSDictionary class]]) return;
|
||||
|
||||
NSString *viewName = @"TimelineView";
|
||||
if (sender == mentionsView) viewName = @"MentionsView";
|
||||
if (sender == conversationView) viewName = @"ConversationView";
|
||||
if (sender == oauthView) viewName = @"OauthView";
|
||||
if (sender == profileView) viewName = @"ProfileView";
|
||||
|
||||
|
||||
NSLog(@"js<%@>: %@:%@: %@",
|
||||
viewName,
|
||||
[[message objectForKey:@"sourceURL"] lastPathComponent],
|
||||
|
@ -33,8 +30,6 @@
|
|||
|
||||
- (void)webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame {
|
||||
NSString *viewName = @"TimelineView";
|
||||
if (sender == mentionsView) viewName = @"MentionsView";
|
||||
if (sender == conversationView) viewName = @"ConversationView";
|
||||
if (sender == oauthView) viewName = @"OauthView";
|
||||
|
||||
NSLog(@"jsa<%@>: %@", viewName, message);
|
||||
|
@ -52,7 +47,7 @@
|
|||
|
||||
- (void)webView:(WebView *)sender decidePolicyForNavigationAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id <WebPolicyDecisionListener>)listener {
|
||||
|
||||
NSArray *frames = [NSArray arrayWithObjects:timelineView.mainFrame, mentionsView.mainFrame, conversationView.mainFrame, oauthView.mainFrame, profileView.mainFrame, nil];
|
||||
NSArray *frames = [NSArray arrayWithObjects:timelineView.mainFrame, oauthView.mainFrame, nil];
|
||||
|
||||
// If it is clicked from one of the views the open default browser
|
||||
if ([frames indexOfObject:frame] != NSNotFound) {
|
||||
|
@ -85,25 +80,9 @@
|
|||
|
||||
[oauthView stringByEvaluatingJavaScriptFromString:@"function HostAppGo() { start('oauth') }"];
|
||||
|
||||
} else if(sender == conversationView) {
|
||||
|
||||
[conversationView stringByEvaluatingJavaScriptFromString:@"function HostAppGo() { start('conversation') }"];
|
||||
|
||||
} else if(sender == profileView) {
|
||||
|
||||
[profileView stringByEvaluatingJavaScriptFromString:@"function HostAppGo() { start('profile') }"];
|
||||
|
||||
} else {
|
||||
|
||||
NSString *action = @"timeline";
|
||||
NSString *delay = @"1";
|
||||
|
||||
if (sender == mentionsView) {
|
||||
action = @"mentions";
|
||||
delay = @"1000";
|
||||
}
|
||||
|
||||
[sender stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"function HostAppGo() { start('%@') }", action]];
|
||||
[sender stringByEvaluatingJavaScriptFromString:@"function HostAppGo() { start('timeline') }"];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -126,8 +105,7 @@
|
|||
}
|
||||
|
||||
- (void)reload:(id)sender {
|
||||
[timelineView stringByEvaluatingJavaScriptFromString:@"bungloo_instance.getNewData();"];
|
||||
[mentionsView stringByEvaluatingJavaScriptFromString:@"bungloo_instance.getNewData();"];
|
||||
[timelineView stringByEvaluatingJavaScriptFromString:@"bungloo.timeline.getNewData();"];
|
||||
}
|
||||
|
||||
- (NSString *)pluginURL
|
||||
|
|
|
@ -236,7 +236,7 @@ li:hover .from {
|
|||
|
||||
li:first-child:hover .from {
|
||||
top: auto;
|
||||
bottom: -1.9em;
|
||||
bottom: -1.8em;
|
||||
z-index: 2;
|
||||
-webkit-border-top-left-radius: 0;
|
||||
-webkit-border-top-right-radius: 0;
|
||||
|
|
|
@ -122,7 +122,6 @@ function(jQuery, Paths, URI, HostApp, Cache) {
|
|||
|
||||
head.appendChild(reposted_by)
|
||||
|
||||
|
||||
var message = document.createElement("p");
|
||||
message.className = "message";
|
||||
data.appendChild(message);
|
||||
|
|
Reference in a new issue