Media filter draft, delete message support
This commit is contained in:
parent
27edee4007
commit
7d86f7a363
@ -694,20 +694,59 @@ a.im_dialog:hover .im_dialog_date {
|
|||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
.im_history_panel_info_link,
|
.im_history_panel_info_link,
|
||||||
.im_history_panel_edit_link {
|
.im_history_panel_edit_link,
|
||||||
color: #3a6d99;
|
.im_history_panel_return_link,
|
||||||
|
.im_history_panel_media_dropdown .dropdown-toggle {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
}
|
}
|
||||||
.im_history_panel_info_link:hover,
|
.im_history_panel_media_dropdown {
|
||||||
.im_history_panel_edit_link:hover {
|
padding-top: 3px;
|
||||||
text-decoration: underline;
|
}
|
||||||
|
.im_history_panel_edit_link,
|
||||||
|
.im_history_panel_return_link,
|
||||||
|
.im_history_panel_media_dropdown {
|
||||||
|
font-size: 13px;
|
||||||
|
margin-right: 20px;
|
||||||
|
}
|
||||||
|
.im_history_panel_return_count {
|
||||||
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.im_history_panel_edit_link {
|
.im_history_panel_media_dropdown .dropdown-menu > li > a {
|
||||||
margin-right: 10px;
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-caret {
|
||||||
|
width: 8px;
|
||||||
|
height: 4px;
|
||||||
|
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: text-top;
|
||||||
|
margin-top: 7px;
|
||||||
|
margin-left: 6px;
|
||||||
|
|
||||||
|
background: url(../img/icons/IconsetW.png?1) -17px -444px no-repeat;
|
||||||
|
background-size: 42px 460px;
|
||||||
|
}
|
||||||
|
.is_1x .icon-caret {
|
||||||
|
background-image: url(../img/icons/IconsetW_1x.png?2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.im_history_panel_media_dropdown .dropdown-menu {
|
||||||
|
border-radius: 2px;
|
||||||
|
right: auto;
|
||||||
|
left: -15px;
|
||||||
|
margin-top: 13px;
|
||||||
|
padding: 0;
|
||||||
|
|
||||||
|
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.175);
|
||||||
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.175);
|
||||||
|
}
|
||||||
|
.dropdown-menu > li > a {
|
||||||
|
padding: 3px 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -308,15 +308,20 @@ angular.module('myApp.controllers', [])
|
|||||||
StatusManager.start();
|
StatusManager.start();
|
||||||
|
|
||||||
$scope.history = [];
|
$scope.history = [];
|
||||||
|
$scope.mediaType = false;
|
||||||
$scope.selectedMsgs = {};
|
$scope.selectedMsgs = {};
|
||||||
$scope.selectedCount = 0;
|
$scope.selectedCount = 0;
|
||||||
$scope.selectActions = false;
|
$scope.selectActions = false;
|
||||||
|
$scope.missedCount = 0;
|
||||||
|
$scope.typing = {};
|
||||||
|
$scope.state = {};
|
||||||
|
|
||||||
$scope.toggleMessage = toggleMessage;
|
$scope.toggleMessage = toggleMessage;
|
||||||
$scope.selectedDelete = selectedDelete;
|
$scope.selectedDelete = selectedDelete;
|
||||||
$scope.selectedCancel = selectedCancel;
|
$scope.selectedCancel = selectedCancel;
|
||||||
$scope.toggleEdit = toggleEdit;
|
$scope.toggleEdit = toggleEdit;
|
||||||
$scope.typing = {};
|
$scope.toggleMedia = toggleMedia;
|
||||||
$scope.state = {};
|
$scope.showPeerInfo = showPeerInfo;
|
||||||
|
|
||||||
var peerID,
|
var peerID,
|
||||||
offset = 0,
|
offset = 0,
|
||||||
@ -333,10 +338,11 @@ angular.module('myApp.controllers', [])
|
|||||||
|
|
||||||
$scope.curDialog.peerID = peerID;
|
$scope.curDialog.peerID = peerID;
|
||||||
$scope.curDialog.inputPeer = AppPeersManager.getInputPeer(newPeer);
|
$scope.curDialog.inputPeer = AppPeersManager.getInputPeer(newPeer);
|
||||||
|
$scope.mediaType = false;
|
||||||
|
|
||||||
if (peerID) {
|
if (peerID) {
|
||||||
updateHistoryPeer(true);
|
updateHistoryPeer(true);
|
||||||
loadHistory(peerID);
|
loadHistory();
|
||||||
} else {
|
} else {
|
||||||
showEmptyHistory();
|
showEmptyHistory();
|
||||||
}
|
}
|
||||||
@ -374,7 +380,15 @@ angular.module('myApp.controllers', [])
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// console.trace('load history');
|
// console.trace('load history');
|
||||||
AppMessagesManager.getHistory($scope.curDialog.inputPeer, maxID, limit).then(function (historyResult) {
|
|
||||||
|
var inputMediaFilter = $scope.mediaType && {_: $scope.mediaType == 'photos' ? 'inputMessagesFilterPhotoVideo' : 'inputMessagesFilterDocument'},
|
||||||
|
getMessagesPromise = inputMediaFilter
|
||||||
|
? AppMessagesManager.getSearch($scope.curDialog.inputPeer, '', inputMediaFilter, maxID, startLimit)
|
||||||
|
: AppMessagesManager.getHistory($scope.curDialog.inputPeer, maxID, startLimit);
|
||||||
|
|
||||||
|
getMessagesPromise.then(function (historyResult) {
|
||||||
|
console.log('got', maxID, historyResult);
|
||||||
|
|
||||||
offset += limit;
|
offset += limit;
|
||||||
hasMore = offset < historyResult.count;
|
hasMore = offset < historyResult.count;
|
||||||
maxID = historyResult.history[historyResult.history.length - 1];
|
maxID = historyResult.history[historyResult.history.length - 1];
|
||||||
@ -394,9 +408,14 @@ angular.module('myApp.controllers', [])
|
|||||||
offset = 0;
|
offset = 0;
|
||||||
maxID = 0;
|
maxID = 0;
|
||||||
|
|
||||||
var curJump = ++jump;
|
var curJump = ++jump,
|
||||||
|
inputMediaFilter = $scope.mediaType && {_: $scope.mediaType == 'photos' ? 'inputMessagesFilterPhotoVideo' : 'inputMessagesFilterDocument'},
|
||||||
|
getMessagesPromise = inputMediaFilter
|
||||||
|
? AppMessagesManager.getSearch($scope.curDialog.inputPeer, '', inputMediaFilter, maxID, startLimit)
|
||||||
|
: AppMessagesManager.getHistory($scope.curDialog.inputPeer, $scope.mediaType, maxID, startLimit);
|
||||||
|
|
||||||
AppMessagesManager.getHistory($scope.curDialog.inputPeer, maxID, startLimit).then(function (historyResult) {
|
getMessagesPromise.then(function (historyResult) {
|
||||||
|
console.log('got', historyResult);
|
||||||
if (curJump != jump) return;
|
if (curJump != jump) return;
|
||||||
|
|
||||||
offset += startLimit;
|
offset += startLimit;
|
||||||
@ -476,6 +495,22 @@ angular.module('myApp.controllers', [])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggleMedia (mediaType) {
|
||||||
|
if (mediaType) {
|
||||||
|
$scope.missedCount = 0;
|
||||||
|
}
|
||||||
|
$scope.mediaType = mediaType || false;
|
||||||
|
loadHistory();
|
||||||
|
}
|
||||||
|
|
||||||
|
function showPeerInfo () {
|
||||||
|
if ($scope.curDialog.peerID > 0) {
|
||||||
|
$rootScope.openUser($scope.curDialog.peerID)
|
||||||
|
} else if ($scope.curDialog.peerID < 0) {
|
||||||
|
$rootScope.openChat(-$scope.curDialog.peerID)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var typingTimeouts = {};
|
var typingTimeouts = {};
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
@ -222,6 +222,7 @@ inputMessagesFilterEmpty#57e2f66c = MessagesFilter;
|
|||||||
inputMessagesFilterPhotos#9609a51c = MessagesFilter;
|
inputMessagesFilterPhotos#9609a51c = MessagesFilter;
|
||||||
inputMessagesFilterVideo#9fc00e65 = MessagesFilter;
|
inputMessagesFilterVideo#9fc00e65 = MessagesFilter;
|
||||||
inputMessagesFilterPhotoVideo#56e9f0e4 = MessagesFilter;
|
inputMessagesFilterPhotoVideo#56e9f0e4 = MessagesFilter;
|
||||||
|
inputMessagesFilterDocument#9eddf188 = MessagesFilter;
|
||||||
|
|
||||||
updateNewMessage#13abdb3 message:Message pts:int = Update;
|
updateNewMessage#13abdb3 message:Message pts:int = Update;
|
||||||
updateMessageID#4e90bfd6 id:int random_id:long = Update;
|
updateMessageID#4e90bfd6 id:int random_id:long = Update;
|
||||||
|
@ -746,6 +746,36 @@ angular.module('myApp.services', [])
|
|||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getSearch (inputPeer, query, inputFilter, maxID, limit) {
|
||||||
|
return MtpApiManager.invokeApi('messages.search', {
|
||||||
|
peer: inputPeer,
|
||||||
|
q: query || '',
|
||||||
|
filter: inputFilter || {_: 'inputMessagesFilterEmpty'},
|
||||||
|
min_date: 0,
|
||||||
|
max_date: 0,
|
||||||
|
limit: limit,
|
||||||
|
max_id: maxID || 0
|
||||||
|
}).then(function (searchResult) {
|
||||||
|
AppUsersManager.saveApiUsers(searchResult.users);
|
||||||
|
AppChatsManager.saveApiChats(searchResult.chats);
|
||||||
|
saveMessages(searchResult.messages);
|
||||||
|
|
||||||
|
var foundCount = searchResult._ == 'messages.messagesSlice'
|
||||||
|
? searchResult.count
|
||||||
|
: searchResult.messages.length;
|
||||||
|
|
||||||
|
var foundMsgs = [];
|
||||||
|
angular.forEach(searchResult.messages, function (message) {
|
||||||
|
foundMsgs.push(message.id);
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
count: foundCount,
|
||||||
|
history: foundMsgs
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function deleteMessages (messageIDs) {
|
function deleteMessages (messageIDs) {
|
||||||
return MtpApiManager.invokeApi('messages.deleteMessages', {
|
return MtpApiManager.invokeApi('messages.deleteMessages', {
|
||||||
id: messageIDs
|
id: messageIDs
|
||||||
@ -1486,6 +1516,7 @@ angular.module('myApp.services', [])
|
|||||||
return {
|
return {
|
||||||
getDialogs: getDialogs,
|
getDialogs: getDialogs,
|
||||||
getHistory: getHistory,
|
getHistory: getHistory,
|
||||||
|
getSearch: getSearch,
|
||||||
readHistory: readHistory,
|
readHistory: readHistory,
|
||||||
flushHistory: flushHistory,
|
flushHistory: flushHistory,
|
||||||
deleteMessages: deleteMessages,
|
deleteMessages: deleteMessages,
|
||||||
|
@ -31,10 +31,31 @@
|
|||||||
<div class="im_history_panel clearfix" ng-controller="AppImPanelController">
|
<div class="im_history_panel clearfix" ng-controller="AppImPanelController">
|
||||||
<div class="im_history_panel_title">
|
<div class="im_history_panel_title">
|
||||||
|
|
||||||
<div ng-if="historyPeer.id < 0">
|
<a class="im_history_panel_info_link pull-right" ng-click="showPeerInfo()">Info</a>
|
||||||
<span class="im_history_panel_info_link pull-right">Info</span>
|
<a class="im_history_panel_edit_link pull-right" ng-click="toggleEdit()">Edit</a>
|
||||||
<span class="im_history_panel_edit_link pull-right" ng-click="toggleEdit()">Edit</span>
|
|
||||||
<h4 ng-click="openChat(-historyPeer.id)">
|
<div class="dropdown im_history_panel_media_dropdown pull-right">
|
||||||
|
<a class="dropdown-toggle">Media<i class="icon icon-caret"></i></a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li>
|
||||||
|
<a ng-click="toggleMedia('photos')">Photos & Videos</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a ng-click="toggleMedia('documents')">Documents</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<a ng-if="mediaType !== false" class="im_history_panel_return_link pull-right" ng-click="toggleMedia()">
|
||||||
|
Show all messages
|
||||||
|
<strong class="im_history_panel_return_count" ng-show="missedCount > 0">+{{missedCount}}</strong>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<h4 ng-if="mediaType !== false" ng-switch="mediaType">
|
||||||
|
<span ng-switch-when="photos"> Photos & Videos </span>
|
||||||
|
<span ng-switch-when="documents"> Documents </span>
|
||||||
|
</h4>
|
||||||
|
|
||||||
|
<h4 ng-if="mediaType === false && historyPeer.id < 0" ng-click="showPeerInfo()">
|
||||||
<span ng-bind-html="historyPeer.data.rTitle"></span>
|
<span ng-bind-html="historyPeer.data.rTitle"></span>
|
||||||
<small class="im_chat_users">
|
<small class="im_chat_users">
|
||||||
<ng-pluralize count="historyPeer.data.participants_count"
|
<ng-pluralize count="historyPeer.data.participants_count"
|
||||||
@ -42,27 +63,22 @@
|
|||||||
</ng-pluralize>
|
</ng-pluralize>
|
||||||
</small>
|
</small>
|
||||||
</h4>
|
</h4>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div ng-if="historyPeer.id > 0">
|
<h4 ng-if="mediaType === false && historyPeer.id > 0" ng-click="showPeerInfo()">
|
||||||
<span class="im_history_panel_info_link pull-right">Info</span>
|
|
||||||
<span class="im_history_panel_edit_link pull-right" ng-click="toggleEdit()">Edit</span>
|
|
||||||
<h4 ng-click="openUser(historyPeer.id)">
|
|
||||||
<span ng-bind-html="historyPeer.data.rFullName"></span>
|
<span ng-bind-html="historyPeer.data.rFullName"></span>
|
||||||
<small class="im_peer_online">{{historyPeer.data | userStatus}}</small>
|
<small class="im_peer_online">{{historyPeer.data | userStatus}}</small>
|
||||||
</h4>
|
</h4>
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="im_edit_panel_wrap clearfix" ng-if="selectActions">
|
<div class="im_edit_panel_wrap clearfix" ng-show="selectActions">
|
||||||
<a class="im_edit_delete_link" ng-click="selectedDelete()"><i class="icon icon-delete"></i></a>
|
<a class="im_edit_delete_link" ng-click="selectedDelete()"><i class="icon icon-delete"></i></a>
|
||||||
<a class="im_edit_cancel_link" ng-click="selectedCancel()">Cancel</a>
|
<a class="im_edit_cancel_link" ng-click="selectedCancel()">Cancel</a>
|
||||||
<h4 class="im_edit_panel_title">
|
<h4 class="im_edit_panel_title">
|
||||||
<ng-pluralize count="selectedCount"
|
<ng-pluralize count="selectedCount"
|
||||||
when="{'0': 'No messages', 'one': '1 message', 'other': '{} messages'}">
|
when="{'0': 'Select messages', 'one': '1 message', 'other': '{} messages'}">
|
||||||
</ng-pluralize>
|
</ng-pluralize>
|
||||||
</h4>
|
</h4>
|
||||||
</div>
|
</div>
|
||||||
@ -97,20 +113,13 @@
|
|||||||
<div class="im_send_form_wrap1">
|
<div class="im_send_form_wrap1">
|
||||||
|
|
||||||
<div class="im_send_form_wrap clearfix" ng-controller="AppImSendController">
|
<div class="im_send_form_wrap clearfix" ng-controller="AppImSendController">
|
||||||
<div class="pull-right im_panel_peer_photo" ng-click="openUser(historyPeer.id)" ng-if="historyPeer.id > 0">
|
<div class="pull-right im_panel_peer_photo" ng-click="showPeerInfo()">
|
||||||
<img
|
|
||||||
class="im_panel_peer_photo"
|
|
||||||
my-load-thumb
|
|
||||||
thumb="historyPeer.photo"
|
|
||||||
/>
|
|
||||||
<i class="icon im_panel_peer_online" ng-show="historyPeer.data.status._ == 'userStatusOnline'"></i>
|
|
||||||
</div>
|
|
||||||
<div class="pull-right im_panel_peer_photo" ng-click="openChat(-historyPeer.id)" ng-if="historyPeer.id < 0">
|
|
||||||
<img
|
<img
|
||||||
class="im_panel_peer_photo"
|
class="im_panel_peer_photo"
|
||||||
my-load-thumb
|
my-load-thumb
|
||||||
thumb="historyPeer.photo"
|
thumb="historyPeer.photo"
|
||||||
/>
|
/>
|
||||||
|
<i class="icon im_panel_peer_online" ng-show="historyPeer.id > 0 && historyPeer.data.status._ == 'userStatusOnline'"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="pull-left im_panel_own_photo">
|
<div class="pull-left im_panel_own_photo">
|
||||||
<img
|
<img
|
||||||
|
Loading…
Reference in New Issue
Block a user