Fixed minor bugs, better timelines and notifications attempt :)
This commit is contained in:
parent
b00cd81d21
commit
e39f60f1f4
13 changed files with 153 additions and 106 deletions
BIN
harbour-tooter-0.1.4-1.armv7hl.rpm
Normal file
BIN
harbour-tooter-0.1.4-1.armv7hl.rpm
Normal file
Binary file not shown.
BIN
harbour-tooter-0.1.4-1.i486.rpm
Normal file
BIN
harbour-tooter-0.1.4-1.i486.rpm
Normal file
Binary file not shown.
|
@ -45,6 +45,8 @@ ApplicationWindow
|
|||
obj.subscribe('confLoaded', function(){
|
||||
console.log('confLoaded');
|
||||
console.log(JSON.stringify(Logic.conf))
|
||||
if (!Logic.conf['notificationLastID'])
|
||||
Logic.conf['notificationLastID'] = 0;
|
||||
if (Logic.conf['instance']) {
|
||||
Logic.api = new Logic.MastodonAPI({ instance: Logic.conf['instance'], api_user_token: "" });
|
||||
}
|
||||
|
|
|
@ -110,7 +110,77 @@ Qt.include("Mastodon.js")
|
|||
var modelTLhome = Qt.createQmlObject('import QtQuick 2.0; ListModel { }', Qt.application, 'InternalQmlObject');
|
||||
var modelTLpublic = Qt.createQmlObject('import QtQuick 2.0; ListModel { }', Qt.application, 'InternalQmlObject');
|
||||
var modelTLnotifications = Qt.createQmlObject('import QtQuick 2.0; ListModel { }', Qt.application, 'InternalQmlObject');
|
||||
var notificationsList = []
|
||||
var notificationGenerator = function(item){
|
||||
var notification;
|
||||
switch (item.urgency){
|
||||
case "normal":
|
||||
notification = Qt.createQmlObject('import org.nemomobile.notifications 1.0; Notification { category: "x-nemo.example"; urgency: Notification.Normal; }', Qt.application, 'InternalQmlObject');
|
||||
break;
|
||||
case "critical":
|
||||
notification = Qt.createQmlObject('import org.nemomobile.notifications 1.0; Notification { category: "x-nemo.example"; urgency: Notification.Critical; }', Qt.application, 'InternalQmlObject');
|
||||
break;
|
||||
default:
|
||||
notification = Qt.createQmlObject('import org.nemomobile.notifications 1.0; Notification { category: "x-nemo.example"; urgency: Notification.Low; }', Qt.application, 'InternalQmlObject');
|
||||
}
|
||||
notification.timestamp = item.timestamp
|
||||
notification.summary = item.summary
|
||||
notification.body = item.body
|
||||
if(item.previewBody)
|
||||
notification.previewBody = item.previewBody;
|
||||
if(item.previewSummary)
|
||||
notification.previewSummary = item.previewSummary;
|
||||
if(notification.replacesId){ notification.replacesId = 0 }
|
||||
notification.publish()
|
||||
}
|
||||
|
||||
var notifier = function(item){
|
||||
|
||||
item.content = item.content.replace(/(<([^>]+)>)/ig,"").replaceAll(""", "\"")
|
||||
|
||||
var msg;
|
||||
switch (item.type){
|
||||
case "favourite":
|
||||
msg = {
|
||||
urgency: "normal",
|
||||
timestamp: item.created_at,
|
||||
summary: (item.reblog_account_display_name !== "" ? item.reblog_account_display_name : '@'+item.reblog_account_username) + ' ' + qsTr("favourited"),
|
||||
body: item.content
|
||||
}
|
||||
break;
|
||||
case "follow":
|
||||
msg = {
|
||||
urgency: "critical",
|
||||
timestamp: item.created_at,
|
||||
summary: (item.account_display_name !== "" ? item.account_display_name : '@'+item.account_acct),
|
||||
body: qsTr("followed you")
|
||||
}
|
||||
break;
|
||||
|
||||
case "reblog":
|
||||
msg = {
|
||||
urgency: "low",
|
||||
timestamp: item.created_at,
|
||||
summary: (item.account_display_name !== "" ? item.account_display_name : '@'+item.account_acct) + ' ' + qsTr("boosted"),
|
||||
body: item.content
|
||||
}
|
||||
break;
|
||||
case "mention":
|
||||
msg = {
|
||||
urgency: "critical",
|
||||
timestamp: item.created_at,
|
||||
summary: (item.account_display_name !== "" ? item.account_display_name : '@'+item.account_acct) + ' ' + qsTr("said"),
|
||||
body: item.content,
|
||||
previewBody: (item.account_display_name !== "" ? item.account_display_name : '@'+item.account_acct) + ' ' + qsTr("said") + ': ' + item.content
|
||||
}
|
||||
break;
|
||||
default:
|
||||
console.log(JSON.stringify(messageObject.data))
|
||||
return;
|
||||
}
|
||||
conf['notificationLastID'] = item.id
|
||||
notificationGenerator(msg)
|
||||
}
|
||||
|
||||
var api;
|
||||
|
||||
|
|
|
@ -5,6 +5,15 @@ WorkerScript.onMessage = function(msg) {
|
|||
console.log("Mode > " + msg.mode)
|
||||
console.log("Conf > " + JSON.stringify(msg.conf))
|
||||
console.log("Params > " + JSON.stringify(msg.params))
|
||||
|
||||
// order notifications in ASC order
|
||||
function orderNotifications(items){
|
||||
for (var i = items.length-1; i > 0; i--){
|
||||
if (items[i].id > msg.conf.notificationLastID)
|
||||
WorkerScript.sendMessage({ 'fireNotification': true, "data": items[i]})
|
||||
}
|
||||
}
|
||||
|
||||
if (!msg.conf.login){
|
||||
console.log("Not loggedin")
|
||||
return;
|
||||
|
@ -46,9 +55,13 @@ WorkerScript.onMessage = function(msg) {
|
|||
}
|
||||
if(msg.model)
|
||||
addDataToModel(msg.model, msg.mode, items)
|
||||
if(msg.action === "notifications")
|
||||
orderNotifications(items)
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//WorkerScript.sendMessage({ 'notifyNewItems': length - i })
|
||||
function addDataToModel (model, mode, items){
|
||||
var length = items.length;
|
||||
|
@ -124,9 +137,6 @@ function parseNotification(data){
|
|||
item['id'] = data.id
|
||||
item['created_at'] = new Date(data.created_at)
|
||||
item['section'] = new Date(data["created_at"]).toLocaleDateString()
|
||||
|
||||
//WorkerScript.sendMessage({ 'fireNotification': true, "data": item})
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ Page {
|
|||
msg.params['spoiler_text'] = warningContent.text
|
||||
}
|
||||
|
||||
worker.sendMessage(msg);
|
||||
worker.sendMessage(msg);
|
||||
console.log(JSON.stringify(msg));
|
||||
warningContent.text = ""
|
||||
toot.text = ""
|
||||
|
|
|
@ -142,52 +142,7 @@ SilicaListView {
|
|||
console.log(JSON.stringify(messageObject))
|
||||
}
|
||||
if (messageObject.fireNotification && notifier){
|
||||
console.log(JSON.stringify(messageObject.data.id))
|
||||
var item = messageObject.data
|
||||
item.content = item.content.replace(/(<([^>]+)>)/ig,"").replaceAll(""", "\"")
|
||||
if(notification.replacesId){
|
||||
notification.replacesId = 0
|
||||
}
|
||||
|
||||
switch (item.type){
|
||||
case "favourite":
|
||||
notification.urgency = Notification.Normal
|
||||
notification.timestamp = item.created_at
|
||||
notification.summary = (item.reblog_account_display_name !== "" ? item.reblog_account_display_name : '@'+item.reblog_account_username) + ' ' + qsTr("favourited")
|
||||
notification.body = item.content
|
||||
notification.publish()
|
||||
break;
|
||||
case "follow":
|
||||
notification.urgency = Notification.Critical
|
||||
notification.timestamp = item.created_at
|
||||
notification.summary = (item.account_display_name !== "" ? item.account_display_name : '@'+item.account_acct)
|
||||
notification.body = qsTr("followed you")
|
||||
notification.publish()
|
||||
break;
|
||||
|
||||
case "reblog":
|
||||
notification.urgency = Notification.Low
|
||||
notification.timestamp = item.created_at
|
||||
notification.summary = (item.account_display_name !== "" ? item.account_display_name : '@'+item.account_acct) + ' ' + qsTr("boosted")
|
||||
notification.body = item.content
|
||||
notification.publish()
|
||||
break;
|
||||
case "mention":
|
||||
notification.urgency = Notification.Critical
|
||||
notification.timestamp = item.created_at
|
||||
notification.summary = (item.account_display_name !== "" ? item.account_display_name : '@'+item.account_acct) + ' ' + qsTr("said")
|
||||
notification.previewSummary = notification.summary
|
||||
notification.body = item.content
|
||||
notification.previewBody = notification.body
|
||||
notification.publish()
|
||||
break;
|
||||
default:
|
||||
console.log(JSON.stringify(messageObject.data))
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Logic.notifier(messageObject.data)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -205,7 +160,7 @@ SilicaListView {
|
|||
}
|
||||
|
||||
Timer {
|
||||
triggeredOnStart: true; interval: 5*60*1000; running: true; repeat: true
|
||||
triggeredOnStart: false; interval: 5*60*1000; running: true; repeat: true
|
||||
onTriggered: {
|
||||
console.log(title + ' ' +Date().toString())
|
||||
loadData("prepend")
|
||||
|
|
|
@ -34,9 +34,10 @@ BackgroundItem {
|
|||
anchors.fill: parent
|
||||
onClicked: {
|
||||
pageStack.push(Qt.resolvedUrl("../Profile.qml"), {
|
||||
"displayname": model.status_account_display_name,
|
||||
"username": model.status_account_acct,
|
||||
"profileImage": model.status_account_avatar
|
||||
"displayname": model.account_username,
|
||||
"username": model.account_acct,
|
||||
"user_id": model.account_id,
|
||||
"profileImage": model.account_avatar
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -121,7 +122,7 @@ BackgroundItem {
|
|||
pageStack.push(Qt.resolvedUrl("../Conversation.qml"), {
|
||||
toot_id: id,
|
||||
title: account_display_name,
|
||||
description: '@'+account_username,
|
||||
description: '@'+account_acct,
|
||||
avatar: account_avatar,
|
||||
type: "reply"
|
||||
})
|
||||
|
|
|
@ -13,7 +13,7 @@ Name: harbour-tooter
|
|||
%{!?qtc_make:%define qtc_make make}
|
||||
%{?qtc_builddir:%define _builddir %qtc_builddir}
|
||||
Summary: Tooter
|
||||
Version: 0.1.3
|
||||
Version: 0.1.4
|
||||
Release: 1
|
||||
Group: Qt/Qt
|
||||
License: LICENSE
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Name: harbour-tooter
|
||||
Summary: Tooter
|
||||
Version: 0.1.3
|
||||
Version: 0.1.4
|
||||
Release:
|
||||
# The contents of the Group field should be one of the groups listed here:
|
||||
# http://gitorious.org/meego-developer-tools/spectacle/blobs/master/data/GROUPS
|
||||
|
|
|
@ -12,6 +12,25 @@
|
|||
<translation></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>API</name>
|
||||
<message>
|
||||
<source>favourited</source>
|
||||
<translation type="unfinished">a ajouté à ses favoris</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>followed you</source>
|
||||
<translation type="unfinished">vous suit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>boosted</source>
|
||||
<translation type="unfinished">a partagé</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>said</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Browser</name>
|
||||
<message>
|
||||
|
@ -101,22 +120,6 @@
|
|||
<source>Load more</source>
|
||||
<translation>Charger davantage</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>favourited</source>
|
||||
<translation type="unfinished">a ajouté à ses favoris</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>followed you</source>
|
||||
<translation type="unfinished">vous suit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>boosted</source>
|
||||
<translation type="unfinished">a partagé</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>said</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Profile</name>
|
||||
|
|
|
@ -12,6 +12,25 @@
|
|||
<translation></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>API</name>
|
||||
<message>
|
||||
<source>favourited</source>
|
||||
<translation type="unfinished">a mes en favorit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>followed you</source>
|
||||
<translation type="unfinished">vos sèc</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>boosted</source>
|
||||
<translation type="unfinished">a tornat partejar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>said</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Browser</name>
|
||||
<message>
|
||||
|
@ -101,22 +120,6 @@
|
|||
<source>Load more</source>
|
||||
<translation>Cargar mai</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>favourited</source>
|
||||
<translation type="unfinished">a mes en favorit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>followed you</source>
|
||||
<translation type="unfinished">vos sèc</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>boosted</source>
|
||||
<translation type="unfinished">a tornat partejar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>said</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Profile</name>
|
||||
|
|
|
@ -12,6 +12,25 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>API</name>
|
||||
<message>
|
||||
<source>favourited</source>
|
||||
<translation type="unfinished">favourited</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>followed you</source>
|
||||
<translation type="unfinished">followed you</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>boosted</source>
|
||||
<translation type="unfinished">boosted</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>said</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Browser</name>
|
||||
<message>
|
||||
|
@ -101,22 +120,6 @@
|
|||
<source>Load more</source>
|
||||
<translation>Load more</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>boosted</source>
|
||||
<translation type="unfinished">boosted</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>favourited</source>
|
||||
<translation type="unfinished">favourited</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>followed you</source>
|
||||
<translation type="unfinished">followed you</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>said</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Profile</name>
|
||||
|
|
Loading…
Reference in a new issue