Setting to hide images in timeline resolves #75
This commit is contained in:
parent
198b804f2e
commit
77db17acd4
4 changed files with 36 additions and 1 deletions
|
@ -40,5 +40,13 @@
|
|||
<ion-toggle [(ngModel)]="set_cc" (ionChange)="updateCc()"></ion-toggle>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-label>
|
||||
<h2>Hide images</h2>
|
||||
<p>Hide images in posts</p>
|
||||
</ion-label>
|
||||
<ion-toggle [(ngModel)]="set_hideimg" (ionChange)="updateHideImg()"></ion-toggle>
|
||||
</ion-item>
|
||||
|
||||
</ion-list>
|
||||
</ion-content>
|
||||
|
|
|
@ -18,6 +18,7 @@ export class SettingsPage {
|
|||
private set_unified: boolean;
|
||||
private set_cc: boolean;
|
||||
private set_default: string;
|
||||
private set_hideimg: boolean;
|
||||
|
||||
constructor(public navCtrl: NavController, private storage: Storage, public navParams: NavParams,
|
||||
public events: Events) {
|
||||
|
@ -41,6 +42,12 @@ export class SettingsPage {
|
|||
}).catch(err => {
|
||||
console.log('ERROR: ' + err);
|
||||
});
|
||||
|
||||
this.storage.get('hideimg').then((val) => {
|
||||
this.set_hideimg = val;
|
||||
}).catch(err => {
|
||||
console.log('ERROR: ' + err);
|
||||
});
|
||||
}
|
||||
|
||||
ionViewDidLeave() {
|
||||
|
@ -59,4 +66,8 @@ export class SettingsPage {
|
|||
this.storage.set('timeline', this.set_default);
|
||||
}
|
||||
|
||||
updateHideImg() {
|
||||
this.storage.set('hideimg', this.set_hideimg);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -54,7 +54,18 @@
|
|||
<div *ngIf="post.raw">
|
||||
<div *ngFor="let r of post.raw">
|
||||
<div *ngIf="r.type == 'io.pnut.core.oembed'">
|
||||
<ion-item><img src="{{ r.value.thumbnail_url || r.value.url }}" (click)="showImage(r.value.url)"></ion-item>
|
||||
<ion-item>
|
||||
<div *ngIf="hideImg; then imgbtn else thumbnail"></div>
|
||||
<ng-template #imgbtn >
|
||||
<button ion-button icon-start (click)="showImage(r.value.url)">
|
||||
<ion-icon name="image"></ion-icon>
|
||||
{{ r.value.title }}
|
||||
</button>
|
||||
</ng-template>
|
||||
<ng-template #thumbnail >
|
||||
<img src="{{ r.value.thumbnail_url || r.value.url }}" (click)="showImage(r.value.url)">
|
||||
</ng-template>
|
||||
</ion-item>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -33,6 +33,7 @@ export class StreamPage {
|
|||
showScrollBtn: boolean = false;
|
||||
showUnified: boolean;
|
||||
ccOnReply: boolean = false;
|
||||
hideImg: boolean = false;
|
||||
|
||||
constructor(public navCtrl: NavController, public navParams: NavParams, public modalCtrl: ModalController,
|
||||
private changeDetectorRef: ChangeDetectorRef, public toastCtrl: ToastController, private storage: Storage,
|
||||
|
@ -43,6 +44,10 @@ export class StreamPage {
|
|||
this.ccOnReply = val;
|
||||
});
|
||||
|
||||
this.storage.get('hideimg').then((val) => {
|
||||
this.hideImg = val;
|
||||
});
|
||||
|
||||
this.storage.get('unified').then((val) => {
|
||||
this.showUnified = val;
|
||||
|
||||
|
|
Reference in a new issue