1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-06 09:20:43 +01:00

hide file download features on edge

This commit is contained in:
Kyle Spearrin 2017-08-28 23:47:35 -04:00
parent 751281a59c
commit bf703b6880
7 changed files with 34 additions and 18 deletions

View File

@ -1,8 +1,9 @@
angular
.module('bit.tools')
.controller('toolsController', function ($scope, SweetAlert, i18nService, $analytics) {
.controller('toolsController', function ($scope, SweetAlert, i18nService, $analytics, utilsService) {
$scope.i18n = i18nService;
$scope.showExport = !utilsService.isEdge();
$scope.launchWebVault = function (createOrg) {
$analytics.eventTrack('Launch Web Vault' + (createOrg ? ' For Share' : ''));
chrome.tabs.create({ url: 'https://vault.bitwarden.com/#/' + (createOrg ? '?org=free' : '') });

View File

@ -2,7 +2,7 @@
.module('bit.tools')
.controller('toolsExportController', function ($scope, $state, toastr, $q, $analytics,
i18nService, cryptoService, userService, folderService, loginService) {
i18nService, cryptoService, userService, folderService, loginService, $window) {
$scope.i18n = i18nService;
$('#master-password').focus();
@ -89,16 +89,21 @@
function downloadFile(csvString) {
var csvBlob = new Blob([csvString]);
if (window.navigator.msSaveOrOpenBlob) {
window.navigator.msSaveBlob(csvBlob, makeFileName());
var fileName = makeFileName();
if ($window.navigator.msSaveOrOpenBlob) {
// Currently bugged in Edge. See
// https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8178877/
// https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8477778/
$window.navigator.msSaveBlob(csvBlob, fileName);
}
else {
var a = window.document.createElement('a');
a.href = window.URL.createObjectURL(csvBlob, { type: 'text/plain' });
a.download = makeFileName();
document.body.appendChild(a);
var a = $window.document.createElement('a');
a.href = $window.URL.createObjectURL(csvBlob, { type: 'text/plain' });
a.download = fileName;
$window.document.body.appendChild(a);
a.click();
document.body.removeChild(a);
$window.document.body.removeChild(a);
}
}

View File

@ -35,7 +35,7 @@
<span class="text">{{i18n.importLogins}}</span>
<span class="detail">{{i18n.importLoginsInfo}}</span>
</a>
<a class="list-section-item wrap" ui-sref="export({animation: 'in-slide-up'})">
<a class="list-section-item wrap" ui-sref="export({animation: 'in-slide-up'})" ng-if="showExport">
<span class="leading-icon" style="color: #ff6f6f;"><i class="fa fa-cloud-download fa-fw"></i></span>
<span class="text">{{i18n.exportVault}}</span>
<span class="detail">{{i18n.exportVaultInfo}}</span>

View File

@ -4,6 +4,7 @@ angular
.controller('vaultEditLoginController', function ($scope, $state, $stateParams, loginService, folderService,
cryptoService, $q, toastr, SweetAlert, utilsService, $analytics, i18nService) {
$scope.i18n = i18nService;
$scope.showAttachments = !utilsService.isEdge();
var loginId = $stateParams.loginId;
var fromView = $stateParams.fromView;
var from = $stateParams.from;

View File

@ -4,6 +4,7 @@ angular
.controller('vaultViewLoginController', function ($scope, $state, $stateParams, loginService, toastr, $q,
$analytics, i18nService, utilsService, totpService, $timeout, tokenService, $window, cryptoService, SweetAlert) {
$scope.i18n = i18nService;
$scope.showAttachments = !utilsService.isEdge();
var from = $stateParams.from,
totpInterval = null;
@ -143,12 +144,20 @@ angular
}).then(function (decBuf) {
var blob = new Blob([decBuf]);
var a = $window.document.createElement('a');
a.href = $window.URL.createObjectURL(blob);
a.download = attachment.fileName;
$window.document.body.appendChild(a);
a.click();
$window.document.body.removeChild(a);
if ($window.navigator.msSaveOrOpenBlob) {
// Currently bugged in Edge. See
// https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8178877/
// https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8477778/
$window.navigator.msSaveBlob(csvBlob, attachment.fileName);
}
else {
var a = $window.document.createElement('a');
a.href = $window.URL.createObjectURL(blob);
a.download = attachment.fileName;
$window.document.body.appendChild(a);
a.click();
$window.document.body.removeChild(a);
}
$timeout(function () {
attachment.downloading = false;

View File

@ -57,7 +57,7 @@
<label for="favorite">{{i18n.favorite}}</label>
<input id="favorite" name="Favorite" type="checkbox" ng-model="login.favorite">
</div>
<a class="list-section-item" href="#" stop-click ng-click="attachments()">
<a class="list-section-item" href="#" stop-click ng-click="attachments()" ng-if="showAttachments">
{{i18n.attachments}}
<i class="fa fa-chevron-right"></i>
</a>

View File

@ -76,7 +76,7 @@
<div class="list-section-item pre">{{login.notes}}</div>
</div>
</div>
<div class="list-section" ng-if="isPremium && login.attachments && login.attachments.length">
<div class="list-section" ng-if="showAttachments && isPremium && login.attachments && login.attachments.length">
<div class="list-section-header">
{{i18n.attachments}}
</div>