Commit 83d1ff25 authored by Morgan McMillian's avatar Morgan McMillian

wire up cc on reply setting and refresh timeline on back event

parent 3f57ebe1
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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment