diff --git a/src/pages/settings/settings.ts b/src/pages/settings/settings.ts index 6a5b6f9..a2633b0 100644 --- a/src/pages/settings/settings.ts +++ b/src/pages/settings/settings.ts @@ -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); } diff --git a/src/pages/stream/stream.ts b/src/pages/stream/stream.ts index bb6a3e4..903ab5a 100644 --- a/src/pages/stream/stream.ts +++ b/src/pages/stream/stream.ts @@ -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) {