Improvements
- deeplinking notifications test - fixed remote_url images bug - full screen image viewer and video player improvements - user autocompleate in toots
This commit is contained in:
parent
ff6b92f5b6
commit
2588a802ea
5 changed files with 180 additions and 63 deletions
|
@ -65,6 +65,7 @@ ApplicationWindow
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onDestruction: {
|
Component.onDestruction: {
|
||||||
|
//Logic.conf.notificationLastID = 0;
|
||||||
Logic.saveData()
|
Logic.saveData()
|
||||||
}
|
}
|
||||||
Connections
|
Connections
|
||||||
|
@ -72,8 +73,7 @@ ApplicationWindow
|
||||||
target: Dbus
|
target: Dbus
|
||||||
onViewtoot:
|
onViewtoot:
|
||||||
{
|
{
|
||||||
console.log(key, "dbus show issue")
|
console.log(key, "dbus onViewtoot")
|
||||||
|
|
||||||
}
|
}
|
||||||
onActivateapp:
|
onActivateapp:
|
||||||
{
|
{
|
||||||
|
|
|
@ -112,19 +112,21 @@ var modelTLpublic = Qt.createQmlObject('import QtQuick 2.0; ListModel { }', Qt
|
||||||
var modelTLnotifications = Qt.createQmlObject('import QtQuick 2.0; ListModel { }', Qt.application, 'InternalQmlObject');
|
var modelTLnotifications = Qt.createQmlObject('import QtQuick 2.0; ListModel { }', Qt.application, 'InternalQmlObject');
|
||||||
var modelTLsearch = Qt.createQmlObject('import QtQuick 2.0; ListModel { }', Qt.application, 'InternalQmlObject');
|
var modelTLsearch = Qt.createQmlObject('import QtQuick 2.0; ListModel { }', Qt.application, 'InternalQmlObject');
|
||||||
var notificationsList = []
|
var notificationsList = []
|
||||||
|
|
||||||
var notificationGenerator = function(item){
|
var notificationGenerator = function(item){
|
||||||
var notification;
|
var notification;
|
||||||
switch (item.urgency){
|
switch (item.urgency){
|
||||||
case "normal":
|
case "normal":
|
||||||
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');
|
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": [ "'+item.service+'", "'+item.key+'" ] }]; urgency: Notification.Normal; }', Qt.application, 'InternalQmlObject');
|
||||||
break;
|
break;
|
||||||
case "critical":
|
case "critical":
|
||||||
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');
|
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": "openapp", "arguments": [ "'+item.service+'", "'+item.key+'" ] }]; urgency: Notification.Critical; }', Qt.application, 'InternalQmlObject');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
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 = 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": [ "'+item.service+'", "'+item.key+'" ] }]; 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": [ ]}]
|
|
||||||
|
console.log(JSON.stringify(notification.remoteActions[0].arguments))
|
||||||
//Notifications.notify("Tooter", "serverinfo.serverTitle", " new activity", false, "2015-10-15 00:00:00", "aaa")
|
//Notifications.notify("Tooter", "serverinfo.serverTitle", " new activity", false, "2015-10-15 00:00:00", "aaa")
|
||||||
|
|
||||||
notification.timestamp = item.timestamp
|
notification.timestamp = item.timestamp
|
||||||
|
@ -132,8 +134,12 @@ var notificationGenerator = function(item){
|
||||||
notification.body = item.body
|
notification.body = item.body
|
||||||
if(item.previewBody)
|
if(item.previewBody)
|
||||||
notification.previewBody = item.previewBody;
|
notification.previewBody = item.previewBody;
|
||||||
|
else
|
||||||
|
notification.previewBody = item.body;
|
||||||
if(item.previewSummary)
|
if(item.previewSummary)
|
||||||
notification.previewSummary = item.previewSummary;
|
notification.previewSummary = item.previewSummary;
|
||||||
|
else
|
||||||
|
notification.previewSummary = item.summary
|
||||||
if(notification.replacesId){ notification.replacesId = 0 }
|
if(notification.replacesId){ notification.replacesId = 0 }
|
||||||
notification.publish()
|
notification.publish()
|
||||||
}
|
}
|
||||||
|
@ -149,7 +155,9 @@ var notifier = function(item){
|
||||||
urgency: "normal",
|
urgency: "normal",
|
||||||
timestamp: item.created_at,
|
timestamp: item.created_at,
|
||||||
summary: (item.reblog_account_display_name !== "" ? item.reblog_account_display_name : '@'+item.reblog_account_username) + ' ' + qsTr("favourited"),
|
summary: (item.reblog_account_display_name !== "" ? item.reblog_account_display_name : '@'+item.reblog_account_username) + ' ' + qsTr("favourited"),
|
||||||
body: item.content
|
body: item.content,
|
||||||
|
service: 'toot',
|
||||||
|
key: item.id
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "follow":
|
case "follow":
|
||||||
|
@ -157,7 +165,9 @@ var notifier = function(item){
|
||||||
urgency: "critical",
|
urgency: "critical",
|
||||||
timestamp: item.created_at,
|
timestamp: item.created_at,
|
||||||
summary: (item.account_display_name !== "" ? item.account_display_name : '@'+item.account_username),
|
summary: (item.account_display_name !== "" ? item.account_display_name : '@'+item.account_username),
|
||||||
body: qsTr("followed you")
|
body: qsTr("followed you"),
|
||||||
|
service: 'profile',
|
||||||
|
key: item.account_username
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -166,7 +176,9 @@ var notifier = function(item){
|
||||||
urgency: "low",
|
urgency: "low",
|
||||||
timestamp: item.created_at,
|
timestamp: item.created_at,
|
||||||
summary: (item.reblog_account_display_name !== "" ? item.reblog_account_display_name : '@'+item.reblog_account_username) + ' ' + qsTr("boosted"),
|
summary: (item.reblog_account_display_name !== "" ? item.reblog_account_display_name : '@'+item.reblog_account_username) + ' ' + qsTr("boosted"),
|
||||||
body: item.content
|
body: item.content,
|
||||||
|
service: 'toot',
|
||||||
|
key: item.id
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "mention":
|
case "mention":
|
||||||
|
@ -175,7 +187,9 @@ var notifier = function(item){
|
||||||
timestamp: item.created_at,
|
timestamp: item.created_at,
|
||||||
summary: (item.account_display_name !== "" ? item.account_display_name : '@'+item.account_username) + ' ' + qsTr("said"),
|
summary: (item.account_display_name !== "" ? item.account_display_name : '@'+item.account_username) + ' ' + qsTr("said"),
|
||||||
body: item.content,
|
body: item.content,
|
||||||
previewBody: (item.account_display_name !== "" ? item.account_display_name : '@'+item.account_username) + ' ' + qsTr("said") + ': ' + item.content
|
previewBody: (item.account_display_name !== "" ? item.account_display_name : '@'+item.account_username) + ' ' + qsTr("said") + ': ' + item.content,
|
||||||
|
service: 'toot',
|
||||||
|
key: item.id
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -185,6 +199,7 @@ var notifier = function(item){
|
||||||
notificationGenerator(msg)
|
notificationGenerator(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var api;
|
var api;
|
||||||
|
|
||||||
function func() {
|
function func() {
|
||||||
|
|
|
@ -53,8 +53,10 @@ WorkerScript.onMessage = function(msg) {
|
||||||
var item;
|
var item;
|
||||||
if (data.hasOwnProperty(i)) {
|
if (data.hasOwnProperty(i)) {
|
||||||
if(msg.action === "accounts/search") {
|
if(msg.action === "accounts/search") {
|
||||||
item = parseAccounts(data[i]);
|
item = parseAccounts([], "", data[i]);
|
||||||
|
console.log(JSON.stringify(data[i]))
|
||||||
items.push(item)
|
items.push(item)
|
||||||
|
console.log("aaaa")
|
||||||
|
|
||||||
} else if(msg.action === "notifications") {
|
} else if(msg.action === "notifications") {
|
||||||
// notification
|
// notification
|
||||||
|
@ -256,13 +258,20 @@ function parseToot (data){
|
||||||
for(var i = 0; i < data['media_attachments'].length ; i++){
|
for(var i = 0; i < data['media_attachments'].length ; i++){
|
||||||
var attachments = data['media_attachments'][i];
|
var attachments = data['media_attachments'][i];
|
||||||
item['content'] = item['content'].replaceAll(attachments['text_url'], '')
|
item['content'] = item['content'].replaceAll(attachments['text_url'], '')
|
||||||
item['attachments'].push({
|
var tmp = {
|
||||||
id: attachments['id'],
|
id: attachments['id'],
|
||||||
id: attachments['id'],
|
id: attachments['id'],
|
||||||
type: attachments['type'],
|
type: attachments['type'],
|
||||||
url: attachments['remote_url'] !=="" ? attachments['remote_url'] : attachments['url'] ,
|
url: typeof attachments['remote_url'] == "string" ? attachments['remote_url'] : attachments['url'] ,
|
||||||
preview_url: loadImages ? attachments['preview_url'] : ''
|
preview_url: loadImages ? attachments['preview_url'] : ''
|
||||||
})
|
}
|
||||||
|
console.log("-----------------------------------")
|
||||||
|
console.log(JSON.stringify(attachments))
|
||||||
|
console.log(typeof attachments['remote_url'])
|
||||||
|
|
||||||
|
console.log(JSON.stringify(tmp))
|
||||||
|
console.log("-----------------------------------")
|
||||||
|
item['attachments'].push(tmp)
|
||||||
}
|
}
|
||||||
/*item['content'] = item['content'].split(" ")
|
/*item['content'] = item['content'].split(" ")
|
||||||
for(var i = 0; i < item['content'].length ; i++){
|
for(var i = 0; i < item['content'].length ; i++){
|
||||||
|
|
|
@ -19,6 +19,12 @@ Page {
|
||||||
btnAddImage.enabled = mediaModel.count < 4
|
btnAddImage.enabled = mediaModel.count < 4
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ListModel {
|
||||||
|
id: suggestedModel
|
||||||
|
onCountChanged: {
|
||||||
|
console.log("aaaa " + count)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
WorkerScript {
|
WorkerScript {
|
||||||
|
@ -65,6 +71,57 @@ Page {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Rectangle {
|
||||||
|
id: predictionList
|
||||||
|
visible: false;
|
||||||
|
anchors.bottom: panel.top
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: panel.right
|
||||||
|
height: Theme.itemSizeMedium * 6
|
||||||
|
color: Theme.highlightDimmerColor
|
||||||
|
|
||||||
|
ListView {
|
||||||
|
anchors.fill: parent
|
||||||
|
model: suggestedModel
|
||||||
|
clip: true
|
||||||
|
|
||||||
|
delegate: BackgroundItem {
|
||||||
|
height: Theme.itemSizeMedium
|
||||||
|
width: parent.width
|
||||||
|
|
||||||
|
Image {
|
||||||
|
id: avatar
|
||||||
|
width: Theme.itemSizeSmall
|
||||||
|
height: width
|
||||||
|
source: model.account_avatar
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: Theme.horizontalPageMargin
|
||||||
|
}
|
||||||
|
Column {
|
||||||
|
anchors.left: avatar.right
|
||||||
|
anchors.leftMargin: Theme.paddingLarge
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
height: account_acct.height + display_name.height
|
||||||
|
Label {
|
||||||
|
id: display_name
|
||||||
|
text: model.account_display_name+" "
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
id: account_acct
|
||||||
|
text: "@"+model.account_acct
|
||||||
|
color: Theme.secondaryColor
|
||||||
|
anchors.leftMargin: Theme.paddingMedium
|
||||||
|
font.pixelSize: Theme.fontSizeExtraSmall
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onCountChanged: {
|
||||||
|
positionViewAtIndex(suggestedModel.count-1, ListView.End )
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DockedPanel {
|
DockedPanel {
|
||||||
id: panel
|
id: panel
|
||||||
|
@ -114,6 +171,44 @@ Page {
|
||||||
EnterKey.onClicked: {
|
EnterKey.onClicked: {
|
||||||
//tweet()
|
//tweet()
|
||||||
}
|
}
|
||||||
|
onTextChanged: {
|
||||||
|
var pattern = /\B@[a-z0-9_-]+/gi;
|
||||||
|
var mentions = text.match(pattern);
|
||||||
|
if (mentions && mentions.length){
|
||||||
|
var index = text.indexOf(cursorPosition);
|
||||||
|
var preText = text.substring(0, cursorPosition);
|
||||||
|
var current;
|
||||||
|
if (preText.indexOf(" ") > 0) {
|
||||||
|
var words = preText.split(" ");
|
||||||
|
current = words[words.length - 1]; //return last word
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
current = preText;
|
||||||
|
}
|
||||||
|
if (current[0] === "@") {
|
||||||
|
predictionList.visible = true;
|
||||||
|
var matches = mentions.filter(function(value){
|
||||||
|
if(value) {
|
||||||
|
return (value.substring(0, current.length) === current);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
console.log(matches)
|
||||||
|
var msg = {
|
||||||
|
'action' : 'accounts/search',
|
||||||
|
'method' : 'GET',
|
||||||
|
'model' : suggestedModel,
|
||||||
|
'mode' : "append",
|
||||||
|
'params' : [ {name: "q", data: matches[0].substring(1)} ],
|
||||||
|
|
||||||
|
'conf' : Logic.conf
|
||||||
|
};
|
||||||
|
|
||||||
|
worker.sendMessage(msg);
|
||||||
|
} else {
|
||||||
|
predictionList.visible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
IconButton {
|
IconButton {
|
||||||
id: btnSmileys
|
id: btnSmileys
|
||||||
|
@ -128,8 +223,8 @@ Page {
|
||||||
rightMargin: Theme.paddingSmall
|
rightMargin: Theme.paddingSmall
|
||||||
}
|
}
|
||||||
icon.source: "image://theme/icon-s-mms?" + (pressed
|
icon.source: "image://theme/icon-s-mms?" + (pressed
|
||||||
? Theme.highlightColor
|
? Theme.highlightColor
|
||||||
: (warningContent.visible ? Theme.secondaryHighlightColor : Theme.primaryColor))
|
: (warningContent.visible ? Theme.secondaryHighlightColor : Theme.primaryColor))
|
||||||
onClicked: pageStack.push(firstWizardPage)
|
onClicked: pageStack.push(firstWizardPage)
|
||||||
}
|
}
|
||||||
SilicaGridView {
|
SilicaGridView {
|
||||||
|
@ -208,31 +303,31 @@ Page {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImageUploader {
|
ImageUploader {
|
||||||
id: imageUploader
|
id: imageUploader
|
||||||
|
|
||||||
onProgressChanged: {
|
onProgressChanged: {
|
||||||
console.log("progress "+progress)
|
console.log("progress "+progress)
|
||||||
uploadProgress.width = parent.width*progress
|
uploadProgress.width = parent.width*progress
|
||||||
}
|
}
|
||||||
|
|
||||||
onSuccess: {
|
onSuccess: {
|
||||||
uploadProgress.width =0
|
uploadProgress.width =0
|
||||||
console.log(replyData);
|
console.log(replyData);
|
||||||
|
|
||||||
mediaModel.append(JSON.parse(replyData))
|
mediaModel.append(JSON.parse(replyData))
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
onFailure: {
|
|
||||||
uploadProgress.width =0
|
|
||||||
btnAddImage.enabled = true;
|
|
||||||
console.log(status)
|
|
||||||
console.log(statusText)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onFailure: {
|
||||||
|
uploadProgress.width =0
|
||||||
|
btnAddImage.enabled = true;
|
||||||
|
console.log(status)
|
||||||
|
console.log(statusText)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
ComboBox {
|
ComboBox {
|
||||||
id: privacy
|
id: privacy
|
||||||
anchors {
|
anchors {
|
||||||
|
@ -309,19 +404,19 @@ Page {
|
||||||
if (mdl.count > 0) {
|
if (mdl.count > 0) {
|
||||||
var setIndex = 0;
|
var setIndex = 0;
|
||||||
switch (mdl.get(0).status_visibility){
|
switch (mdl.get(0).status_visibility){
|
||||||
case "unlisted":
|
case "unlisted":
|
||||||
setIndex = 1;
|
setIndex = 1;
|
||||||
break;
|
break;
|
||||||
case "private":
|
case "private":
|
||||||
setIndex = 2;
|
setIndex = 2;
|
||||||
break;
|
break;
|
||||||
case "direct":
|
case "direct":
|
||||||
privacy.enabled = false;
|
privacy.enabled = false;
|
||||||
setIndex = 3;
|
setIndex = 3;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
privacy.enabled = true;
|
privacy.enabled = true;
|
||||||
setIndex = 0;
|
setIndex = 0;
|
||||||
}
|
}
|
||||||
privacy.currentIndex = setIndex;
|
privacy.currentIndex = setIndex;
|
||||||
}
|
}
|
||||||
|
@ -347,7 +442,7 @@ Page {
|
||||||
onAcceptPendingChanged: {
|
onAcceptPendingChanged: {
|
||||||
if (acceptPending) {
|
if (acceptPending) {
|
||||||
// Tell the destination page what the selected category is
|
// Tell the destination page what the selected category is
|
||||||
// acceptDestinationInstance.category = selector.value
|
// acceptDestinationInstance.category = selector.value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -277,18 +277,16 @@ Page {
|
||||||
}
|
}
|
||||||
VerticalScrollDecorator { flickable: imageFlickable }
|
VerticalScrollDecorator { flickable: imageFlickable }
|
||||||
IconButton {
|
IconButton {
|
||||||
visible: false
|
visible: true
|
||||||
anchors{
|
anchors.right: parent.right
|
||||||
right: imagePage.right;
|
anchors.bottom: parent.bottom
|
||||||
rightMargin: Theme.paddingLarge;
|
anchors.rightMargin: Theme.paddingLarge
|
||||||
bottom: imagePage.bottom;
|
anchors.bottomMargin: Theme.paddingMedium
|
||||||
bottomMargin: Theme.paddingLarge;
|
//width: Theme.iconSizeMedium+Theme.paddingMedium*2
|
||||||
}
|
|
||||||
width: Theme.iconSizeMedium+Theme.paddingMedium*2
|
|
||||||
|
|
||||||
icon.source: "image://theme/icon-m-cloud-download"
|
icon.source: "image://theme/icon-m-cloud-download"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
//py.saveImg(MD5.hex_md5(strThumbnailUrl),strHpTitle+"."+Script.parseDate(currentDay));
|
var filename = mediaURL.split("/");
|
||||||
|
FileDownloader.downloadFile(mediaURL, filename[filename.length-1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue