removed add image and implemented reposts
This commit is contained in:
parent
5ca4fd7985
commit
3a81618436
6 changed files with 164 additions and 131 deletions
|
@ -99,7 +99,6 @@
|
|||
<string key="NSFrame">{{257, 2}, {38, 17}}</string>
|
||||
<reference key="NSSuperview" ref="568628114"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSTextFieldCell" key="NSCell" id="894039108">
|
||||
<int key="NSCellFlags">68157504</int>
|
||||
|
@ -184,23 +183,15 @@
|
|||
<string key="NSTitle">Add current location</string>
|
||||
<string key="NSKeyEquiv"/>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<object class="NSCustomResource" key="NSOnImage" id="400068421">
|
||||
<object class="NSCustomResource" key="NSOnImage">
|
||||
<string key="NSClassName">NSImage</string>
|
||||
<string key="NSResourceName">NSMenuCheckmark</string>
|
||||
</object>
|
||||
<object class="NSCustomResource" key="NSMixedImage" id="196417858">
|
||||
<object class="NSCustomResource" key="NSMixedImage">
|
||||
<string key="NSClassName">NSImage</string>
|
||||
<string key="NSResourceName">NSMenuMixedState</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMenuItem" id="502380341">
|
||||
<reference key="NSMenu" ref="723763594"/>
|
||||
<string key="NSTitle">Add photo</string>
|
||||
<string key="NSKeyEquiv"/>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<reference key="NSOnImage" ref="400068421"/>
|
||||
<reference key="NSMixedImage" ref="196417858"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
@ -271,14 +262,6 @@
|
|||
</object>
|
||||
<int key="connectionID">100054</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">addImage:</string>
|
||||
<reference key="source" ref="512844837"/>
|
||||
<reference key="destination" ref="502380341"/>
|
||||
</object>
|
||||
<int key="connectionID">100056</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">delegate</string>
|
||||
|
@ -394,7 +377,6 @@
|
|||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="921309347"/>
|
||||
<reference ref="502380341"/>
|
||||
</object>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
|
@ -403,11 +385,6 @@
|
|||
<reference key="object" ref="921309347"/>
|
||||
<reference key="parent" ref="723763594"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">100055</int>
|
||||
<reference key="object" ref="502380341"/>
|
||||
<reference key="parent" ref="723763594"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="flattenedProperties">
|
||||
|
@ -425,7 +402,6 @@
|
|||
<string>100040.IBPluginDependency</string>
|
||||
<string>100041.IBPluginDependency</string>
|
||||
<string>100043.IBPluginDependency</string>
|
||||
<string>100055.IBPluginDependency</string>
|
||||
<string>5.IBPluginDependency</string>
|
||||
<string>5.IBWindowTemplateEditedContentRect</string>
|
||||
<string>6.IBPluginDependency</string>
|
||||
|
@ -444,7 +420,6 @@
|
|||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>{{127, 736}, {299, 113}}</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
</object>
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.4.0</string>
|
||||
<string>0.4.2</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleURLTypes</key>
|
||||
|
@ -57,7 +57,7 @@
|
|||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>0.4.0</string>
|
||||
<string>0.4.2</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.lifestyle</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
|
|
|
@ -14,6 +14,13 @@
|
|||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Tentia 0.4.2</h1>
|
||||
|
||||
<p>Removed Photo post type because the Tent protocol in version 0.1.0 does not quite support it yet</p>
|
||||
<p>Implemented showing and making reposts</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<h1>Tentia 0.4.1</h1>
|
||||
|
||||
<p>Fixed problem where you couldn't log in again after you logged out.</p>
|
||||
|
|
|
@ -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;
|
||||
.reposted_by:before {
|
||||
content: " ";
|
||||
display: inline-block;
|
||||
background: url(../img/sprite-icons.png) no-repeat -192px 0;
|
||||
height: 12px;
|
||||
width: 15px;
|
||||
margin-right: 5px;
|
||||
}
|
|
@ -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;
|
||||
|
||||
});
|
|
@ -25,24 +25,26 @@ function(jQuery, Paths, URI, HostApp, Followings) {
|
|||
|
||||
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);
|
||||
|
||||
|
@ -90,11 +88,13 @@ function(jQuery, Paths, URI, HostApp, Followings) {
|
|||
pin.alt = "Map link";
|
||||
geo.appendChild(pin);
|
||||
|
||||
var in_reply_text = document.createTextNode(" in reply to ");
|
||||
in_reply.appendChild(in_reply_text)
|
||||
head.appendChild(space.cloneNode());
|
||||
|
||||
var reposted_by = a.cloneNode();
|
||||
reposted_by.className = "reposted_by";
|
||||
reposted_by.style.display = "none";
|
||||
head.appendChild(reposted_by)
|
||||
|
||||
var in_reply_a = a.cloneNode();
|
||||
in_reply.appendChild(in_reply_a);
|
||||
|
||||
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,6 +173,11 @@ 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"));
|
||||
|
|
Reference in a new issue