diff --git a/Mac/English.lproj/NewMessageWindow.xib b/Mac/English.lproj/NewMessageWindow.xib index a2204f0..a90811e 100644 --- a/Mac/English.lproj/NewMessageWindow.xib +++ b/Mac/English.lproj/NewMessageWindow.xib @@ -99,7 +99,6 @@ {{257, 2}, {38, 17}} - YES 68157504 @@ -184,23 +183,15 @@ Add current location 2147483647 - + NSImage NSMenuCheckmark - + NSImage NSMenuMixedState - - - Add photo - - 2147483647 - - - @@ -271,14 +262,6 @@ 100054 - - - addImage: - - - - 100056 - delegate @@ -394,7 +377,6 @@ YES - @@ -403,11 +385,6 @@ - - 100055 - - - @@ -425,7 +402,6 @@ 100040.IBPluginDependency 100041.IBPluginDependency 100043.IBPluginDependency - 100055.IBPluginDependency 5.IBPluginDependency 5.IBWindowTemplateEditedContentRect 6.IBPluginDependency @@ -444,7 +420,6 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin {{127, 736}, {299, 113}} com.apple.InterfaceBuilder.CocoaPlugin diff --git a/Mac/Tentia-Info.plist b/Mac/Tentia-Info.plist index 15dcd0e..060baa3 100644 --- a/Mac/Tentia-Info.plist +++ b/Mac/Tentia-Info.plist @@ -42,7 +42,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.4.0 + 0.4.2 CFBundleSignature ???? CFBundleURLTypes @@ -57,7 +57,7 @@ CFBundleVersion - 0.4.0 + 0.4.2 LSApplicationCategoryType public.app-category.lifestyle LSMinimumSystemVersion diff --git a/Mac/publish/ReleaseNotes.html b/Mac/publish/ReleaseNotes.html index 34fe092..07a7b8c 100644 --- a/Mac/publish/ReleaseNotes.html +++ b/Mac/publish/ReleaseNotes.html @@ -14,6 +14,13 @@ +

Tentia 0.4.2

+ +

Removed Photo post type because the Tent protocol in version 0.1.0 does not quite support it yet

+

Implemented showing and making reposts

+ +
+

Tentia 0.4.1

Fixed problem where you couldn't log in again after you logged out.

diff --git a/WebKit/css/default.css b/WebKit/css/default.css index 52a2f55..ddd6c62 100644 --- a/WebKit/css/default.css +++ b/WebKit/css/default.css @@ -22,7 +22,7 @@ ol { li, .error { clear: both; - padding: 8px 16px 8px 8px; + padding: 8px; background: #eee; border-top: 1px solid #fefefe; border-bottom: 1px solid #c9c9c9; @@ -71,13 +71,6 @@ h1 { font-weight: bold; margin: 0; padding: 0; - margin-right: -8px; - overflow: hidden; - white-space: nowrap; -} - -h1.favorited:after { - content: "*"; } h1 img { @@ -87,13 +80,10 @@ h1 img { p { margin: 0; padding: 0; - padding-left: 3px; - margin-left: -3px; - padding-bottom: 2px; - margin-bottom: -2px; + word-wrap: break-word; } -.image, .twitpic { +.image { float: left; margin-left: 2px; width: 48px; @@ -108,18 +98,6 @@ p { height: 48px; } -.twitpic { - float: right; - width: 75px; - height: 75px; -} - -.twitpic a { - display: block; - width: 75px; - height: 75px; -} - .images:empty { display: none; } @@ -134,39 +112,18 @@ p { margin-right: 5px; } -.direct-message { - color: #555; -} - -.retweeted span { - height: 11px; - width: 15px; - background: url(../img/sprite-icons.png) no-repeat -192px -1px; - display: inline-block; - margin: 0 3px 0 4px; +.images img.photo { + max-width: 100%; + max-height: auto; + margin-right: 0; + border-radius: 3px; + box-shadow: 0 0 1px black; } .data { margin-left: 62px; } -.message { - overflow: hidden; -} - -.reply, .direct-message { - display: none; - font-weight: normal; -} - -.reply a { - font-weight: bold; -} - -li:hover .reply, li:hover .direct-message { - display: inline; -} - li .name:first-child { margin-left: -3px; } @@ -225,28 +182,30 @@ li:first-child:hover .date { border-top: 0; } -.reply_to, .retweet, .remove { +aside { + width: 15px; + float: right; + margin: 0 3px 3px 3px; + visibility: hidden; +} + +.reply_to, .repost, .remove { width: 15px; height: 12px; - position: absolute; - top: 5px; - right: 10px; background: url(../img/sprite-icons.png) no-repeat -16px 0; - display: none; + display: inline-block; } -li:hover .reply_to, li:hover .retweet, li:hover .remove { - display: block; +li:hover aside { + visibility: visible; } -.retweet { - top: 18px; +.repost { background-position: -192px 0; } .remove { background-position: -128px 0; - top: 20px; } li.mentioned { @@ -257,9 +216,11 @@ li.mentioned { border-right: 0; } -.photo { - margin-top: 10px; - max-width: 100%; - border-radius: 3px; - box-shadow: 0 0 1px black; -} \ No newline at end of file +.reposted_by:before { + content: " "; + display: inline-block; + background: url(../img/sprite-icons.png) no-repeat -192px 0; + height: 12px; + width: 15px; + margin-right: 5px; +} diff --git a/WebKit/scripts/controller/Timeline.js b/WebKit/scripts/controller/Timeline.js index 55d8785..4f9c734 100644 --- a/WebKit/scripts/controller/Timeline.js +++ b/WebKit/scripts/controller/Timeline.js @@ -68,7 +68,7 @@ function(Core, Paths, HostApp, URI) { } } else if (status.type == "https://tent.io/types/post/repost/v0.1.0") { - //debug(status) + this.getRepost(status, this.body.firstChild); } } @@ -125,6 +125,30 @@ function(Core, Paths, HostApp, URI) { } } + Timeline.prototype.getRepost = function(repost, before_node) { + + var _this = this; + var callback = function(resp) { + var status = JSON.parse(resp.responseText); + status.__repost = repost; + var li = _this.getStatusDOMElement(status); + before_node.parentNode.insertBefore(li, before_node); + } + + Paths.findProfileURL(repost.content.entity, function(profile_url) { + if (profile_url) { + + Paths.getURL(profile_url, "GET", function(resp) { + + var profile = JSON.parse(resp.responseText); + var server = profile["https://tent.io/types/info/core/v0.1.0"].servers[0]; + Paths.getURL(URI(server + "/posts/" + repost.content.id).toString(), "GET", callback, null, false); + + }, null, false); // do not send auth-headers + } + }) + } + Timeline.prototype.sendNewMessage = function(content, in_reply_to_status_id, in_reply_to_entity, location, image_data_uri) { var _this = this; var callback = function(data) { _this.getNewData(); } @@ -137,6 +161,14 @@ function(Core, Paths, HostApp, URI) { Core.prototype.remove.call(this, id, callback); } + Timeline.prototype.repost = function(id, entity, callback) { + var _this = this; + if (!callback) { + callback = function(data) { _this.getNewData(); } + } + Core.prototype.repost.call(this, id, entity, callback); + } + return Timeline; }); \ No newline at end of file diff --git a/WebKit/scripts/helper/Core.js b/WebKit/scripts/helper/Core.js index f554706..9fa3308 100644 --- a/WebKit/scripts/helper/Core.js +++ b/WebKit/scripts/helper/Core.js @@ -24,25 +24,27 @@ function(jQuery, Paths, URI, HostApp, Followings) { var a = document.createElement("a"); var item = document.createElement("li"); + + var aside = document.createElement("aside"); + item.appendChild(aside); var reply_to = a.cloneNode(); reply_to.className = "reply_to" reply_to.innerText = " "; reply_to.href = "#"; - item.appendChild(reply_to); + aside.appendChild(reply_to); - var retweet = a.cloneNode(); - retweet.className = "retweet"; - retweet.innerText = " "; - retweet.href = "#"; - // item.appendChild(retweet); // FIXME + var repost = a.cloneNode(); + repost.className = "repost"; + repost.innerText = " "; + repost.href = "#"; + aside.appendChild(repost); var remove = a.cloneNode(); remove.className = "remove"; remove.innerText = " "; remove.href = "#"; - item.appendChild(remove); - + aside.appendChild(remove); var image = document.createElement("img"); image.className = "image"; @@ -63,10 +65,6 @@ function(jQuery, Paths, URI, HostApp, Followings) { var username = a.cloneNode(); head.appendChild(username); - var in_reply = document.createElement("span"); - in_reply.className = "reply"; - head.appendChild(in_reply); - var space = document.createTextNode(" "); head.appendChild(space); @@ -89,12 +87,14 @@ function(jQuery, Paths, URI, HostApp, Followings) { pin.src = "img/pin.png"; pin.alt = "Map link"; geo.appendChild(pin); - - var in_reply_text = document.createTextNode(" in reply to "); - in_reply.appendChild(in_reply_text) - - var in_reply_a = a.cloneNode(); - in_reply.appendChild(in_reply_a); + + head.appendChild(space.cloneNode()); + + var reposted_by = a.cloneNode(); + reposted_by.className = "reposted_by"; + reposted_by.style.display = "none"; + head.appendChild(reposted_by) + var message = document.createElement("p"); message.className = "message"; @@ -122,10 +122,10 @@ function(jQuery, Paths, URI, HostApp, Followings) { item: item, reply_to: reply_to, is_private: is_private, - retweet: retweet, image: image, username: username, - in_reply: in_reply_a, + repost: repost, + reposted_by: reposted_by, message: message, ago: ago, source: source, @@ -143,13 +143,18 @@ function(jQuery, Paths, URI, HostApp, Followings) { var template = this.getTemplate(); - template.item.id = "post-" + status.id; + template.item.id = "post-" + (typeof status.__repost != "undefined" ? status.__repost.id : status.id); if (HostApp.stringForKey("entity") == status.entity) { template.remove.onclick = function() { _this.remove(status.id); return false; } + } else if (status.__repost && HostApp.stringForKey("entity") == status.__repost.entity) { + template.remove.onclick = function() { + _this.remove(status.__repost.id); + return false; + } } else { template.remove.style.display = "none"; } @@ -168,7 +173,12 @@ function(jQuery, Paths, URI, HostApp, Followings) { } //template.retweet.onclick = function() { template.retweet.className = "hidden"; _this.retweet(status.id_str, template.item); return false; } - + template.repost.onclick = function() { + template.repost.className = "hidden"; + _this.repost(status.id, status.entity); + return false; + } + template.username.innerText = status.entity; template.username.href = status.entity; // FIXME open profile @@ -205,12 +215,39 @@ function(jQuery, Paths, URI, HostApp, Followings) { }); } + if (typeof status.__repost != "undefined") { + + template.reposted_by.href = status.__repost.entity; + template.reposted_by.innerText = status.__repost.entity; + template.reposted_by.title = status.__repost.entity; + template.reposted_by.style.display = ''; + + if (this.followings.followings[status.__repost.entity]) { + + var basic = this.followings.followings[status.__repost.entity].profile["https://tent.io/types/info/basic/v0.1.0"]; + template.reposted_by.innerText = basic.name; + } else { + + Paths.findProfileURL(status.__repost.entity, function(profile_url) { + if (profile_url) { + Paths.getURL(profile_url, "GET", function(resp) { + var p = JSON.parse(resp.responseText); + var profile = p["https://tent.io/types/info/basic/v0.1.0"]; + if (profile && profile.name) { + template.reposted_by.innerText = profile.name; + } + + }, null, false); // do not send auth-headers + } + }); + + } + } + if (status && status.permissions && !status.permissions.public) { template.is_private.style.display = ''; } - template.in_reply.parentNode.className = "hidden"; - var text = ""; if (status.type == "https://tent.io/types/post/photo/v0.1.0") { @@ -233,17 +270,19 @@ function(jQuery, Paths, URI, HostApp, Followings) { if (status.type == "https://tent.io/types/post/photo/v0.1.0") { for (var i = 0; i < status.attachments.length; i++) { + // closure needed for the callback + (function() { + var attachment = status.attachments[i]; + var img = new Image(); + img.className = "photo"; + template.images.append(img); - var attachment = status.attachments[i]; - var img = new Image(); - img.className = "photo"; - template.message.parentNode.insertBefore(img, template.message.nextSibling); + var url = Paths.mkApiRootPath("/posts/" + status.id + "/attachments/" + attachment.name); - var url = Paths.mkApiRootPath("/posts/" + status.id + "/attachments/" + attachment.name); - - var callback = function(resp) { - img.src = "data:image/png;base64," + resp.responseText; - } + var callback = function(resp) { + img.src = "data:image/png;base64," + resp.responseText; + } + })(); Paths.getURL(url.toString(), "GET", callback, null, null, attachment.type); }; @@ -321,6 +360,25 @@ function(jQuery, Paths, URI, HostApp, Followings) { } } + + Core.prototype.repost = function(id, entity, callback) { + var url = URI(Paths.mkApiRootPath("/posts")); + + var data = { + "type": "https://tent.io/types/post/repost/v0.1.0", + "published_at": parseInt(new Date().getTime() / 1000, 10), + "permissions": { + "public": true + }, + "content": { + "entity": entity, + "id": id + } + }; + + Paths.getURL(url.toString(), "POST", callback, JSON.stringify(data)); + } + Core.prototype.sendNewMessageWithImage = function(content, in_reply_to_status_id, in_reply_to_entity, location, image_data_uri, callback) { var url = URI(Paths.mkApiRootPath("/posts"));