Add ability to prefetch and auto-prefetch offline data
This commit is contained in:
@@ -11,6 +11,14 @@
|
||||
<i slot="start" class="fa" [ngClass]="isDark() ? 'fa-sun' : 'fa-moon'"></i>
|
||||
<ion-label>{{ isDark() ? 'To The Light!' : 'Go Dark...' }}</ion-label>
|
||||
</ion-item>
|
||||
<ion-item button (click)="onSelect('prefetch_data')">
|
||||
<i slot="start" class="fa fa-download"></i>
|
||||
<ion-label>Prefetch Offline Data</ion-label>
|
||||
</ion-item>
|
||||
<ion-item button (click)="onSelect('toggle_auto_prefetch')">
|
||||
<i slot="start" class="fa" [ngClass]="isPrefetch() ? 'fa-check-square' : 'fa-square'"></i>
|
||||
<ion-label>Auto-Prefetch</ion-label>
|
||||
</ion-item>
|
||||
<ion-item button (click)="onSelect('logout')">
|
||||
<i slot="start" class="fa fa-sign-out-alt"></i>
|
||||
<ion-label>Logout</ion-label>
|
||||
|
||||
@@ -2,7 +2,7 @@ import {Component, Input, OnInit} from '@angular/core';
|
||||
import {Router} from '@angular/router';
|
||||
import {ApiService} from '../../service/api.service';
|
||||
import {PopoverController} from '@ionic/angular';
|
||||
import {DatabaseService} from "../../service/db/database.service";
|
||||
import {DatabaseService} from '../../service/db/database.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-option-picker',
|
||||
@@ -13,6 +13,9 @@ export class OptionPickerComponent implements OnInit {
|
||||
@Input() toggleDark: () => void;
|
||||
@Input() isDark: () => boolean;
|
||||
@Input() showSearch: () => void | Promise<void>;
|
||||
@Input() isPrefetch: () => boolean;
|
||||
@Input() togglePrefetch: () => void;
|
||||
@Input() doPrefetch: () => any;
|
||||
|
||||
constructor(
|
||||
protected api: ApiService,
|
||||
@@ -34,6 +37,11 @@ export class OptionPickerComponent implements OnInit {
|
||||
} else if ( key === 'search_everywhere' ) {
|
||||
this.showSearch();
|
||||
this.popover.dismiss();
|
||||
} else if ( key === 'toggle_auto_prefetch' ) {
|
||||
this.togglePrefetch();
|
||||
} else if ( key === 'prefetch_data' ) {
|
||||
this.popover.dismiss();
|
||||
this.doPrefetch();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user