Browse Source

Merge branch 'changelog'

master
Igor Zhukov 11 years ago
parent
commit
158fd5b708
  1. 25
      app/CHANGELOG.md
  2. 28
      app/css/app.css
  3. BIN
      app/img/changelog/card_wecandoit.png
  4. 10
      app/js/controllers.js
  5. 64
      app/js/services.js
  6. 48
      app/partials/changelog_modal.html
  7. 7
      app/partials/settings_modal.html
  8. 2
      gulpfile.js

25
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

28
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;
}

BIN
app/img/changelog/card_wecandoit.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

10
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); $scope.$on('$routeUpdate', updateCurDialog);
@ -289,6 +289,8 @@ angular.module('myApp.controllers', [])
peer: $routeParams.p || false peer: $routeParams.p || false
}; };
} }
ChangelogNotifyService.checkUpdate();
}) })
.controller('AppImDialogsController', function ($scope, $location, MtpApiManager, AppUsersManager, AppChatsManager, AppMessagesManager, AppPeersManager, ErrorService) { .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.profile = {};
$scope.photo = {}; $scope.photo = {};
@ -1548,6 +1550,10 @@ angular.module('myApp.controllers', [])
} }
$rootScope.$broadcast('settings_changed'); $rootScope.$broadcast('settings_changed');
} }
$scope.openChangelog = function () {
ChangelogNotifyService.showChangelog(false);
}
}); });
}) })

64
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
}
})

48
app/partials/changelog_modal.html

@ -0,0 +1,48 @@
<div class="changelog_modal_wrap" my-modal-position>
<a class="modal-close-button" ng-click="$close()"><i></i></a>
<div class="modal-body">
<div class="changelog_card_wrap" ng-switch="lastVersion === false">
<div ng-switch-when="true">
<div class="changelog_card"></div>
<h2 class="changelog_header"><strong>Telegram</strong> recent updates</h2>
</div>
<div ng-switch-default>
<div class="changelog_card"></div>
<h2 class="changelog_header"><strong>Telegram</strong> has been updated!</h2>
</div>
</div>
<div class="changelog_versions_wrap">
<div class="modal_section changelog_version_wrap">
<h3 class="modal_section_header changelog_version_title">
<span class="pull-right">current 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>
</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>

2
gulpfile.js

@ -41,7 +41,7 @@ gulp.task('copy-images', function() {
gulp.task('copy', function() { gulp.task('copy', function() {
return es.concat( return es.concat(
gulp.src(['app/favicon.ico', 'app/favicon_unread.ico', 'app/manifest.webapp', 'app/manifest.json', 'app/**/*worker.js']) gulp.src(['app/favicon.ico', 'app/favicon_unread.ico', 'app/manifest.webapp', 'app/manifest.json', 'app/**/*worker.js', 'CHANGELOG.mdown'])
.pipe(gulp.dest('dist')), .pipe(gulp.dest('dist')),
gulp.src(['app/img/**/*.wav']) gulp.src(['app/img/**/*.wav'])
.pipe(gulp.dest('dist/img')), .pipe(gulp.dest('dist/img')),

Loading…
Cancel
Save