Browse Source

Improved change log modal design

Added ‘recent updates’ link to settings
master
Igor Zhukov 11 years ago
parent
commit
f1f5bbc59a
  1. 27
      app/css/app.css
  2. BIN
      app/img/changelog/card_wecandoit.png
  3. 6
      app/js/controllers.js
  4. 51
      app/js/services.js
  5. 51
      app/partials/changelog_modal.html
  6. 7
      app/partials/settings_modal.html

27
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 { .changelog_version_title {
font-weight: bold; color: #9d9479;
background: #efede3;
}
.changelog_version_changes_list li {
line-height: 20px;
} }

BIN
app/img/changelog/card_wecandoit.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

6
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.profile = {};
$scope.photo = {}; $scope.photo = {};
@ -1550,6 +1550,10 @@ angular.module('myApp.controllers', [])
} }
$rootScope.$broadcast('settings_changed'); $rootScope.$broadcast('settings_changed');
} }
$scope.openChangelog = function () {
ChangelogNotifyService.showChangelog(false);
}
}); });
}) })

51
app/js/services.js

@ -3431,42 +3431,33 @@ angular.module('myApp.services', [])
function checkUpdate () { function checkUpdate () {
AppConfigManager.get('last_version').then(function (lastVersion) { AppConfigManager.get('last_version').then(function (lastVersion) {
if (lastVersion != Config.App.version) { if (lastVersion != Config.App.version) {
$http.get('CHANGELOG.md').then(function (response) { showChangelog(lastVersion || '0');
var changeLogText = response.data; AppConfigManager.set({last_version: Config.App.version});
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)
});
}
});
if (changelog.length) { function showChangelog (lastVersion) {
var $scope = $rootScope.$new(); var $scope = $rootScope.$new();
$scope.version = Config.App.version; $scope.lastVersion = lastVersion;
$scope.changelog = changelog; $scope.canShowVersion = function (curVersion) {
if ($scope.lastVersion === false || $scope.lastVersion === undefined) {
return true;
}
$modal.open({ return versionCompare(curVersion, lastVersion) > 0;
templateUrl: 'partials/changelog_modal.html', };
scope: $scope,
windowClass: 'error_modal_window'
});
}
AppConfigManager.set({last_version: Config.App.version}); $modal.open({
}) templateUrl: 'partials/changelog_modal.html',
} scope: $scope,
}) windowClass: 'changelog_modal_window'
});
} }
return { return {
checkUpdate: checkUpdate checkUpdate: checkUpdate,
showChangelog: showChangelog
} }
}) })

51
app/partials/changelog_modal.html

@ -1,29 +1,48 @@
<div class="error_modal_wrap" my-modal-position> <div class="changelog_modal_wrap" my-modal-position>
<a class="modal-close-button" ng-click="$close()"><i></i></a> <a class="modal-close-button" ng-click="$close()"><i></i></a>
<div class="modal-body"> <div class="modal-body">
<h4 class="modal_simple_header"> <div class="changelog_card_wrap" ng-switch="lastVersion === false">
Telegram Web was updated <div ng-switch-when="true">
</h4> <div class="changelog_card"></div>
<h2 class="changelog_header"><strong>Telegram</strong> recent updates</h2>
<div ng-repeat="versionChanges in changelog"> </div>
<h4 ng-bind="versionChanges.title"></h4> <div ng-switch-default>
<ul ng-repeat="feature in versionChanges.changes"> <div class="changelog_card"></div>
<li ng-bind="feature" ng-if="feature.length"></li> <h2 class="changelog_header"><strong>Telegram</strong> has been updated!</h2>
</ul> </div>
</div> </div>
</div> <div class="changelog_versions_wrap">
<div class="modal-footer"> <div class="modal_section changelog_version_wrap">
<div> <h3 class="modal_section_header changelog_version_title">
<div class="pull-left"> <span class="pull-right">current version</span>
New version is <span class="changelog_new_version" ng-bind="version"></span>. Version 0.1.3
</h3>
<div class="modal_section_body changelog_version_changes">
<ul class="list-unstyled changelog_version_changes_list">
<li>Added this welcome message</li>
<li>Added keyboard shortcuts:</li>
<ul>
<li><strong>Tab</strong> - set focus to message field</li>
<li><strong>Esc</strong> or <strong>Shift+Tab</strong> - focus search field</li>
<li><strong>Up/Down</strong> (while in search field) - move around dialogs</li>
<li><strong>Enter</strong> (while in search field) - open selected or first dialog</li>
<li><strong>Alt+[0-9]</strong> - Switch to Nth dialog</li>
<li><strong>Alt+Up/Down</strong> - move to previous/next dialog</li>
</ul>
<li>Improved messages grouping</li>
<li>Fixed video modal position bug</li>
<li>Fixed mobile focus issues</li>
</ul>
</div>
</div> </div>
<button type="button" class="btn btn-primary" ng-click="$dismiss()">Done</button>
</div> </div>
</div> </div>
</div> </div>

7
app/partials/settings_modal.html

@ -102,7 +102,12 @@
<div class="modal_section"> <div class="modal_section">
<h3 class="modal_section_header">About</h3> <h3 class="modal_section_header">About</h3>
<div class="modal_section_body"> <div class="modal_section_body">
<p><strong>Webogram</strong> v{{version}}, <a href="https://github.com/zhukov/webogram" target="_blank">GitHub</a></p> <p>
<strong>Webogram</strong> v{{version}}, <a ng-click="openChangelog()">Recent updates</a></br>
</p>
<p>
Source code available on <a href="https://github.com/zhukov/webogram" target="_blank">GitHub</a>
</p>
</div> </div>
</div> </div>

Loading…
Cancel
Save