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: {
|
||||
//Logic.conf.notificationLastID = 0;
|
||||
Logic.saveData()
|
||||
}
|
||||
Connections
|
||||
|
@ -72,8 +73,7 @@ ApplicationWindow
|
|||
target: Dbus
|
||||
onViewtoot:
|
||||
{
|
||||
console.log(key, "dbus show issue")
|
||||
|
||||
console.log(key, "dbus onViewtoot")
|
||||
}
|
||||
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 modelTLsearch = 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-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;
|
||||
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;
|
||||
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")
|
||||
|
||||
notification.timestamp = item.timestamp
|
||||
|
@ -132,8 +134,12 @@ var notificationGenerator = function(item){
|
|||
notification.body = item.body
|
||||
if(item.previewBody)
|
||||
notification.previewBody = item.previewBody;
|
||||
else
|
||||
notification.previewBody = item.body;
|
||||
if(item.previewSummary)
|
||||
notification.previewSummary = item.previewSummary;
|
||||
else
|
||||
notification.previewSummary = item.summary
|
||||
if(notification.replacesId){ notification.replacesId = 0 }
|
||||
notification.publish()
|
||||
}
|
||||
|
@ -149,7 +155,9 @@ var notifier = function(item){
|
|||
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
|
||||
body: item.content,
|
||||
service: 'toot',
|
||||
key: item.id
|
||||
}
|
||||
break;
|
||||
case "follow":
|
||||
|
@ -157,7 +165,9 @@ var notifier = function(item){
|
|||
urgency: "critical",
|
||||
timestamp: item.created_at,
|
||||
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;
|
||||
|
||||
|
@ -166,7 +176,9 @@ var notifier = function(item){
|
|||
urgency: "low",
|
||||
timestamp: item.created_at,
|
||||
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;
|
||||
case "mention":
|
||||
|
@ -175,7 +187,9 @@ var notifier = function(item){
|
|||
timestamp: item.created_at,
|
||||
summary: (item.account_display_name !== "" ? item.account_display_name : '@'+item.account_username) + ' ' + qsTr("said"),
|
||||
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;
|
||||
default:
|
||||
|
@ -185,6 +199,7 @@ var notifier = function(item){
|
|||
notificationGenerator(msg)
|
||||
}
|
||||
|
||||
|
||||
var api;
|
||||
|
||||
function func() {
|
||||
|
|
|
@ -53,8 +53,10 @@ WorkerScript.onMessage = function(msg) {
|
|||
var item;
|
||||
if (data.hasOwnProperty(i)) {
|
||||
if(msg.action === "accounts/search") {
|
||||
item = parseAccounts(data[i]);
|
||||
item = parseAccounts([], "", data[i]);
|
||||
console.log(JSON.stringify(data[i]))
|
||||
items.push(item)
|
||||
console.log("aaaa")
|
||||
|
||||
} else if(msg.action === "notifications") {
|
||||
// notification
|
||||
|
@ -256,13 +258,20 @@ function parseToot (data){
|
|||
for(var i = 0; i < data['media_attachments'].length ; i++){
|
||||
var attachments = data['media_attachments'][i];
|
||||
item['content'] = item['content'].replaceAll(attachments['text_url'], '')
|
||||
item['attachments'].push({
|
||||
id: attachments['id'],
|
||||
id: attachments['id'],
|
||||
type: attachments['type'],
|
||||
url: attachments['remote_url'] !=="" ? attachments['remote_url'] : attachments['url'] ,
|
||||
preview_url: loadImages ? attachments['preview_url'] : ''
|
||||
})
|
||||
var tmp = {
|
||||
id: attachments['id'],
|
||||
id: attachments['id'],
|
||||
type: attachments['type'],
|
||||
url: typeof attachments['remote_url'] == "string" ? attachments['remote_url'] : attachments['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(" ")
|
||||
for(var i = 0; i < item['content'].length ; i++){
|
||||
|
|
|
@ -19,6 +19,12 @@ Page {
|
|||
btnAddImage.enabled = mediaModel.count < 4
|
||||
}
|
||||
}
|
||||
ListModel {
|
||||
id: suggestedModel
|
||||
onCountChanged: {
|
||||
console.log("aaaa " + count)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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 {
|
||||
id: panel
|
||||
|
@ -114,6 +171,44 @@ Page {
|
|||
EnterKey.onClicked: {
|
||||
//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 {
|
||||
id: btnSmileys
|
||||
|
@ -128,8 +223,8 @@ Page {
|
|||
rightMargin: Theme.paddingSmall
|
||||
}
|
||||
icon.source: "image://theme/icon-s-mms?" + (pressed
|
||||
? Theme.highlightColor
|
||||
: (warningContent.visible ? Theme.secondaryHighlightColor : Theme.primaryColor))
|
||||
? Theme.highlightColor
|
||||
: (warningContent.visible ? Theme.secondaryHighlightColor : Theme.primaryColor))
|
||||
onClicked: pageStack.push(firstWizardPage)
|
||||
}
|
||||
SilicaGridView {
|
||||
|
@ -208,31 +303,31 @@ Page {
|
|||
}
|
||||
}
|
||||
ImageUploader {
|
||||
id: imageUploader
|
||||
id: imageUploader
|
||||
|
||||
onProgressChanged: {
|
||||
console.log("progress "+progress)
|
||||
uploadProgress.width = parent.width*progress
|
||||
}
|
||||
onProgressChanged: {
|
||||
console.log("progress "+progress)
|
||||
uploadProgress.width = parent.width*progress
|
||||
}
|
||||
|
||||
onSuccess: {
|
||||
uploadProgress.width =0
|
||||
console.log(replyData);
|
||||
onSuccess: {
|
||||
uploadProgress.width =0
|
||||
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 {
|
||||
id: privacy
|
||||
anchors {
|
||||
|
@ -309,19 +404,19 @@ Page {
|
|||
if (mdl.count > 0) {
|
||||
var setIndex = 0;
|
||||
switch (mdl.get(0).status_visibility){
|
||||
case "unlisted":
|
||||
setIndex = 1;
|
||||
break;
|
||||
case "private":
|
||||
setIndex = 2;
|
||||
break;
|
||||
case "direct":
|
||||
privacy.enabled = false;
|
||||
setIndex = 3;
|
||||
break;
|
||||
default:
|
||||
privacy.enabled = true;
|
||||
setIndex = 0;
|
||||
case "unlisted":
|
||||
setIndex = 1;
|
||||
break;
|
||||
case "private":
|
||||
setIndex = 2;
|
||||
break;
|
||||
case "direct":
|
||||
privacy.enabled = false;
|
||||
setIndex = 3;
|
||||
break;
|
||||
default:
|
||||
privacy.enabled = true;
|
||||
setIndex = 0;
|
||||
}
|
||||
privacy.currentIndex = setIndex;
|
||||
}
|
||||
|
@ -347,7 +442,7 @@ Page {
|
|||
onAcceptPendingChanged: {
|
||||
if (acceptPending) {
|
||||
// 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 }
|
||||
IconButton {
|
||||
visible: false
|
||||
anchors{
|
||||
right: imagePage.right;
|
||||
rightMargin: Theme.paddingLarge;
|
||||
bottom: imagePage.bottom;
|
||||
bottomMargin: Theme.paddingLarge;
|
||||
}
|
||||
width: Theme.iconSizeMedium+Theme.paddingMedium*2
|
||||
|
||||
visible: true
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.rightMargin: Theme.paddingLarge
|
||||
anchors.bottomMargin: Theme.paddingMedium
|
||||
//width: Theme.iconSizeMedium+Theme.paddingMedium*2
|
||||
icon.source: "image://theme/icon-m-cloud-download"
|
||||
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