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

View file

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