mirror of https://github.com/procxx/kepka.git
Fixed position of Saved Messages in touchbar when user unpins it.
This commit is contained in:
parent
b4df7b4efd
commit
de3cc76468
|
@ -438,6 +438,7 @@ NSString* FormatTime(int time) {
|
||||||
- (void) updatePinnedButtons {
|
- (void) updatePinnedButtons {
|
||||||
const auto &order = Auth().data().pinnedChatsOrder(nullptr);
|
const auto &order = Auth().data().pinnedChatsOrder(nullptr);
|
||||||
auto isSelfPeerPinned = false;
|
auto isSelfPeerPinned = false;
|
||||||
|
auto isArchivePinned = false;
|
||||||
PinnedDialogButton *selfChatButton;
|
PinnedDialogButton *selfChatButton;
|
||||||
NSCustomTouchBarItem *item = [self.touchBarMain itemForIdentifier:kPinnedPanelItemIdentifier];
|
NSCustomTouchBarItem *item = [self.touchBarMain itemForIdentifier:kPinnedPanelItemIdentifier];
|
||||||
NSStackView *stack = item.view;
|
NSStackView *stack = item.view;
|
||||||
|
@ -447,6 +448,8 @@ NSString* FormatTime(int time) {
|
||||||
if (num <= kSavedMessagesId) {
|
if (num <= kSavedMessagesId) {
|
||||||
if (num == kSavedMessagesId) {
|
if (num == kSavedMessagesId) {
|
||||||
selfChatButton = button;
|
selfChatButton = button;
|
||||||
|
} else if (num == kArchiveId) {
|
||||||
|
isArchivePinned = !button.isDeletedFromView;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -472,7 +475,9 @@ NSString* FormatTime(int time) {
|
||||||
[stack removeView:selfChatButton.view];
|
[stack removeView:selfChatButton.view];
|
||||||
} else if (!isSelfPeerPinned && selfChatButton.isDeletedFromView) {
|
} else if (!isSelfPeerPinned && selfChatButton.isDeletedFromView) {
|
||||||
selfChatButton.isDeletedFromView = false;
|
selfChatButton.isDeletedFromView = false;
|
||||||
[stack insertView:selfChatButton.view atIndex:0 inGravity:NSStackViewGravityLeading];
|
[stack insertView:selfChatButton.view
|
||||||
|
atIndex:(isArchivePinned ? 1 : 0)
|
||||||
|
inGravity:NSStackViewGravityLeading];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue