Notification actions test 2

This commit is contained in:
Dusko Angirevic 2017-10-25 23:45:15 +02:00
parent 78ebabf471
commit ff6b92f5b6
12 changed files with 6 additions and 238 deletions

View file

@ -30,7 +30,6 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
import org.nemomobile.notifications 1.0;
import "../lib/API.js" as Logic
@ -126,64 +125,11 @@ CoverBackground {
if (Logic.conf.notificationLastID < Logic.modelTLnotifications.get(i).id) {
notificationsNum++
var item = Logic.modelTLnotifications.get(i);
item.content = item.content.replace(/(<([^>]+)>)/ig,"").replaceAll("&quot;", "\"").replaceAll("&amp;", "&")
//Logic.notifier())
switch (item.type){
case "favourite":
//Notifications.notify("Tooter", "serverinfo.serverTitle", (item.reblog_account_display_name !== "" ? item.reblog_account_display_name : '@'+item.reblog_account_username) + ' ' + qsTrId("favourited"), false, item.created_at.getTime()/1000|0, "")
ntf.urgency = Notification.Normal
ntf.timestamp = item.created_at
ntf.summary = (item.reblog_account_display_name !== "" ? item.reblog_account_display_name : '@'+item.reblog_account_username) + ' ' + qsTr("favourited")
ntf.body = item.content
break;
case "follow":
ntf.urgency = Notification.Critical
ntf.timestamp = item.created_at
ntf.summary = (item.account_display_name !== "" ? item.account_display_name : '@'+item.account_username)
ntf.body = qsTr("followed you")
ntf.remoteActions[0].method = "showtoot"
ntf.remoteActions[0].arguments = ["user", ntf.summary]
break;
case "reblog":
ntf.urgency = Notification.Low
ntf.timestamp = item.created_at
ntf.summary = (item.reblog_account_display_name !== "" ? item.reblog_account_display_name : '@'+item.reblog_account_username) + ' ' + qsTr("boosted")
ntf.body = item.content
ntf.remoteActions[0].method = "showtoot"
ntf.remoteActions[0].arguments = ["toot", item.id]
break;
}
ntf.replacesId = 0;
ntf.publish();
Logic.notifier(Logic.modelTLnotifications.get(i))
}
}
notificationsLbl.text = notificationsNum;
Logic.conf.notificationLastID = notificationLastID;
}
Notification {
id: ntf
category: "x-harbour.tooter.activity"
appName: "Tooter"
appIcon: "/usr/share/harbour-tooter/config/icon-lock-harbour-tooter.png"
summary: "Notification summary"
body: "Notification body"
previewSummary: summary
previewBody: body
itemCount: 1
timestamp: "2013-02-20 18:21:00"
remoteActions: [ {
"name": "default",
"displayName": "Do something",
"icon": "icon-s-certificates",
"service": "ba.dysko.harbour.tooter",
"path": "/",
"iface": "ba.dysko.harbour.tooter",
"method": "openapp",
"arguments": [ ]
}]
onClicked: console.log("Clicked")
onClosed: console.log("Closed, reason: " + reason)
}
}

View file

@ -116,13 +116,13 @@ var notificationGenerator = function(item){
var notification;
switch (item.urgency){
case "normal":
notification = Qt.createQmlObject('import org.nemomobile.notifications 1.0; Notification { category: "x-harbour.tooter.activity"; appName: "Tooter"; appIcon: "/usr/share/harbour-tooter/config/icon-lock-harbour-tooter.png"; summary: "Notification summary"; body: "Notification body"; previewSummary: "Notification preview summary"; previewBody: "Notification preview body"; itemCount: 1; remoteActions: [ { "name": "default", "displayName": "Do something", "icon": "icon-s-certificates", "service": "ba.dysko.harbour.tooter", "path": "/", "iface": "ba.dysko.harbour.tooter", "method": "openapp", "arguments": [ ] }]; urgency: Notification.Normal; }', Qt.application, 'InternalQmlObject');
notification = Qt.createQmlObject('import org.nemomobile.notifications 1.0; Notification { category: "x-harbour.tooter.activity"; appName: "Tooter"; itemCount: 1; remoteActions: [ { "name": "default", "displayName": "Do something", "icon": "icon-s-certificates", "service": "ba.dysko.harbour.tooter", "path": "/", "iface": "ba.dysko.harbour.tooter", "method": "openapp", "arguments": [ ] }]; urgency: Notification.Normal; }', Qt.application, 'InternalQmlObject');
break;
case "critical":
notification = Qt.createQmlObject('import org.nemomobile.notifications 1.0; Notification { appName: "Tooter"; itemCount: 1; category: "x-harbour.tooter.activity"; urgency: Notification.Critical; remoteActions: [ { "name": "default", "displayName": "Do something", "icon": "icon-s-do-it", "service": "org.nemomobile.example", "path": "/example", "iface": "org.nemomobile.example", "method": "doSomething", "arguments": [ "argument", 1 ] },{ "name": "ignore", "displayName": "Ignore the problem", "icon": "icon-s-ignore", "service": "org.nemomobile.example", "path": "/example", "iface": "org.nemomobile.example", "method": "ignore", "arguments": [ "argument", 1 ] } ]; onClicked: console.log("Clicked"); onClosed: console.log("Closed, reason: " + reason); }', Qt.application, 'InternalQmlObject');
notification = Qt.createQmlObject('import org.nemomobile.notifications 1.0; Notification { appName: "Tooter"; itemCount: 1; remoteActions: [ { "name": "default", "displayName": "Do something", "icon": "icon-s-certificates", "service": "ba.dysko.harbour.tooter", "path": "/", "iface": "ba.dysko.harbour.tooter", "method": "viewtoot", "arguments": [ "myTest", "blabla" ] }]; urgency: Notification.Critical; }', Qt.application, 'InternalQmlObject');
break;
default:
notification = Qt.createQmlObject('import org.nemomobile.notifications 1.0; Notification { appName: "Tooter"; itemCount: 1; category: "x-harbour.tooter.activity"; urgency: Notification.Low; }', Qt.application, 'InternalQmlObject');
notification = Qt.createQmlObject('import org.nemomobile.notifications 1.0; Notification { category: "x-harbour.tooter.activity"; appName: "Tooter"; itemCount: 1; remoteActions: [ { "name": "default", "displayName": "Do something", "icon": "icon-s-certificates", "service": "ba.dysko.harbour.tooter", "path": "/", "iface": "ba.dysko.harbour.tooter", "method": "viewtoot", "arguments": [ "a", "b" ] }]; urgency: Notification.Low; }', Qt.application, 'InternalQmlObject');
}
//notification.remoteActions = [ { "name": "app", "displayName": "Do something", "icon": "icon-s-do-it", "service": "ba.dysko.harbour.tooter", "path": "/", "iface": "ba.dysko.harbour.tooter", "method": "openapp", "arguments": [ ]}]
//Notifications.notify("Tooter", "serverinfo.serverTitle", " new activity", false, "2015-10-15 00:00:00", "aaa")

View file

@ -3,8 +3,6 @@ import Sailfish.Silica 1.0
import "../../lib/API.js" as Logic
import "."
import org.nemomobile.notifications 1.0;
SilicaListView {
id: myList
property string type;
@ -58,18 +56,6 @@ SilicaListView {
}
PullDownMenu {
MenuItem {
text: "NOTIFIKACIJA"
onClicked: {
Notifications.notify("Tooter", "serverinfo.serverTitle", " new activity", true, "", "aaa")
}
}
MenuItem {
text: "NOTIFIKACIJA2"
onClicked: {
Notifications.notify("Tooter", "serverinfo.serverTitle", " new activity", false, "2015-10-15 00:00:00", "aaa")
}
}
MenuItem {
text: qsTr("Settings")
onClicked: {
@ -119,9 +105,7 @@ SilicaListView {
console.log("CountChanged!")*/
}
Button {
onClicked: notification.publish()
}
footer: Item{
width: parent.width
height: Theme.itemSizeLarge
@ -163,10 +147,7 @@ SilicaListView {
console.log(JSON.stringify(messageObject))
}
if (messageObject.fireNotification && notifier){
//Logic.notifier(messageObject.data)
console.log(JSON.stringify(messageObject.data))
notification.body = "a"
notification.publish()
Logic.notifier(messageObject.data)
}
}
@ -202,29 +183,5 @@ SilicaListView {
if (type !== "")
worker.sendMessage(msg);
}
Notification {
id: notification
category: "x-harbour.tooter.activity"
appName: "Tooter"
appIcon: "/usr/share/harbour-tooter/config/icon-lock-harbour-tooter.png"
summary: "Notification summary"
body: "Notification body"
previewSummary: "Notification preview summary"
previewBody: "Notification preview body"
itemCount: 5
timestamp: "2013-02-20 18:21:00"
remoteActions: [ {
"name": "default",
"displayName": "Do something",
"icon": "icon-s-certificates",
"service": "ba.dysko.harbour.tooter",
"path": "/",
"iface": "ba.dysko.harbour.tooter",
"method": "openapp",
"arguments": [ ]
}]
onClicked: console.log("Clicked")
onClosed: console.log("Closed, reason: " + reason)
}
}

View file

@ -78,21 +78,6 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CoverPage</name>
<message>
<source>favourited</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>followed you</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>boosted</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ImageFullScreen</name>
<message>

View file

@ -78,21 +78,6 @@
<translation>Κτυπήστε για εισαγωγή</translation>
</message>
</context>
<context>
<name>CoverPage</name>
<message>
<source>favourited</source>
<translation type="unfinished">στους σελιδοδείκτες</translation>
</message>
<message>
<source>followed you</source>
<translation type="unfinished">σας ακολουθούν</translation>
</message>
<message>
<source>boosted</source>
<translation type="unfinished">προωθημένο</translation>
</message>
</context>
<context>
<name>ImageFullScreen</name>
<message>

View file

@ -78,21 +78,6 @@
<translation>Tap to insert</translation>
</message>
</context>
<context>
<name>CoverPage</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>
</context>
<context>
<name>ImageFullScreen</name>
<message>

View file

@ -78,21 +78,6 @@
<translation>Toca para insertar</translation>
</message>
</context>
<context>
<name>CoverPage</name>
<message>
<source>favourited</source>
<translation type="unfinished">marcó como favorito</translation>
</message>
<message>
<source>followed you</source>
<translation type="unfinished">te empezó a seguir</translation>
</message>
<message>
<source>boosted</source>
<translation type="unfinished">retooteó</translation>
</message>
</context>
<context>
<name>ImageFullScreen</name>
<message>

View file

@ -78,21 +78,6 @@
<translation>Appuyez pour insérer</translation>
</message>
</context>
<context>
<name>CoverPage</name>
<message>
<source>favourited</source>
<translation type="unfinished">a ajouté à ses favoris</translation>
</message>
<message>
<source>followed you</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>boosted</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ImageFullScreen</name>
<message>

View file

@ -78,21 +78,6 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CoverPage</name>
<message>
<source>favourited</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>followed you</source>
<translation type="unfinished">volgde jou</translation>
</message>
<message>
<source>boosted</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ImageFullScreen</name>
<message>

View file

@ -78,21 +78,6 @@
<translation>Tustejar per inserir</translation>
</message>
</context>
<context>
<name>CoverPage</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"></translation>
</message>
</context>
<context>
<name>ImageFullScreen</name>
<message>

View file

@ -78,21 +78,6 @@
<translation>Тапни за убацивање</translation>
</message>
</context>
<context>
<name>CoverPage</name>
<message>
<source>favourited</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>followed you</source>
<translation type="unfinished">вас прати</translation>
</message>
<message>
<source>boosted</source>
<translation type="unfinished">разглашено</translation>
</message>
</context>
<context>
<name>ImageFullScreen</name>
<message>

View file

@ -78,21 +78,6 @@
<translation>Tap to insert</translation>
</message>
</context>
<context>
<name>CoverPage</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>
</context>
<context>
<name>ImageFullScreen</name>
<message>