diff --git a/app/CHANGELOG.md b/app/CHANGELOG.md new file mode 100644 index 00000000..c0bc0fcd --- /dev/null +++ b/app/CHANGELOG.md @@ -0,0 +1,25 @@ +What's new? +=========== + + + + +version 2.0 +----------- + +* Updated settings + + +version 0.1.3, June 3rd, 2014 +----------------------------- + +* Added this welcome message +* Improved messages grouping +* Fixed video modal position bug +* Fixed mobile focus issues + + +version 0.0.1 +------------- + +* some very old stuff \ No newline at end of file diff --git a/app/css/app.css b/app/css/app.css index fc5b9055..23e1440f 100644 --- a/app/css/app.css +++ b/app/css/app.css @@ -3379,3 +3379,31 @@ ce671b orange } } + +.changelog_modal_window .modal-dialog { + max-width: 506px; +} +.changelog_card_wrap { + text-align: center; + padding: 12px 0 18px; +} +.changelog_header { + margin-top: 15px; + font-size: 16px; +} +.changelog_card { + width: 160px; + height: 160px; + display: block; + background: url(../img/changelog/card_wecandoit.png) no-repeat 0 0; + background-size: 160px 160px; + margin: 0 auto; +} + +.changelog_version_title { + color: #9d9479; + background: #efede3; +} +.changelog_version_changes_list li { + line-height: 20px; +} diff --git a/app/img/changelog/card_wecandoit.png b/app/img/changelog/card_wecandoit.png new file mode 100644 index 00000000..e154f136 Binary files /dev/null and b/app/img/changelog/card_wecandoit.png differ diff --git a/app/js/controllers.js b/app/js/controllers.js index 15882377..4a90e713 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -220,7 +220,7 @@ angular.module('myApp.controllers', []) }; }) - .controller('AppIMController', function ($scope, $location, $routeParams, $modal, $rootScope, $modalStack, MtpApiManager, AppUsersManager, ContactsSelectService, ErrorService) { + .controller('AppIMController', function ($scope, $location, $routeParams, $modal, $rootScope, $modalStack, MtpApiManager, AppUsersManager, ContactsSelectService, ChangelogNotifyService, ErrorService) { $scope.$on('$routeUpdate', updateCurDialog); @@ -289,6 +289,8 @@ angular.module('myApp.controllers', []) peer: $routeParams.p || false }; } + + ChangelogNotifyService.checkUpdate(); }) .controller('AppImDialogsController', function ($scope, $location, MtpApiManager, AppUsersManager, AppChatsManager, AppMessagesManager, AppPeersManager, ErrorService) { @@ -1407,7 +1409,7 @@ angular.module('myApp.controllers', []) }) - .controller('SettingsModalController', function ($rootScope, $scope, $timeout, $modal, AppUsersManager, AppChatsManager, MtpApiManager, AppConfigManager, NotificationsManager, MtpApiFileManager, ApiUpdatesManager, ErrorService) { + .controller('SettingsModalController', function ($rootScope, $scope, $timeout, $modal, AppUsersManager, AppChatsManager, MtpApiManager, AppConfigManager, NotificationsManager, MtpApiFileManager, ApiUpdatesManager, ChangelogNotifyService, ErrorService) { $scope.profile = {}; $scope.photo = {}; @@ -1548,6 +1550,10 @@ angular.module('myApp.controllers', []) } $rootScope.$broadcast('settings_changed'); } + + $scope.openChangelog = function () { + ChangelogNotifyService.showChangelog(false); + } }); }) diff --git a/app/js/services.js b/app/js/services.js index abd20bca..a4c56877 100644 --- a/app/js/services.js +++ b/app/js/services.js @@ -3397,3 +3397,67 @@ angular.module('myApp.services', []) }, } }) + + +.service('ChangelogNotifyService', function (AppConfigManager, $rootScope, $http, $modal) { + + function versionCompare (ver1, ver2) { + if (typeof ver1 !== 'string') { + ver1 = ''; + } + if (typeof ver2 !== 'string') { + ver2 = ''; + } + // console.log('ss', ver1, ver2); + ver1 = ver1.replace(/^\s+|\s+$/g, '').split('.'); + ver2 = ver2.replace(/^\s+|\s+$/g, '').split('.'); + + var a = Math.max(ver1.length, ver2.length), i; + + for (i = 0; i < a; i++) { + if (ver1[i] == ver2[i]) { + continue; + } + if (ver1[i] > ver2[i]) { + return 1; + } else { + return -1; + } + } + + return 0; + } + + function checkUpdate () { + AppConfigManager.get('last_version').then(function (lastVersion) { + if (lastVersion != Config.App.version) { + showChangelog(lastVersion || '0'); + AppConfigManager.set({last_version: Config.App.version}); + } + }) + } + + function showChangelog (lastVersion) { + var $scope = $rootScope.$new(); + + $scope.lastVersion = lastVersion; + $scope.canShowVersion = function (curVersion) { + if ($scope.lastVersion === false || $scope.lastVersion === undefined) { + return true; + } + + return versionCompare(curVersion, lastVersion) > 0; + }; + + $modal.open({ + templateUrl: 'partials/changelog_modal.html', + scope: $scope, + windowClass: 'changelog_modal_window' + }); + } + + return { + checkUpdate: checkUpdate, + showChangelog: showChangelog + } +}) diff --git a/app/partials/changelog_modal.html b/app/partials/changelog_modal.html new file mode 100644 index 00000000..09e5fd0a --- /dev/null +++ b/app/partials/changelog_modal.html @@ -0,0 +1,48 @@ +
Webogram v{{version}}, GitHub
++ Webogram v{{version}}, Recent updates +
++ Source code available on GitHub +