Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix App Added Alert #2037

Merged
merged 3 commits into from
Oct 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/ui/components/VPNAlert.qml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ Rectangle {
property var duration: 0
// Delete itself after closing
property var destructive: false
// Fixes the Y on show() if the alert does not use Layout
property var setY: 0

Layout.minimumHeight: style.alertHeight
Layout.maximumHeight: style.alertHeight
Expand Down Expand Up @@ -320,12 +322,16 @@ Rectangle {
if (!isLayout) {
height = style.alertHeight;
width = Math.min(window.width - Theme.windowMargin, Theme.maxHorizontalContentWidth);
y = fullscreenRequired()? iosSafeAreaTopMargin.height + Theme.windowMargin : Theme.windowMargin;
if (setY > 0) {
y = setY;
} else {
y = fullscreenRequired() ? iosSafeAreaTopMargin.height + Theme.windowMargin : Theme.windowMargin;
}
anchors.horizontalCenter = parent.horizontalCenter;
anchors.margins = Theme.windowMargin / 2;
}
if(alertBox.duration > 0){
console.log("Toasbox timer start")
console.log("Toastbox timer start")
autoHideTimer.start()
}
}
Expand Down
14 changes: 12 additions & 2 deletions src/ui/settings/ViewAppPermissions.qml
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,27 @@ Item {
target: VPNAppPermissions
function onNotification(type,message,action) {
console.log("Got notification: "+type + " message:"+message);
var component = Qt.createComponent("qrc://components/components/VPNAlert.qml");
component.createObject(root, {
var component = Qt.createComponent("qrc:/components/components/VPNAlert.qml");
if(component.status !== Component.Ready)
{
if( component.status == Component.Error )
console.debug("Error:"+ component.errorString() );

}
var alert = component.createObject(root, {
isLayout:false,
visible:true,
alertText: message,
alertType: type,
alertActionText: action,
duration:type === "warning"? 0: 2000,
destructive:true,
// Pin y hight to be below the alert bar as we can't render above it
setY: vpnFlickable.y+Theme.windowMargin,
onActionPressed: ()=>{VPNAppPermissions.openFilePicker();},
});

alert.show();
}
}

Expand Down