Browse Source

Fixed notification empty group photo, mtproto baseDcID bug, empty thumb bug

master
Igor Zhukov 11 years ago
parent
commit
f38f15f4a7
  1. 6
      app/index.html
  2. 3
      app/js/directives.js
  3. 25
      app/js/lib/mtproto.js
  4. 2
      app/js/services.js

6
app/index.html

@ -32,14 +32,14 @@
<script type="text/javascript" src="js/lib/config.js"></script> <script type="text/javascript" src="js/lib/config.js"></script>
<script type="text/javascript" src="js/lib/mtproto.js"></script> <script type="text/javascript" src="js/lib/mtproto.js?1"></script>
<script type="text/javascript" src="js/util.js"></script> <script type="text/javascript" src="js/util.js"></script>
<script type="text/javascript" src="js/app.js"></script> <script type="text/javascript" src="js/app.js"></script>
<script type="text/javascript" src="js/services.js?1"></script> <script type="text/javascript" src="js/services.js?2"></script>
<script type="text/javascript" src="js/controllers.js?1"></script> <script type="text/javascript" src="js/controllers.js?1"></script>
<script type="text/javascript" src="js/filters.js?1"></script> <script type="text/javascript" src="js/filters.js?1"></script>
<script type="text/javascript" src="js/directives.js?1"></script> <script type="text/javascript" src="js/directives.js?2"></script>
</body> </body>
</html> </html>

3
app/js/directives.js

@ -331,8 +331,7 @@ angular.module('myApp.directives', ['myApp.filters'])
function link (scope, element, attrs) { function link (scope, element, attrs) {
scope.$watch('thumb.location', function (newVal) { scope.$watch('thumb.location', function (newVal) {
if (!scope.thumb) dLog(222, scope); if (!scope.thumb || !scope.thumb.location) {
if (!scope.thumb.location) {
element.attr('src', scope.thumb.placeholder || ''); element.attr('src', scope.thumb.placeholder || '');
return; return;
} }

25
app/js/lib/mtproto.js

@ -2117,14 +2117,23 @@ factory('MtpApiManager', function (AppConfigManager, MtpAuthorizer, MtpNetworker
}; };
function mtpInvokeApi (method, params, options) { function mtpInvokeApi (method, params, options) {
var deferred = $q.defer();
options = options || {}; options = options || {};
var dcID = options.dcID || baseDcID || 1;
var deferred = $q.defer(),
dcID,
networkerPromise;
if (dcID = options.dcID) {
networkerPromise = mtpGetNetworker(dcID);
} else {
networkerPromise = AppConfigManager.get('dc').then(function (baseDcID) {
return mtpGetNetworker(dcID = baseDcID || 1);
});
}
var cachedNetworker; var cachedNetworker;
mtpGetNetworker(dcID).then(function (networker) { networkerPromise.then(function (networker) {
return (cachedNetworker = networker).wrapApiCall(method, params, options).then( return (cachedNetworker = networker).wrapApiCall(method, params, options).then(
function (result) { function (result) {
deferred.resolve(result); deferred.resolve(result);
@ -2175,13 +2184,9 @@ factory('MtpApiManager', function (AppConfigManager, MtpAuthorizer, MtpNetworker
}; };
function mtpGetUserID () { function mtpGetUserID () {
var deferred = $q.defer(); return AppConfigManager.get('user_auth').then(function (auth) {
return auth.id || 0;
AppConfigManager.get('user_auth').then(function (auth) {
deferred.resolve(auth.id || 0);
}); });
return deferred.promise;
} }
return { return {

2
app/js/services.js

@ -1013,7 +1013,7 @@ angular.module('myApp.services', [])
notification.message = message.message; notification.message = message.message;
notificationPhoto = AppChatsManager.getChatPhoto(-peerID); notificationPhoto = AppChatsManager.getChatPhoto(-peerID, 'Chat');
peerString = AppChatsManager.getChatString(-peerID); peerString = AppChatsManager.getChatString(-peerID);
} }

Loading…
Cancel
Save