Various bug fixes
This commit is contained in:
parent
d67e85cc2f
commit
2a6dcc1cd0
@ -22,7 +22,7 @@ Here are some screenshots of the interface:
|
||||
### Unsupported at the moment
|
||||
|
||||
* Secret chats
|
||||
* Black list and blocking user
|
||||
* Black list
|
||||
* ...
|
||||
|
||||
|
||||
|
@ -1467,6 +1467,10 @@ div.im_message_video_thumb {
|
||||
background-position: -2px -542px;
|
||||
}
|
||||
|
||||
.im_history_selectable a[ng-click] {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.im_message_document_link_disabled {
|
||||
cursor: default;
|
||||
pointer-events: none;
|
||||
@ -2545,14 +2549,14 @@ ce671b orange
|
||||
.user_color_8,
|
||||
.user_color_8:hover {color: #c07844;}
|
||||
|
||||
.user_bgcolor_1 {background: #e57979;}
|
||||
.user_bgcolor_2 {background: #fba76f;}
|
||||
.user_bgcolor_1 {background: #cc90e2;}
|
||||
.user_bgcolor_2 {background: #80d066;}
|
||||
.user_bgcolor_3 {background: #ecd074;}
|
||||
.user_bgcolor_4 {background: #80d066;}
|
||||
.user_bgcolor_5 {background: #73cdd0;}
|
||||
.user_bgcolor_6 {background: #6fb1e4;}
|
||||
.user_bgcolor_7 {background: #cc90e2;}
|
||||
.user_bgcolor_8 {background: #f98bae;}
|
||||
.user_bgcolor_4 {background: #6fb1e4;}
|
||||
.user_bgcolor_5 {background: #e57979;}
|
||||
.user_bgcolor_6 {background: #f98bae;}
|
||||
.user_bgcolor_7 {background: #73cdd0;}
|
||||
.user_bgcolor_8 {background: #fba76f;}
|
||||
|
||||
a.peer_photo_init:hover,
|
||||
a.peer_photo_init:active,
|
||||
@ -2970,7 +2974,7 @@ div.peer_modal_photo {
|
||||
}
|
||||
.peer_modal_photo .peer_initials {
|
||||
line-height: 72px;
|
||||
font-size: 17px;
|
||||
font-size: 22px;
|
||||
}
|
||||
.peer_modal_profile_name {
|
||||
font-size: 17px;
|
||||
|
@ -545,9 +545,16 @@ a.im_panel_peer_photo {
|
||||
margin-left: 12px;
|
||||
height: 55px;
|
||||
}
|
||||
div.im_panel_own_photo {
|
||||
a.im_panel_own_photo {
|
||||
display: block;
|
||||
margin-right: 12px;
|
||||
}
|
||||
a.im_panel_own_photo .peer_initials,
|
||||
div.im_panel_peer_photo .peer_initials,
|
||||
a.im_panel_peer_photo .peer_initials {
|
||||
font-size: 18px;
|
||||
line-height: 50px;
|
||||
}
|
||||
|
||||
.im_panel_peer_online {
|
||||
background: #6ec26d;
|
||||
@ -996,6 +1003,11 @@ div.im_panel_own_photo {
|
||||
div.im_dialog_photo {
|
||||
margin-right: 12px;
|
||||
}
|
||||
div.im_dialog_photo .peer_initials {
|
||||
line-height: 48px;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.im_dialog_message {
|
||||
margin-top: 4px;
|
||||
}
|
||||
@ -1159,7 +1171,7 @@ div.im_dialog_photo {
|
||||
overflow: hidden;
|
||||
}
|
||||
.media_modal_author_photo .peer_initials {
|
||||
line-height: 32px;
|
||||
line-height: 32px;
|
||||
}
|
||||
a.media_modal_author_photo {
|
||||
margin: 1px 10px 1px 0;
|
||||
|
@ -36,7 +36,7 @@
|
||||
<body>
|
||||
|
||||
<div class="page_wrap" ng-view></div>
|
||||
|
||||
|
||||
<div id="notify_sound"></div>
|
||||
|
||||
<!-- build:js js/app.js -->
|
||||
|
@ -307,7 +307,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
||||
LayoutSwitchService.start();
|
||||
})
|
||||
|
||||
.controller('AppIMController', function ($scope, $location, $routeParams, $modal, $rootScope, $modalStack, MtpApiManager, AppUsersManager, AppChatsManager, ContactsSelectService, ChangelogNotifyService, ErrorService, AppRuntimeManager, HttpsMigrateService, LayoutSwitchService) {
|
||||
.controller('AppIMController', function ($scope, $location, $routeParams, $modal, $rootScope, $modalStack, MtpApiManager, AppUsersManager, AppChatsManager, AppPeersManager, ContactsSelectService, ChangelogNotifyService, ErrorService, AppRuntimeManager, HttpsMigrateService, LayoutSwitchService) {
|
||||
|
||||
$scope.$on('$routeUpdate', updateCurDialog);
|
||||
|
||||
@ -316,7 +316,15 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
||||
if (peerData.peerString == $scope.curDialog.peer && peerData.messageID == $scope.curDialog.messageID) {
|
||||
$scope.$broadcast(peerData.messageID ? 'ui_history_change_scroll' : 'ui_history_focus');
|
||||
} else {
|
||||
$location.url('/im?p=' + peerData.peerString + (peerData.messageID ? '&m=' + peerData.messageID : ''));
|
||||
var peerID = AppPeersManager.getPeerID(peerData.peerString);
|
||||
var peer = peerData.peerString;
|
||||
if (peerID > 0) {
|
||||
var username = AppUsersManager.getUser(peerID).username;
|
||||
if (username) {
|
||||
peer = '@' + username;
|
||||
}
|
||||
}
|
||||
$location.url('/im?p=' + peer + (peerData.messageID ? '&m=' + peerData.messageID : ''));
|
||||
}
|
||||
});
|
||||
|
||||
@ -428,10 +436,22 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
||||
} else {
|
||||
lastSearch = false;
|
||||
}
|
||||
$scope.curDialog = {
|
||||
peer: $routeParams.p || false,
|
||||
messageID: $routeParams.m || false
|
||||
};
|
||||
if ($routeParams.p && $routeParams.p.charAt(0) == '@') {
|
||||
if ($scope.curDialog === undefined) {
|
||||
$scope.curDialog = {};
|
||||
}
|
||||
AppUsersManager.resolveUsername($routeParams.p.substr(1)).then(function (userID) {
|
||||
$scope.curDialog = {
|
||||
peer: AppUsersManager.getUserString(userID),
|
||||
messageID: $routeParams.m || false
|
||||
};
|
||||
});
|
||||
} else {
|
||||
$scope.curDialog = {
|
||||
peer: $routeParams.p || false,
|
||||
messageID: $routeParams.m || false
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
ChangelogNotifyService.checkUpdate();
|
||||
|
@ -129,7 +129,7 @@ angular.module('myApp.directives')
|
||||
if (!atBottom && !options.my) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var pr = parseInt($(scrollableWrap).css('paddingRight'))
|
||||
$(scrollableWrap).addClass('im_history_to_bottom');
|
||||
$(scrollable).css({bottom: 0, marginLeft: -Math.ceil(pr / 2)});
|
||||
|
@ -240,6 +240,7 @@
|
||||
"error_modal_phonebook_required_description": "Telegram needs access to phonebook to import contacts.",
|
||||
"error_modal_username_occupied_description": "Sorry, this username is already taken.",
|
||||
"error_modal_media_not_supported_description": "Your browser cannot play this media file. Try downloading the file and opening it in a standalone player.",
|
||||
"error_modal_username_not_found_description": "There is no Telegram account with the username you provided.",
|
||||
|
||||
"error_modal_bad_request_description": "One of the params is missing or invalid.",
|
||||
"error_modal_unauthorized_description": "This action requires authorization access. Please {login-link: log in}.",
|
||||
|
@ -11,8 +11,9 @@
|
||||
|
||||
angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
|
||||
.service('AppUsersManager', function ($rootScope, $modal, $modalStack, $filter, $q, MtpApiFileManager, MtpApiManager, RichTextProcessor, SearchIndexManager, ErrorService, Storage, _) {
|
||||
.service('AppUsersManager', function ($rootScope, $modal, $modalStack, $filter, $q, qSync, MtpApiFileManager, MtpApiManager, RichTextProcessor, SearchIndexManager, ErrorService, Storage, _) {
|
||||
var users = {},
|
||||
usernames = {},
|
||||
cachedPhotoLocations = {},
|
||||
contactsFillPromise,
|
||||
contactsList,
|
||||
@ -73,6 +74,23 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
});
|
||||
};
|
||||
|
||||
function userNameClean (username) {
|
||||
return username && username.toLowerCase() || '';
|
||||
}
|
||||
|
||||
function resolveUsername (username) {
|
||||
var searchUserName = userNameClean(username);
|
||||
var foundUserID = usernames[searchUserName];
|
||||
if (foundUserID &&
|
||||
userNameClean(users[foundUserID].username) == searchUserName) {
|
||||
return qSync.when(foundUserID);
|
||||
}
|
||||
return MtpApiManager.invokeApi('contacts.resolveUsername', {username: username}).then(function (resolveResult) {
|
||||
saveApiUser(resolveResult);
|
||||
return resolveResult.id;
|
||||
});
|
||||
}
|
||||
|
||||
function saveApiUsers (apiUsers) {
|
||||
angular.forEach(apiUsers, saveApiUser);
|
||||
};
|
||||
@ -83,11 +101,13 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
return;
|
||||
}
|
||||
|
||||
var userID = apiUser.id;
|
||||
|
||||
if (apiUser.phone) {
|
||||
apiUser.rPhone = $filter('phoneNumber')(apiUser.phone);
|
||||
}
|
||||
|
||||
apiUser.num = (Math.abs(apiUser.id) % 8) + 1;
|
||||
apiUser.num = (Math.abs(userID) % 8) + 1;
|
||||
|
||||
if (apiUser.first_name) {
|
||||
apiUser.rFirstName = RichTextProcessor.wrapRichText(apiUser.first_name, {noLinks: true, noLinebreaks: true});
|
||||
@ -97,6 +117,10 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
apiUser.rFullName = RichTextProcessor.wrapRichText(apiUser.last_name, {noLinks: true, noLinebreaks: true}) || apiUser.rPhone || _('user_name_deleted');
|
||||
}
|
||||
|
||||
if (apiUser.username) {
|
||||
usernames[userNameClean(apiUser.username)] = userID;
|
||||
}
|
||||
|
||||
apiUser.sortName = SearchIndexManager.cleanSearchText(apiUser.first_name + ' ' + (apiUser.last_name || ''));
|
||||
|
||||
var nameWords = apiUser.sortName.split(' ');
|
||||
@ -107,15 +131,16 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
apiUser.sortStatus = getUserStatusForSort(apiUser.status);
|
||||
|
||||
|
||||
if (users[apiUser.id] === undefined) {
|
||||
users[apiUser.id] = apiUser;
|
||||
var result = users[userID];
|
||||
if (result === undefined) {
|
||||
result = users[userID] = apiUser;
|
||||
} else {
|
||||
safeReplaceObject(users[apiUser.id], apiUser);
|
||||
safeReplaceObject(result, apiUser);
|
||||
}
|
||||
$rootScope.$broadcast('user_update', apiUser.id);
|
||||
$rootScope.$broadcast('user_update', userID);
|
||||
|
||||
if (cachedPhotoLocations[apiUser.id] !== undefined) {
|
||||
safeReplaceObject(cachedPhotoLocations[apiUser.id], apiUser && apiUser.photo && apiUser.photo.photo_small || {empty: true});
|
||||
if (cachedPhotoLocations[userID] !== undefined) {
|
||||
safeReplaceObject(cachedPhotoLocations[userID], apiUser && apiUser.photo && apiUser.photo.photo_small || {empty: true});
|
||||
}
|
||||
};
|
||||
|
||||
@ -193,7 +218,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
if (user.status &&
|
||||
user.status._ == 'userStatusOnline' &&
|
||||
user.status.expires < timestampNow) {
|
||||
user.status = user.status.wasStatus ||
|
||||
user.status = user.status.wasStatus ||
|
||||
{_: 'userStatusOffline', was_online: user.status.expires};
|
||||
delete user.status.wasStatus;
|
||||
$rootScope.$broadcast('user_update', user.id);
|
||||
@ -392,6 +417,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
deleteContacts: deleteContacts,
|
||||
wrapForFull: wrapForFull,
|
||||
openUser: openUser,
|
||||
resolveUsername: resolveUsername,
|
||||
openImportContact: openImportContact
|
||||
}
|
||||
})
|
||||
@ -500,7 +526,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
var lastWord = titleWords.pop();
|
||||
apiChat.initials = firstWord.charAt(0) + (lastWord ? lastWord.charAt(0) : firstWord.charAt(1));
|
||||
|
||||
apiChat.num = (Math.abs(apiChat.id) % 4) + 1;
|
||||
apiChat.num = (Math.abs(apiChat.id >> 1) % (Config.Mobile ? 4 : 8)) + 1;
|
||||
|
||||
if (chats[apiChat.id] === undefined) {
|
||||
chats[apiChat.id] = apiChat;
|
||||
@ -592,7 +618,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
}
|
||||
})
|
||||
|
||||
.service('AppPeersManager', function (AppUsersManager, AppChatsManager) {
|
||||
.service('AppPeersManager', function (AppUsersManager, AppChatsManager, MtpApiManager) {
|
||||
return {
|
||||
getInputPeer: function (peerString) {
|
||||
var isUser = peerString.charAt(0) == 'u',
|
||||
@ -3177,7 +3203,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
emojiUtf.push(emojiData[emojiCode][0]);
|
||||
emojiMap[emojiData[emojiCode][0]] = emojiCode;
|
||||
}
|
||||
|
||||
|
||||
var regexAlphaChars = "a-z" +
|
||||
"\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff" + // Latin-1
|
||||
"\\u0100-\\u024f" + // Latin Extended A and B
|
||||
@ -4075,3 +4101,20 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
switchLayout: switchLayout
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
// .service('LocationParamsService', function ($routeParams) {
|
||||
|
||||
// var started = false;
|
||||
// function start () {
|
||||
// if (started) {
|
||||
// return;
|
||||
// }
|
||||
// started = true;
|
||||
// navigator.registerProtocolHandler('web+tg', '#im?tgaddr=%s', 'Telegram Web');
|
||||
// };
|
||||
|
||||
// return {
|
||||
// start: start
|
||||
// };
|
||||
// })
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
<h4 ng-if="error" class="md_simple_header" ng-switch="error.type">
|
||||
<span ng-switch-when="MEDIA_TYPE_NOT_SUPPORTED" my-i18n="error_modal_media_not_supported_title"></span>
|
||||
<span ng-switch-when="USERNAME_NOT_OCCUPIED" my-i18n="error_modal_not_found_title"></span>
|
||||
<span ng-switch-default ng-switch="error.code">
|
||||
<span ng-switch-when="400" my-i18n="error_modal_bad_request_title"></span>
|
||||
<span ng-switch-when="401" my-i18n="error_modal_unauthorized_title"></span>
|
||||
@ -35,6 +36,7 @@
|
||||
<span ng-switch-when="USERNAME_INVALID" my-i18n="error_modal_username_invalid_description"></span>
|
||||
<span ng-switch-when="USERNAME_OCCUPIED" my-i18n="error_modal_username_occupied_description"></span>
|
||||
<span ng-switch-when="MEDIA_TYPE_NOT_SUPPORTED" my-i18n="error_modal_media_not_supported_description"></span>
|
||||
<span ng-switch-when="USERNAME_NOT_OCCUPIED" my-i18n="error_modal_username_not_found_description"></span>
|
||||
|
||||
|
||||
<div ng-switch-default ng-switch="error.code">
|
||||
|
@ -233,7 +233,7 @@
|
||||
<a class="pull-right im_panel_peer_photo" my-peer-photolink="historyPeer.id" img-class="im_panel_peer_photo" watch="true">
|
||||
<i class="icon im_panel_peer_online" ng-show="historyPeer.id > 0 && historyPeer.data.status._ == 'userStatusOnline'"></i>
|
||||
</a>
|
||||
<div class="pull-left im_panel_own_photo" my-peer-photolink="ownID" img-class="im_panel_own_photo" watch="true"></div>
|
||||
<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>
|
||||
|
||||
<form my-send-form draft-message="draftMessage" class="im_send_form" ng-class="{im_send_form_empty: !draftMessage.text.length}">
|
||||
|
||||
|
@ -8,7 +8,9 @@
|
||||
<div class="im_dialogs_panel">
|
||||
<div class="im_dialogs_search">
|
||||
<input class="form-control im_dialogs_search_field no_outline" type="search" placeholder="{{'modal_search' | i18n}}" ng-model="search.query"/>
|
||||
<a class="im_dialogs_search_clear" ng-click="searchClear()" ng-show="search.query.length"></a>
|
||||
<a class="im_dialogs_search_clear" ng-click="searchClear()" ng-show="search.query.length">
|
||||
<i class="im_dialogs_search_clear"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="im_dialogs_tabs_wrap">
|
||||
|
@ -32,8 +32,10 @@
|
||||
<div class="im_dialogs_modal_col_wrap" ng-controller="AppImDialogsController" my-dialogs>
|
||||
<div class="im_dialogs_panel">
|
||||
<div class="im_dialogs_search">
|
||||
<input my-focused class="form-control im_dialogs_search_field" type="search" placeholder="{{'modal_search' | i18n}}" ng-model="search.query"/>
|
||||
<a class="im_dialogs_search_clear" ng-click="search.query = ''" ng-show="search.query.length"></a>
|
||||
<input my-focused class="form-control im_dialogs_search_field no_outline" type="search" placeholder="{{'modal_search' | i18n}}" ng-model="search.query"/>
|
||||
<a class="im_dialogs_search_clear" ng-click="search.query = ''" ng-show="search.query.length">
|
||||
<i class="im_dialogs_search_clear"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div my-dialogs-list-mobile modal="true" class="im_dialogs_modal_col im_dialogs_scrollable_wrap mobile_scrollable_wrap">
|
||||
|
@ -79,7 +79,7 @@
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="mobile_modal_section">
|
||||
<div class="mobile_modal_section" ng-if="user.phone.length > 0">
|
||||
<h4 class="mobile_modal_section_header" my-i18n="user_modal_phone"></h4>
|
||||
<div class="mobile_modal_section_value" ng-bind="user.phone | phoneNumber"></div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user