diff --git a/Mac/Controller.m b/Mac/Controller.m index bfc694b..328d220 100644 --- a/Mac/Controller.m +++ b/Mac/Controller.m @@ -60,11 +60,11 @@ accessToken = [[AccessToken alloc] init]; BOOL forceLogin = NO; - if (![accessToken stringForKey:@"version-0.5.2-new-login"]) { + if (![accessToken stringForKey:@"version-0.6.0-new-login"]) { [self logout:self]; forceLogin = YES; [accessToken setString:nil forKey:@"entity"]; - [accessToken setString:@"yes" forKey:@"version-0.5.2-new-login"]; + [accessToken setString:@"yes" forKey:@"version-0.6.0-new-login"]; } if (forceLogin || ![accessToken stringForKey:@"user_access_token"] || ![accessToken secret]) { @@ -479,7 +479,8 @@ { if ([notification object] == mentionsViewWindow) { - [self unreadMentions:0]; + //[self unreadMentions:0]; + [mentionsView stringByEvaluatingJavaScriptFromString:@"tentia_instance.setAllMentionsRead();"]; } } diff --git a/Mac/English.lproj/MainMenu.xib b/Mac/English.lproj/MainMenu.xib index 241ecc7..fc40ddf 100644 --- a/Mac/English.lproj/MainMenu.xib +++ b/Mac/English.lproj/MainMenu.xib @@ -236,7 +236,7 @@ Open Profile ... - p + u 1048576 2147483647 @@ -838,7 +838,7 @@ - + 256 YES @@ -886,7 +886,6 @@ {397, 581} - {{0, 0}, {2560, 1418}} @@ -937,6 +936,7 @@ {376, 581} + @@ -954,6 +954,7 @@ {376, 581} + {{0, 0}, {2560, 1418}} @@ -971,7 +972,7 @@ - + 256 YES @@ -1010,7 +1011,6 @@ {376, 581} - {{0, 0}, {2560, 1418}} @@ -1028,7 +1028,7 @@ - + 256 YES @@ -1067,7 +1067,6 @@ {376, 581} - {{0, 0}, {2560, 1418}} @@ -1211,7 +1210,6 @@ {{391, 46}, {75, 32}} - _NS:9 YES @@ -1320,7 +1318,6 @@ {{285, 13}, {74, 32}} - _NS:9 YES @@ -3129,7 +3126,11 @@ clearCache: login: logout: + openNewMessageWindow: + sendTweet: + showConversationForPostId:andEntity: showProfile: + showProfileForEntity: YES @@ -3137,6 +3138,10 @@ id id id + id + NSString + id + NSString @@ -3146,7 +3151,11 @@ clearCache: login: logout: + openNewMessageWindow: + sendTweet: + showConversationForPostId:andEntity: showProfile: + showProfileForEntity: YES @@ -3162,10 +3171,26 @@ logout: id + + openNewMessageWindow: + id + + + sendTweet: + id + + + showConversationForPostId:andEntity: + NSString + showProfile: id + + showProfileForEntity: + NSString + @@ -3181,6 +3206,7 @@ logoLayer mentionsView mentionsViewWindow + openProfileWindow profileView profileViewWindow showProfileTextField @@ -3199,6 +3225,7 @@ NSImageView WebView NSWindow + NSPanel WebView NSWindow NSTextField @@ -3220,6 +3247,7 @@ logoLayer mentionsView mentionsViewWindow + openProfileWindow profileView profileViewWindow showProfileTextField @@ -3265,6 +3293,10 @@ mentionsViewWindow NSWindow + + openProfileWindow + NSPanel + profileView WebView diff --git a/WebKit/scripts/controller/Mentions.js b/WebKit/scripts/controller/Mentions.js index 3b0a18f..0dfc746 100644 --- a/WebKit/scripts/controller/Mentions.js +++ b/WebKit/scripts/controller/Mentions.js @@ -1,9 +1,11 @@ define([ "helper/HostApp", - "controller/Timeline" + "controller/Timeline", + "lib/URI", + "helper/Paths" ], -function(HostApp, Timeline) { +function(HostApp, Timeline, URI, Paths) { function Mentions() { @@ -63,6 +65,37 @@ function(HostApp, Timeline) { } } + Mentions.prototype.setAllMentionsRead = function() { + this.unread_mentions = 0; + HostApp.unreadMentions(this.unread_mentions); + this.updateLatestMentionRead(); + } + + Mentions.prototype.updateLatestMentionRead = function() { + var status = this.body.firstChild.status; + + if (status && status.type == "https://tent.io/types/post/status/v0.1.0") { + + var url = URI(Paths.mkApiRootPath("/profile/" + encodeURIComponent("https://tent.io/types/info/cursor/v0.1.0"))); + var body = { + "https://tent.io/types/info/cursor/v0.1.0": { + "mentions": { + "https://tent.io/types/post/status/v0.1.0": { + "post_id": status.id, + "post_entity": status.entity + } + } + } + } + + var callback = function(resp) { + //debug(resp) + } + + Paths.getURL(url.toString(), "PUT", callback, JSON.stringify(body)); + } + } + return Mentions; diff --git a/WebKit/scripts/controller/Oauth.js b/WebKit/scripts/controller/Oauth.js index 96f2cf4..1506ea1 100644 --- a/WebKit/scripts/controller/Oauth.js +++ b/WebKit/scripts/controller/Oauth.js @@ -104,7 +104,8 @@ function(HostApp, Paths, Hmac) { + "&redirect_uri=" + this.app_info["redirect_uris"][0] + "&scope=" + Object.keys(this.app_info["scopes"]).join(",") + "&state=" + this.state - + "&tent_post_types=all"; + + "&tent_post_types=all" + + "&tent_profile_info_types=all"; HostApp.openAuthorizationURL(this.apiRoot() + auth); } diff --git a/WebKit/scripts/helper/Core.js b/WebKit/scripts/helper/Core.js index 980c3d5..96a481a 100644 --- a/WebKit/scripts/helper/Core.js +++ b/WebKit/scripts/helper/Core.js @@ -150,6 +150,7 @@ function(jQuery, Paths, URI, HostApp, Cache) { var template = this.getTemplate(); template.item.id = "post-" + (typeof status.__repost != "undefined" ? status.__repost.id : status.id); + template.item.status = status; if (HostApp.stringForKey("entity") == status.entity && typeof status.__repost == "undefined") { template.remove.onclick = function() { @@ -644,7 +645,9 @@ function(jQuery, Paths, URI, HostApp, Cache) { var text = node.innerHTML; var mentions_in_text = []; - var res = text.match(/(\^[\w:/]+\.[\w:/.]+(?:[\w]))/ig); + + var res = text.match(/(\^[\w:/.]+(?:[\w]))/ig); + if (res) { for (var i = 0; i < res.length; i++) { var name = res[i]; @@ -671,11 +674,12 @@ function(jQuery, Paths, URI, HostApp, Cache) { (function(mention) { // need this closure var profile = function(profile) { + var basic = profile["https://tent.io/types/info/basic/v0.1.0"]; - if (profile && basic) { + if (profile) { var name = mention.text; - if (basic.name) { + if (basic && basic.name) { name = basic.name; }