Merge pull request #199 from jgibbon/bugfix/functions-appnotification

fix functions scope; make appNotification global
This commit is contained in:
Sebastian Wolf 2020-11-23 21:11:05 +01:00 committed by GitHub
commit 4712d3dc0d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 26 additions and 24 deletions

View file

@ -192,9 +192,6 @@ SilicaFlickable {
id: membersList
}
AppNotification {
id: infoNotification
}
PullDownMenu {
MenuItem {
visible: (chatInformationPage.isSuperGroup || chatInformationPage.isBasicGroup) && chatInformationPage.groupInformation && chatInformationPage.groupInformation.status["@type"] !== "chatMemberStatusBanned"
@ -420,7 +417,7 @@ SilicaFlickable {
anchors.verticalCenter: inviteLinkItem.verticalCenter
onClicked: {
Clipboard.text = chatInformationPage.groupFullInformation.invite_link
infoNotification.show(qsTr("The Invite Link has been copied to the clipboard."));
appNotification.show(qsTr("The Invite Link has been copied to the clipboard."));
}
}
}

View file

@ -19,6 +19,8 @@
import QtQuick 2.6
import Sailfish.Silica 1.0
import "pages"
import "components"
import "./js/functions.js" as Functions
ApplicationWindow
{
@ -37,4 +39,16 @@ ApplicationWindow
appWindow.activate();
}
}
AppNotification {
id: appNotification
parent: pageStack.currentPage
}
Component.onCompleted: {
Functions.setGlobals({
tdLibWrapper: tdLibWrapper,
appNotification: appNotification
});
}
}

View file

@ -21,6 +21,13 @@
.import "debug.js" as Debug
.import Sailfish.Silica 1.0 as Silica
var tdLibWrapper;
var appNotification;
function setGlobals(globals) {
tdLibWrapper = globals.tdLibWrapper;
appNotification = globals.appNotification;
}
function getUserName(userInformation) {
var firstName = typeof userInformation.first_name !== "undefined" ? userInformation.first_name : "";
var lastName = typeof userInformation.last_name !== "undefined" ? userInformation.last_name : "";

View file

@ -579,10 +579,6 @@ Page {
}
}
AppNotification {
id: appNotification
}
BackgroundItem {
id: headerMouseArea
height: headerRow.height

View file

@ -82,11 +82,11 @@ Page {
}
}
onCopyToDownloadsSuccessful: {
imageNotification.show(qsTr("Download of %1 successful.").arg(fileName), filePath);
appNotification.show(qsTr("Download of %1 successful.").arg(fileName), filePath);
}
onCopyToDownloadsError: {
imageNotification.show(qsTr("Download failed."));
appNotification.show(qsTr("Download failed."));
}
}
@ -105,10 +105,6 @@ Page {
}
}
AppNotification {
id: imageNotification
}
SilicaFlickable {
id: imageFlickable
anchors.fill: parent

View file

@ -187,10 +187,6 @@ Page {
}
}
AppNotification {
id: appNotification
}
Column {
id: column
width: parent.width

View file

@ -74,18 +74,14 @@ Page {
}
}
onCopyToDownloadsSuccessful: {
videoNotification.show(qsTr("Download of %1 successful.").arg(fileName), filePath);
appNotification.show(qsTr("Download of %1 successful.").arg(fileName), filePath);
}
onCopyToDownloadsError: {
videoNotification.show(qsTr("Download failed."));
appNotification.show(qsTr("Download failed."));
}
}
AppNotification {
id: videoNotification
}
Item {
width: videoPage.videoWidth * videoPage.sizingFactor
height: videoPage.videoHeight * videoPage.sizingFactor