removed obj-c oauth
This commit is contained in:
parent
61b195eebb
commit
65ca64c505
14 changed files with 437 additions and 1124 deletions
|
@ -11,13 +11,18 @@
|
|||
|
||||
@implementation ViewDelegate
|
||||
|
||||
@synthesize timelineView, mentionsView;
|
||||
@synthesize timelineView, mentionsView, twittiaOauthView;
|
||||
|
||||
- (void)webView:(WebView *)sender addMessageToConsole:(NSDictionary *)message;{
|
||||
|
||||
if (![message isKindOfClass:[NSDictionary class]]) return;
|
||||
|
||||
NSLog(@"js: %@:%@: %@",
|
||||
NSString *viewName = @"TimelineView";
|
||||
if (sender == mentionsView) viewName = @"MentionsView";
|
||||
if (sender == twittiaOauthView) viewName = @"TwittiaOauthView";
|
||||
|
||||
NSLog(@"js<%@>: %@:%@: %@",
|
||||
viewName,
|
||||
[[message objectForKey:@"sourceURL"] lastPathComponent],
|
||||
[message objectForKey:@"lineNumber"],
|
||||
[message objectForKey:@"message"]
|
||||
|
@ -25,7 +30,11 @@
|
|||
}
|
||||
|
||||
- (void)webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame {
|
||||
NSLog(@"jsa: %@", message);
|
||||
NSString *viewName = @"TimelineView";
|
||||
if (sender == mentionsView) viewName = @"MentionsView";
|
||||
if (sender == twittiaOauthView) viewName = @"TwittiaOauthView";
|
||||
|
||||
NSLog(@"jsa<%@>: %@", viewName, message);
|
||||
}
|
||||
|
||||
- (void)webView:(WebView *)sender decidePolicyForNavigationAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id <WebPolicyDecisionListener>)listener {
|
||||
|
@ -34,18 +43,26 @@
|
|||
}
|
||||
|
||||
- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame {
|
||||
NSString *action = @"home_timeline";
|
||||
NSString *delay = @"1";
|
||||
|
||||
if (sender == mentionsView) {
|
||||
action = @"mentions";
|
||||
delay = @"1000";
|
||||
}
|
||||
|
||||
[sender stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:
|
||||
@"setTimeout(function(){ twittia_instance = new Twittia('%@'); \
|
||||
document.getElementsByTagName('body')[0].appendChild(twittia_instance.body); \
|
||||
setTimeout(function() { loadPlugin(controller.pluginURL()) }, 1); }, %@);", action, delay]];
|
||||
if (sender == twittiaOauthView) {
|
||||
|
||||
[twittiaOauthView stringByEvaluatingJavaScriptFromString:@"setTimeout( function() { twittia_oauth = new TwittiaOauth(); }, 2);"];
|
||||
|
||||
} else {
|
||||
|
||||
NSString *action = @"home_timeline";
|
||||
NSString *delay = @"1";
|
||||
|
||||
if (sender == mentionsView) {
|
||||
action = @"mentions";
|
||||
delay = @"1000";
|
||||
}
|
||||
|
||||
[sender stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:
|
||||
@"setTimeout(function(){ twittia_instance = new Twittia('%@'); \
|
||||
document.getElementsByTagName('body')[0].appendChild(twittia_instance.body); \
|
||||
setTimeout(function() { loadPlugin(controller.pluginURL()) }, 1); }, %@);", action, delay]];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Reference in a new issue