Merge branch 'ui-improvements' into develop

This commit is contained in:
molan-git 2020-06-11 14:26:55 +02:00
commit a59a15b781
7 changed files with 71 additions and 70 deletions

View file

@ -35,8 +35,8 @@ import "./lib/API.js" as Logic
ApplicationWindow {
id: appWindow
cover: Qt.resolvedUrl("cover/CoverPage.qml")
allowedOrientations: defaultAllowedOrientations
cover: Qt.resolvedUrl("cover/CoverPage.qml")
Component.onCompleted: {
var obj = {}
Logic.mediator.installTo(obj)
@ -44,26 +44,26 @@ ApplicationWindow {
console.log('confLoaded');
//console.log(JSON.stringify(Logic.conf))
if (!Logic.conf['notificationLastID'])
Logic.conf['notificationLastID'] = 0
Logic.conf['notificationLastID'] = 0
if (Logic.conf['instance']) {
Logic.api = Logic.mastodonAPI({
"instance": Logic.conf['instance'],
"api_user_token": ""
})
Logic.api = Logic.mastodonAPI({
"instance": Logic.conf['instance'],
"api_user_token": ""
})
}
if (Logic.conf['login']) {
//Logic.conf['notificationLastID'] = 0
Logic.api.setConfig("api_user_token", Logic.conf['api_user_token'])
//accounts/verify_credentials
Logic.api.get('instance', [], function(data) {
console.log(JSON.stringify(data))
pageStack.push(Qt.resolvedUrl("./pages/MainPage.qml"), {})
})
//pageStack.push(Qt.resolvedUrl("./pages/Conversation.qml"), {})
//Logic.conf['notificationLastID'] = 0
Logic.api.setConfig("api_user_token", Logic.conf['api_user_token'])
//accounts/verify_credentials
Logic.api.get('instance', [], function(data) {
console.log(JSON.stringify(data))
pageStack.push(Qt.resolvedUrl("./pages/MainPage.qml"), {})
})
//pageStack.push(Qt.resolvedUrl("./pages/Conversation.qml"), {})
} else {
pageStack.push(Qt.resolvedUrl("./pages/LoginPage.qml"), {})
pageStack.push(Qt.resolvedUrl("./pages/LoginPage.qml"), {})
}
})
Logic.init()
@ -73,6 +73,7 @@ ApplicationWindow {
//Logic.conf.notificationLastID = 0;
Logic.saveData()
}
Connections {
target: Dbus
onViewtoot: {

View file

@ -39,37 +39,37 @@ Page {
EnterKey.onClicked: {
Logic.api = Logic.mastodonAPI({ instance: instance.text, api_user_token: "" });
Logic.api.registerApplication("Tooter",
'http://localhost/harbour-tooter', // redirect uri, we will need this later on
["read", "write", "follow"], //scopes
"http://grave-design.com/harbour-tooter", //website on the login screen
function(data) {
'http://localhost/harbour-tooter', // redirect uri, we will need this later on
["read", "write", "follow"], //scopes
"http://grave-design.com/harbour-tooter", //website on the login screen
function(data) {
console.log(data)
var conf = JSON.parse(data)
conf.instance = instance.text;
conf.login = false;
console.log(data)
var conf = JSON.parse(data)
conf.instance = instance.text;
conf.login = false;
/*conf['login'] = false;
/*conf['login'] = false;
conf['mastodon_client_id'] = data['mastodon_client_id'];
conf['mastodon_client_secret'] = data['mastodon_client_secret'];
conf['mastodon_client_redirect_uri'] = data['mastodon_client_redirect_uri'];
delete Logic.conf;*/
Logic.conf = conf;
console.log(JSON.stringify(conf))
console.log(JSON.stringify(Logic.conf))
// we got our application
Logic.conf = conf;
console.log(JSON.stringify(conf))
console.log(JSON.stringify(Logic.conf))
// we got our application
// our user to it!
var url = Logic.api.generateAuthLink(Logic.conf["client_id"],
Logic.conf["redirect_uri"],
"code", // oauth method
["read", "write", "follow"] //scopes
);
console.log(url)
webView.url = url
webView.visible = true
}
);
// our user to it!
var url = Logic.api.generateAuthLink(Logic.conf["client_id"],
Logic.conf["redirect_uri"],
"code", // oauth method
["read", "write", "follow"] //scopes
);
console.log(url)
webView.url = url
webView.visible = true
}
);
}
}
Label {
@ -109,7 +109,7 @@ Page {
if (
(url+"").substr(0, 37) === 'http://localhost/harbour-tooter?code=' ||
(url+"").substr(0, 38) === 'https://localhost/harbour-tooter?code='
) {
) {
visible = false;
var vars = {};
@ -120,22 +120,22 @@ Page {
console.log(authCode)
Logic.api.getAccessTokenFromAuthCode(
Logic.conf["client_id"],
Logic.conf["client_secret"],
Logic.conf["redirect_uri"],
authCode,
function(data) {
// AAAND DATA CONTAINS OUR TOKEN!
console.log(data)
data = JSON.parse(data)
console.log(JSON.stringify(data))
console.log(JSON.stringify(data.access_token))
Logic.conf["api_user_token"] = data.access_token
Logic.conf["login"] = true;
Logic.api.setConfig("api_user_token", Logic.conf["api_user_token"])
pageStack.replace(Qt.resolvedUrl("MainPage.qml"), {})
}
)
Logic.conf["client_id"],
Logic.conf["client_secret"],
Logic.conf["redirect_uri"],
authCode,
function(data) {
// AAAND DATA CONTAINS OUR TOKEN!
console.log(data)
data = JSON.parse(data)
console.log(JSON.stringify(data))
console.log(JSON.stringify(data.access_token))
Logic.conf["api_user_token"] = data.access_token
Logic.conf["login"] = true;
Logic.api.setConfig("api_user_token", Logic.conf["api_user_token"])
pageStack.replace(Qt.resolvedUrl("MainPage.qml"), {})
}
)
}

View file

@ -28,7 +28,7 @@ DockedPanel {
right: parent.right
rightMargin: Theme.horizontalPageMargin
verticalCenter: parent.verticalCenter
}
}
}
MouseArea {

View file

@ -122,7 +122,7 @@ Item {
rightMargin: Theme.paddingLarge
}
/* Rectangle {
/* Rectangle {
id: followingBg
visible: (following ? true : false)
radius: Theme.paddingSmall

View file

@ -4,7 +4,7 @@ import Sailfish.Silica 1.0
FullscreenContentPage {
id: profileImage
property string image: ""
property string image: ""
allowedOrientations: Orientation.All

View file

@ -23,8 +23,8 @@ BackgroundItem {
height: parent.height
opacity: 0.3
gradient: Gradient {
GradientStop { position: -1.5; color: "transparent" }
GradientStop { position: 0.6; color: Theme.highlightBackgroundColor }
GradientStop { position: -1.5; color: "transparent" }
GradientStop { position: 0.6; color: Theme.highlightBackgroundColor }
}
}
@ -37,8 +37,8 @@ BackgroundItem {
height: parent.height
opacity: 0.5
gradient: Gradient {
GradientStop { position: -0.5; color: "transparent" }
GradientStop { position: 0.4; color: Theme.highlightDimmerColor }
GradientStop { position: -0.5; color: "transparent" }
GradientStop { position: 0.4; color: Theme.highlightDimmerColor }
}
}
@ -71,8 +71,8 @@ BackgroundItem {
onStatusChanged: {
if (avatar.status === Image.Error)
source = "../../images/icon-m-profile.svg?" + (pressed
? Theme.highlightColor
: Theme.primaryColor)
? Theme.highlightColor
: Theme.primaryColor)
}
MouseArea {
@ -165,8 +165,8 @@ BackgroundItem {
textFormat: Text.RichText
font.pixelSize: Theme.fontSizeSmall
linkColor: if (myList.type === "notifications" && ( model.type === "favourite" || model.type === "reblog" )) {
Theme.secondaryHighlightColor
} else Theme.highlightColor
Theme.secondaryHighlightColor
} else Theme.highlightColor
wrapMode: Text.Wrap
color: if (myList.type === "notifications" && ( model.type === "favourite" || model.type === "reblog" )) {
(pressed ? Theme.secondaryHighlightColor : (!highlight ? Theme.secondaryColor : Theme.secondaryHighlightColor))
@ -305,7 +305,7 @@ BackgroundItem {
MenuItem {
id: mnuFavourite
visible: model.type !== "follow" || model.status_visibility !== "direct"
visible: model.type !== "follow"
text: typeof model.favourited !== "undefined" && model.favourited ? qsTr("Unfavorite") : qsTr("Favorite")
onClicked: {
var status = typeof model.favourited !== "undefined" && model.favourited