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 @@ @@ -32,14 +32,14 @@
<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/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/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>
</html>

3
app/js/directives.js

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

25
app/js/lib/mtproto.js

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

2
app/js/services.js

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

Loading…
Cancel
Save