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