improved langs for stickers, fixed confirmed actions from chats context menu, changed AppUserModelId for beta version

This commit is contained in:
John Preston 2015-12-06 18:50:02 +03:00
parent 93c29a1422
commit 128cbefe0c
15 changed files with 139 additions and 80 deletions

View File

@ -583,8 +583,10 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
"lng_stickers_default_set" = "Great Minds"; "lng_stickers_default_set" = "Great Minds";
"lng_stickers_you_have" = "Manage and reorder sticker packs"; "lng_stickers_you_have" = "Manage and reorder sticker packs";
"lng_stickers_packs" = "Sticker Packs"; "lng_stickers_packs" = "Sticker Packs";
"lng_stickers_remove" = "Remove"; "lng_stickers_reorder" = "Click and drag to reorder sticker packs";
"lng_stickers_return" = "Return"; "lng_stickers_remove" = "Delete";
"lng_stickers_return" = "Undo";
"lng_stickers_restore" = "Restore";
"lng_stickers_count" = "{count:Loading..|# sticker|# stickers}"; "lng_stickers_count" = "{count:Loading..|# sticker|# stickers}";
"lng_in_dlg_photo" = "Photo"; "lng_in_dlg_photo" = "Photo";

View File

@ -1424,12 +1424,13 @@ contactsNewItemIconPosition: point(29px, 19px);
contactsNewItemTop: 18px; contactsNewItemTop: 18px;
contactsNewItemFg: #4b82af; contactsNewItemFg: #4b82af;
contactsAboutBg: #f7f7f7; contactsAboutBg: #f7f7f7;
contactsAboutShadow: #0000001F;
contactsAdminCheckbox: Checkbox(defaultCheckbox) { contactsAdminCheckbox: Checkbox(defaultCheckbox) {
font: semiboldFont; font: semiboldFont;
textBg: #f7f7f7; textBg: #f7f7f7;
textPosition: point(34px, 1px); textPosition: point(34px, 1px);
} }
contactsAboutHeight: 80px; contactsAboutHeight: 42px;
contactsAboutTop: 9px; contactsAboutTop: 9px;
contactsScroll: flatScroll(boxScroll) { contactsScroll: flatScroll(boxScroll) {
deltab: 0px; deltab: 0px;
@ -1794,6 +1795,8 @@ stickersScroll: flatScroll(boxScroll) {
deltat: 23px; deltat: 23px;
deltab: 9px; deltab: 9px;
} }
stickersReorderPadding: margins(0px, 12px, 0px, 12px);
stickersReorderFg: #777;
stickersRowDisabledOpacity: 0.4; stickersRowDisabledOpacity: 0.4;
stickersRowDuration: 200; stickersRowDuration: 200;
@ -1938,11 +1941,11 @@ stickerIconLeft: sprite(342px, 72px, 40px, 1px);
stickerIconRight: sprite(342px, 73px, 40px, 1px); stickerIconRight: sprite(342px, 73px, 40px, 1px);
stickerIconMove: 400; stickerIconMove: 400;
verifiedCheckProfile: sprite(285px, 240px, 22px, 22px); verifiedCheckProfile: sprite(285px, 235px, 18px, 18px);
verifiedCheckProfilePos: point(9px, 4px); verifiedCheckProfilePos: point(7px, 6px);
verifiedCheck: sprite(285px, 221px, 19px, 19px); verifiedCheck: sprite(285px, 221px, 14px, 14px);
verifiedCheckInv: sprite(304px, 221px, 19px, 19px); verifiedCheckInv: sprite(299px, 221px, 14px, 14px);
verifiedCheckPos: point(5px, 0px); verifiedCheckPos: point(4px, 2px);
botKbDuration: 200; botKbDuration: 200;
botKbBg: #f7f7f7; botKbBg: #f7f7f7;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 178 KiB

After

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 240 KiB

After

Width:  |  Height:  |  Size: 240 KiB

View File

@ -94,7 +94,7 @@ namespace {
ContactsInner::ContactsInner(ChatData *chat, MembersFilter membersFilter) : TWidget() ContactsInner::ContactsInner(ChatData *chat, MembersFilter membersFilter) : TWidget()
, _rowHeight(st::contactsPadding.top() + st::contactsPhotoSize + st::contactsPadding.bottom()) , _rowHeight(st::contactsPadding.top() + st::contactsPhotoSize + st::contactsPadding.bottom())
, _newItemHeight((membersFilter == MembersFilterAdmins) ? (st::contactsNewItemHeight + st::contactsAboutHeight) : 0) , _newItemHeight(0)
, _newItemSel(false) , _newItemSel(false)
, _chat(chat) , _chat(chat)
, _channel(0) , _channel(0)
@ -119,8 +119,11 @@ ContactsInner::ContactsInner(ChatData *chat, MembersFilter membersFilter) : TWid
, _addContactLnk(this, lang(lng_add_contact_button)) , _addContactLnk(this, lang(lng_add_contact_button))
, _saving(false) { , _saving(false) {
initList(); initList();
if (membersFilter == MembersFilterAdmins && !_contacts->list.count) { if (membersFilter == MembersFilterAdmins) {
App::api()->requestFullPeer(_chat); _newItemHeight = st::contactsNewItemHeight + qMax(_aboutAllAdmins.countHeight(_aboutWidth), _aboutAdmins.countHeight(_aboutWidth)) + st::contactsAboutHeight;
if (!_contacts->list.count) {
App::api()->requestFullPeer(_chat);
}
} }
init(); init();
} }
@ -775,9 +778,9 @@ void ContactsInner::changeCheckState(ContactData *data, PeerData *peer) {
int32 ContactsInner::selectedCount() const { int32 ContactsInner::selectedCount() const {
int32 result = _selCount; int32 result = _selCount;
if (_chat) { if (_chat) {
result += (_chat->count > 0) ? _chat->count : 1; result += qMax(_chat->count, 1);
} else if (_channel) { } else if (_channel) {
result += _already.size(); result += qMax(_channel->count, _already.size());
} else if (_creating == CreatingGroupGroup) { } else if (_creating == CreatingGroupGroup) {
result += 1; result += 1;
} }

View File

@ -334,11 +334,13 @@ StickersInner::StickersInner() : TWidget()
, _aboveShadowFadeStart(0) , _aboveShadowFadeStart(0)
, _aboveShadowFadeOpacity(0, 0) , _aboveShadowFadeOpacity(0, 0)
, _a_shifting(animFunc(this, &StickersInner::animStep_shifting)) , _a_shifting(animFunc(this, &StickersInner::animStep_shifting))
, _itemsTop(st::membersPadding.top())
, _saving(false) , _saving(false)
, _removeSel(-1) , _removeSel(-1)
, _removeDown(-1) , _removeDown(-1)
, _removeWidth(st::normalFont->width(lang(lng_stickers_remove))) , _removeWidth(st::normalFont->width(lang(lng_stickers_remove)))
, _returnWidth(st::normalFont->width(lang(lng_stickers_return))) , _returnWidth(st::normalFont->width(lang(lng_stickers_return)))
, _restoreWidth(st::normalFont->width(lang(lng_stickers_restore)))
, _selected(-1) , _selected(-1)
, _started(-1) , _started(-1)
, _dragging(-1) , _dragging(-1)
@ -357,14 +359,14 @@ void StickersInner::paintEvent(QPaintEvent *e) {
p.fillRect(r, st::white); p.fillRect(r, st::white);
p.setClipRect(r); p.setClipRect(r);
int32 yFrom = r.y() - st::membersPadding.top(), yTo = r.y() + r.height() - st::membersPadding.top();
p.translate(0, st::membersPadding.top());
if (_rows.isEmpty()) { if (_rows.isEmpty()) {
p.setFont(st::noContactsFont->f); p.setFont(st::noContactsFont->f);
p.setPen(st::noContactsColor->p); p.setPen(st::noContactsColor->p);
p.drawText(QRect(0, 0, width(), st::noContactsHeight), lang(lng_contacts_loading), style::al_center); p.drawText(QRect(0, 0, width(), st::noContactsHeight), lang(lng_contacts_loading), style::al_center);
} else { } else {
p.translate(0, _itemsTop);
int32 yFrom = r.y() - _itemsTop, yTo = r.y() + r.height() - _itemsTop;
int32 from = floorclamp(yFrom - _rowHeight, _rowHeight, 0, _rows.size()); int32 from = floorclamp(yFrom - _rowHeight, _rowHeight, 0, _rows.size());
int32 to = ceilclamp(yTo + _rowHeight, _rowHeight, 0, _rows.size()); int32 to = ceilclamp(yTo + _rowHeight, _rowHeight, 0, _rows.size());
p.translate(0, from * _rowHeight); p.translate(0, from * _rowHeight);
@ -396,7 +398,9 @@ void StickersInner::paintRow(Painter &p, int32 index) {
} else { } else {
p.setPen(st::btnDefLink.color->p); p.setPen(st::btnDefLink.color->p);
} }
p.drawTextRight(st::contactsPadding.right() + st::contactsCheckPosition.x(), st::contactsPadding.top() + (st::contactsPhotoSize - st::normalFont->height) / 2, width(), lang(s->disabled ? lng_stickers_return : lng_stickers_remove), s->disabled ? _returnWidth : _removeWidth); int32 remWidth = s->disabled ? (s->official ? _restoreWidth : _returnWidth) : _removeWidth;
QString remText = lang(s->disabled ? (s->official ? lng_stickers_restore : lng_stickers_return) : lng_stickers_remove);
p.drawTextRight(st::contactsPadding.right() + st::contactsCheckPosition.x(), st::contactsPadding.top() + (st::contactsPhotoSize - st::normalFont->height) / 2, width(), remText, remWidth);
if (index == _above) { if (index == _above) {
float64 current = _aboveShadowFadeOpacity.current(); float64 current = _aboveShadowFadeOpacity.current();
@ -441,7 +445,7 @@ void StickersInner::mousePressEvent(QMouseEvent *e) {
onUpdateSelected(); onUpdateSelected();
if (_removeSel >= 0) { if (_removeSel >= 0) {
_removeDown = _removeSel; _removeDown = _removeSel;
update(0, st::membersPadding.top() + _removeSel * _rowHeight, width(), _rowHeight); update(0, _itemsTop + _removeSel * _rowHeight, width(), _rowHeight);
} else if (_selected >= 0) { } else if (_selected >= 0) {
_above = _dragging = _started = _selected; _above = _dragging = _started = _selected;
_dragStart = mapFromGlobal(_mouse); _dragStart = mapFromGlobal(_mouse);
@ -489,14 +493,14 @@ void StickersInner::onUpdateSelected() {
emit checkDraggingScroll(local.y()); emit checkDraggingScroll(local.y());
} else { } else {
bool in = rect().marginsRemoved(QMargins(0, st::membersPadding.top(), 0, st::membersPadding.bottom())).contains(local); bool in = rect().marginsRemoved(QMargins(0, _itemsTop, 0, st::membersPadding.bottom())).contains(local);
_selected = in ? floorclamp(local.y() - st::membersPadding.top(), _rowHeight, 0, _rows.size() - 1) : -1; _selected = in ? floorclamp(local.y() - _itemsTop, _rowHeight, 0, _rows.size() - 1) : -1;
int32 removeSel = -1; int32 removeSel = -1;
if (_selected >= 0) { if (_selected >= 0) {
int32 remw = _rows.at(_selected)->disabled ? _returnWidth : _removeWidth; int32 remw = _rows.at(_selected)->disabled ? (_rows.at(_selected)->official ? _restoreWidth : _returnWidth) : _removeWidth;
QRect rem(myrtlrect(width() - st::contactsPadding.right() - st::contactsCheckPosition.x() - remw, st::contactsPadding.top() + (st::contactsPhotoSize - st::normalFont->height) / 2, remw, st::normalFont->height)); QRect rem(myrtlrect(width() - st::contactsPadding.right() - st::contactsCheckPosition.x() - remw, st::contactsPadding.top() + (st::contactsPhotoSize - st::normalFont->height) / 2, remw, st::normalFont->height));
removeSel = rem.contains(local.x(), local.y() - st::membersPadding.top() - _selected * _rowHeight) ? _selected : -1; removeSel = rem.contains(local.x(), local.y() - _itemsTop - _selected * _rowHeight) ? _selected : -1;
} }
setRemoveSel(removeSel); setRemoveSel(removeSel);
emit noDraggingScroll(); emit noDraggingScroll();
@ -529,7 +533,7 @@ void StickersInner::mouseReleaseEvent(QMouseEvent *e) {
_dragging = _started = -1; _dragging = _started = -1;
} }
if (_removeDown >= 0) { if (_removeDown >= 0) {
update(0, st::membersPadding.top() + _removeDown * _rowHeight, width(), _rowHeight); update(0, _itemsTop + _removeDown * _rowHeight, width(), _rowHeight);
_removeDown = -1; _removeDown = -1;
} }
} }
@ -551,7 +555,7 @@ void StickersInner::updateAnimatedRegions() {
if (updateMax < _dragging) updateMax = _dragging; if (updateMax < _dragging) updateMax = _dragging;
} }
if (updateMin >= 0) { if (updateMin >= 0) {
update(0, st::membersPadding.top() + _rowHeight * (updateMin - 1), width(), _rowHeight * (updateMax - updateMin + 3)); update(0, _itemsTop + _rowHeight * (updateMin - 1), width(), _rowHeight * (updateMax - updateMin + 3));
} }
} }
@ -610,9 +614,9 @@ void StickersInner::clear() {
void StickersInner::setRemoveSel(int32 removeSel) { void StickersInner::setRemoveSel(int32 removeSel) {
if (removeSel != _removeSel) { if (removeSel != _removeSel) {
if (_removeSel >= 0) update(0, st::membersPadding.top() + _removeSel * _rowHeight, width(), _rowHeight); if (_removeSel >= 0) update(0, _itemsTop + _removeSel * _rowHeight, width(), _rowHeight);
_removeSel = removeSel; _removeSel = removeSel;
if (_removeSel >= 0) update(0, st::membersPadding.top() + _removeSel * _rowHeight, width(), _rowHeight); if (_removeSel >= 0) update(0, _itemsTop + _removeSel * _rowHeight, width(), _rowHeight);
setCursor((_removeSel >= 0 && (_removeDown < 0 || _removeDown == _removeSel)) ? style::cur_pointer : style::cur_default); setCursor((_removeSel >= 0 && (_removeDown < 0 || _removeDown == _removeSel)) ? style::cur_pointer : style::cur_default);
} }
} }
@ -621,7 +625,7 @@ void StickersInner::rebuild() {
QList<StickerSetRow*> rows, rowsDisabled; QList<StickerSetRow*> rows, rowsDisabled;
int32 namex = st::contactsPadding.left() + st::contactsPhotoSize + st::contactsPadding.left(); int32 namex = st::contactsPadding.left() + st::contactsPhotoSize + st::contactsPadding.left();
int32 namew = st::boxWideWidth - namex - st::contactsPadding.right() - st::contactsCheckPosition.x() - qMax(_returnWidth, _removeWidth); int32 namew = st::boxWideWidth - namex - st::contactsPadding.right() - st::contactsCheckPosition.x() - qMax(qMax(_returnWidth, _removeWidth), _restoreWidth);
clear(); clear();
const StickerSetsOrder &order(cStickerSetsOrder()); const StickerSetsOrder &order(cStickerSetsOrder());
@ -656,7 +660,8 @@ void StickersInner::rebuild() {
if (titleWidth > namew) { if (titleWidth > namew) {
title = st::contactsNameFont->elided(title, namew); title = st::contactsNameFont->elided(title, namew);
} }
(disabled ? rowsDisabled : rows).push_back(new StickerSetRow(it->id, sticker, it->stickers.size(), title, disabled, pixw, pixh)); bool official = (it->flags & MTPDstickerSet::flag_official);
(disabled ? rowsDisabled : rows).push_back(new StickerSetRow(it->id, sticker, it->stickers.size(), title, official, disabled, pixw, pixh));
_animStartTimes.push_back(0); _animStartTimes.push_back(0);
if (it->stickers.isEmpty() || (it->flags & MTPDstickerSet_flag_NOT_LOADED)) { if (it->stickers.isEmpty() || (it->flags & MTPDstickerSet_flag_NOT_LOADED)) {
App::api()->scheduleStickerSetRequest(it->id, it->access); App::api()->scheduleStickerSetRequest(it->id, it->access);
@ -665,7 +670,7 @@ void StickersInner::rebuild() {
} }
App::api()->requestStickerSets(); App::api()->requestStickerSets();
_rows = rows + rowsDisabled; _rows = rows + rowsDisabled;
resize(width(), st::membersPadding.top() + _rows.size() * _rowHeight + st::membersPadding.bottom()); resize(width(), _itemsTop + _rows.size() * _rowHeight + st::membersPadding.bottom());
} }
QVector<uint64> StickersInner::getOrder() const { QVector<uint64> StickersInner::getOrder() const {
@ -706,8 +711,13 @@ StickersBox::StickersBox() : ItemListBox(st::boxScroll)
, _save(this, lang(lng_settings_save), st::defaultBoxButton) , _save(this, lang(lng_settings_save), st::defaultBoxButton)
, _cancel(this, lang(lng_cancel), st::cancelBoxButton) , _cancel(this, lang(lng_cancel), st::cancelBoxButton)
, _reorderRequest(0) , _reorderRequest(0)
, _bottomShadow(this) { , _topShadow(this, st::contactsAboutShadow)
ItemListBox::init(&_inner, st::boxButtonPadding.top() + _save.height() + st::boxButtonPadding.bottom()); , _bottomShadow(this)
, _scrollDelta(0)
, _aboutWidth(st::boxWideWidth - st::contactsPadding.left() - st::contactsPhotoSize - st::contactsPadding.left() - st::contactsPadding.right())
, _about(st::boxTextFont, lang(lng_stickers_reorder), _defaultOptions, _aboutWidth)
, _aboutHeight(st::stickersReorderPadding.top() + _about.countHeight(_aboutWidth) + st::stickersReorderPadding.bottom()) {
ItemListBox::init(&_inner, st::boxButtonPadding.top() + _save.height() + st::boxButtonPadding.bottom(), st::boxTitleHeight + _aboutHeight);
setMaxHeight(snap(countHeight(), int32(st::sessionsHeight), int32(st::boxMaxListHeight))); setMaxHeight(snap(countHeight(), int32(st::sessionsHeight), int32(st::boxMaxListHeight)));
connect(App::main(), SIGNAL(stickersUpdated()), this, SLOT(onStickersUpdated())); connect(App::main(), SIGNAL(stickersUpdated()), this, SLOT(onStickersUpdated()));
@ -727,7 +737,7 @@ StickersBox::StickersBox() : ItemListBox(st::boxScroll)
} }
int32 StickersBox::countHeight() const { int32 StickersBox::countHeight() const {
return st::boxTitleHeight + _inner.height() + st::boxButtonPadding.top() + _save.height() + st::boxButtonPadding.bottom(); return st::boxTitleHeight + _aboutHeight + _inner.height() + st::boxButtonPadding.top() + _save.height() + st::boxButtonPadding.bottom();
} }
void StickersBox::disenableDone(const MTPBool & result, mtpRequestId req) { void StickersBox::disenableDone(const MTPBool & result, mtpRequestId req) {
@ -780,6 +790,10 @@ void StickersBox::paintEvent(QPaintEvent *e) {
paintTitle(p, lang(lng_stickers_packs)); paintTitle(p, lang(lng_stickers_packs));
p.translate(0, st::boxTitleHeight); p.translate(0, st::boxTitleHeight);
p.fillRect(0, 0, width(), _aboutHeight, st::contactsAboutBg);
p.setPen(st::stickersReorderFg);
_about.drawLeft(p, st::contactsPadding.left() + st::contactsPhotoSize + st::contactsPadding.left(), st::stickersReorderPadding.top(), _aboutWidth, width());
} }
void StickersBox::closePressed() { void StickersBox::closePressed() {
@ -803,6 +817,7 @@ void StickersBox::resizeEvent(QResizeEvent *e) {
_save.moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _save.height()); _save.moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _save.height());
_cancel.moveToRight(st::boxButtonPadding.right() + _save.width() + st::boxButtonPadding.left(), _save.y()); _cancel.moveToRight(st::boxButtonPadding.right() + _save.width() + st::boxButtonPadding.left(), _save.y());
_inner.resize(width(), _inner.height()); _inner.resize(width(), _inner.height());
_topShadow.setGeometry(0, st::boxTitleHeight + _aboutHeight, width(), st::lineWidth);
_bottomShadow.setGeometry(0, height() - st::boxButtonPadding.bottom() - _save.height() - st::boxButtonPadding.top() - st::lineWidth, width(), st::lineWidth); _bottomShadow.setGeometry(0, height() - st::boxButtonPadding.bottom() - _save.height() - st::boxButtonPadding.top() - st::lineWidth, width(), st::lineWidth);
_inner.setVisibleScrollbar((_scroll.scrollTopMax() > 0) ? (st::boxScroll.width - st::boxScroll.deltax) : 0); _inner.setVisibleScrollbar((_scroll.scrollTopMax() > 0) ? (st::boxScroll.width - st::boxScroll.deltax) : 0);
} }
@ -908,6 +923,7 @@ void StickersBox::onSave() {
void StickersBox::hideAll() { void StickersBox::hideAll() {
_save.hide(); _save.hide();
_cancel.hide(); _cancel.hide();
_topShadow.hide();
_bottomShadow.hide(); _bottomShadow.hide();
ItemListBox::hideAll(); ItemListBox::hideAll();
} }
@ -915,6 +931,7 @@ void StickersBox::hideAll() {
void StickersBox::showAll() { void StickersBox::showAll() {
_save.show(); _save.show();
_cancel.show(); _cancel.show();
_topShadow.show();
_bottomShadow.show(); _bottomShadow.show();
ItemListBox::showAll(); ItemListBox::showAll();
} }

View File

@ -154,10 +154,11 @@ private:
int32 _rowHeight; int32 _rowHeight;
struct StickerSetRow { struct StickerSetRow {
StickerSetRow(uint64 id, DocumentData *sticker, int32 count, const QString &title, bool disabled, int32 pixw, int32 pixh) : id(id) StickerSetRow(uint64 id, DocumentData *sticker, int32 count, const QString &title, bool official, bool disabled, int32 pixw, int32 pixh) : id(id)
, sticker(sticker) , sticker(sticker)
, count(count) , count(count)
, title(title) , title(title)
, official(official)
, disabled(disabled) , disabled(disabled)
, pixw(pixw) , pixw(pixw)
, pixh(pixh) , pixh(pixh)
@ -167,7 +168,7 @@ private:
DocumentData *sticker; DocumentData *sticker;
int32 count; int32 count;
QString title; QString title;
bool disabled; bool official, disabled;
int32 pixw, pixh; int32 pixw, pixh;
anim::ivalue yadd; anim::ivalue yadd;
}; };
@ -178,9 +179,11 @@ private:
anim::fvalue _aboveShadowFadeOpacity; anim::fvalue _aboveShadowFadeOpacity;
Animation _a_shifting; Animation _a_shifting;
int32 _itemsTop;
bool _saving; bool _saving;
int32 _removeSel, _removeDown, _removeWidth, _returnWidth; int32 _removeSel, _removeDown, _removeWidth, _returnWidth, _restoreWidth;
QPoint _mouse; QPoint _mouse;
int32 _selected; int32 _selected;
@ -232,11 +235,16 @@ private:
BoxButton _save, _cancel; BoxButton _save, _cancel;
QMap<mtpRequestId, NullType> _disenableRequests; QMap<mtpRequestId, NullType> _disenableRequests;
mtpRequestId _reorderRequest; mtpRequestId _reorderRequest;
PlainShadow _topShadow;
ScrollableBoxShadow _bottomShadow; ScrollableBoxShadow _bottomShadow;
QTimer _scrollTimer; QTimer _scrollTimer;
int32 _scrollDelta; int32 _scrollDelta;
int32 _aboutWidth;
Text _about;
int32 _aboutHeight;
}; };
int32 stickerPacksCount(bool includeDisabledOfficial = false); int32 stickerPacksCount(bool includeDisabledOfficial = false);

View File

@ -59,6 +59,8 @@ enum {
MTPDebugBufferSize = 1024 * 1024, // 1 mb start size MTPDebugBufferSize = 1024 * 1024, // 1 mb start size
MaxUsersPerInvite = 100, // max users in one super group invite request
MTPPingDelayDisconnect = 60, // 1 min MTPPingDelayDisconnect = 60, // 1 min
MTPPingSendAfterAuto = 30, // send new ping starting from 30 seconds (add to existing container) MTPPingSendAfterAuto = 30, // send new ping starting from 30 seconds (add to existing container)
MTPPingSendAfter = 45, // send new ping after 45 seconds without ping MTPPingSendAfter = 45, // send new ping after 45 seconds without ping

View File

@ -56,6 +56,7 @@ DialogsInner::DialogsInner(QWidget *parent, MainWidget *main) : SplittedWidget(p
, _searchInPeer(0) , _searchInPeer(0)
, _searchInMigrated(0) , _searchInMigrated(0)
, _menuPeer(0) , _menuPeer(0)
, _menuActionPeer(0)
, _menu(0) { , _menu(0) {
connect(App::wnd(), SIGNAL(imageLoaded()), this, SLOT(update())); connect(App::wnd(), SIGNAL(imageLoaded()), this, SLOT(update()));
connect(main, SIGNAL(peerNameChanged(PeerData*, const PeerData::Names&, const PeerData::NameFirstChars&)), this, SLOT(onPeerNameChanged(PeerData*, const PeerData::Names&, const PeerData::NameFirstChars&))); connect(main, SIGNAL(peerNameChanged(PeerData*, const PeerData::Names&, const PeerData::NameFirstChars&)), this, SLOT(onPeerNameChanged(PeerData*, const PeerData::Names&, const PeerData::NameFirstChars&)));
@ -64,7 +65,7 @@ DialogsInner::DialogsInner(QWidget *parent, MainWidget *main) : SplittedWidget(p
connect(&_addContactLnk, SIGNAL(clicked()), App::wnd(), SLOT(onShowAddContact())); connect(&_addContactLnk, SIGNAL(clicked()), App::wnd(), SLOT(onShowAddContact()));
connect(&_cancelSearchInPeer, SIGNAL(clicked()), this, SIGNAL(cancelSearchInPeer())); connect(&_cancelSearchInPeer, SIGNAL(clicked()), this, SIGNAL(cancelSearchInPeer()));
_cancelSearchInPeer.hide(); _cancelSearchInPeer.hide();
refresh(false); refresh();
} }
int32 DialogsInner::filteredOffset() const { int32 DialogsInner::filteredOffset() const {
@ -608,6 +609,7 @@ void DialogsInner::contextMenuEvent(QContextMenuEvent *e) {
_menuPeer = 0; _menuPeer = 0;
disconnect(App::main(), SIGNAL(peerUpdated(PeerData*)), this, SLOT(peerUpdated(PeerData*))); disconnect(App::main(), SIGNAL(peerUpdated(PeerData*)), this, SLOT(peerUpdated(PeerData*)));
} }
if (e->reason() == QContextMenuEvent::Mouse) { if (e->reason() == QContextMenuEvent::Mouse) {
lastMousePos = e->globalPos(); lastMousePos = e->globalPos();
selByMouse = true; selByMouse = true;
@ -632,8 +634,10 @@ void DialogsInner::contextMenuEvent(QContextMenuEvent *e) {
if (_menuPeer->isUser()) { if (_menuPeer->isUser()) {
_menu->addAction(lang(lng_profile_clear_history), this, SLOT(onContextClearHistory()))->setEnabled(true); _menu->addAction(lang(lng_profile_clear_history), this, SLOT(onContextClearHistory()))->setEnabled(true);
_menu->addAction(lang(lng_profile_delete_conversation), this, SLOT(onContextDeleteAndLeave()))->setEnabled(true); _menu->addAction(lang(lng_profile_delete_conversation), this, SLOT(onContextDeleteAndLeave()))->setEnabled(true);
_menu->addAction(lang((_menuPeer->asUser()->blocked == UserIsBlocked) ? (_menuPeer->asUser()->botInfo ? lng_profile_unblock_bot : lng_profile_unblock_user) : (_menuPeer->asUser()->botInfo ? lng_profile_block_bot : lng_profile_block_user)), this, SLOT(onContextToggleBlock()))->setEnabled(true); if (_menuPeer->asUser()->access != UserNoAccess) {
connect(App::main(), SIGNAL(peerUpdated(PeerData*)), this, SLOT(peerUpdated(PeerData*))); _menu->addAction(lang((_menuPeer->asUser()->blocked == UserIsBlocked) ? (_menuPeer->asUser()->botInfo ? lng_profile_unblock_bot : lng_profile_unblock_user) : (_menuPeer->asUser()->botInfo ? lng_profile_block_bot : lng_profile_block_user)), this, SLOT(onContextToggleBlock()))->setEnabled(true);
connect(App::main(), SIGNAL(peerUpdated(PeerData*)), this, SLOT(peerUpdated(PeerData*)));
}
} else if (_menuPeer->isChat()) { } else if (_menuPeer->isChat()) {
_menu->addAction(lang(lng_profile_clear_history), this, SLOT(onContextClearHistory()))->setEnabled(true); _menu->addAction(lang(lng_profile_clear_history), this, SLOT(onContextClearHistory()))->setEnabled(true);
_menu->addAction(lang(lng_profile_clear_and_exit), this, SLOT(onContextDeleteAndLeave()))->setEnabled(true); _menu->addAction(lang(lng_profile_clear_and_exit), this, SLOT(onContextDeleteAndLeave()))->setEnabled(true);
@ -667,39 +671,42 @@ void DialogsInner::onContextSearch() {
void DialogsInner::onContextClearHistory() { void DialogsInner::onContextClearHistory() {
if (!_menuPeer || _menuPeer->isChannel()) return; if (!_menuPeer || _menuPeer->isChannel()) return;
_menuActionPeer = _menuPeer;
ConfirmBox *box = new ConfirmBox(_menuPeer->isUser() ? lng_sure_delete_history(lt_contact, _menuPeer->name) : lng_sure_delete_group_history(lt_group, _menuPeer->name), lang(lng_box_delete), st::attentionBoxButton); ConfirmBox *box = new ConfirmBox(_menuPeer->isUser() ? lng_sure_delete_history(lt_contact, _menuPeer->name) : lng_sure_delete_group_history(lt_group, _menuPeer->name), lang(lng_box_delete), st::attentionBoxButton);
connect(box, SIGNAL(confirmed()), this, SLOT(onContextClearHistorySure())); connect(box, SIGNAL(confirmed()), this, SLOT(onContextClearHistorySure()));
App::showLayer(box); App::showLayer(box);
} }
void DialogsInner::onContextClearHistorySure() { void DialogsInner::onContextClearHistorySure() {
if (!_menuPeer || _menuPeer->isChannel()) return; if (!_menuActionPeer || _menuActionPeer->isChannel()) return;
App::wnd()->hideLayer(); App::wnd()->hideLayer();
App::main()->clearHistory(_menuPeer); App::main()->clearHistory(_menuActionPeer);
} }
void DialogsInner::onContextDeleteAndLeave() { void DialogsInner::onContextDeleteAndLeave() {
if (!_menuPeer) return; if (!_menuPeer) return;
_menuActionPeer = _menuPeer;
ConfirmBox *box = new ConfirmBox(_menuPeer->isUser() ? lng_sure_delete_history(lt_contact, _menuPeer->name) : (_menuPeer->isChat() ? lng_sure_delete_and_exit(lt_group, _menuPeer->name) : lang(_menuPeer->isMegagroup() ? lng_sure_leave_group : lng_sure_leave_channel)), lang(_menuPeer->isUser() ? lng_box_delete : lng_box_leave), _menuPeer->isChannel() ? st::defaultBoxButton : st::attentionBoxButton); ConfirmBox *box = new ConfirmBox(_menuPeer->isUser() ? lng_sure_delete_history(lt_contact, _menuPeer->name) : (_menuPeer->isChat() ? lng_sure_delete_and_exit(lt_group, _menuPeer->name) : lang(_menuPeer->isMegagroup() ? lng_sure_leave_group : lng_sure_leave_channel)), lang(_menuPeer->isUser() ? lng_box_delete : lng_box_leave), _menuPeer->isChannel() ? st::defaultBoxButton : st::attentionBoxButton);
connect(box, SIGNAL(confirmed()), this, SLOT(onContextDeleteAndLeaveSure())); connect(box, SIGNAL(confirmed()), this, SLOT(onContextDeleteAndLeaveSure()));
App::wnd()->showLayer(box); App::wnd()->showLayer(box);
} }
void DialogsInner::onContextDeleteAndLeaveSure() { void DialogsInner::onContextDeleteAndLeaveSure() {
if (!_menuPeer) return; if (!_menuActionPeer) return;
if (_menuPeer->isUser()) {
App::main()->deleteConversation(_menuPeer); App::wnd()->hideLayer();
} else if (_menuPeer->isChat()) { App::main()->showDialogs();
App::wnd()->hideLayer(); if (_menuActionPeer->isUser()) {
App::main()->showDialogs(); App::main()->deleteConversation(_menuActionPeer);
MTP::send(MTPmessages_DeleteChatUser(_menuPeer->asChat()->inputChat, App::self()->inputUser), App::main()->rpcDone(&MainWidget::deleteHistoryAfterLeave, _menuPeer), App::main()->rpcFail(&MainWidget::leaveChatFailed, _menuPeer)); } else if (_menuActionPeer->isChat()) {
} else if (_menuPeer->isChannel()) { MTP::send(MTPmessages_DeleteChatUser(_menuActionPeer->asChat()->inputChat, App::self()->inputUser), App::main()->rpcDone(&MainWidget::deleteHistoryAfterLeave, _menuActionPeer), App::main()->rpcFail(&MainWidget::leaveChatFailed, _menuActionPeer));
App::wnd()->hideLayer(); } else if (_menuActionPeer->isChannel()) {
App::main()->showDialogs(); if (_menuActionPeer->migrateFrom()) {
if (_menuPeer->migrateFrom()) { App::main()->deleteConversation(_menuActionPeer->migrateFrom());
App::main()->deleteConversation(_menuPeer->migrateFrom());
} }
MTP::send(MTPchannels_LeaveChannel(_menuPeer->asChannel()->inputChannel), App::main()->rpcDone(&MainWidget::sentUpdatesReceived)); MTP::send(MTPchannels_LeaveChannel(_menuActionPeer->asChannel()->inputChannel), App::main()->rpcDone(&MainWidget::sentUpdatesReceived));
} }
} }
@ -919,13 +926,13 @@ void DialogsInner::itemReplaced(HistoryItem *oldItem, HistoryItem *newItem) {
} }
void DialogsInner::updateNotifySettings(PeerData *peer) { void DialogsInner::updateNotifySettings(PeerData *peer) {
if (_menu && _menuPeer == peer) { if (_menu && _menuPeer == peer && _menu->actions().size() > 1) {
_menu->actions().at(1)->setText(lang(menuPeerMuted() ? lng_enable_notifications_from_tray : lng_disable_notifications_from_tray)); _menu->actions().at(1)->setText(lang(menuPeerMuted() ? lng_enable_notifications_from_tray : lng_disable_notifications_from_tray));
} }
} }
void DialogsInner::peerUpdated(PeerData *peer) { void DialogsInner::peerUpdated(PeerData *peer) {
if (_menu && _menuPeer == peer && _menuPeer->isUser()) { if (_menu && _menuPeer == peer && _menuPeer->isUser() && _menu->actions().size() > 5) {
_menu->actions().at(5)->setText(lang((_menuPeer->asUser()->blocked == UserIsBlocked) ? (_menuPeer->asUser()->botInfo ? lng_profile_unblock_bot : lng_profile_unblock_user) : (_menuPeer->asUser()->botInfo ? lng_profile_block_bot : lng_profile_block_user))); _menu->actions().at(5)->setText(lang((_menuPeer->asUser()->blocked == UserIsBlocked) ? (_menuPeer->asUser()->botInfo ? lng_profile_unblock_bot : lng_profile_unblock_user) : (_menuPeer->asUser()->botInfo ? lng_profile_block_bot : lng_profile_block_user)));
} }
} }
@ -1175,7 +1182,6 @@ void DialogsInner::setState(State newState) {
_filteredSel = -1; _filteredSel = -1;
} }
onFilterUpdate(_filter, true); onFilterUpdate(_filter, true);
refresh(true);
} }
DialogsInner::State DialogsInner::state() const { DialogsInner::State DialogsInner::state() const {
@ -1848,7 +1854,9 @@ bool DialogsWidget::animStep_show(float64 ms) {
_scroll.show(); _scroll.show();
_filter.show(); _filter.show();
onFilterUpdate(true); _a_show.stop();
onFilterUpdate();
activate(); activate();
if (App::app()) App::app()->mtpUnpause(); if (App::app()) App::app()->mtpUnpause();

View File

@ -204,7 +204,7 @@ private:
bool _overDelete; bool _overDelete;
PeerData *_searchInPeer, *_searchInMigrated, *_menuPeer; PeerData *_searchInPeer, *_searchInMigrated, *_menuPeer, *_menuActionPeer;
PopupMenu *_menu; PopupMenu *_menu;

View File

@ -4252,7 +4252,7 @@ void HistoryWidget::blockDone(PeerData *peer, const MTPBool &result) {
} }
void HistoryWidget::onBotStart() { void HistoryWidget::onBotStart() {
if (!_peer || !_peer->isUser() || !_peer->asUser()->botInfo) { if (!_peer || !_peer->isUser() || !_peer->asUser()->botInfo || !_canSendMessages) {
updateControlsVisibility(); updateControlsVisibility();
return; return;
} }
@ -4819,7 +4819,7 @@ bool HistoryWidget::hasBroadcastToggle() const {
} }
bool HistoryWidget::isBotStart() const { bool HistoryWidget::isBotStart() const {
if (!_peer || !_peer->isUser() || !_peer->asUser()->botInfo) return false; if (!_peer || !_peer->isUser() || !_peer->asUser()->botInfo || !_canSendMessages) return false;
return !_peer->asUser()->botInfo->startToken.isEmpty() || (_history->isEmpty() && !_history->lastMsg); return !_peer->asUser()->botInfo->startToken.isEmpty() || (_history->isEmpty() && !_history->lastMsg);
} }
@ -5899,7 +5899,7 @@ void HistoryWidget::updateBotKeyboard(History *h) {
if (_keyboard.singleUse() && _keyboard.hasMarkup() && _keyboard.forMsgId() == FullMsgId(_channel, _history->lastKeyboardId) && _history->lastKeyboardUsed) { if (_keyboard.singleUse() && _keyboard.hasMarkup() && _keyboard.forMsgId() == FullMsgId(_channel, _history->lastKeyboardId) && _history->lastKeyboardUsed) {
_history->lastKeyboardHiddenId = _history->lastKeyboardId; _history->lastKeyboardHiddenId = _history->lastKeyboardId;
} }
if (!isBotStart() && !isBlocked() && (wasVisible || _replyTo || (!_field.hasSendText() && !kbWasHidden()))) { if (!isBotStart() && !isBlocked() && _canSendMessages && (wasVisible || _replyTo || (!_field.hasSendText() && !kbWasHidden()))) {
if (!_a_show.animating()) { if (!_a_show.animating()) {
if (hasMarkup) { if (hasMarkup) {
_kbScroll.show(); _kbScroll.show();

View File

@ -2467,7 +2467,7 @@ namespace Local {
TaskId startStickerImageLoad(const StorageKey &location, mtpFileLoader *loader) { TaskId startStickerImageLoad(const StorageKey &location, mtpFileLoader *loader) {
StorageMap::iterator j = _stickerImagesMap.find(location); StorageMap::iterator j = _stickerImagesMap.find(location);
if (j == _stickerImagesMap.cend()) { if (j == _stickerImagesMap.cend() || !_localLoader) {
return 0; return 0;
} }
return _localLoader->addTask(new StickerImageLoadTask(j->first, location, loader)); return _localLoader->addTask(new StickerImageLoadTask(j->first, location, loader));
@ -2526,7 +2526,7 @@ namespace Local {
TaskId startAudioLoad(const StorageKey &location, mtpFileLoader *loader) { TaskId startAudioLoad(const StorageKey &location, mtpFileLoader *loader) {
StorageMap::iterator j = _audiosMap.find(location); StorageMap::iterator j = _audiosMap.find(location);
if (j == _audiosMap.cend()) { if (j == _audiosMap.cend() || !_localLoader) {
return 0; return 0;
} }
return _localLoader->addTask(new AudioLoadTask(j->first, location, loader)); return _localLoader->addTask(new AudioLoadTask(j->first, location, loader));

View File

@ -971,11 +971,17 @@ void MainWidget::addParticipants(PeerData *chatOrChannel, const QVector<UserData
} }
} else if (chatOrChannel->isChannel()) { } else if (chatOrChannel->isChannel()) {
QVector<MTPInputUser> inputUsers; QVector<MTPInputUser> inputUsers;
inputUsers.reserve(users.size()); inputUsers.reserve(qMin(users.size(), int(MaxUsersPerInvite)));
for (QVector<UserData*>::const_iterator i = users.cbegin(), e = users.cend(); i != e; ++i) { for (QVector<UserData*>::const_iterator i = users.cbegin(), e = users.cend(); i != e; ++i) {
inputUsers.push_back((*i)->inputUser); inputUsers.push_back((*i)->inputUser);
if (inputUsers.size() == MaxUsersPerInvite) {
MTP::send(MTPchannels_InviteToChannel(chatOrChannel->asChannel()->inputChannel, MTP_vector<MTPInputUser>(inputUsers)), rpcDone(&MainWidget::inviteToChannelDone, chatOrChannel->asChannel()), rpcFail(&MainWidget::addParticipantsFail, chatOrChannel->asChannel()), 0, 5);
inputUsers.clear();
}
}
if (!inputUsers.isEmpty()) {
MTP::send(MTPchannels_InviteToChannel(chatOrChannel->asChannel()->inputChannel, MTP_vector<MTPInputUser>(inputUsers)), rpcDone(&MainWidget::inviteToChannelDone, chatOrChannel->asChannel()), rpcFail(&MainWidget::addParticipantsFail, chatOrChannel->asChannel()), 0, 5);
} }
MTP::send(MTPchannels_InviteToChannel(chatOrChannel->asChannel()->inputChannel, MTP_vector<MTPInputUser>(inputUsers)), rpcDone(&MainWidget::inviteToChannelDone, chatOrChannel->asChannel()), rpcFail(&MainWidget::addParticipantsFail, chatOrChannel->asChannel()), 0, 5);
} }
} }

View File

@ -1636,7 +1636,7 @@ void ProfileInner::showAll() {
_invitationLink.hide(); _invitationLink.hide();
} }
} }
if (_peerChannel->count < cMaxMegaGroupCount() && _peerChannel->isMegagroup() && (_amCreator || _peerChannel->amEditor())) { if (_peerChannel->count < cMaxMegaGroupCount() && _peerChannel->isMegagroup() && (true || _amCreator || _peerChannel->amEditor())) {
_addParticipant.show(); _addParticipant.show();
} else { } else {
_addParticipant.hide(); _addParticipant.hide();

View File

@ -72,7 +72,12 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
#define WM_NCPOINTERUP 0x0243 #define WM_NCPOINTERUP 0x0243
#endif #endif
const WCHAR AppUserModelId[] = L"Telegram.TelegramDesktop"; const WCHAR AppUserModelIdRelease[] = L"Telegram.TelegramDesktop";
const WCHAR AppUserModelIdBeta[] = L"Telegram.TelegramDesktop.Beta";
const WCHAR *AppUserModelId() {
return cBetaVersion() ? AppUserModelIdBeta : AppUserModelIdRelease;
}
static const PROPERTYKEY pkey_AppUserModel_ID = { { 0x9F4C2855, 0x9F79, 0x4B39, { 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3 } }, 5 }; static const PROPERTYKEY pkey_AppUserModel_ID = { { 0x9F4C2855, 0x9F79, 0x4B39, { 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3 } }, 5 };
static const PROPERTYKEY pkey_AppUserModel_StartPinOption = { { 0x9F4C2855, 0x9F79, 0x4B39, { 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3 } }, 12 }; static const PROPERTYKEY pkey_AppUserModel_StartPinOption = { { 0x9F4C2855, 0x9F79, 0x4B39, { 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3 } }, 12 };
@ -2301,7 +2306,7 @@ void _manageAppLnk(bool create, bool silent, int path_csidl, const wchar_t *args
hr = shellLink.As(&propertyStore); hr = shellLink.As(&propertyStore);
if (SUCCEEDED(hr)) { if (SUCCEEDED(hr)) {
PROPVARIANT appIdPropVar; PROPVARIANT appIdPropVar;
hr = InitPropVariantFromString(AppUserModelId, &appIdPropVar); hr = InitPropVariantFromString(AppUserModelId(), &appIdPropVar);
if (SUCCEEDED(hr)) { if (SUCCEEDED(hr)) {
hr = propertyStore->SetValue(pkey_AppUserModel_ID, appIdPropVar); hr = propertyStore->SetValue(pkey_AppUserModel_ID, appIdPropVar);
PropVariantClear(&appIdPropVar); PropVariantClear(&appIdPropVar);
@ -2921,7 +2926,7 @@ void CheckPinnedAppUserModelId() {
WCHAR already[MAX_PATH]; WCHAR already[MAX_PATH];
hr = propVariantToString(appIdPropVar, already, MAX_PATH); hr = propVariantToString(appIdPropVar, already, MAX_PATH);
if (SUCCEEDED(hr)) { if (SUCCEEDED(hr)) {
if (std::wstring(AppUserModelId) == already) { if (std::wstring(AppUserModelId()) == already) {
LOG(("Already!")); LOG(("Already!"));
PropVariantClear(&appIdPropVar); PropVariantClear(&appIdPropVar);
return; return;
@ -2933,7 +2938,7 @@ void CheckPinnedAppUserModelId() {
} }
PropVariantClear(&appIdPropVar); PropVariantClear(&appIdPropVar);
hr = InitPropVariantFromString(AppUserModelId, &appIdPropVar); hr = InitPropVariantFromString(AppUserModelId(), &appIdPropVar);
if (!SUCCEEDED(hr)) return; if (!SUCCEEDED(hr)) return;
hr = propertyStore->SetValue(pkey_AppUserModel_ID, appIdPropVar); hr = propertyStore->SetValue(pkey_AppUserModel_ID, appIdPropVar);
@ -3028,7 +3033,7 @@ bool ValidateAppUserModelIdShortcutAt(const QString &path) {
WCHAR already[MAX_PATH]; WCHAR already[MAX_PATH];
hr = propVariantToString(appIdPropVar, already, MAX_PATH); hr = propVariantToString(appIdPropVar, already, MAX_PATH);
if (SUCCEEDED(hr)) { if (SUCCEEDED(hr)) {
if (std::wstring(AppUserModelId) == already) { if (std::wstring(AppUserModelId()) == already) {
PropVariantClear(&appIdPropVar); PropVariantClear(&appIdPropVar);
return true; return true;
} }
@ -3039,7 +3044,7 @@ bool ValidateAppUserModelIdShortcutAt(const QString &path) {
} }
PropVariantClear(&appIdPropVar); PropVariantClear(&appIdPropVar);
hr = InitPropVariantFromString(AppUserModelId, &appIdPropVar); hr = InitPropVariantFromString(AppUserModelId(), &appIdPropVar);
if (!SUCCEEDED(hr)) return false; if (!SUCCEEDED(hr)) return false;
hr = propertyStore->SetValue(pkey_AppUserModel_ID, appIdPropVar); hr = propertyStore->SetValue(pkey_AppUserModel_ID, appIdPropVar);
@ -3062,11 +3067,16 @@ bool ValidateAppUserModelIdShortcut() {
QString path = systemShortcutPath(); QString path = systemShortcutPath();
if (path.isEmpty()) return false; if (path.isEmpty()) return false;
if (ValidateAppUserModelIdShortcutAt(path + qsl("Telegram Desktop/Telegram.lnk"))) return true; if (cBetaVersion()) {
if (ValidateAppUserModelIdShortcutAt(path + qsl("Telegram Win (Unofficial)/Telegram.lnk"))) return true; path += qsl("TelegramBeta.lnk");
if (ValidateAppUserModelIdShortcutAt(path)) return true;
path += qsl("Telegram.lnk"); } else {
if (ValidateAppUserModelIdShortcutAt(path)) return true; if (ValidateAppUserModelIdShortcutAt(path + qsl("Telegram Desktop/Telegram.lnk"))) return true;
if (ValidateAppUserModelIdShortcutAt(path + qsl("Telegram Win (Unofficial)/Telegram.lnk"))) return true;
path += qsl("Telegram.lnk");
if (ValidateAppUserModelIdShortcutAt(path)) return true;
}
ComPtr<IShellLink> shellLink; ComPtr<IShellLink> shellLink;
HRESULT hr = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&shellLink)); HRESULT hr = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&shellLink));
@ -3086,7 +3096,7 @@ bool ValidateAppUserModelIdShortcut() {
if (!SUCCEEDED(hr)) return false; if (!SUCCEEDED(hr)) return false;
PROPVARIANT appIdPropVar; PROPVARIANT appIdPropVar;
hr = InitPropVariantFromString(AppUserModelId, &appIdPropVar); hr = InitPropVariantFromString(AppUserModelId(), &appIdPropVar);
if (!SUCCEEDED(hr)) return false; if (!SUCCEEDED(hr)) return false;
hr = propertyStore->SetValue(pkey_AppUserModel_ID, appIdPropVar); hr = propertyStore->SetValue(pkey_AppUserModel_ID, appIdPropVar);
@ -3116,13 +3126,13 @@ bool ValidateAppUserModelIdShortcut() {
bool InitToastManager() { bool InitToastManager() {
if (!useToast || !ValidateAppUserModelIdShortcut()) return false; if (!useToast || !ValidateAppUserModelIdShortcut()) return false;
if (!SUCCEEDED(setCurrentProcessExplicitAppUserModelID(AppUserModelId))) { if (!SUCCEEDED(setCurrentProcessExplicitAppUserModelID(AppUserModelId()))) {
return false; return false;
} }
if (!SUCCEEDED(wrap_GetActivationFactory(StringReferenceWrapper(RuntimeClass_Windows_UI_Notifications_ToastNotificationManager).Get(), &toastNotificationManager))) { if (!SUCCEEDED(wrap_GetActivationFactory(StringReferenceWrapper(RuntimeClass_Windows_UI_Notifications_ToastNotificationManager).Get(), &toastNotificationManager))) {
return false; return false;
} }
if (!SUCCEEDED(toastNotificationManager->CreateToastNotifierWithId(StringReferenceWrapper(AppUserModelId).Get(), &toastNotifier))) { if (!SUCCEEDED(toastNotificationManager->CreateToastNotifierWithId(StringReferenceWrapper(AppUserModelId(), wcslen(AppUserModelId())).Get(), &toastNotifier))) {
return false; return false;
} }
if (!SUCCEEDED(wrap_GetActivationFactory(StringReferenceWrapper(RuntimeClass_Windows_UI_Notifications_ToastNotification).Get(), &toastNotificationFactory))) { if (!SUCCEEDED(wrap_GetActivationFactory(StringReferenceWrapper(RuntimeClass_Windows_UI_Notifications_ToastNotification).Get(), &toastNotificationFactory))) {