|
|
@ -160,7 +160,6 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
|
|
|
|
|
|
|
|
function saveAuth (result) { |
|
|
|
function saveAuth (result) { |
|
|
|
MtpApiManager.setUserAuth(options.dcID, { |
|
|
|
MtpApiManager.setUserAuth(options.dcID, { |
|
|
|
expires: result.expires, |
|
|
|
|
|
|
|
id: result.user.id |
|
|
|
id: result.user.id |
|
|
|
}); |
|
|
|
}); |
|
|
|
$timeout.cancel(callTimeout); |
|
|
|
$timeout.cancel(callTimeout); |
|
|
@ -408,9 +407,12 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
|
|
|
|
|
|
|
|
$scope.$on('$routeUpdate', updateCurDialog); |
|
|
|
$scope.$on('$routeUpdate', updateCurDialog); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var pendingParams = false; |
|
|
|
$scope.$on('history_focus', function (e, peerData) { |
|
|
|
$scope.$on('history_focus', function (e, peerData) { |
|
|
|
$modalStack.dismissAll(); |
|
|
|
$modalStack.dismissAll(); |
|
|
|
if (peerData.peerString == $scope.curDialog.peer && peerData.messageID == $scope.curDialog.messageID) { |
|
|
|
if (peerData.peerString == $scope.curDialog.peer && |
|
|
|
|
|
|
|
peerData.messageID == $scope.curDialog.messageID && |
|
|
|
|
|
|
|
!peerData.startParam) { |
|
|
|
$scope.$broadcast(peerData.messageID ? 'ui_history_change_scroll' : 'ui_history_focus'); |
|
|
|
$scope.$broadcast(peerData.messageID ? 'ui_history_change_scroll' : 'ui_history_focus'); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
var peerID = AppPeersManager.getPeerID(peerData.peerString); |
|
|
|
var peerID = AppPeersManager.getPeerID(peerData.peerString); |
|
|
@ -421,7 +423,19 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
peer = '@' + username; |
|
|
|
peer = '@' + username; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
$location.url('/im?p=' + peer + (peerData.messageID ? '&m=' + peerData.messageID : '')); |
|
|
|
if (peerData.messageID || peerData.startParam) { |
|
|
|
|
|
|
|
pendingParams = { |
|
|
|
|
|
|
|
messageID: peerData.messageID, |
|
|
|
|
|
|
|
startParam: peerData.startParam |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
pendingParams = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if ($routeParams.p != peer) { |
|
|
|
|
|
|
|
$location.url('/im?p=' + peer); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
updateCurDialog(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
@ -569,21 +583,24 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
lastSearch = false; |
|
|
|
lastSearch = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
var addParams = pendingParams || {}; |
|
|
|
|
|
|
|
pendingParams = false; |
|
|
|
|
|
|
|
addParams.messageID = parseInt(addParams.messageID) || false; |
|
|
|
|
|
|
|
addParams.startParam = addParams.startParam || false; |
|
|
|
|
|
|
|
|
|
|
|
if ($routeParams.p && $routeParams.p.charAt(0) == '@') { |
|
|
|
if ($routeParams.p && $routeParams.p.charAt(0) == '@') { |
|
|
|
if ($scope.curDialog === undefined) { |
|
|
|
if ($scope.curDialog === undefined) { |
|
|
|
$scope.curDialog = {}; |
|
|
|
$scope.curDialog = {}; |
|
|
|
} |
|
|
|
} |
|
|
|
AppUsersManager.resolveUsername($routeParams.p.substr(1)).then(function (userID) { |
|
|
|
AppUsersManager.resolveUsername($routeParams.p.substr(1)).then(function (userID) { |
|
|
|
$scope.curDialog = { |
|
|
|
$scope.curDialog = angular.extend({ |
|
|
|
peer: AppUsersManager.getUserString(userID), |
|
|
|
peer: AppUsersManager.getUserString(userID) |
|
|
|
messageID: parseInt($routeParams.m) || false |
|
|
|
}, addParams); |
|
|
|
}; |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$scope.curDialog = { |
|
|
|
$scope.curDialog = angular.extend({ |
|
|
|
peer: $routeParams.p || false, |
|
|
|
peer: $routeParams.p || false |
|
|
|
messageID: parseInt($routeParams.m) || false |
|
|
|
}, addParams); |
|
|
|
}; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -639,6 +656,9 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
var topMessages = []; |
|
|
|
var topMessages = []; |
|
|
|
var topToDialogs = {}; |
|
|
|
var topToDialogs = {}; |
|
|
|
angular.forEach(dialogsUpdated, function (dialog, peerID) { |
|
|
|
angular.forEach(dialogsUpdated, function (dialog, peerID) { |
|
|
|
|
|
|
|
if ($scope.noUsers && peerID > 0) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
topToDialogs[dialog.top_message] = dialog; |
|
|
|
topToDialogs[dialog.top_message] = dialog; |
|
|
|
topMessages.push(dialog.top_message); |
|
|
|
topMessages.push(dialog.top_message); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -738,8 +758,7 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
$location.url( |
|
|
|
$location.url( |
|
|
|
'/im' + |
|
|
|
'/im' + |
|
|
|
($scope.curDialog.peer |
|
|
|
($scope.curDialog.peer |
|
|
|
? '?p=' + $scope.curDialog.peer + |
|
|
|
? '?p=' + $scope.curDialog.peer |
|
|
|
($scope.curDialog.messageID ? '&m=' + $scope.curDialog.messageID : '') |
|
|
|
|
|
|
|
: '' |
|
|
|
: '' |
|
|
|
) |
|
|
|
) |
|
|
|
); |
|
|
|
); |
|
|
@ -777,7 +796,11 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
return AppMessagesManager.getSearch({_: 'inputPeerEmpty'}, $scope.search.query, {_: 'inputMessagesFilterEmpty'}, maxID); |
|
|
|
return AppMessagesManager.getSearch({_: 'inputPeerEmpty'}, $scope.search.query, {_: 'inputMessagesFilterEmpty'}, maxID); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
promise = AppMessagesManager.getDialogs($scope.search.query, maxID); |
|
|
|
var query = $scope.search.query; |
|
|
|
|
|
|
|
if ($scope.noUsers) { |
|
|
|
|
|
|
|
query = '%pg ' + (query || ''); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
promise = AppMessagesManager.getDialogs(query, maxID); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return promise.then(function (result) { |
|
|
|
return promise.then(function (result) { |
|
|
@ -862,7 +885,10 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!hasMore && !searchMessages && ($scope.search.query || !$scope.dialogs.length)) { |
|
|
|
if (!hasMore && |
|
|
|
|
|
|
|
!searchMessages && |
|
|
|
|
|
|
|
!$scope.noUsers && |
|
|
|
|
|
|
|
($scope.search.query || !$scope.dialogs.length)) { |
|
|
|
showMoreConversations(); |
|
|
|
showMoreConversations(); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -937,7 +963,7 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
}, 500); |
|
|
|
}, 500); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($scope.search.query) { |
|
|
|
if ($scope.search.query && !$scope.noMessages) { |
|
|
|
searchMessages = true; |
|
|
|
searchMessages = true; |
|
|
|
loadDialogs(); |
|
|
|
loadDialogs(); |
|
|
|
} |
|
|
|
} |
|
|
@ -947,7 +973,7 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
|
|
|
|
|
|
|
|
.controller('AppImHistoryController', function ($scope, $location, $timeout, $rootScope, MtpApiManager, AppUsersManager, AppChatsManager, AppMessagesManager, AppPeersManager, ApiUpdatesManager, PeersSelectService, IdleManager, StatusManager, ErrorService) { |
|
|
|
.controller('AppImHistoryController', function ($scope, $location, $timeout, $rootScope, MtpApiManager, AppUsersManager, AppChatsManager, AppMessagesManager, AppPeersManager, ApiUpdatesManager, PeersSelectService, IdleManager, StatusManager, ErrorService) { |
|
|
|
|
|
|
|
|
|
|
|
$scope.$watch('curDialog', applyDialogSelect); |
|
|
|
$scope.$watchCollection('curDialog', applyDialogSelect); |
|
|
|
|
|
|
|
|
|
|
|
ApiUpdatesManager.attach(); |
|
|
|
ApiUpdatesManager.attach(); |
|
|
|
IdleManager.start(); |
|
|
|
IdleManager.start(); |
|
|
@ -967,6 +993,7 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
$scope.selectedReply = selectedReply; |
|
|
|
$scope.selectedReply = selectedReply; |
|
|
|
$scope.selectedCancel = selectedCancel; |
|
|
|
$scope.selectedCancel = selectedCancel; |
|
|
|
$scope.selectedFlush = selectedFlush; |
|
|
|
$scope.selectedFlush = selectedFlush; |
|
|
|
|
|
|
|
$scope.botStart = botStart; |
|
|
|
|
|
|
|
|
|
|
|
$scope.toggleEdit = toggleEdit; |
|
|
|
$scope.toggleEdit = toggleEdit; |
|
|
|
$scope.toggleMedia = toggleMedia; |
|
|
|
$scope.toggleMedia = toggleMedia; |
|
|
@ -1007,8 +1034,9 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
var newPeer = newDialog.peer || $scope.curDialog.peer || ''; |
|
|
|
var newPeer = newDialog.peer || $scope.curDialog.peer || ''; |
|
|
|
peerID = AppPeersManager.getPeerID(newPeer); |
|
|
|
peerID = AppPeersManager.getPeerID(newPeer); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (peerID == $scope.curDialog.peerID && |
|
|
|
if (peerID == $scope.curDialog.peerID && oldDialog.messageID == newDialog.messageID) { |
|
|
|
oldDialog.messageID == newDialog.messageID && |
|
|
|
|
|
|
|
oldDialog.startParam == newDialog.startParam) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1017,9 +1045,12 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
$scope.curDialog.inputPeer = AppPeersManager.getInputPeer(newPeer); |
|
|
|
$scope.curDialog.inputPeer = AppPeersManager.getInputPeer(newPeer); |
|
|
|
$scope.historyFilter.mediaType = false; |
|
|
|
$scope.historyFilter.mediaType = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
updateStartBot(); |
|
|
|
selectedCancel(true); |
|
|
|
selectedCancel(true); |
|
|
|
|
|
|
|
|
|
|
|
if (oldDialog.peer && oldDialog.peer == newDialog.peer && newDialog.messageID) { |
|
|
|
if (oldDialog.peer && |
|
|
|
|
|
|
|
oldDialog.peer == newDialog.peer && |
|
|
|
|
|
|
|
newDialog.messageID) { |
|
|
|
messageFocusHistory(); |
|
|
|
messageFocusHistory(); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (peerID) { |
|
|
|
else if (peerID) { |
|
|
@ -1108,6 +1139,36 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function updateStartBot () { |
|
|
|
|
|
|
|
var wasStartBot = $scope.historyState.startBot; |
|
|
|
|
|
|
|
if (!peerID || |
|
|
|
|
|
|
|
peerID < 0 || |
|
|
|
|
|
|
|
!AppUsersManager.isBot(peerID) || |
|
|
|
|
|
|
|
$scope.historyFilter.mediaType || |
|
|
|
|
|
|
|
$scope.curDialog.messageID) { |
|
|
|
|
|
|
|
$scope.historyState.startBot = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if ( |
|
|
|
|
|
|
|
$scope.state.empty || ( |
|
|
|
|
|
|
|
peerHistory && |
|
|
|
|
|
|
|
peerHistory.messages.length == 1 && |
|
|
|
|
|
|
|
peerHistory.messages[0].action && |
|
|
|
|
|
|
|
peerHistory.messages[0].action._ == 'messageActionBotIntro' |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
$scope.historyState.startBot = 2; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if ($scope.curDialog.startParam) { |
|
|
|
|
|
|
|
$scope.historyState.startBot = 1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
$scope.historyState.startBot = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (wasStartBot != $scope.historyState.startBot) { |
|
|
|
|
|
|
|
$scope.$broadcast('ui_panel_update'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function messageFocusHistory () { |
|
|
|
function messageFocusHistory () { |
|
|
|
var history = historiesQueueFind(peerID); |
|
|
|
var history = historiesQueueFind(peerID); |
|
|
|
|
|
|
|
|
|
|
@ -1310,6 +1371,8 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
|
|
|
|
|
|
|
|
AppMessagesManager.readHistory($scope.curDialog.inputPeer); |
|
|
|
AppMessagesManager.readHistory($scope.curDialog.inputPeer); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
updateStartBot(); |
|
|
|
|
|
|
|
|
|
|
|
}, function () { |
|
|
|
}, function () { |
|
|
|
safeReplaceObject($scope.state, {error: true}); |
|
|
|
safeReplaceObject($scope.state, {error: true}); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -1325,16 +1388,47 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
$scope.$broadcast('ui_history_change'); |
|
|
|
$scope.$broadcast('ui_history_change'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function botStart () { |
|
|
|
|
|
|
|
AppMessagesManager.startBot(peerID, 0, $scope.curDialog.startParam); |
|
|
|
|
|
|
|
$scope.curDialog.startParam = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function toggleMessage (messageID, $event) { |
|
|
|
function toggleMessage (messageID, $event) { |
|
|
|
var target = $event.target, |
|
|
|
if ($scope.historyState.startBot) { |
|
|
|
shiftClick = $event.shiftKey; |
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (shiftClick) { |
|
|
|
if (!$scope.historyState.selectActions) { |
|
|
|
$scope.$broadcast('ui_selection_clear'); |
|
|
|
var sel = ( |
|
|
|
|
|
|
|
window.getSelection && window.getSelection() || |
|
|
|
|
|
|
|
document.getSelection && document.getSelection() || |
|
|
|
|
|
|
|
document.selection && document.selection.createRange().text || '' |
|
|
|
|
|
|
|
).toString().replace(/^\s+|\s+$/g, ''); |
|
|
|
|
|
|
|
if (sel) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var target = $event.target; |
|
|
|
|
|
|
|
while (target) { |
|
|
|
|
|
|
|
if (target.className.indexOf('im_message_outer_wrap') != -1) { |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (target.tagName == 'A' || |
|
|
|
|
|
|
|
target.onclick || |
|
|
|
|
|
|
|
target.getAttribute('ng-click')) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
var events = $._data(target, 'events'); |
|
|
|
|
|
|
|
if (events && (events.click || events.mousedown)) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
target = target.parentNode; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!$scope.historyState.selectActions && !$(target).hasClass('icon-select-tick') && !$(target).hasClass('im_content_message_select_area')) { |
|
|
|
var shiftClick = $event.shiftKey; |
|
|
|
return false; |
|
|
|
if (shiftClick) { |
|
|
|
|
|
|
|
$scope.$broadcast('ui_selection_clear'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($scope.selectedMsgs[messageID]) { |
|
|
|
if ($scope.selectedMsgs[messageID]) { |
|
|
@ -1382,6 +1476,11 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function selectedCancel (noBroadcast) { |
|
|
|
function selectedCancel (noBroadcast) { |
|
|
|
|
|
|
|
if (!noBroadcast && |
|
|
|
|
|
|
|
$scope.curDialog.startParam) { |
|
|
|
|
|
|
|
delete $scope.curDialog.startParam; |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
$scope.selectedMsgs = {}; |
|
|
|
$scope.selectedMsgs = {}; |
|
|
|
$scope.selectedCount = 0; |
|
|
|
$scope.selectedCount = 0; |
|
|
|
$scope.historyState.selectActions = false; |
|
|
|
$scope.historyState.selectActions = false; |
|
|
@ -1416,7 +1515,6 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function selectedForward () { |
|
|
|
function selectedForward () { |
|
|
|
if ($scope.selectedCount > 0) { |
|
|
|
if ($scope.selectedCount > 0) { |
|
|
|
var selectedMessageIDs = []; |
|
|
|
var selectedMessageIDs = []; |
|
|
@ -1493,6 +1591,16 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
loadAfterSync = false; |
|
|
|
loadAfterSync = false; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.$on('reply_button_press', function (e, button) { |
|
|
|
|
|
|
|
var replyKeyboard = $scope.historyState.replyKeyboard; |
|
|
|
|
|
|
|
if (!replyKeyboard) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
AppMessagesManager.sendText(peerID, button.text, { |
|
|
|
|
|
|
|
replyToMsgID: peerID < 0 && replyKeyboard.id |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var typingTimeouts = {}; |
|
|
|
var typingTimeouts = {}; |
|
|
|
$scope.$on('history_append', function (e, addedMessage) { |
|
|
|
$scope.$on('history_append', function (e, addedMessage) { |
|
|
@ -1552,6 +1660,8 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
AppMessagesManager.readHistory($scope.curDialog.inputPeer); |
|
|
|
AppMessagesManager.readHistory($scope.curDialog.inputPeer); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
updateStartBot(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
@ -1644,6 +1754,8 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
AppMessagesManager.readHistory($scope.curDialog.inputPeer); |
|
|
|
AppMessagesManager.readHistory($scope.curDialog.inputPeer); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
updateStartBot(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
@ -1673,6 +1785,7 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
$scope.$broadcast('messages_regroup'); |
|
|
|
$scope.$broadcast('messages_regroup'); |
|
|
|
if (historyUpdate.peerID == $scope.curDialog.peerID) { |
|
|
|
if (historyUpdate.peerID == $scope.curDialog.peerID) { |
|
|
|
$scope.state.empty = !newMessages.length; |
|
|
|
$scope.state.empty = !newMessages.length; |
|
|
|
|
|
|
|
updateStartBot(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
@ -1683,6 +1796,7 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
history.ids = []; |
|
|
|
history.ids = []; |
|
|
|
if (dialog.peerID == $scope.curDialog.peerID) { |
|
|
|
if (dialog.peerID == $scope.curDialog.peerID) { |
|
|
|
$scope.state.empty = true; |
|
|
|
$scope.state.empty = true; |
|
|
|
|
|
|
|
updateStartBot(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -1737,7 +1851,7 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
$scope.$on('user_update', angular.noop); |
|
|
|
$scope.$on('user_update', angular.noop); |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
.controller('AppImSendController', function ($scope, $timeout, MtpApiManager, Storage, AppChatsManager, AppUsersManager, AppPeersManager, AppDocsManager, AppMessagesManager, MtpApiFileManager) { |
|
|
|
.controller('AppImSendController', function ($scope, $timeout, MtpApiManager, Storage, AppProfileManager, AppChatsManager, AppUsersManager, AppPeersManager, AppDocsManager, AppMessagesManager, MtpApiFileManager, RichTextProcessor) { |
|
|
|
|
|
|
|
|
|
|
|
$scope.$watch('curDialog.peer', resetDraft); |
|
|
|
$scope.$watch('curDialog.peer', resetDraft); |
|
|
|
$scope.$on('user_update', angular.noop); |
|
|
|
$scope.$on('user_update', angular.noop); |
|
|
@ -1746,11 +1860,28 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
}); |
|
|
|
}); |
|
|
|
$scope.$on('ui_typing', onTyping); |
|
|
|
$scope.$on('ui_typing', onTyping); |
|
|
|
|
|
|
|
|
|
|
|
$scope.draftMessage = {text: '', send: sendMessage, replyClear: replyClear}; |
|
|
|
$scope.draftMessage = { |
|
|
|
|
|
|
|
text: '', |
|
|
|
|
|
|
|
send: sendMessage, |
|
|
|
|
|
|
|
replyClear: replyClear |
|
|
|
|
|
|
|
}; |
|
|
|
$scope.mentions = {}; |
|
|
|
$scope.mentions = {}; |
|
|
|
|
|
|
|
$scope.commands = {}; |
|
|
|
$scope.$watch('draftMessage.text', onMessageChange); |
|
|
|
$scope.$watch('draftMessage.text', onMessageChange); |
|
|
|
$scope.$watch('draftMessage.files', onFilesSelected); |
|
|
|
$scope.$watch('draftMessage.files', onFilesSelected); |
|
|
|
$scope.$watch('draftMessage.sticker', onStickerSelected); |
|
|
|
$scope.$watch('draftMessage.sticker', onStickerSelected); |
|
|
|
|
|
|
|
$scope.$watch('draftMessage.command', onCommandSelected); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.$on('history_reply_markup', function (e, peerData) { |
|
|
|
|
|
|
|
if (peerData.peerID == $scope.curDialog.peerID) { |
|
|
|
|
|
|
|
updateReplyKeyboard(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.replyKeyboardToggle = replyKeyboardToggle; |
|
|
|
|
|
|
|
$scope.toggleSlash = toggleSlash; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var replyToMarkup = false; |
|
|
|
|
|
|
|
|
|
|
|
function sendMessage (e) { |
|
|
|
function sendMessage (e) { |
|
|
|
$scope.$broadcast('ui_message_before_send'); |
|
|
|
$scope.$broadcast('ui_message_before_send'); |
|
|
@ -1822,9 +1953,53 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function updateCommands () { |
|
|
|
|
|
|
|
var peerID = $scope.curDialog.peerID; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AppProfileManager.getPeerBots(peerID).then(function (peerBots) { |
|
|
|
|
|
|
|
if (!peerBots.length) { |
|
|
|
|
|
|
|
safeReplaceObject($scope.commands, {}); |
|
|
|
|
|
|
|
$scope.$broadcast('mentions_update'); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var needMentions = peerBots.length > 1; |
|
|
|
|
|
|
|
var commandsList = []; |
|
|
|
|
|
|
|
var commandsIndex = SearchIndexManager.createIndex(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
angular.forEach(peerBots, function (peerBot) { |
|
|
|
|
|
|
|
var mention = ''; |
|
|
|
|
|
|
|
if (needMentions) { |
|
|
|
|
|
|
|
var bot = AppUsersManager.getUser(peerBot.id); |
|
|
|
|
|
|
|
if (bot && bot.username) { |
|
|
|
|
|
|
|
mention += '@' + bot.username; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
var botSearchText = AppUsersManager.getUserSearchText(peerBot.id); |
|
|
|
|
|
|
|
angular.forEach(peerBot.commands, function (description, command) { |
|
|
|
|
|
|
|
var value = '/' + command + mention; |
|
|
|
|
|
|
|
commandsList.push({ |
|
|
|
|
|
|
|
botID: peerBot.id, |
|
|
|
|
|
|
|
value: value, |
|
|
|
|
|
|
|
rDescription: RichTextProcessor.wrapRichText(description, {noLinks: true, noLineBreaks: true}) |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
SearchIndexManager.indexObject(value, botSearchText + ' ' + command + ' ' + description, commandsIndex); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
safeReplaceObject($scope.commands, { |
|
|
|
|
|
|
|
list: commandsList, |
|
|
|
|
|
|
|
index: commandsIndex |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
$scope.$broadcast('mentions_update'); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function resetDraft (newPeer) { |
|
|
|
function resetDraft (newPeer) { |
|
|
|
updateMentions(); |
|
|
|
updateMentions(); |
|
|
|
|
|
|
|
updateCommands(); |
|
|
|
replyClear(); |
|
|
|
replyClear(); |
|
|
|
|
|
|
|
updateReplyKeyboard(); |
|
|
|
|
|
|
|
|
|
|
|
if (newPeer) { |
|
|
|
if (newPeer) { |
|
|
|
Storage.get('draft' + $scope.curDialog.peerID).then(function (draftText) { |
|
|
|
Storage.get('draft' + $scope.curDialog.peerID).then(function (draftText) { |
|
|
@ -1843,13 +2018,67 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
function replySelect(messageID) { |
|
|
|
function replySelect(messageID) { |
|
|
|
$scope.draftMessage.replyToMessage = AppMessagesManager.wrapForDialog(messageID); |
|
|
|
$scope.draftMessage.replyToMessage = AppMessagesManager.wrapForDialog(messageID); |
|
|
|
$scope.$broadcast('ui_peer_reply'); |
|
|
|
$scope.$broadcast('ui_peer_reply'); |
|
|
|
|
|
|
|
replyToMarkup = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function replyClear() { |
|
|
|
function replyClear() { |
|
|
|
|
|
|
|
var message = $scope.draftMessage.replyToMessage; |
|
|
|
|
|
|
|
if (message && |
|
|
|
|
|
|
|
$scope.historyState.replyKeyboard && |
|
|
|
|
|
|
|
$scope.historyState.replyKeyboard.id == message.id && |
|
|
|
|
|
|
|
!$scope.historyState.replyKeyboard.pFlags.hidden) { |
|
|
|
|
|
|
|
$scope.historyState.replyKeyboard.pFlags.hidden = true; |
|
|
|
|
|
|
|
$scope.$broadcast('ui_keyboard_update'); |
|
|
|
|
|
|
|
} |
|
|
|
delete $scope.draftMessage.replyToMessage; |
|
|
|
delete $scope.draftMessage.replyToMessage; |
|
|
|
$scope.$broadcast('ui_peer_reply'); |
|
|
|
$scope.$broadcast('ui_peer_reply'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function toggleSlash ($event) { |
|
|
|
|
|
|
|
if ($scope.draftMessage.text && |
|
|
|
|
|
|
|
$scope.draftMessage.text.charAt(0) == '/') { |
|
|
|
|
|
|
|
$scope.draftMessage.text = ''; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
$scope.draftMessage.text = '/'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$scope.$broadcast('ui_peer_draft'); |
|
|
|
|
|
|
|
return cancelEvent($event); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function updateReplyKeyboard () { |
|
|
|
|
|
|
|
var peerID = $scope.curDialog.peerID; |
|
|
|
|
|
|
|
var replyKeyboard = AppMessagesManager.getReplyKeyboard(peerID); |
|
|
|
|
|
|
|
if (replyKeyboard) { |
|
|
|
|
|
|
|
replyKeyboard = AppMessagesManager.wrapReplyMarkup(replyKeyboard); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// console.log('update reply markup', peerID, replyKeyboard);
|
|
|
|
|
|
|
|
$scope.historyState.replyKeyboard = replyKeyboard; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var addReplyMessage = |
|
|
|
|
|
|
|
replyKeyboard && |
|
|
|
|
|
|
|
!replyKeyboard.hidden && |
|
|
|
|
|
|
|
(replyKeyboard._ == 'replyKeyboardForceReply' || |
|
|
|
|
|
|
|
(replyKeyboard._ == 'replyKeyboardMarkup' && peerID < 0)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (addReplyMessage) { |
|
|
|
|
|
|
|
replySelect(replyKeyboard.id); |
|
|
|
|
|
|
|
replyToMarkup = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (replyToMarkup) { |
|
|
|
|
|
|
|
replyClear(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$scope.$broadcast('ui_keyboard_update'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function replyKeyboardToggle ($event) { |
|
|
|
|
|
|
|
var replyKeyboard = $scope.historyState.replyKeyboard; |
|
|
|
|
|
|
|
if (replyKeyboard) { |
|
|
|
|
|
|
|
replyKeyboard.pFlags.hidden = !replyKeyboard.pFlags.hidden; |
|
|
|
|
|
|
|
updateReplyKeyboard(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return cancelEvent($event); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function onMessageChange(newVal) { |
|
|
|
function onMessageChange(newVal) { |
|
|
|
// console.log('ctrl text changed', newVal);
|
|
|
|
// console.log('ctrl text changed', newVal);
|
|
|
|
// console.trace('ctrl text changed', newVal);
|
|
|
|
// console.trace('ctrl text changed', newVal);
|
|
|
@ -1916,6 +2145,17 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
} |
|
|
|
} |
|
|
|
delete $scope.draftMessage.sticker; |
|
|
|
delete $scope.draftMessage.sticker; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function onCommandSelected (command) { |
|
|
|
|
|
|
|
if (!command) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
AppMessagesManager.sendText($scope.curDialog.peerID, command); |
|
|
|
|
|
|
|
delete $scope.draftMessage.sticker; |
|
|
|
|
|
|
|
delete $scope.draftMessage.text; |
|
|
|
|
|
|
|
$scope.$broadcast('ui_message_send'); |
|
|
|
|
|
|
|
$scope.$broadcast('ui_peer_draft'); |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
.controller('AppLangSelectController', function ($scope, _, Storage, ErrorService, AppRuntimeManager) { |
|
|
|
.controller('AppLangSelectController', function ($scope, _, Storage, ErrorService, AppRuntimeManager) { |
|
|
@ -2156,8 +2396,7 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
$scope.nav = {}; |
|
|
|
$scope.nav = {}; |
|
|
|
$scope.canForward = true; |
|
|
|
$scope.canForward = true; |
|
|
|
|
|
|
|
|
|
|
|
var inputUser = AppUsersManager.getUserInput($scope.userID), |
|
|
|
var list = [$scope.photoID], |
|
|
|
list = [$scope.photoID], |
|
|
|
|
|
|
|
maxID = $scope.photoID, |
|
|
|
maxID = $scope.photoID, |
|
|
|
preloaded = {}, |
|
|
|
preloaded = {}, |
|
|
|
myID = 0, |
|
|
|
myID = 0, |
|
|
@ -2165,7 +2404,7 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
|
|
|
|
|
|
|
|
updatePrevNext(); |
|
|
|
updatePrevNext(); |
|
|
|
|
|
|
|
|
|
|
|
AppPhotosManager.getUserPhotos(inputUser, 0, 1000).then(function (userpicCachedResult) { |
|
|
|
AppPhotosManager.getUserPhotos($scope.userID, 0, 1000).then(function (userpicCachedResult) { |
|
|
|
if (userpicCachedResult.photos.indexOf($scope.photoID) >= 0) { |
|
|
|
if (userpicCachedResult.photos.indexOf($scope.photoID) >= 0) { |
|
|
|
list = userpicCachedResult.photos; |
|
|
|
list = userpicCachedResult.photos; |
|
|
|
maxID = list[list.length - 1]; |
|
|
|
maxID = list[list.length - 1]; |
|
|
@ -2234,7 +2473,7 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
function loadMore () { |
|
|
|
function loadMore () { |
|
|
|
if (loadingPromise) return loadingPromise; |
|
|
|
if (loadingPromise) return loadingPromise; |
|
|
|
|
|
|
|
|
|
|
|
return loadingPromise = AppPhotosManager.getUserPhotos(inputUser, maxID).then(function (userpicResult) { |
|
|
|
return loadingPromise = AppPhotosManager.getUserPhotos($scope.userID, maxID).then(function (userpicResult) { |
|
|
|
if (userpicResult.photos.length) { |
|
|
|
if (userpicResult.photos.length) { |
|
|
|
maxID = userpicResult.photos[userpicResult.photos.length - 1]; |
|
|
|
maxID = userpicResult.photos[userpicResult.photos.length - 1]; |
|
|
|
list = list.concat(userpicResult.photos); |
|
|
|
list = list.concat(userpicResult.photos); |
|
|
@ -2503,7 +2742,7 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
.controller('UserModalController', function ($scope, $location, $rootScope, $modal, AppUsersManager, MtpApiManager, NotificationsManager, AppPhotosManager, AppMessagesManager, AppPeersManager, PeersSelectService, ErrorService) { |
|
|
|
.controller('UserModalController', function ($scope, $location, $rootScope, AppProfileManager, $modal, AppUsersManager, MtpApiManager, NotificationsManager, AppPhotosManager, AppMessagesManager, AppPeersManager, PeersSelectService, ErrorService) { |
|
|
|
|
|
|
|
|
|
|
|
var peerString = AppUsersManager.getUserString($scope.userID); |
|
|
|
var peerString = AppUsersManager.getUserString($scope.userID); |
|
|
|
|
|
|
|
|
|
|
@ -2513,23 +2752,10 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
|
|
|
|
|
|
|
|
$scope.settings = {notifications: true}; |
|
|
|
$scope.settings = {notifications: true}; |
|
|
|
|
|
|
|
|
|
|
|
MtpApiManager.invokeApi('users.getFullUser', { |
|
|
|
AppProfileManager.getProfile($scope.userID, $scope.override).then(function (userFull) { |
|
|
|
id: AppUsersManager.getUserInput($scope.userID) |
|
|
|
$scope.blocked = userFull.blocked; |
|
|
|
}).then(function (userFullResult) { |
|
|
|
$scope.bot_info = userFull.bot_info; |
|
|
|
if ($scope.override && $scope.override.phone_number) { |
|
|
|
|
|
|
|
userFullResult.user.phone = $scope.override.phone_number; |
|
|
|
|
|
|
|
if ($scope.override.first_name || $scope.override.last_name) { |
|
|
|
|
|
|
|
userFullResult.user.first_name = $scope.override.first_name; |
|
|
|
|
|
|
|
userFullResult.user.last_name = $scope.override.last_name; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
AppUsersManager.saveApiUser(userFullResult.user); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
AppUsersManager.saveApiUser(userFullResult.user, true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
AppPhotosManager.savePhoto(userFullResult.profile_photo); |
|
|
|
|
|
|
|
$scope.blocked = userFullResult.blocked; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NotificationsManager.savePeerSettings($scope.userID, userFullResult.notify_settings); |
|
|
|
|
|
|
|
NotificationsManager.getPeerMuted($scope.userID).then(function (muted) { |
|
|
|
NotificationsManager.getPeerMuted($scope.userID).then(function (muted) { |
|
|
|
$scope.settings.notifications = !muted; |
|
|
|
$scope.settings.notifications = !muted; |
|
|
|
|
|
|
|
|
|
|
@ -2538,11 +2764,7 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
NotificationsManager.getPeerSettings($scope.userID).then(function (settings) { |
|
|
|
NotificationsManager.getPeerSettings($scope.userID).then(function (settings) { |
|
|
|
if (newValue) { |
|
|
|
settings.mute_until = newValue ? 0 : 2000000000; |
|
|
|
settings.mute_until = 0; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
settings.mute_until = 2000000000; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
NotificationsManager.updatePeerSettings($scope.userID, settings); |
|
|
|
NotificationsManager.updatePeerSettings($scope.userID, settings); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -2588,6 +2810,26 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.inviteToGroup = function () { |
|
|
|
|
|
|
|
PeersSelectService.selectPeer({ |
|
|
|
|
|
|
|
confirm_type: 'INVITE_TO_GROUP', |
|
|
|
|
|
|
|
noUsers: true |
|
|
|
|
|
|
|
}).then(function (peerString) { |
|
|
|
|
|
|
|
var peerID = AppPeersManager.getPeerID(peerString); |
|
|
|
|
|
|
|
var chatID = peerID < 0 ? -peerID : 0; |
|
|
|
|
|
|
|
AppMessagesManager.startBot($scope.user.id, chatID).then(function () { |
|
|
|
|
|
|
|
$rootScope.$broadcast('history_focus', {peerString: peerString}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.sendCommand = function (command) { |
|
|
|
|
|
|
|
AppMessagesManager.sendText($scope.userID, '/' + command); |
|
|
|
|
|
|
|
$rootScope.$broadcast('history_focus', { |
|
|
|
|
|
|
|
peerString: peerString |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
$scope.toggleBlock = function (block) { |
|
|
|
$scope.toggleBlock = function (block) { |
|
|
|
MtpApiManager.invokeApi(block ? 'contacts.block' : 'contacts.unblock', { |
|
|
|
MtpApiManager.invokeApi(block ? 'contacts.block' : 'contacts.unblock', { |
|
|
|
id: AppUsersManager.getUserInput($scope.userID) |
|
|
|
id: AppUsersManager.getUserInput($scope.userID) |
|
|
@ -2690,11 +2932,9 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
$scope.kickFromGroup = function (userID) { |
|
|
|
$scope.kickFromGroup = function (userID) { |
|
|
|
var user = AppUsersManager.getUser(userID); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MtpApiManager.invokeApi('messages.deleteChatUser', { |
|
|
|
MtpApiManager.invokeApi('messages.deleteChatUser', { |
|
|
|
chat_id: $scope.chatID, |
|
|
|
chat_id: $scope.chatID, |
|
|
|
user_id: {_: 'inputUserForeign', user_id: userID, access_hash: user.access_hash || '0'} |
|
|
|
user_id: AppUsersManager.getUserInput(userID) |
|
|
|
}).then(onChatUpdated); |
|
|
|
}).then(onChatUpdated); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -2783,7 +3023,9 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
id: {_: 'inputUserSelf'} |
|
|
|
id: {_: 'inputUserSelf'} |
|
|
|
}).then(function (userFullResult) { |
|
|
|
}).then(function (userFullResult) { |
|
|
|
AppUsersManager.saveApiUser(userFullResult.user); |
|
|
|
AppUsersManager.saveApiUser(userFullResult.user); |
|
|
|
AppPhotosManager.savePhoto(userFullResult.profile_photo); |
|
|
|
AppPhotosManager.savePhoto(userFullResult.profile_photo, { |
|
|
|
|
|
|
|
user_id: userFullResult.user.id |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$scope.notify = {volume: 0.5}; |
|
|
|
$scope.notify = {volume: 0.5}; |
|
|
@ -2854,8 +3096,10 @@ angular.module('myApp.controllers', ['myApp.i18n']) |
|
|
|
crop: {_: 'inputPhotoCropAuto'} |
|
|
|
crop: {_: 'inputPhotoCropAuto'} |
|
|
|
}).then(function (updateResult) { |
|
|
|
}).then(function (updateResult) { |
|
|
|
AppUsersManager.saveApiUsers(updateResult.users); |
|
|
|
AppUsersManager.saveApiUsers(updateResult.users); |
|
|
|
AppPhotosManager.savePhoto(updateResult.photo); |
|
|
|
|
|
|
|
MtpApiManager.getUserID().then(function (id) { |
|
|
|
MtpApiManager.getUserID().then(function (id) { |
|
|
|
|
|
|
|
AppPhotosManager.savePhoto(updateResult.photo, { |
|
|
|
|
|
|
|
user_id: id |
|
|
|
|
|
|
|
}); |
|
|
|
ApiUpdatesManager.processUpdateMessage({ |
|
|
|
ApiUpdatesManager.processUpdateMessage({ |
|
|
|
_: 'updateShort', |
|
|
|
_: 'updateShort', |
|
|
|
update: { |
|
|
|
update: { |
|
|
|