Igor Zhukov 10 years ago
parent
commit
64ef97feff
  1. 26
      app/js/controllers.js
  2. 8
      gulpfile.js

26
app/js/controllers.js

@ -826,7 +826,7 @@ angular.module('myApp.controllers', [])
}; };
}) })
.controller('ChatModalController', function ($scope, $timeout, $rootScope, $modal, AppUsersManager, AppChatsManager, MtpApiManager, MtpApiFileManager, NotificationsManager, AppMessagesManager, AppPeersManager, ApiUpdatesManager, ContactsSelectService) { .controller('ChatModalController', function ($scope, $timeout, $rootScope, $modal, AppUsersManager, AppChatsManager, MtpApiManager, MtpApiFileManager, NotificationsManager, AppMessagesManager, AppPeersManager, ApiUpdatesManager, ContactsSelectService, ErrorService) {
$scope.chatFull = AppChatsManager.wrapForFull($scope.chatID, {}); $scope.chatFull = AppChatsManager.wrapForFull($scope.chatID, {});
@ -954,7 +954,7 @@ angular.module('myApp.controllers', [])
} }
$scope.photo.updating = true; $scope.photo.updating = true;
MtpApiFileManager.uploadFile(photo).then(function (inputFile) { MtpApiFileManager.uploadFile(photo).then(function (inputFile) {
MtpApiManager.invokeApi('messages.editChatPhoto', { return MtpApiManager.invokeApi('messages.editChatPhoto', {
chat_id: $scope.chatID, chat_id: $scope.chatID,
photo: { photo: {
_: 'inputChatUploadedPhoto', _: 'inputChatUploadedPhoto',
@ -963,8 +963,15 @@ angular.module('myApp.controllers', [])
} }
}).then(function (updateResult) { }).then(function (updateResult) {
onStatedMessage(updateResult); onStatedMessage(updateResult);
$scope.photo.updating = false; }, function (error) {
switch (error.code) {
case 400:
ErrorService.showSimpleError('Bad photo', 'The photo is invalid, please select another file.');
break;
}
}); });
})['finally'](function () {
$scope.photo.updating = false;
}); });
}; };
@ -975,6 +982,7 @@ angular.module('myApp.controllers', [])
photo: {_: 'inputChatPhotoEmpty'} photo: {_: 'inputChatPhotoEmpty'}
}).then(function (updateResult) { }).then(function (updateResult) {
onStatedMessage(updateResult); onStatedMessage(updateResult);
}).['finally'](function () {
$scope.photo.updating = false; $scope.photo.updating = false;
}); });
}; };
@ -993,7 +1001,7 @@ angular.module('myApp.controllers', [])
}) })
.controller('SettingsModalController', function ($rootScope, $scope, $timeout, AppUsersManager, AppChatsManager, MtpApiManager, AppConfigManager, NotificationsManager, MtpApiFileManager, ApiUpdatesManager) { .controller('SettingsModalController', function ($rootScope, $scope, $timeout, AppUsersManager, AppChatsManager, MtpApiManager, AppConfigManager, NotificationsManager, MtpApiFileManager, ApiUpdatesManager, ErrorService) {
$scope.profile = {}; $scope.profile = {};
@ -1036,8 +1044,15 @@ angular.module('myApp.controllers', [])
}); });
$scope.profile.photo = AppUsersManager.getUserPhoto(id, 'User'); $scope.profile.photo = AppUsersManager.getUserPhoto(id, 'User');
}); });
$scope.photo.updating = false; }, function (error) {
switch (error.code) {
case 400:
ErrorService.showSimpleError('Bad photo', 'The photo is invalid, please select another file.');
break;
}
}); });
})['finally'](function () {
$scope.photo.updating = false;
}); });
}; };
@ -1057,6 +1072,7 @@ angular.module('myApp.controllers', [])
}); });
$scope.profile.photo = AppUsersManager.getUserPhoto(id, 'User'); $scope.profile.photo = AppUsersManager.getUserPhoto(id, 'User');
}); });
})['finally'](function () {
$scope.photo.updating = false; $scope.photo.updating = false;
}); });
}; };

8
gulpfile.js

@ -27,7 +27,7 @@ gulp.task('usemin', ['templates', 'enable-production'], function() {
.pipe(gulp.dest('dist')); .pipe(gulp.dest('dist'));
}); });
gulp.task('imagemin', ['build', 'copy'], function() { gulp.task('imagemin', function() {
return gulp.src(['app/img/**/*', '!app/img/screenshot*', '!app/img/*.wav']) return gulp.src(['app/img/**/*', '!app/img/screenshot*', '!app/img/*.wav'])
.pipe($.imagemin()) .pipe($.imagemin())
.pipe(gulp.dest('dist/img')); .pipe(gulp.dest('dist/img'));
@ -56,7 +56,7 @@ gulp.task('copy', function() {
); );
}); });
gulp.task('compress-dist', ['add-csp', 'imagemin'], function() { gulp.task('compress-dist', ['add-csp'], function() {
return gulp.src('dist/**/*') return gulp.src('dist/**/*')
.pipe($.zip('webogram_v' + pj.version + '.zip')) .pipe($.zip('webogram_v' + pj.version + '.zip'))
.pipe(gulp.dest('releases')); .pipe(gulp.dest('releases'));
@ -135,10 +135,10 @@ gulp.task('clean', function() {
gulp.task('bump', ['update-version-manifests', 'update-version-settings', 'update-version-comments']); gulp.task('bump', ['update-version-manifests', 'update-version-settings', 'update-version-comments']);
gulp.task('build', ['usemin', 'copy'], function () { gulp.task('build', ['usemin', 'copy', 'imagemin'], function () {
gulp.start('disable-production'); gulp.start('disable-production');
}); });
gulp.task('package', ['cleanup-dist', 'imagemin']); gulp.task('package', ['cleanup-dist']);
gulp.task('publish', ['build'], function() { gulp.task('publish', ['build'], function() {
gulp.start('add-appcache-manifest'); gulp.start('add-appcache-manifest');

Loading…
Cancel
Save