Add new calls to Calls log box in realtime.

Also improve button ripple effect in Calls log box.
This commit is contained in:
John Preston 2017-04-28 15:54:40 +03:00
parent c4f90983af
commit 28c0e815b3
4 changed files with 14 additions and 2 deletions

View File

@ -150,6 +150,6 @@ callReDial: IconButton {
iconPosition: point(-1px, -1px);
ripple: defaultRippleAnimation;
rippleAreaPosition: point(4px, 12px);
rippleAreaSize: 32px;
rippleAreaPosition: point(0px, 8px);
rippleAreaSize: 40px;
}

View File

@ -196,6 +196,11 @@ void BoxController::prepare() {
view()->refreshRows();
}
});
subscribe(Current().newServiceMessage(), [this](const FullMsgId &msgId) {
if (auto item = App::histItemById(msgId)) {
insertRow(item, InsertWay::Prepend);
}
});
view()->setTitle(lang(lng_call_box_title));
view()->addButton(lang(lng_close), [this] { view()->closeBox(); });

View File

@ -39,6 +39,10 @@ public:
return _currentCallChanged;
}
base::Observable<FullMsgId> &newServiceMessage() {
return _newServiceMessage;
}
~Instance();
private:
@ -61,6 +65,7 @@ private:
std::unique_ptr<Call> _currentCall;
std::unique_ptr<Panel> _currentCallPanel;
base::Observable<Call*> _currentCallChanged;
base::Observable<FullMsgId> _newServiceMessage;
};

View File

@ -2809,6 +2809,8 @@ HistoryCall::HistoryCall(HistoryItem *parent, const MTPDmessageActionPhoneCall &
_duration = 0;
}
}
Calls::Current().newServiceMessage().notify(_parent->fullId());
}
HistoryCall::FinishReason HistoryCall::GetReason(const MTPDmessageActionPhoneCall &call) {