diff --git a/app/css/app.css b/app/css/app.css index 7247b51c..d38b59d3 100644 --- a/app/css/app.css +++ b/app/css/app.css @@ -3374,7 +3374,30 @@ 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_new_version { - font-weight: bold; +.changelog_version_title { + color: #9d9479; + background: #efede3; +} +.changelog_version_changes_list li { + line-height: 20px; } \ No newline at end of file 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 94192add..bf89b903 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -1409,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 = {}; @@ -1550,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 09deec8c..a4c56877 100644 --- a/app/js/services.js +++ b/app/js/services.js @@ -3431,42 +3431,33 @@ angular.module('myApp.services', []) function checkUpdate () { AppConfigManager.get('last_version').then(function (lastVersion) { if (lastVersion != Config.App.version) { - $http.get('CHANGELOG.md').then(function (response) { - var changeLogText = response.data; - var matchesStart = changeLogText.match(/^([\s\S]+?\n)(?=version)/i), - changelog = []; - - changeLogText.replace(/(version ([\d\.]+)[\s\S]+?)(?=\nversion|$)/gi, function (whole, versionP, version) { - if (versionCompare(version, lastVersion) > 0) { - var contents = versionP.split(/\n\s*-{3,}\s*\n/); - - changelog.push({ - title: contents[0], - changes: contents[1].split(/\n?\s*\*\s*/g) - }); - } - }); + showChangelog(lastVersion || '0'); + AppConfigManager.set({last_version: Config.App.version}); + } + }) + } - if (changelog.length) { - var $scope = $rootScope.$new(); + function showChangelog (lastVersion) { + var $scope = $rootScope.$new(); - $scope.version = Config.App.version; - $scope.changelog = changelog; + $scope.lastVersion = lastVersion; + $scope.canShowVersion = function (curVersion) { + if ($scope.lastVersion === false || $scope.lastVersion === undefined) { + return true; + } - $modal.open({ - templateUrl: 'partials/changelog_modal.html', - scope: $scope, - windowClass: 'error_modal_window' - }); - } + return versionCompare(curVersion, lastVersion) > 0; + }; - AppConfigManager.set({last_version: Config.App.version}); - }) - } - }) + $modal.open({ + templateUrl: 'partials/changelog_modal.html', + scope: $scope, + windowClass: 'changelog_modal_window' + }); } return { - checkUpdate: checkUpdate + checkUpdate: checkUpdate, + showChangelog: showChangelog } }) diff --git a/app/partials/changelog_modal.html b/app/partials/changelog_modal.html index 6b627c18..09e5fd0a 100644 --- a/app/partials/changelog_modal.html +++ b/app/partials/changelog_modal.html @@ -1,29 +1,48 @@ -
+