fixes #86
This commit is contained in:
parent
fee541fd1d
commit
e07fa926b8
7 changed files with 62 additions and 25 deletions
|
@ -186,7 +186,14 @@ class Controller(QtCore.QObject):
|
||||||
func = "tentia_instance.showProfileForEntity('{}');".format(entity)
|
func = "tentia_instance.showProfileForEntity('{}');".format(entity)
|
||||||
self.app.profile.evaluateJavaScript(func)
|
self.app.profile.evaluateJavaScript(func)
|
||||||
self.app.profile.show()
|
self.app.profile.show()
|
||||||
|
|
||||||
|
@QtCore.pyqtSlot(str, str)
|
||||||
|
def notificateViewsAboutDeletedPostWithIdbyEntity(self, post_id, entity):
|
||||||
|
func = "tentia_instance.postDeleted('{}', '{}')".format(post_id, entity);
|
||||||
|
self.app.timelineView.evaluateJavaScript(func)
|
||||||
|
self.app.mentionsView.evaluateJavaScript(func)
|
||||||
|
self.app.conversationView.evaluateJavaScript(func)
|
||||||
|
self.app.profileView.evaluateJavaScript(func)
|
||||||
|
|
||||||
@QtCore.pyqtSlot(str)
|
@QtCore.pyqtSlot(str)
|
||||||
def authentificationDidNotSucceed(self, errorMessage):
|
def authentificationDidNotSucceed(self, errorMessage):
|
||||||
|
|
|
@ -73,6 +73,7 @@
|
||||||
|
|
||||||
- (void)openURL:(NSString *)url;
|
- (void)openURL:(NSString *)url;
|
||||||
- (IBAction)showProfile:(id)sender;
|
- (IBAction)showProfile:(id)sender;
|
||||||
|
- (void)notificateViewsAboutDeletedPostWithId:(NSString *)postId byEntity:(NSString*)entity;
|
||||||
|
|
||||||
- (void)setString:(NSString *)string forKey:(NSString *)aKey;
|
- (void)setString:(NSString *)string forKey:(NSString *)aKey;
|
||||||
- (void)setSecret:(NSString *)string;
|
- (void)setSecret:(NSString *)string;
|
||||||
|
|
|
@ -90,9 +90,9 @@
|
||||||
NSString *index_string = [NSString stringWithContentsOfFile:[NSString stringWithFormat:@"%@index.html", path] encoding:NSUTF8StringEncoding error:nil];
|
NSString *index_string = [NSString stringWithContentsOfFile:[NSString stringWithFormat:@"%@index.html", path] encoding:NSUTF8StringEncoding error:nil];
|
||||||
|
|
||||||
oauthView = [[WebView alloc] init];
|
oauthView = [[WebView alloc] init];
|
||||||
WebPreferences* prefs = [oauthView preferences];
|
//WebPreferences* prefs = [oauthView preferences];
|
||||||
[prefs _setLocalStorageDatabasePath:@"~/Library/Application Support/Tentia"];
|
//[prefs _setLocalStorageDatabasePath:@"~/Library/Application Support/Tentia"];
|
||||||
[prefs setLocalStorageEnabled:YES];
|
//[prefs setLocalStorageEnabled:YES];
|
||||||
viewDelegate.oauthView = oauthView;
|
viewDelegate.oauthView = oauthView;
|
||||||
[[oauthView mainFrame] loadHTMLString:index_string baseURL:url];
|
[[oauthView mainFrame] loadHTMLString:index_string baseURL:url];
|
||||||
[oauthView setFrameLoadDelegate:viewDelegate];
|
[oauthView setFrameLoadDelegate:viewDelegate];
|
||||||
|
@ -113,7 +113,7 @@
|
||||||
{
|
{
|
||||||
[self initOauth];
|
[self initOauth];
|
||||||
|
|
||||||
NSString *localStoragePath = @"~/Library/Application Support/Tentia";
|
//NSString *localStoragePath = @"~/Library/Application Support/Tentia";
|
||||||
|
|
||||||
NSString *path = [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Webkit/"];
|
NSString *path = [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Webkit/"];
|
||||||
NSURL *url = [NSURL fileURLWithPath:path];
|
NSURL *url = [NSURL fileURLWithPath:path];
|
||||||
|
@ -125,9 +125,9 @@
|
||||||
[timelineView setPolicyDelegate:viewDelegate];
|
[timelineView setPolicyDelegate:viewDelegate];
|
||||||
[timelineView setUIDelegate:viewDelegate];
|
[timelineView setUIDelegate:viewDelegate];
|
||||||
[[timelineView windowScriptObject] setValue:self forKey:@"controller"];
|
[[timelineView windowScriptObject] setValue:self forKey:@"controller"];
|
||||||
WebPreferences* prefs = [timelineView preferences];
|
//WebPreferences* prefs = [timelineView preferences];
|
||||||
[prefs _setLocalStorageDatabasePath:localStoragePath];
|
//[prefs _setLocalStorageDatabasePath:localStoragePath];
|
||||||
[prefs setLocalStorageEnabled:YES];
|
//[prefs setLocalStorageEnabled:YES];
|
||||||
|
|
||||||
viewDelegate.mentionsView = mentionsView;
|
viewDelegate.mentionsView = mentionsView;
|
||||||
[[mentionsView mainFrame] loadHTMLString:index_string baseURL:url];
|
[[mentionsView mainFrame] loadHTMLString:index_string baseURL:url];
|
||||||
|
@ -135,9 +135,9 @@
|
||||||
[mentionsView setPolicyDelegate:viewDelegate];
|
[mentionsView setPolicyDelegate:viewDelegate];
|
||||||
[mentionsView setUIDelegate:viewDelegate];
|
[mentionsView setUIDelegate:viewDelegate];
|
||||||
[[mentionsView windowScriptObject] setValue:self forKey:@"controller"];
|
[[mentionsView windowScriptObject] setValue:self forKey:@"controller"];
|
||||||
prefs = [mentionsView preferences];
|
//prefs = [mentionsView preferences];
|
||||||
[prefs _setLocalStorageDatabasePath:localStoragePath];
|
//[prefs _setLocalStorageDatabasePath:localStoragePath];
|
||||||
[prefs setLocalStorageEnabled:YES];
|
//[prefs setLocalStorageEnabled:YES];
|
||||||
|
|
||||||
viewDelegate.conversationView = conversationView;
|
viewDelegate.conversationView = conversationView;
|
||||||
[[conversationView mainFrame] loadHTMLString:index_string baseURL:url];
|
[[conversationView mainFrame] loadHTMLString:index_string baseURL:url];
|
||||||
|
@ -145,9 +145,9 @@
|
||||||
[conversationView setPolicyDelegate:viewDelegate];
|
[conversationView setPolicyDelegate:viewDelegate];
|
||||||
[conversationView setUIDelegate:viewDelegate];
|
[conversationView setUIDelegate:viewDelegate];
|
||||||
[[conversationView windowScriptObject] setValue:self forKey:@"controller"];
|
[[conversationView windowScriptObject] setValue:self forKey:@"controller"];
|
||||||
prefs = [conversationView preferences];
|
//prefs = [conversationView preferences];
|
||||||
[prefs _setLocalStorageDatabasePath:localStoragePath];
|
//[prefs _setLocalStorageDatabasePath:localStoragePath];
|
||||||
[prefs setLocalStorageEnabled:YES];
|
//[prefs setLocalStorageEnabled:YES];
|
||||||
|
|
||||||
viewDelegate.profileView = profileView;
|
viewDelegate.profileView = profileView;
|
||||||
[[profileView mainFrame] loadHTMLString:index_string baseURL:url];
|
[[profileView mainFrame] loadHTMLString:index_string baseURL:url];
|
||||||
|
@ -155,9 +155,9 @@
|
||||||
[profileView setPolicyDelegate:viewDelegate];
|
[profileView setPolicyDelegate:viewDelegate];
|
||||||
[profileView setUIDelegate:viewDelegate];
|
[profileView setUIDelegate:viewDelegate];
|
||||||
[[profileView windowScriptObject] setValue:self forKey:@"controller"];
|
[[profileView windowScriptObject] setValue:self forKey:@"controller"];
|
||||||
prefs = [profileView preferences];
|
//prefs = [profileView preferences];
|
||||||
[prefs _setLocalStorageDatabasePath:localStoragePath];
|
//[prefs _setLocalStorageDatabasePath:localStoragePath];
|
||||||
[prefs setLocalStorageEnabled:YES];
|
//[prefs setLocalStorageEnabled:YES];
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -421,6 +421,15 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)notificateViewsAboutDeletedPostWithId:(NSString *)postId byEntity:(NSString*)entity
|
||||||
|
{
|
||||||
|
NSString *fun = [NSString stringWithFormat:@"tentia_instance.postDeleted('%@', '%@')", postId, entity];
|
||||||
|
[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
|
- (void)storeAccessToken:(NSString *)_accessToken secret:(NSString *)secret userId:(NSString *)userId andScreenName:(NSString *)screenName
|
||||||
|
|
|
@ -99,13 +99,20 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *)webView:(WebView *)sender contextMenuItemsForElement:(NSDictionary *)element defaultMenuItems:(NSArray *)defaultMenuItems {
|
- (NSArray *)webView:(WebView *)sender contextMenuItemsForElement:(NSDictionary *)element defaultMenuItems:(NSArray *)defaultMenuItems
|
||||||
|
{
|
||||||
|
// FIXME
|
||||||
|
/*
|
||||||
|
NSMutableArray *menuItems = [NSMutableArray arrayWithArray:defaultMenuItems];
|
||||||
|
|
||||||
for (NSMenuItem*item in defaultMenuItems) {
|
for (NSMenuItem*item in defaultMenuItems) {
|
||||||
if ([[item title] isEqualToString:@"Reload"]) {
|
if ([[item title] isEqualToString:@"Reload"]) {
|
||||||
[item setAction:@selector(reload:)];
|
//[item setAction:@selector(reload:)];
|
||||||
[item setTarget:self];
|
//[item setTarget:self];
|
||||||
|
} else {
|
||||||
|
[menuItems addObject:item];
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
return defaultMenuItems;
|
return defaultMenuItems;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,10 +62,8 @@ function(Core, Paths, HostApp, URI) {
|
||||||
|
|
||||||
} else if (status.type == "https://tent.io/types/post/delete/v0.1.0") {
|
} else if (status.type == "https://tent.io/types/post/delete/v0.1.0") {
|
||||||
|
|
||||||
var li = document.getElementById("post-" + status.content.id);
|
HostApp.notificateViewsAboutDeletedPost(status.content.id, status.entity);
|
||||||
if (li) {
|
|
||||||
this.body.removeChild(li);
|
|
||||||
}
|
|
||||||
} else if (status.type == "https://tent.io/types/post/repost/v0.1.0") {
|
} else if (status.type == "https://tent.io/types/post/repost/v0.1.0") {
|
||||||
|
|
||||||
this.getRepost(status, this.body.firstChild);
|
this.getRepost(status, this.body.firstChild);
|
||||||
|
|
|
@ -747,6 +747,13 @@ function(jQuery, Paths, URI, HostApp, Cache) {
|
||||||
HostApp.openNewMessageWidow(entity, status_id, string, is_private);
|
HostApp.openNewMessageWidow(entity, status_id, string, is_private);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Core.prototype.postDeleted = function(post_id, entity) {
|
||||||
|
var li = document.getElementById("post-" + post_id);
|
||||||
|
if (li) {
|
||||||
|
this.body.removeChild(li);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return Core;
|
return Core;
|
||||||
|
|
||||||
});
|
});
|
|
@ -132,6 +132,14 @@ define(function() {
|
||||||
return OS_TYPE == "mac" ? "OS X" : "Linux";
|
return OS_TYPE == "mac" ? "OS X" : "Linux";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HostApp.notificateViewsAboutDeletedPost = function(postId, entity) {
|
||||||
|
if (OS_TYPE == "mac") {
|
||||||
|
controller.notificateViewsAboutDeletedPostWithId_byEntity_(postId, entity);
|
||||||
|
} else {
|
||||||
|
controller.notificateViewsAboutDeletedPostWithIdbyEntity(postId, entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return HostApp;
|
return HostApp;
|
||||||
|
|
||||||
});
|
});
|
Reference in a new issue