Merge branch 'master' of github.com:jeena/Tentia
This commit is contained in:
commit
f380b03f6a
5 changed files with 89 additions and 18 deletions
|
@ -60,11 +60,11 @@
|
||||||
accessToken = [[AccessToken alloc] init];
|
accessToken = [[AccessToken alloc] init];
|
||||||
|
|
||||||
BOOL forceLogin = NO;
|
BOOL forceLogin = NO;
|
||||||
if (![accessToken stringForKey:@"version-0.5.2-new-login"]) {
|
if (![accessToken stringForKey:@"version-0.6.0-new-login"]) {
|
||||||
[self logout:self];
|
[self logout:self];
|
||||||
forceLogin = YES;
|
forceLogin = YES;
|
||||||
[accessToken setString:nil forKey:@"entity"];
|
[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]) {
|
if (forceLogin || ![accessToken stringForKey:@"user_access_token"] || ![accessToken secret]) {
|
||||||
|
@ -479,7 +479,8 @@
|
||||||
{
|
{
|
||||||
if ([notification object] == mentionsViewWindow)
|
if ([notification object] == mentionsViewWindow)
|
||||||
{
|
{
|
||||||
[self unreadMentions:0];
|
//[self unreadMentions:0];
|
||||||
|
[mentionsView stringByEvaluatingJavaScriptFromString:@"tentia_instance.setAllMentionsRead();"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -236,7 +236,7 @@
|
||||||
<object class="NSMenuItem" id="361695239">
|
<object class="NSMenuItem" id="361695239">
|
||||||
<reference key="NSMenu" ref="720053764"/>
|
<reference key="NSMenu" ref="720053764"/>
|
||||||
<string key="NSTitle">Open Profile ...</string>
|
<string key="NSTitle">Open Profile ...</string>
|
||||||
<string key="NSKeyEquiv">p</string>
|
<string key="NSKeyEquiv">u</string>
|
||||||
<int key="NSKeyEquivModMask">1048576</int>
|
<int key="NSKeyEquivModMask">1048576</int>
|
||||||
<int key="NSMnemonicLoc">2147483647</int>
|
<int key="NSMnemonicLoc">2147483647</int>
|
||||||
<reference key="NSOnImage" ref="1033313550"/>
|
<reference key="NSOnImage" ref="1033313550"/>
|
||||||
|
@ -838,7 +838,7 @@
|
||||||
<nil key="NSViewClass"/>
|
<nil key="NSViewClass"/>
|
||||||
<nil key="NSUserInterfaceItemIdentifier"/>
|
<nil key="NSUserInterfaceItemIdentifier"/>
|
||||||
<object class="NSView" key="NSWindowView" id="332867700">
|
<object class="NSView" key="NSWindowView" id="332867700">
|
||||||
<reference key="NSNextResponder"/>
|
<nil key="NSNextResponder"/>
|
||||||
<int key="NSvFlags">256</int>
|
<int key="NSvFlags">256</int>
|
||||||
<object class="NSMutableArray" key="NSSubviews">
|
<object class="NSMutableArray" key="NSSubviews">
|
||||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
@ -886,7 +886,6 @@
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<string key="NSFrameSize">{397, 581}</string>
|
<string key="NSFrameSize">{397, 581}</string>
|
||||||
<reference key="NSSuperview"/>
|
|
||||||
<reference key="NSNextKeyView" ref="690752143"/>
|
<reference key="NSNextKeyView" ref="690752143"/>
|
||||||
</object>
|
</object>
|
||||||
<string key="NSScreenRect">{{0, 0}, {2560, 1418}}</string>
|
<string key="NSScreenRect">{{0, 0}, {2560, 1418}}</string>
|
||||||
|
@ -937,6 +936,7 @@
|
||||||
</object>
|
</object>
|
||||||
<string key="NSFrameSize">{376, 581}</string>
|
<string key="NSFrameSize">{376, 581}</string>
|
||||||
<reference key="NSSuperview" ref="438898709"/>
|
<reference key="NSSuperview" ref="438898709"/>
|
||||||
|
<reference key="NSWindow"/>
|
||||||
<reference key="NSNextKeyView"/>
|
<reference key="NSNextKeyView"/>
|
||||||
<string key="FrameName"/>
|
<string key="FrameName"/>
|
||||||
<string key="GroupName"/>
|
<string key="GroupName"/>
|
||||||
|
@ -954,6 +954,7 @@
|
||||||
</object>
|
</object>
|
||||||
<string key="NSFrameSize">{376, 581}</string>
|
<string key="NSFrameSize">{376, 581}</string>
|
||||||
<reference key="NSSuperview"/>
|
<reference key="NSSuperview"/>
|
||||||
|
<reference key="NSWindow"/>
|
||||||
<reference key="NSNextKeyView" ref="126069112"/>
|
<reference key="NSNextKeyView" ref="126069112"/>
|
||||||
</object>
|
</object>
|
||||||
<string key="NSScreenRect">{{0, 0}, {2560, 1418}}</string>
|
<string key="NSScreenRect">{{0, 0}, {2560, 1418}}</string>
|
||||||
|
@ -971,7 +972,7 @@
|
||||||
<nil key="NSViewClass"/>
|
<nil key="NSViewClass"/>
|
||||||
<nil key="NSUserInterfaceItemIdentifier"/>
|
<nil key="NSUserInterfaceItemIdentifier"/>
|
||||||
<object class="NSView" key="NSWindowView" id="469460548">
|
<object class="NSView" key="NSWindowView" id="469460548">
|
||||||
<reference key="NSNextResponder"/>
|
<nil key="NSNextResponder"/>
|
||||||
<int key="NSvFlags">256</int>
|
<int key="NSvFlags">256</int>
|
||||||
<object class="NSMutableArray" key="NSSubviews">
|
<object class="NSMutableArray" key="NSSubviews">
|
||||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
@ -1010,7 +1011,6 @@
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<string key="NSFrameSize">{376, 581}</string>
|
<string key="NSFrameSize">{376, 581}</string>
|
||||||
<reference key="NSSuperview"/>
|
|
||||||
<reference key="NSNextKeyView" ref="352293288"/>
|
<reference key="NSNextKeyView" ref="352293288"/>
|
||||||
</object>
|
</object>
|
||||||
<string key="NSScreenRect">{{0, 0}, {2560, 1418}}</string>
|
<string key="NSScreenRect">{{0, 0}, {2560, 1418}}</string>
|
||||||
|
@ -1028,7 +1028,7 @@
|
||||||
<nil key="NSViewClass"/>
|
<nil key="NSViewClass"/>
|
||||||
<nil key="NSUserInterfaceItemIdentifier"/>
|
<nil key="NSUserInterfaceItemIdentifier"/>
|
||||||
<object class="NSView" key="NSWindowView" id="352860314">
|
<object class="NSView" key="NSWindowView" id="352860314">
|
||||||
<reference key="NSNextResponder"/>
|
<nil key="NSNextResponder"/>
|
||||||
<int key="NSvFlags">256</int>
|
<int key="NSvFlags">256</int>
|
||||||
<object class="NSMutableArray" key="NSSubviews">
|
<object class="NSMutableArray" key="NSSubviews">
|
||||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
@ -1067,7 +1067,6 @@
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<string key="NSFrameSize">{376, 581}</string>
|
<string key="NSFrameSize">{376, 581}</string>
|
||||||
<reference key="NSSuperview"/>
|
|
||||||
<reference key="NSNextKeyView" ref="106985301"/>
|
<reference key="NSNextKeyView" ref="106985301"/>
|
||||||
</object>
|
</object>
|
||||||
<string key="NSScreenRect">{{0, 0}, {2560, 1418}}</string>
|
<string key="NSScreenRect">{{0, 0}, {2560, 1418}}</string>
|
||||||
|
@ -1211,7 +1210,6 @@
|
||||||
<string key="NSFrame">{{391, 46}, {75, 32}}</string>
|
<string key="NSFrame">{{391, 46}, {75, 32}}</string>
|
||||||
<reference key="NSSuperview" ref="503676418"/>
|
<reference key="NSSuperview" ref="503676418"/>
|
||||||
<reference key="NSWindow"/>
|
<reference key="NSWindow"/>
|
||||||
<reference key="NSNextKeyView"/>
|
|
||||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||||
<bool key="NSEnabled">YES</bool>
|
<bool key="NSEnabled">YES</bool>
|
||||||
<object class="NSButtonCell" key="NSCell" id="54847478">
|
<object class="NSButtonCell" key="NSCell" id="54847478">
|
||||||
|
@ -1320,7 +1318,6 @@
|
||||||
<string key="NSFrame">{{285, 13}, {74, 32}}</string>
|
<string key="NSFrame">{{285, 13}, {74, 32}}</string>
|
||||||
<reference key="NSSuperview" ref="997375509"/>
|
<reference key="NSSuperview" ref="997375509"/>
|
||||||
<reference key="NSWindow"/>
|
<reference key="NSWindow"/>
|
||||||
<reference key="NSNextKeyView"/>
|
|
||||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||||
<bool key="NSEnabled">YES</bool>
|
<bool key="NSEnabled">YES</bool>
|
||||||
<object class="NSButtonCell" key="NSCell" id="302504138">
|
<object class="NSButtonCell" key="NSCell" id="302504138">
|
||||||
|
@ -3129,7 +3126,11 @@
|
||||||
<string>clearCache:</string>
|
<string>clearCache:</string>
|
||||||
<string>login:</string>
|
<string>login:</string>
|
||||||
<string>logout:</string>
|
<string>logout:</string>
|
||||||
|
<string>openNewMessageWindow:</string>
|
||||||
|
<string>sendTweet:</string>
|
||||||
|
<string>showConversationForPostId:andEntity:</string>
|
||||||
<string>showProfile:</string>
|
<string>showProfile:</string>
|
||||||
|
<string>showProfileForEntity:</string>
|
||||||
</object>
|
</object>
|
||||||
<object class="NSArray" key="dict.values">
|
<object class="NSArray" key="dict.values">
|
||||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
@ -3137,6 +3138,10 @@
|
||||||
<string>id</string>
|
<string>id</string>
|
||||||
<string>id</string>
|
<string>id</string>
|
||||||
<string>id</string>
|
<string>id</string>
|
||||||
|
<string>id</string>
|
||||||
|
<string>NSString</string>
|
||||||
|
<string>id</string>
|
||||||
|
<string>NSString</string>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="NSMutableDictionary" key="actionInfosByName">
|
<object class="NSMutableDictionary" key="actionInfosByName">
|
||||||
|
@ -3146,7 +3151,11 @@
|
||||||
<string>clearCache:</string>
|
<string>clearCache:</string>
|
||||||
<string>login:</string>
|
<string>login:</string>
|
||||||
<string>logout:</string>
|
<string>logout:</string>
|
||||||
|
<string>openNewMessageWindow:</string>
|
||||||
|
<string>sendTweet:</string>
|
||||||
|
<string>showConversationForPostId:andEntity:</string>
|
||||||
<string>showProfile:</string>
|
<string>showProfile:</string>
|
||||||
|
<string>showProfileForEntity:</string>
|
||||||
</object>
|
</object>
|
||||||
<object class="NSArray" key="dict.values">
|
<object class="NSArray" key="dict.values">
|
||||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
@ -3162,10 +3171,26 @@
|
||||||
<string key="name">logout:</string>
|
<string key="name">logout:</string>
|
||||||
<string key="candidateClassName">id</string>
|
<string key="candidateClassName">id</string>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="IBActionInfo">
|
||||||
|
<string key="name">openNewMessageWindow:</string>
|
||||||
|
<string key="candidateClassName">id</string>
|
||||||
|
</object>
|
||||||
|
<object class="IBActionInfo">
|
||||||
|
<string key="name">sendTweet:</string>
|
||||||
|
<string key="candidateClassName">id</string>
|
||||||
|
</object>
|
||||||
|
<object class="IBActionInfo">
|
||||||
|
<string key="name">showConversationForPostId:andEntity:</string>
|
||||||
|
<string key="candidateClassName">NSString</string>
|
||||||
|
</object>
|
||||||
<object class="IBActionInfo">
|
<object class="IBActionInfo">
|
||||||
<string key="name">showProfile:</string>
|
<string key="name">showProfile:</string>
|
||||||
<string key="candidateClassName">id</string>
|
<string key="candidateClassName">id</string>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="IBActionInfo">
|
||||||
|
<string key="name">showProfileForEntity:</string>
|
||||||
|
<string key="candidateClassName">NSString</string>
|
||||||
|
</object>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="NSMutableDictionary" key="outlets">
|
<object class="NSMutableDictionary" key="outlets">
|
||||||
|
@ -3181,6 +3206,7 @@
|
||||||
<string>logoLayer</string>
|
<string>logoLayer</string>
|
||||||
<string>mentionsView</string>
|
<string>mentionsView</string>
|
||||||
<string>mentionsViewWindow</string>
|
<string>mentionsViewWindow</string>
|
||||||
|
<string>openProfileWindow</string>
|
||||||
<string>profileView</string>
|
<string>profileView</string>
|
||||||
<string>profileViewWindow</string>
|
<string>profileViewWindow</string>
|
||||||
<string>showProfileTextField</string>
|
<string>showProfileTextField</string>
|
||||||
|
@ -3199,6 +3225,7 @@
|
||||||
<string>NSImageView</string>
|
<string>NSImageView</string>
|
||||||
<string>WebView</string>
|
<string>WebView</string>
|
||||||
<string>NSWindow</string>
|
<string>NSWindow</string>
|
||||||
|
<string>NSPanel</string>
|
||||||
<string>WebView</string>
|
<string>WebView</string>
|
||||||
<string>NSWindow</string>
|
<string>NSWindow</string>
|
||||||
<string>NSTextField</string>
|
<string>NSTextField</string>
|
||||||
|
@ -3220,6 +3247,7 @@
|
||||||
<string>logoLayer</string>
|
<string>logoLayer</string>
|
||||||
<string>mentionsView</string>
|
<string>mentionsView</string>
|
||||||
<string>mentionsViewWindow</string>
|
<string>mentionsViewWindow</string>
|
||||||
|
<string>openProfileWindow</string>
|
||||||
<string>profileView</string>
|
<string>profileView</string>
|
||||||
<string>profileViewWindow</string>
|
<string>profileViewWindow</string>
|
||||||
<string>showProfileTextField</string>
|
<string>showProfileTextField</string>
|
||||||
|
@ -3265,6 +3293,10 @@
|
||||||
<string key="name">mentionsViewWindow</string>
|
<string key="name">mentionsViewWindow</string>
|
||||||
<string key="candidateClassName">NSWindow</string>
|
<string key="candidateClassName">NSWindow</string>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="IBToOneOutletInfo">
|
||||||
|
<string key="name">openProfileWindow</string>
|
||||||
|
<string key="candidateClassName">NSPanel</string>
|
||||||
|
</object>
|
||||||
<object class="IBToOneOutletInfo">
|
<object class="IBToOneOutletInfo">
|
||||||
<string key="name">profileView</string>
|
<string key="name">profileView</string>
|
||||||
<string key="candidateClassName">WebView</string>
|
<string key="candidateClassName">WebView</string>
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
define([
|
define([
|
||||||
"helper/HostApp",
|
"helper/HostApp",
|
||||||
"controller/Timeline"
|
"controller/Timeline",
|
||||||
|
"lib/URI",
|
||||||
|
"helper/Paths"
|
||||||
],
|
],
|
||||||
|
|
||||||
function(HostApp, Timeline) {
|
function(HostApp, Timeline, URI, Paths) {
|
||||||
|
|
||||||
|
|
||||||
function Mentions() {
|
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;
|
return Mentions;
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,8 @@ function(HostApp, Paths, Hmac) {
|
||||||
+ "&redirect_uri=" + this.app_info["redirect_uris"][0]
|
+ "&redirect_uri=" + this.app_info["redirect_uris"][0]
|
||||||
+ "&scope=" + Object.keys(this.app_info["scopes"]).join(",")
|
+ "&scope=" + Object.keys(this.app_info["scopes"]).join(",")
|
||||||
+ "&state=" + this.state
|
+ "&state=" + this.state
|
||||||
+ "&tent_post_types=all";
|
+ "&tent_post_types=all"
|
||||||
|
+ "&tent_profile_info_types=all";
|
||||||
|
|
||||||
HostApp.openAuthorizationURL(this.apiRoot() + auth);
|
HostApp.openAuthorizationURL(this.apiRoot() + auth);
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,6 +150,7 @@ function(jQuery, Paths, URI, HostApp, Cache) {
|
||||||
var template = this.getTemplate();
|
var template = this.getTemplate();
|
||||||
|
|
||||||
template.item.id = "post-" + (typeof status.__repost != "undefined" ? status.__repost.id : status.id);
|
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") {
|
if (HostApp.stringForKey("entity") == status.entity && typeof status.__repost == "undefined") {
|
||||||
template.remove.onclick = function() {
|
template.remove.onclick = function() {
|
||||||
|
@ -644,7 +645,9 @@ function(jQuery, Paths, URI, HostApp, Cache) {
|
||||||
|
|
||||||
var text = node.innerHTML;
|
var text = node.innerHTML;
|
||||||
var mentions_in_text = [];
|
var mentions_in_text = [];
|
||||||
var res = text.match(/(\^[\w:/]+\.[\w:/.]+(?:[\w]))/ig);
|
|
||||||
|
var res = text.match(/(\^[\w:/.]+(?:[\w]))/ig);
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
for (var i = 0; i < res.length; i++) {
|
for (var i = 0; i < res.length; i++) {
|
||||||
var name = res[i];
|
var name = res[i];
|
||||||
|
@ -671,11 +674,12 @@ function(jQuery, Paths, URI, HostApp, Cache) {
|
||||||
(function(mention) { // need this closure
|
(function(mention) { // need this closure
|
||||||
|
|
||||||
var profile = function(profile) {
|
var profile = function(profile) {
|
||||||
|
|
||||||
var basic = profile["https://tent.io/types/info/basic/v0.1.0"];
|
var basic = profile["https://tent.io/types/info/basic/v0.1.0"];
|
||||||
|
|
||||||
if (profile && basic) {
|
if (profile) {
|
||||||
var name = mention.text;
|
var name = mention.text;
|
||||||
if (basic.name) {
|
if (basic && basic.name) {
|
||||||
name = basic.name;
|
name = basic.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue