Changelog modal draft
This commit is contained in:
parent
a740015dff
commit
505367b541
25
app/CHANGELOG.md
Normal file
25
app/CHANGELOG.md
Normal file
@ -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
|
@ -3373,3 +3373,8 @@ ce671b orange
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.changelog_new_version {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
@ -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) {
|
||||||
|
@ -3397,3 +3397,76 @@ 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) {
|
||||||
|
$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)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (changelog.length) {
|
||||||
|
var $scope = $rootScope.$new();
|
||||||
|
|
||||||
|
$scope.version = Config.App.version;
|
||||||
|
$scope.changelog = changelog;
|
||||||
|
|
||||||
|
$modal.open({
|
||||||
|
templateUrl: 'partials/changelog_modal.html',
|
||||||
|
scope: $scope,
|
||||||
|
windowClass: 'error_modal_window'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
AppConfigManager.set({last_version: Config.App.version});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
checkUpdate: checkUpdate
|
||||||
|
}
|
||||||
|
})
|
||||||
|
29
app/partials/changelog_modal.html
Normal file
29
app/partials/changelog_modal.html
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<div class="error_modal_wrap" my-modal-position>
|
||||||
|
|
||||||
|
<a class="modal-close-button" ng-click="$close()"><i></i></a>
|
||||||
|
|
||||||
|
<div class="modal-body">
|
||||||
|
|
||||||
|
<h4 class="modal_simple_header">
|
||||||
|
Telegram Web was updated
|
||||||
|
</h4>
|
||||||
|
|
||||||
|
<div ng-repeat="versionChanges in changelog">
|
||||||
|
<h4 ng-bind="versionChanges.title"></h4>
|
||||||
|
<ul ng-repeat="feature in versionChanges.changes">
|
||||||
|
<li ng-bind="feature" ng-if="feature.length"></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
<div>
|
||||||
|
<div class="pull-left">
|
||||||
|
New version is <span class="changelog_new_version" ng-bind="version"></span>.
|
||||||
|
</div>
|
||||||
|
<button type="button" class="btn btn-primary" ng-click="$dismiss()">Done</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
@ -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…
x
Reference in New Issue
Block a user