Clear draft after sending inline result

Closes #1183
This commit is contained in:
Igor Zhukov 2016-07-06 18:39:55 +03:00
parent 3b5fe8e73b
commit 758d1cb771
4 changed files with 27 additions and 9 deletions

View File

@ -2735,9 +2735,17 @@ angular.module('myApp.controllers', ['myApp.i18n'])
}
var options = {
replyToMsgID: $scope.draftMessage.replyToMsgID
replyToMsgID: $scope.draftMessage.replyToMsgID,
clearDraft: true
}
AppInlineBotsManager.sendInlineResult($scope.curDialog.peerID, qID, options)
if (forceDraft == $scope.curDialog.peer) {
forceDraft = false
} else {
DraftsManager.changeDraft($scope.curDialog.peerID)
}
fwdsSend()
resetDraft()
delete $scope.draftMessage.sticker
@ -4361,7 +4369,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
}
})
.controller('ContactsModalController', function ($scope, $timeout, $modal, $modalInstance, MtpApiManager, AppUsersManager, ErrorService) {
.controller('ContactsModalController', function ($scope, $rootScope, $timeout, $modal, $modalInstance, MtpApiManager, AppUsersManager, ErrorService) {
$scope.contacts = []
$scope.foundPeers = []
$scope.search = {}
@ -4487,7 +4495,13 @@ angular.module('myApp.controllers', ['myApp.i18n'])
}
$scope.importContact = function () {
AppUsersManager.openImportContact()
AppUsersManager.openImportContact().then(function (foundContact) {
if (foundContact) {
$rootScope.$broadcast('history_focus', {
peerString: AppUsersManager.getUserString(foundContact)
})
}
})
}
})

View File

@ -1775,6 +1775,9 @@ angular.module('myApp.services')
if (asChannel) {
flags |= 16
}
if (options.clearDraft) {
flags |= 128
}
var sentRequestOptions = {}
if (pendingAfterMsgs[peerID]) {

View File

@ -16,10 +16,10 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
var usernames = {}
var userAccess = {}
var cachedPhotoLocations = {}
var contactsFillPromise,
contactsList
var contactsIndex = SearchIndexManager.createIndex(),
myID
var contactsIndex = SearchIndexManager.createIndex()
var contactsFillPromise
var contactsList
var myID
MtpApiManager.getUserID().then(function (id) {
myID = id
@ -363,8 +363,9 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
}
function onContactUpdated (userID, isContact) {
userID = parseInt(userID)
if (angular.isArray(contactsList)) {
var curPos = curIsContact = contactsList.indexOf(parseInt(userID))
var curPos = curIsContact = contactsList.indexOf(userID)
var curIsContact = curPos != -1
if (isContact != curIsContact) {

View File

@ -11,7 +11,7 @@
<span ng-switch-when="true" my-i18n="login_incorrect_number"></span>
<span ng-switch-default my-i18n="contact_import_modal_phone"></span>
</label>
<input class="md-input" my-focused type="tel" ng-model="importContact.phone" ng-pattern="/^[-\+\(\)\d]{7,32}$/" my-submit-on-enter name="phone" />
<input class="md-input" my-focused type="tel" ng-model="importContact.phone" ng-pattern="/^[-\+\(\)\d\s]{7,32}$/" my-submit-on-enter name="phone" />
</div>
<div class="md-input-group" my-labeled-input>