MOBILE-2478 desktop: Don't display free space in desktop

main
Dani Palou 2018-07-20 09:01:37 +02:00
parent 6e026bd813
commit c4f60e902d
2 changed files with 13 additions and 5 deletions

View File

@ -20,7 +20,7 @@
<p>{{ 'core.settings.total' | translate }}</p>
<p item-end>{{ totalUsage | coreBytesToSize }}</p>
</ion-item-divider>
<ion-item-divider color="light">
<ion-item-divider color="light" *ngIf="showFreeSpace">
<p>{{ 'core.settings.estimatedfreespace' | translate }}</p>
<p item-end>{{ freeSpace | coreBytesToSize }}</p>
</ion-item-divider>

View File

@ -15,6 +15,7 @@
import { Component, } from '@angular/core';
import { IonicPage } from 'ionic-angular';
import { TranslateService } from '@ngx-translate/core';
import { CoreAppProvider } from '@providers/app';
import { CoreFileProvider } from '@providers/file';
import { CoreFilepoolProvider } from '@providers/filepool';
import { CoreSitesProvider } from '@providers/sites';
@ -36,11 +37,13 @@ export class CoreSettingsSpaceUsagePage {
currentSiteId = '';
totalUsage = 0;
freeSpace = 0;
showFreeSpace = true;
constructor(private fileProvider: CoreFileProvider, private filePoolProvider: CoreFilepoolProvider,
private sitesProvider: CoreSitesProvider, private textUtils: CoreTextUtilsProvider,
private translate: TranslateService, private domUtils: CoreDomUtilsProvider) {
private translate: TranslateService, private domUtils: CoreDomUtilsProvider, appProvider: CoreAppProvider) {
this.currentSiteId = this.sitesProvider.getCurrentSiteId();
this.showFreeSpace = !appProvider.isDesktop();
}
/**
@ -112,10 +115,15 @@ export class CoreSettingsSpaceUsagePage {
* @return {Promise<any>} Resolved when done.
*/
protected fetchData(): Promise<any> {
return Promise.all([
const promises = [
this.calculateSizeUsage().then(() => this.calculateTotalUsage()),
this.calculateFreeSpace(),
]);
];
if (this.showFreeSpace) {
promises.push(this.calculateFreeSpace());
}
return Promise.all(promises);
}
/**