Added broadcast in UI
This commit is contained in:
parent
2bb8e63444
commit
82e5f0c068
@ -1156,8 +1156,8 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
|||||||
data: peerData
|
data: peerData
|
||||||
});
|
});
|
||||||
|
|
||||||
MtpApiManager.getUserID().then(function (id) {
|
MtpApiManager.getUserID().then(function (myID) {
|
||||||
$scope.ownID = id;
|
$scope.ownID = myID;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (preload) {
|
if (preload) {
|
||||||
@ -2147,6 +2147,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
|||||||
Storage.get('draft' + $scope.curDialog.peerID).then(function (draftText) {
|
Storage.get('draft' + $scope.curDialog.peerID).then(function (draftText) {
|
||||||
// console.log('Restore draft', 'draft' + $scope.curDialog.peerID, draftText);
|
// console.log('Restore draft', 'draft' + $scope.curDialog.peerID, draftText);
|
||||||
$scope.draftMessage.text = draftText || '';
|
$scope.draftMessage.text = draftText || '';
|
||||||
|
$scope.draftMessage.isBroadcast = AppPeersManager.isChannel($scope.curDialog.peerID);
|
||||||
// console.log('send broadcast', $scope.draftMessage);
|
// console.log('send broadcast', $scope.draftMessage);
|
||||||
$scope.$broadcast('ui_peer_draft');
|
$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 {
|
return {
|
||||||
link: link,
|
link: link,
|
||||||
@ -1495,9 +1495,7 @@ angular.module('myApp.directives', ['myApp.filters'])
|
|||||||
|
|
||||||
var richTextarea = composer.richTextareaEl[0];
|
var richTextarea = composer.richTextareaEl[0];
|
||||||
if (richTextarea) {
|
if (richTextarea) {
|
||||||
$(richTextarea)
|
$(richTextarea).on('keydown keyup', updateHeight);
|
||||||
.attr('placeholder', $interpolate($(messageField).attr('placeholder'))($scope))
|
|
||||||
.on('keydown keyup', updateHeight);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fileSelects.on('change', function () {
|
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_change', composer.resetTyping.bind(composer));
|
||||||
$scope.$on('ui_peer_draft', function () {
|
$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) {
|
if (richTextarea) {
|
||||||
composer.setValue($scope.draftMessage.text || '');
|
composer.setValue($scope.draftMessage.text || '');
|
||||||
updateHeight();
|
updateHeight();
|
||||||
|
@ -442,6 +442,7 @@
|
|||||||
"im_reply_loading": "Loading{dots}",
|
"im_reply_loading": "Loading{dots}",
|
||||||
"im_photos_drop_text": "Drop photos here to send",
|
"im_photos_drop_text": "Drop photos here to send",
|
||||||
"im_message_field_placeholder": "Write a message...",
|
"im_message_field_placeholder": "Write a message...",
|
||||||
|
"im_broadcast_field_placeholder": "Broadcast a message...",
|
||||||
"im_media_attach_title": "Send media",
|
"im_media_attach_title": "Send media",
|
||||||
"im_attach_file_title": "Send file",
|
"im_attach_file_title": "Send file",
|
||||||
"im_emoji_btn_title": "Insert emoticon",
|
"im_emoji_btn_title": "Insert emoticon",
|
||||||
|
@ -1174,6 +1174,11 @@ MessageComposer.prototype.resetTyping = function () {
|
|||||||
this.lastLength = 0;
|
this.lastLength = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MessageComposer.prototype.setPlaceholder = function (newPlaceholder) {
|
||||||
|
(this.richTextareaEl || this.textareaEl).attr('placeholder', newPlaceholder);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function Scroller(content, options) {
|
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}">
|
<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>
|
<i class="icon im_panel_peer_online" ng-show="historyPeer.id > 0 && historyPeer.data.status._ == 'userStatusOnline'"></i>
|
||||||
</a>
|
</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}">
|
<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>
|
<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>
|
<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>
|
||||||
|
|
||||||
<div class="im_send_buttons_wrap clearfix">
|
<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>
|
<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>
|
<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>
|
||||||
|
|
||||||
<div class="im_attach pull-right">
|
<div class="im_attach pull-right">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user