fixed mentions
This commit is contained in:
parent
2b925dec34
commit
0d39948c7e
9 changed files with 357 additions and 23 deletions
|
@ -40,7 +40,7 @@
|
|||
- (void)authentificationSucceded:(id)sender;
|
||||
- (void)initWebViews;
|
||||
- (void)initHotKeys;
|
||||
- (void)openNewMessageWindowInReplyTo:(NSString *)userName statusId:(NSString *)statusId;
|
||||
- (void)openNewMessageWindowInReplyTo:(NSString *)userName statusId:(NSString *)statusId withString:(NSString *)string;
|
||||
- (NSString *)pluginURL;
|
||||
- (void)handleGetURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent;
|
||||
- (void)unreadMentions:(NSInteger)count;
|
||||
|
|
|
@ -175,10 +175,10 @@
|
|||
[[NSDocumentController sharedDocumentController] openUntitledDocumentAndDisplay:YES error:nil];
|
||||
}
|
||||
|
||||
- (void)openNewMessageWindowInReplyTo:(NSString *)userName statusId:(NSString *)statusId {
|
||||
- (void)openNewMessageWindowInReplyTo:(NSString *)userName statusId:(NSString *)statusId withString:(NSString *)string {
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
NewMessageWindow *newTweet = (NewMessageWindow *)[[NSDocumentController sharedDocumentController] openUntitledDocumentAndDisplay:YES error:nil];
|
||||
[newTweet inReplyTo:userName statusId:statusId];
|
||||
[newTweet inReplyTo:userName statusId:statusId withString:string];
|
||||
}
|
||||
|
||||
- (void)openNewMessageWindowWithString:(NSString *)aString {
|
||||
|
@ -202,7 +202,10 @@
|
|||
|
||||
- (IBAction)sendTweet:(id)sender {
|
||||
TweetModel *tweet = (TweetModel *)[sender object];
|
||||
NSString *func = [NSString stringWithFormat:@"tentia_instance.sendNewMessage(\"%@\", \"%@\")", [tweet.text stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""], tweet.inReplyTostatusId];
|
||||
NSString *func = [NSString stringWithFormat:@"tentia_instance.sendNewMessage(\"%@\", \"%@\", \"%@\")",
|
||||
[tweet.text stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""],
|
||||
tweet.inReplyTostatusId,
|
||||
tweet.inReplyToEntity];
|
||||
[timelineView stringByEvaluatingJavaScriptFromString:func];
|
||||
}
|
||||
|
||||
|
|
70
Core.js
70
Core.js
|
@ -73,7 +73,16 @@ Core.prototype.getItem = function(status) {
|
|||
|
||||
var template = this.getTemplate();
|
||||
|
||||
template.reply_to.onclick = function() { replyTo(status.entity, status.id); return false; }
|
||||
template.reply_to.onclick = function() {
|
||||
var mentions = [];
|
||||
for (var i = 0; i < status.mentions.length; i++) {
|
||||
var mention = status.mentions[i];
|
||||
if(mention.entity != controller.stringForKey_("entity"))
|
||||
mentions.push(mention);
|
||||
};
|
||||
replyTo(status.entity, status.id, mentions);
|
||||
return false;
|
||||
}
|
||||
//template.retweet.onclick = function() { template.retweet.className = "hidden"; _this.retweet(status.id_str, template.item); return false; }
|
||||
|
||||
//template.image.src = status.user.profile_image_url;
|
||||
|
@ -87,7 +96,10 @@ Core.prototype.getItem = function(status) {
|
|||
var basic = profile["https://tent.io/types/info/basic/v0.1.0"];
|
||||
|
||||
if (profile && basic) {
|
||||
if(basic.name) template.username.innerText = basic.name;
|
||||
if(basic.name) {
|
||||
template.username.title = template.username.innerText;
|
||||
template.username.innerText = basic.name;
|
||||
}
|
||||
if(basic.avatar_url) template.image.src = basic.avatar_url;
|
||||
}
|
||||
});
|
||||
|
@ -113,7 +125,7 @@ Core.prototype.getItem = function(status) {
|
|||
else */template.in_reply.parentNode.className = "hidden";
|
||||
//template.in_reply.href = WEBSITE_PATH + status.in_reply_to_screen_name + "/status/" + status.in_reply_to_status_id_str;
|
||||
|
||||
template.message.innerHTML = replaceTwitterLinks(replaceURLWithHTMLLinks(status.content.text, status.entities, template.message));
|
||||
template.message.innerHTML = replaceUsernamesWithLinks(replaceURLWithHTMLLinks(status.content.text, status.entities, template.message));
|
||||
|
||||
var time = document.createElement("abbr");
|
||||
time.innerText = ISODateString(new Date(status.published_at * 1000));
|
||||
|
@ -346,7 +358,7 @@ Core.prototype.getNewData = function(supress_new_with_timeout) {
|
|||
}
|
||||
|
||||
|
||||
Core.prototype.sendNewMessage = function(content, in_reply_to_status_id) {
|
||||
Core.prototype.sendNewMessage = function(content, in_reply_to_status_id, in_reply_to_entity) {
|
||||
|
||||
var _this = this;
|
||||
|
||||
|
@ -355,7 +367,7 @@ Core.prototype.sendNewMessage = function(content, in_reply_to_status_id) {
|
|||
var http_method = "POST";
|
||||
var callback = function(data) { _this.getNewData(true); }
|
||||
|
||||
var data = JSON.stringify({
|
||||
var data = {
|
||||
"type": "https://tent.io/types/post/status/v0.1.0",
|
||||
"published_at": (new Date().getTime() / 1000),
|
||||
"permissions": {
|
||||
|
@ -363,14 +375,19 @@ Core.prototype.sendNewMessage = function(content, in_reply_to_status_id) {
|
|||
},
|
||||
"content": {
|
||||
"text": content,
|
||||
},
|
||||
};
|
||||
|
||||
var mentions = parseMentions(content, in_reply_to_status_id, in_reply_to_entity);
|
||||
if (mentions.length > 0) {
|
||||
data["mentions"] = mentions;
|
||||
}
|
||||
});
|
||||
|
||||
getURL(
|
||||
url.toString(),
|
||||
http_method,
|
||||
callback,
|
||||
data,
|
||||
JSON.stringify(data),
|
||||
makeAuthHeader(
|
||||
url.toString(),
|
||||
http_method,
|
||||
|
@ -415,6 +432,7 @@ Core.prototype.sendNewMessage = function(content, in_reply_to_status_id) {
|
|||
}
|
||||
});*/
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Core.prototype.retweet = function(status_id, item) {
|
||||
|
@ -531,7 +549,9 @@ Core.prototype.findUsernamesFor = function(query) {
|
|||
/* Helper functions */
|
||||
|
||||
function replaceURLWithHTMLLinks(text, entities, message_node) {
|
||||
if(!entities) return text;
|
||||
var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_()|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
|
||||
return text.replace(exp, "<a href='$1'>$1</a>");
|
||||
|
||||
/*
|
||||
var urls = entities.urls;
|
||||
|
||||
|
@ -594,7 +614,7 @@ function replaceURLWithHTMLLinks(text, entities, message_node) {
|
|||
return text;*/
|
||||
}
|
||||
|
||||
function replaceTwitterLinks(text) {
|
||||
function replaceUsernamesWithLinks(text, mentions) {
|
||||
return text; // FIXME!
|
||||
var username = /(^|\s)(\^)(\w+)/ig;
|
||||
var hash = /(^|\s)(#)(\w+)/ig;
|
||||
|
@ -602,8 +622,12 @@ function replaceTwitterLinks(text) {
|
|||
return text.replace(hash, "$1$2<a href='http://search.twitter.com/search?q=%23$3'>$3</a>");
|
||||
}
|
||||
|
||||
function replyTo(username, status_id) {
|
||||
controller.openNewMessageWindowInReplyTo_statusId_(username, status_id);
|
||||
function replyTo(entity, status_id, mentions) {
|
||||
var string = "^" + entity + " ";
|
||||
for (var i = 0; i < mentions.length; i++) {
|
||||
string += "^" + mentions[i].entity + " ";
|
||||
}
|
||||
controller.openNewMessageWindowInReplyTo_statusId_withString_(entity, status_id, string);
|
||||
}
|
||||
|
||||
function loadPlugin(url) {
|
||||
|
@ -659,6 +683,30 @@ function replaceShortened(url, message_node) {
|
|||
});
|
||||
}
|
||||
|
||||
function parseMentions(text, post_id, entity) {
|
||||
var mentions = [];
|
||||
|
||||
if (post_id && entity) {
|
||||
mentions.push({
|
||||
post: post_id,
|
||||
entity: entity
|
||||
})
|
||||
}
|
||||
|
||||
var res = text.match(/((\^https?):\/\/\S+)/ig);
|
||||
|
||||
if (res) {
|
||||
for (var i = 0; i < res.length; i++) {
|
||||
var e = res[i].substring(1);
|
||||
if (e != entity) {
|
||||
mentions.push({entity:e});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return mentions;
|
||||
}
|
||||
|
||||
function ISODateString(d){
|
||||
function pad(n){return n<10 ? '0'+n : n}
|
||||
return d.getUTCFullYear()+'-'
|
||||
|
|
|
@ -21,9 +21,15 @@
|
|||
</object>
|
||||
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>NSButton</string>
|
||||
<string>NSButtonCell</string>
|
||||
<string>NSCustomObject</string>
|
||||
<string>NSImageCell</string>
|
||||
<string>NSImageView</string>
|
||||
<string>NSMenu</string>
|
||||
<string>NSMenuItem</string>
|
||||
<string>NSTextField</string>
|
||||
<string>NSTextFieldCell</string>
|
||||
<string>NSView</string>
|
||||
<string>NSWindowTemplate</string>
|
||||
<string>WebView</string>
|
||||
|
@ -903,6 +909,168 @@
|
|||
<string key="NSFrameAutosaveName">mentions</string>
|
||||
<bool key="NSWindowIsRestorable">YES</bool>
|
||||
</object>
|
||||
<object class="NSWindowTemplate" id="842998572">
|
||||
<int key="NSWindowStyleMask">15</int>
|
||||
<int key="NSWindowBacking">2</int>
|
||||
<string key="NSWindowRect">{{641, 502}, {480, 186}}</string>
|
||||
<int key="NSWTFlags">611845120</int>
|
||||
<string key="NSWindowTitle">Login</string>
|
||||
<string key="NSWindowClass">NSWindow</string>
|
||||
<nil key="NSViewClass"/>
|
||||
<nil key="NSUserInterfaceItemIdentifier"/>
|
||||
<object class="NSView" key="NSWindowView" id="503676418">
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">256</int>
|
||||
<object class="NSMutableArray" key="NSSubviews">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSImageView" id="433812480">
|
||||
<reference key="NSNextResponder" ref="503676418"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<object class="NSMutableSet" key="NSDragTypes">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="set.sortedObjects">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>Apple PDF pasteboard type</string>
|
||||
<string>Apple PICT pasteboard type</string>
|
||||
<string>Apple PNG pasteboard type</string>
|
||||
<string>NSFilenamesPboardType</string>
|
||||
<string>NeXT Encapsulated PostScript v1.2 pasteboard type</string>
|
||||
<string>NeXT TIFF v4.0 pasteboard type</string>
|
||||
</object>
|
||||
</object>
|
||||
<string key="NSFrame">{{20, 20}, {146, 146}}</string>
|
||||
<reference key="NSSuperview" ref="503676418"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="215157023"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSImageCell" key="NSCell" id="266676500">
|
||||
<int key="NSCellFlags">0</int>
|
||||
<int key="NSCellFlags2">33554432</int>
|
||||
<object class="NSCustomResource" key="NSContents">
|
||||
<string key="NSClassName">NSImage</string>
|
||||
<string key="NSResourceName">Icon</string>
|
||||
</object>
|
||||
<int key="NSAlign">0</int>
|
||||
<int key="NSScale">0</int>
|
||||
<int key="NSStyle">0</int>
|
||||
<bool key="NSAnimates">YES</bool>
|
||||
</object>
|
||||
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
|
||||
<bool key="NSEditable">YES</bool>
|
||||
</object>
|
||||
<object class="NSTextField" id="643973685">
|
||||
<reference key="NSNextResponder" ref="503676418"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{194, 82}, {266, 22}}</string>
|
||||
<reference key="NSSuperview" ref="503676418"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="251531186"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSTextFieldCell" key="NSCell" id="2007231">
|
||||
<int key="NSCellFlags">-1804599231</int>
|
||||
<int key="NSCellFlags2">272630784</int>
|
||||
<string key="NSContents"/>
|
||||
<object class="NSFont" key="NSSupport" id="528364649">
|
||||
<string key="NSName">LucidaGrande</string>
|
||||
<double key="NSSize">13</double>
|
||||
<int key="NSfFlags">1044</int>
|
||||
</object>
|
||||
<string key="NSPlaceholderString">https://someone.tent.is</string>
|
||||
<string key="NSCellIdentifier">_NS:9</string>
|
||||
<reference key="NSControlView" ref="643973685"/>
|
||||
<bool key="NSDrawsBackground">YES</bool>
|
||||
<object class="NSColor" key="NSBackgroundColor">
|
||||
<int key="NSColorSpace">6</int>
|
||||
<string key="NSCatalogName">System</string>
|
||||
<string key="NSColorName">textBackgroundColor</string>
|
||||
<object class="NSColor" key="NSColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MQA</bytes>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSColor" key="NSTextColor">
|
||||
<int key="NSColorSpace">6</int>
|
||||
<string key="NSCatalogName">System</string>
|
||||
<string key="NSColorName">textColor</string>
|
||||
<object class="NSColor" key="NSColor" id="90908694">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MAA</bytes>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
|
||||
</object>
|
||||
<object class="NSTextField" id="215157023">
|
||||
<reference key="NSNextResponder" ref="503676418"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{191, 112}, {163, 17}}</string>
|
||||
<reference key="NSSuperview" ref="503676418"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="643973685"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:1535</string>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSTextFieldCell" key="NSCell" id="860986880">
|
||||
<int key="NSCellFlags">68157504</int>
|
||||
<int key="NSCellFlags2">272630784</int>
|
||||
<string key="NSContents">Add your entity to log in:</string>
|
||||
<reference key="NSSupport" ref="528364649"/>
|
||||
<string key="NSCellIdentifier">_NS:1535</string>
|
||||
<reference key="NSControlView" ref="215157023"/>
|
||||
<object class="NSColor" key="NSBackgroundColor">
|
||||
<int key="NSColorSpace">6</int>
|
||||
<string key="NSCatalogName">System</string>
|
||||
<string key="NSColorName">controlColor</string>
|
||||
<object class="NSColor" key="NSColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSColor" key="NSTextColor">
|
||||
<int key="NSColorSpace">6</int>
|
||||
<string key="NSCatalogName">System</string>
|
||||
<string key="NSColorName">controlTextColor</string>
|
||||
<reference key="NSColor" ref="90908694"/>
|
||||
</object>
|
||||
</object>
|
||||
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
|
||||
</object>
|
||||
<object class="NSButton" id="251531186">
|
||||
<reference key="NSNextResponder" ref="503676418"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{391, 46}, {75, 32}}</string>
|
||||
<reference key="NSSuperview" ref="503676418"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSButtonCell" key="NSCell" id="54847478">
|
||||
<int key="NSCellFlags">67108864</int>
|
||||
<int key="NSCellFlags2">134217728</int>
|
||||
<string key="NSContents">Login</string>
|
||||
<reference key="NSSupport" ref="528364649"/>
|
||||
<string key="NSCellIdentifier">_NS:9</string>
|
||||
<reference key="NSControlView" ref="251531186"/>
|
||||
<int key="NSButtonFlags">-2038284288</int>
|
||||
<int key="NSButtonFlags2">129</int>
|
||||
<string key="NSAlternateContents"/>
|
||||
<string key="NSKeyEquivalent"/>
|
||||
<int key="NSPeriodicDelay">200</int>
|
||||
<int key="NSPeriodicInterval">25</int>
|
||||
</object>
|
||||
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
|
||||
</object>
|
||||
</object>
|
||||
<string key="NSFrameSize">{480, 186}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="433812480"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:20</string>
|
||||
</object>
|
||||
<string key="NSScreenRect">{{0, 0}, {2560, 1418}}</string>
|
||||
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
|
||||
<bool key="NSWindowIsRestorable">YES</bool>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBObjectContainer" key="IBDocument.Objects">
|
||||
<object class="NSMutableArray" key="connectionRecords">
|
||||
|
@ -1974,6 +2142,83 @@
|
|||
<reference key="object" ref="126069112"/>
|
||||
<reference key="parent" ref="438898709"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">592</int>
|
||||
<reference key="object" ref="842998572"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="503676418"/>
|
||||
</object>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">593</int>
|
||||
<reference key="object" ref="503676418"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="433812480"/>
|
||||
<reference ref="643973685"/>
|
||||
<reference ref="215157023"/>
|
||||
<reference ref="251531186"/>
|
||||
</object>
|
||||
<reference key="parent" ref="842998572"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">594</int>
|
||||
<reference key="object" ref="433812480"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="266676500"/>
|
||||
</object>
|
||||
<reference key="parent" ref="503676418"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">595</int>
|
||||
<reference key="object" ref="266676500"/>
|
||||
<reference key="parent" ref="433812480"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">596</int>
|
||||
<reference key="object" ref="643973685"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="2007231"/>
|
||||
</object>
|
||||
<reference key="parent" ref="503676418"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">597</int>
|
||||
<reference key="object" ref="2007231"/>
|
||||
<reference key="parent" ref="643973685"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">598</int>
|
||||
<reference key="object" ref="215157023"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="860986880"/>
|
||||
</object>
|
||||
<reference key="parent" ref="503676418"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">599</int>
|
||||
<reference key="object" ref="860986880"/>
|
||||
<reference key="parent" ref="215157023"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">600</int>
|
||||
<reference key="object" ref="251531186"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="54847478"/>
|
||||
</object>
|
||||
<reference key="parent" ref="503676418"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">601</int>
|
||||
<reference key="object" ref="54847478"/>
|
||||
<reference key="parent" ref="251531186"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="flattenedProperties">
|
||||
|
@ -2069,6 +2314,17 @@
|
|||
<string>561.IBPluginDependency</string>
|
||||
<string>57.IBPluginDependency</string>
|
||||
<string>58.IBPluginDependency</string>
|
||||
<string>592.IBPluginDependency</string>
|
||||
<string>592.NSWindowTemplate.visibleAtLaunch</string>
|
||||
<string>593.IBPluginDependency</string>
|
||||
<string>594.IBPluginDependency</string>
|
||||
<string>595.IBPluginDependency</string>
|
||||
<string>596.IBPluginDependency</string>
|
||||
<string>597.IBPluginDependency</string>
|
||||
<string>598.IBPluginDependency</string>
|
||||
<string>599.IBPluginDependency</string>
|
||||
<string>600.IBPluginDependency</string>
|
||||
<string>601.IBPluginDependency</string>
|
||||
<string>72.IBPluginDependency</string>
|
||||
<string>73.IBPluginDependency</string>
|
||||
<string>79.IBPluginDependency</string>
|
||||
|
@ -2169,6 +2425,17 @@
|
|||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="YES"/>
|
||||
<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>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<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>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
|
@ -2189,7 +2456,7 @@
|
|||
<reference key="dict.values" ref="0"/>
|
||||
</object>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">591</int>
|
||||
<int key="maxID">601</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
|
@ -2321,11 +2588,13 @@
|
|||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>Icon</string>
|
||||
<string>NSMenuCheckmark</string>
|
||||
<string>NSMenuMixedState</string>
|
||||
</object>
|
||||
<object class="NSArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>{512, 512}</string>
|
||||
<string>{11, 11}</string>
|
||||
<string>{10, 3}</string>
|
||||
</object>
|
||||
|
|
|
@ -15,13 +15,14 @@
|
|||
IBOutlet NSTextField *textField;
|
||||
IBOutlet NSTextField *counter;
|
||||
NSString *inReplyTostatusId;
|
||||
NSString *inReplyToEntity;
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) IBOutlet NSTextField *textField;
|
||||
@property (nonatomic, retain) IBOutlet NSTextField *counter;
|
||||
|
||||
- (IBAction)sendTweet:(NSControl *)control;
|
||||
- (void)inReplyTo:(NSString *)userName statusId:(NSString *)statusId;
|
||||
- (void)inReplyTo:(NSString *)userName statusId:(NSString *)statusId withString:(NSString *)string;
|
||||
- (void)withString:(NSString *)aString;
|
||||
|
||||
@end
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
// Add your subclass-specific initialization here.
|
||||
// If an error occurs here, send a [self release] message and return nil.
|
||||
inReplyTostatusId = @"";
|
||||
inReplyToEntity = @"";
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -33,11 +34,11 @@
|
|||
// If you need to use a subclass of NSWindowController or if your document supports multiple NSWindowControllers, you should remove this method and override -makeWindowControllers instead.
|
||||
return @"NewMessageWindow";
|
||||
}
|
||||
|
||||
/*
|
||||
- (NSString *)displayName {
|
||||
return @"New Tweet";
|
||||
}
|
||||
|
||||
*/
|
||||
- (void)windowControllerDidLoadNib:(NSWindowController *) aController
|
||||
{
|
||||
[super windowControllerDidLoadNib:aController];
|
||||
|
@ -72,13 +73,18 @@
|
|||
return YES;
|
||||
}
|
||||
|
||||
- (void)inReplyTo:(NSString *)userName statusId:(NSString *)statusId {
|
||||
[textField setStringValue:[NSString stringWithFormat:@"^%@ ", userName]];
|
||||
- (void)inReplyTo:(NSString *)entity statusId:(NSString *)statusId withString:(NSString *)string {
|
||||
[textField setStringValue:string];
|
||||
NSRange range = {[[textField stringValue] length] , 0};
|
||||
[[textField currentEditor] setSelectedRange:range];
|
||||
|
||||
[inReplyTostatusId release];
|
||||
inReplyTostatusId = statusId;
|
||||
[inReplyTostatusId retain];
|
||||
|
||||
[inReplyToEntity release];
|
||||
inReplyToEntity = entity;
|
||||
[inReplyToEntity retain];
|
||||
}
|
||||
|
||||
- (void)withString:(NSString *)aString {
|
||||
|
@ -105,6 +111,7 @@
|
|||
TweetModel *tweet = [[[TweetModel alloc] init] autorelease];
|
||||
tweet.text = [control stringValue];
|
||||
tweet.inReplyTostatusId = inReplyTostatusId;
|
||||
tweet.inReplyToEntity = inReplyToEntity;
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"sendTweet" object:tweet];
|
||||
[self close];
|
||||
} else {
|
||||
|
|
|
@ -12,9 +12,11 @@
|
|||
@interface TweetModel : NSObject {
|
||||
NSString *text;
|
||||
NSString *inReplyTostatusId;
|
||||
NSString *inReplyToEntity;
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) NSString *text;
|
||||
@property (nonatomic, retain) NSString *inReplyTostatusId;
|
||||
@property (nonatomic, retain) NSString *inReplyToEntity;
|
||||
|
||||
@end
|
||||
|
|
|
@ -11,11 +11,12 @@
|
|||
|
||||
@implementation TweetModel
|
||||
|
||||
@synthesize text, inReplyTostatusId;
|
||||
@synthesize text, inReplyTostatusId, inReplyToEntity;
|
||||
|
||||
- (void)dealloc {
|
||||
[text release];
|
||||
[inReplyTostatusId release];
|
||||
[inReplyToEntity release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
|
|
@ -89,5 +89,8 @@ function findProfileURL(entity, callback) {
|
|||
}
|
||||
|
||||
function debug(string) {
|
||||
if (typeof string == "Object") {
|
||||
string = JSON.stirngify(string);
|
||||
}
|
||||
alert("DEBUG: " + string);
|
||||
}
|
Reference in a new issue