|
@@ -1,5 +1,5 @@
|
|
import { Component } from '@angular/core';
|
|
import { Component } from '@angular/core';
|
|
-import { IonicPage, NavController, NavParams } from 'ionic-angular';
|
|
|
|
|
|
+import { IonicPage, NavController, NavParams, AlertController, LoadingController } from 'ionic-angular';
|
|
import { FormBuilder, Validators, FormGroup } from '@angular/forms';
|
|
import { FormBuilder, Validators, FormGroup } from '@angular/forms';
|
|
import { TwitterApiProvider } from '../../providers/twitter-api/twitter-api';
|
|
import { TwitterApiProvider } from '../../providers/twitter-api/twitter-api';
|
|
|
|
|
|
@@ -23,7 +23,8 @@ export class WriteTweetPage {
|
|
public navCtrl: NavController,
|
|
public navCtrl: NavController,
|
|
public navParams: NavParams,
|
|
public navParams: NavParams,
|
|
private formBuilder: FormBuilder,
|
|
private formBuilder: FormBuilder,
|
|
- private twitter: TwitterApiProvider
|
|
|
|
|
|
+ private twitter: TwitterApiProvider,
|
|
|
|
+ private alertCtrl: AlertController
|
|
) {
|
|
) {
|
|
this.tweet = this.formBuilder.group({
|
|
this.tweet = this.formBuilder.group({
|
|
text: ['', Validators.maxLength(140)],
|
|
text: ['', Validators.maxLength(140)],
|
|
@@ -36,15 +37,25 @@ export class WriteTweetPage {
|
|
}
|
|
}
|
|
|
|
|
|
get tweetCharProgress() {
|
|
get tweetCharProgress() {
|
|
- let progress = 1 - this.tweet.value["text"].length/140;
|
|
|
|
|
|
+ let progress = 1 - this.tweet.value["text"].length / 140;
|
|
let radius = 8;
|
|
let radius = 8;
|
|
let circumference = Math.PI * radius * 2;
|
|
let circumference = Math.PI * radius * 2;
|
|
return progress * circumference;
|
|
return progress * circumference;
|
|
}
|
|
}
|
|
|
|
|
|
submitTweet() {
|
|
submitTweet() {
|
|
- // Todo: navigate to user timeline after successfully post the tweet + handle error
|
|
|
|
- this.twitter.tweet(this.tweet.value["text"]);
|
|
|
|
|
|
+
|
|
|
|
+ if (this.tweet.value.p2p) {
|
|
|
|
+ this.alertCtrl.create({
|
|
|
|
+ title: 'Private Mode',
|
|
|
|
+ subTitle: 'Your tweet will be encrypted and send to the private network. TODO!',
|
|
|
|
+ buttons: ['OK']
|
|
|
|
+ }).present();
|
|
|
|
+ } else {
|
|
|
|
+ this.twitter.tweet(this.tweet.value["text"]);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.navCtrl.pop();
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|