Added broadcast in UI
This commit is contained in:
parent
2bb8e63444
commit
82e5f0c068
app
js
partials
@ -1156,8 +1156,8 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
||||
data: peerData
|
||||
});
|
||||
|
||||
MtpApiManager.getUserID().then(function (id) {
|
||||
$scope.ownID = id;
|
||||
MtpApiManager.getUserID().then(function (myID) {
|
||||
$scope.ownID = myID;
|
||||
});
|
||||
|
||||
if (preload) {
|
||||
@ -2147,6 +2147,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
||||
Storage.get('draft' + $scope.curDialog.peerID).then(function (draftText) {
|
||||
// console.log('Restore draft', 'draft' + $scope.curDialog.peerID, draftText);
|
||||
$scope.draftMessage.text = draftText || '';
|
||||
$scope.draftMessage.isBroadcast = AppPeersManager.isChannel($scope.curDialog.peerID);
|
||||
// console.log('send broadcast', $scope.draftMessage);
|
||||
$scope.$broadcast('ui_peer_draft');
|
||||
});
|
||||
|
@ -1395,7 +1395,7 @@ angular.module('myApp.directives', ['myApp.filters'])
|
||||
|
||||
})
|
||||
|
||||
.directive('mySendForm', function ($timeout, $compile, $modalStack, $http, $interpolate, Storage, AppStickersManager, AppDocsManager, ErrorService) {
|
||||
.directive('mySendForm', function (_, $timeout, $compile, $modalStack, $http, $interpolate, Storage, AppStickersManager, AppDocsManager, ErrorService) {
|
||||
|
||||
return {
|
||||
link: link,
|
||||
@ -1495,9 +1495,7 @@ angular.module('myApp.directives', ['myApp.filters'])
|
||||
|
||||
var richTextarea = composer.richTextareaEl[0];
|
||||
if (richTextarea) {
|
||||
$(richTextarea)
|
||||
.attr('placeholder', $interpolate($(messageField).attr('placeholder'))($scope))
|
||||
.on('keydown keyup', updateHeight);
|
||||
$(richTextarea).on('keydown keyup', updateHeight);
|
||||
}
|
||||
|
||||
fileSelects.on('change', function () {
|
||||
@ -1571,6 +1569,9 @@ angular.module('myApp.directives', ['myApp.filters'])
|
||||
|
||||
$scope.$on('ui_peer_change', composer.resetTyping.bind(composer));
|
||||
$scope.$on('ui_peer_draft', function () {
|
||||
var isBroadcast = $scope.draftMessage.isBroadcast;
|
||||
composer.setPlaceholder(_(isBroadcast ? 'im_broadcast_field_placeholder_raw' : 'im_message_field_placeholder_raw'));
|
||||
|
||||
if (richTextarea) {
|
||||
composer.setValue($scope.draftMessage.text || '');
|
||||
updateHeight();
|
||||
|
@ -442,6 +442,7 @@
|
||||
"im_reply_loading": "Loading{dots}",
|
||||
"im_photos_drop_text": "Drop photos here to send",
|
||||
"im_message_field_placeholder": "Write a message...",
|
||||
"im_broadcast_field_placeholder": "Broadcast a message...",
|
||||
"im_media_attach_title": "Send media",
|
||||
"im_attach_file_title": "Send file",
|
||||
"im_emoji_btn_title": "Insert emoticon",
|
||||
|
@ -1174,6 +1174,11 @@ MessageComposer.prototype.resetTyping = function () {
|
||||
this.lastLength = 0;
|
||||
}
|
||||
|
||||
MessageComposer.prototype.setPlaceholder = function (newPlaceholder) {
|
||||
(this.richTextareaEl || this.textareaEl).attr('placeholder', newPlaceholder);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function Scroller(content, options) {
|
||||
|
@ -170,10 +170,10 @@
|
||||
|
||||
<div class="im_send_form_wrap clearfix" ng-controller="AppImSendController" ng-class="{im_send_reply_form_wrap: draftMessage.replyToMessage != null}">
|
||||
|
||||
<a class="pull-right im_panel_peer_photo" my-peer-photolink="historyPeer.id" img-class="im_panel_peer_photo" watch="true">
|
||||
<a class="pull-right im_panel_peer_photo" my-peer-photolink="historyPeer.id" img-class="im_panel_peer_photo" watch="true" ng-show="!draftMessage.isBroadcast">
|
||||
<i class="icon im_panel_peer_online" ng-show="historyPeer.id > 0 && historyPeer.data.status._ == 'userStatusOnline'"></i>
|
||||
</a>
|
||||
<a class="pull-left im_panel_own_photo" my-peer-photolink="ownID" img-class="im_panel_own_photo" watch="true" ng-click="openSettings()" no-open="true"></a>
|
||||
<a class="pull-left im_panel_own_photo" my-peer-photolink="draftMessage.isBroadcast ? historyPeer.id : ownID" img-class="im_panel_own_photo" watch="true" ng-click="openSettings()" no-open="true"></a>
|
||||
|
||||
<form my-send-form draft-message="draftMessage" mentions="mentions" commands="commands" class="im_send_form" ng-class="{im_send_form_empty: !draftMessage.text.length}">
|
||||
|
||||
@ -188,7 +188,7 @@
|
||||
<a class="composer_keyboard_btn" ng-show="historyState.replyKeyboard._ == 'replyKeyboardMarkup'" ng-mousedown="replyKeyboardToggle($event)" ng-class="!historyState.replyKeyboard.pFlags.hidden ? 'active' : ''"><i class="icon icon-keyboard"></i></a>
|
||||
|
||||
<div class="im_send_dropbox_wrap" my-i18n="im_photos_drop_text"></div>
|
||||
<textarea ng-model="draftMessage.text" placeholder="{{'im_message_field_placeholder' | i18n}}" class="form-control im_message_field no_outline" dir="auto"></textarea>
|
||||
<textarea ng-model="draftMessage.text" class="form-control im_message_field no_outline" dir="auto"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="im_send_buttons_wrap clearfix">
|
||||
|
@ -151,7 +151,7 @@
|
||||
<a class="composer_keyboard_btn" ng-show="historyState.replyKeyboard._ == 'replyKeyboardMarkup'" ng-mousedown="replyKeyboardToggle($event)" ng-class="!historyState.replyKeyboard.pFlags.hidden ? 'active' : ''"><i class="icon icon-keyboard"></i></a>
|
||||
|
||||
<div class="im_send_dropbox_wrap" my-i18n="im_photos_drop_text"></div>
|
||||
<textarea ng-model="draftMessage.text" placeholder="{{'im_message_field_placeholder' | i18n}}" class="form-control im_message_field no_outline" dir="auto"></textarea>
|
||||
<textarea ng-model="draftMessage.text" class="form-control im_message_field no_outline" dir="auto"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="im_attach pull-right">
|
||||
|
Loading…
Reference in New Issue
Block a user