Commit c321bce8 authored by Aral Balkan's avatar Aral Balkan
Browse files

Implemented initial onboarding messages for empty timelines. Closes #73.

parent 6da5c6c1
......@@ -392,7 +392,29 @@ class TimelineViewController: NSViewController, WKNavigationDelegate
// println("RECEIVED TIMELINE: \(messages)")
for message in messages["messages"].array!
let messages = messages["messages"].array!
if messages.count == 0
var noticeBody = "<p><strong>No messages yet.</strong></p>"
if! == "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 messaegs 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! == "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]);
for message in messages
// NOTE: Lots of repetition with MessageSplitViewController’s sendMessageNotificationHandler — TODO: REFACTOR!
let messageID = (message["key"]).string!
......@@ -76,6 +76,7 @@
<h1 id='title'>Timeline</h1>
<div id='notice'></div>
<div id='messages'>
......@@ -109,11 +110,18 @@
function displayNotice(notice) {
console.log("Displaying notice: " + notice)
// Clear out any messages possibly left over from
// a previous timeline.
var messagesDiv = document.getElementById('messages');
messagesDiv.innerHTML = ""
// And make sure the notice is showing
var noticeDiv = document.getElementById('notice'); = "block";
messagesDiv.innerHTML = notice.body
noticeDiv.innerHTML = notice.body
......@@ -121,7 +129,12 @@
function updateTimeline(message) {
console.log("Updating the timeline…")
console.log("Updating the timeline…");
// Hide the initial notice if there is a message.
var noticeDiv = document.getElementById('notice'); = "none";
var messageBodyDiv = div();
messageBodyDiv.setAttribute('class', 'messageBody');
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