Simplify remorse popups, see #206

This commit is contained in:
Sebastian Wolf 2020-11-29 13:33:14 +01:00
parent db41f61c97
commit 782599f905
2 changed files with 15 additions and 22 deletions

View file

@ -204,18 +204,15 @@ SilicaFlickable {
onClicked: {
// ensure it's done even if the page is closed:
if (chatInformationPage.userIsMember) {
var remorse = Remorse.popupAction(appWindow, qsTr("Leaving chat"), (function(chatid) {
return function() {
tdLibWrapper.leaveChat(chatid);
var chatId = chatInformationPage.chatInformation.id;
Remorse.popupAction(chatInformationPage, qsTr("Leaving chat"), function() {
tdLibWrapper.leaveChat(chatId);
// this does not care about the response (ideally type "ok" without further reference) for now
pageStack.pop(pageStack.find( function(page){ return(page._depth === 0)} ));
};
}(chatInformationPage.chatInformation.id)))
});
} else {
tdLibWrapper.joinChat(chatInformationPage.chatInformation.id);
}
}
}
MenuItem {
@ -251,7 +248,7 @@ SilicaFlickable {
property int maxDimension: Screen.width / 2
property int minX: Theme.horizontalPageMargin
property int maxX: (chatInformationPage.width - maxDimension)/2
property int minY: Theme.paddingSmall//(parent.height - minDimension)/2
property int minY: Theme.paddingMedium
property int maxY: parent.height
property double tweenFactor: {
if(!hasImage) {

View file

@ -587,11 +587,8 @@ Page {
id: closeSecretChatMenuItem
visible: chatPage.isSecretChat && chatPage.secretChatDetails.state["@type"] !== "secretChatStateClosed"
onClicked: {
var remorse = Remorse.popupAction(appWindow, qsTr("Closing chat"), (function(secretChatId) {
return function() {
tdLibWrapper.closeSecretChat(secretChatId);
};
}(chatPage.secretChatDetails.id)))
var secretChatId = chatPage.secretChatDetails.id;
Remorse.popupAction(chatPage, qsTr("Closing chat"), function() { tdLibWrapper.closeSecretChat(secretChatId) });
}
text: qsTr("Close Chat")
}
@ -601,13 +598,12 @@ Page {
visible: (chatPage.isSuperGroup || chatPage.isBasicGroup) && chatGroupInformation && chatGroupInformation.status["@type"] !== "chatMemberStatusBanned"
onClicked: {
if (chatPage.userIsMember) {
var remorse = Remorse.popupAction(appWindow, qsTr("Leaving chat"), (function(chatid) {
return function() {
tdLibWrapper.leaveChat(chatid);
var chatId = chatInformation.id;
Remorse.popupAction(chatPage, qsTr("Leaving chat"), function() {
tdLibWrapper.leaveChat(chatId);
// this does not care about the response (ideally type "ok" without further reference) for now
pageStack.pop(pageStack.find( function(page){ return(page._depth === 0)} ));
};
}(chatInformation.id)))
});
} else {
tdLibWrapper.joinChat(chatInformation.id);
}