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

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
{
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 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 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!
......
......@@ -76,6 +76,7 @@
</head>
<body>
<h1 id='title'>Timeline</h1>
<div id='notice'></div>
<div id='messages'>
</div>
<script>
......@@ -109,11 +110,18 @@
function displayNotice(notice) {
console.log("Displaying notice: " + notice)
setTitle(notice.title);
// 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');
noticeDiv.style.display = "block";
messagesDiv.innerHTML = notice.body
setTitle(notice.title);
noticeDiv.innerHTML = notice.body
}
//
......@@ -121,7 +129,12 @@
//
function updateTimeline(message) {
console.log("Updating the timeline…")
console.log("Updating the timeline…");
console.log(message);
// Hide the initial notice if there is a message.
var noticeDiv = document.getElementById('notice');
noticeDiv.style.display = "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