Ind.ie is now Small Technology Foundation.
Commit d8e01493 authored by Aral Balkan's avatar Aral Balkan

Added back commented out placeholder timeline messages/code to the...

Added back commented out placeholder timeline messages/code to the TimelineViewController (to be migrated to Heartbeat Node).
parent f465d490
......@@ -388,6 +388,124 @@ class TimelineViewController: NSViewController, WKNavigationDelegate
// This is going to have a delay but let’s just get it working here
// first: call the server and ask for the timeline. (All except the Everyone timeline, which is an exception
// as it is loaded from Waystone via the Web.)
// if (self.currentTimeline.id != "everyone")
// {
// println("Trying to get the timeline \(CurrentTimeline.id!)…")
//
// Node.sharedInstance.call(remoteFunction.named(.getTimeline), withArguments: [CurrentTimeline.id!])
// {
// /* and handle callback with */ messages in
//
// // println("RECEIVED TIMELINE: \(messages)")
//
// let messages = messages["messages"].array!
//
// if messages.count == 0
// {
// println(">>>>>\(CurrentTimeline.id!)")
//
// var noticeBody = "<p><strong>No messages yet.</strong></p>"
// if CurrentTimeline.id! == "allfriends"
// {
// noticeBody += "<p>This is where you will see messages from all of your friends. Messages you send will also be seen by all of your friends.</p><p>To avoid confusion, when replying to friends here, start your messages them with <em>@<their handle></em>. Although this does nothing special at the moment, it might give them a notification in the future.</p><p>Also, remember that your friends won’t see each other’s messages unless they are also friends with each other. In the future, @handle could help with discovery if we link handles to people’s public pages (thereby making it possible for your friends to discover each other through your conversations on this timeline).</p>"
// }
// if CurrentTimeline.id! == "private"
// {
// noticeBody += "<p>This timeline is for you alone.</p><p>It is only synchronised between your own devices.</p><p><em>This timeline is currently not very useful as we are only supporting one device per account during the pre-alpha.</em> Once we can lift this limit, this section will be expanded to make it easy for you to store files and folders and keep them synchronised between your devices.</p>"
// }
//
// post(TimelineNoticeDisplayRequestNotification, from: self, with: ["title": self.currentTimeline.title, "body": noticeBody]);
// return
// }
//
// for message in messages
// {
// // NOTE: Lots of repetition with MessageSplitViewController’s sendMessageNotificationHandler — TODO: REFACTOR!
// let messageID = (message["key"]).string!
// var messageHTML = (message["value"]).string!
//
// //
// // Check if this is a message *from* someone to the all friends timeline.
// // If so, we need to massage the assetURLPrefix and filePath to take this into consideration.
// //
// println("Message ID: \(messageID)")
//
// var fromPersonHandle:String = (messageID as NSString).firstMatchedGroupWithRegex(".+?Z-(.+?)$")
//
// println("From person: \(fromPersonHandle).")
//
//
// var relativeWebPrefix = CurrentTimeline.relativeWebPrefix!
// if self.currentTimeline.id == fromPersonHandle
// {
// // For the specific friends timeline, massage the assetURLPrefix to remove the person handle first.
// relativeWebPrefix = relativeWebPrefix.stringByReplacingOccurrencesOfString("\(fromPersonHandle)/", replacement: "\(CurrentPerson.sharedInstance.accountHandle!)/")
//
// println("Relative web prefix after massaging for specific friends timeline: \(relativeWebPrefix)")
// }
//
// var assetURLPrefix = relativeWebPrefix.stringByAppendingPathComponent(messageID)
//
// var filePath = NSHomeDirectory().stringByAppendingPathComponent("Pulse/Sync").stringByAppendingPathComponent(CurrentTimeline.path!).stringByAppendingPathComponent(messageID)
//
// // println("Asset URL prefix: \(assetURLPrefix)")
// // println("filePath: \(filePath)")
//
// if fromPersonHandle != ""
// {
// println("The message was sent from person \(fromPersonHandle). Massaging the asset URL prefix and the file path.")
//
// //
// // Remove the person’s handle (and the dash preceding it) from the end of the asset URL prefix.
// //
// let fromPersonHandleLengthIncludingDash = count(fromPersonHandle) + 1
// let assetURLPrefixIndexOfThePersonsHandle = count(assetURLPrefix)-fromPersonHandleLengthIncludingDash
// assetURLPrefix = assetURLPrefix.substringToIndex(assetURLPrefixIndexOfThePersonsHandle)
//
// // Store the old asset URL prefix so we can swap it out later for the new one.
// let oldAssetURLPrefix = assetURLPrefix
//
// // Add the correct folder path.
// if self.currentTimeline.id == fromPersonHandle
// {
// // Specific friends
// assetURLPrefix = assetURLPrefix.stringByReplacingOccurrencesOfString("/\(CurrentPerson.sharedInstance.accountHandle!)/to", replacement: "/\(fromPersonHandle)/from")
// }
// else
// {
// assetURLPrefix = assetURLPrefix.stringByReplacingOccurrencesOfString("/to", replacement: "/from/\(fromPersonHandle)")
// }
//
// filePath = filePath.stringByReplacingOccurrencesOfString("/to", replacement: "/from/\(fromPersonHandle)")
//
// // Remove the person’s handle (and the dash preceding it) from the end of the file path.
// let filePathIndexOfThePersonsHandle = count(filePath)-fromPersonHandleLengthIncludingDash
// filePath = filePath.substringToIndex(filePathIndexOfThePersonsHandle)
//
// // println("Message HTML: \(messageHTML)")
// // println("Old assetURLPrefix: \(oldAssetURLPrefix)")
// // println("New assetURLPrefix: \(assetURLPrefix)")
// // println("New filePath: \(filePath)")
//
// // Actually replace the old asset URL prefix with the new one in the message HTML.
// messageHTML = messageHTML.stringByReplacingOccurrencesOfString(oldAssetURLPrefix, replacement: assetURLPrefix)
//
// // println("Message HTML after: \(messageHTML)")
// }
// else
// {
// // The message is one of ours.
// fromPersonHandle = ""
// }
//
// let fileURL:NSURL? = NSURL(fileURLWithPath: filePath, isDirectory: true)
//
// let message = Message(id: messageID, assetURLPrefix: assetURLPrefix, folderURL: fileURL!, html: messageHTML as String, personHandle: fromPersonHandle, synced: false)
//
// post(MessageNotification.named(.ShowMessage), from: self, with: ["message": message])
// }
// }
// }
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment