wire up cc on reply setting and refresh timeline on back event
This commit is contained in:
parent
3f57ebe195
commit
83d1ff2555
2 changed files with 17 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
|||
import { Component } from '@angular/core';
|
||||
import { NavController, NavParams } from 'ionic-angular';
|
||||
import { Storage } from '@ionic/storage';
|
||||
import { Events } from 'ionic-angular';
|
||||
|
||||
/**
|
||||
* Generated class for the SettingsPage page.
|
||||
|
@ -17,7 +18,8 @@ export class SettingsPage {
|
|||
private set_unified: boolean;
|
||||
private set_cc: boolean;
|
||||
|
||||
constructor(public navCtrl: NavController, private storage: Storage, public navParams: NavParams) {
|
||||
constructor(public navCtrl: NavController, private storage: Storage, public navParams: NavParams,
|
||||
public events: Events) {
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
|
@ -34,6 +36,10 @@ export class SettingsPage {
|
|||
});
|
||||
}
|
||||
|
||||
ionViewDidLeave() {
|
||||
this.events.publish('stream:reload', {});
|
||||
}
|
||||
|
||||
updateUnified() {
|
||||
this.storage.set('unified', this.set_unified);
|
||||
}
|
||||
|
|
|
@ -29,12 +29,17 @@ export class StreamPage {
|
|||
myUsername: string;
|
||||
showScrollBtn: boolean = false;
|
||||
showUnified: boolean;
|
||||
ccOnReply: boolean = false;
|
||||
|
||||
constructor(public navCtrl: NavController, public navParams: NavParams, public modalCtrl: ModalController,
|
||||
private changeDetectorRef: ChangeDetectorRef, public toastCtrl: ToastController, private storage: Storage,
|
||||
public popoverCtrl: PopoverController, public events: Events) {
|
||||
// console.log(JSON.stringify(navParams));
|
||||
|
||||
this.storage.get('cc').then((val) => {
|
||||
this.ccOnReply = val;
|
||||
});
|
||||
|
||||
this.storage.get('unified').then((val) => {
|
||||
this.showUnified = val;
|
||||
|
||||
|
@ -274,13 +279,13 @@ export class StreamPage {
|
|||
}
|
||||
|
||||
showReplyPost(postData) {
|
||||
let newPostModal = this.modalCtrl.create(NewPostModal, {type: 'reply', post: postData, me: this.myUsername});
|
||||
let newPostModal = this.modalCtrl.create(NewPostModal, {type: 'reply', post: postData, me: this.myUsername, cc: this.ccOnReply});
|
||||
newPostModal.present();
|
||||
}
|
||||
|
||||
showQuotedPost(postData) {
|
||||
console.log(postData);
|
||||
let newPostModal = this.modalCtrl.create(NewPostModal, {type: 'quote', post: postData, me: this.myUsername});
|
||||
let newPostModal = this.modalCtrl.create(NewPostModal, {type: 'quote', post: postData, me: this.myUsername, cc: this.ccOnReply});
|
||||
newPostModal.present();
|
||||
}
|
||||
|
||||
|
@ -401,6 +406,9 @@ export class NewPostModal {
|
|||
|
||||
parseMentions(mentions) {
|
||||
let mtext = ""
|
||||
if (this.navParams.data.cc) {
|
||||
mtext += "\n/";
|
||||
}
|
||||
for(var i = 0; i < mentions.length; i++) {
|
||||
let mu = mentions[i].text;
|
||||
if (mu !== this.myUsername) {
|
||||
|
|
Reference in a new issue