1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 07:43:35 +00:00
Files
browser/src/popup/app/settings/settingsSyncController.js
2017-01-14 12:47:11 -05:00

31 lines
989 B
JavaScript

angular
.module('bit.settings')
.controller('settingsSyncController', function ($scope, syncService, toastr, $analytics, i18nService) {
$scope.i18n = i18nService;
$scope.lastSync = '--';
$scope.loading = false;
setLastSync();
$scope.sync = function () {
$scope.loading = true;
syncService.fullSync(true, function () {
$analytics.eventTrack('Synced Full');
$scope.loading = false;
toastr.success(i18nService.syncingComplete);
setLastSync();
});
};
function setLastSync() {
syncService.getLastSync(function (lastSync) {
if (lastSync) {
$scope.lastSync = lastSync.toLocaleDateString() + ' ' + lastSync.toLocaleTimeString();
}
else {
$scope.lastSync = i18nService.never;
}
});
}
});