Browse Source

Reply tweet with login page design

rohit.gowda 4 years ago
parent
commit
d0d32e8c68

+ 0 - 1
app/src/components/tweet-actions/tweet-actions.ts

@@ -33,7 +33,6 @@ export class TweetActionsComponent {
   }
 
   get favoriteCount() {
-    console.log('favoriteCount');
     if (this.data["retweeted_status"]) {
       return this.data["retweeted_status"]["favorite_count"];
     } else {

+ 0 - 1
app/src/components/tweet-body/tweet-body.ts

@@ -147,7 +147,6 @@ export class TweetBodyComponent {
   }
 
   private getUrlsForTweetArray(urls) {
-    console.log('url recovered are:',urls);
     const res = [];
     urls.forEach(element => {
       console.log('element in geturl is:',element);

+ 0 - 1
app/src/components/tweet/tweet.ts

@@ -17,7 +17,6 @@ export class TweetComponent {
   constructor() {}
 
   get user() {
-    console.log('inside tweet.html tihs.data is:', this.data);
     if (this.data["retweeted_status"]) {
       return this.data["retweeted_status"]["user"];
     } else {

+ 4 - 7
app/src/pages/mock-login/mock-login.html

@@ -1,22 +1,19 @@
 <h2>Login</h2>
-<form [formGroup]="loginForm" (ngSubmit)="onSubmit()">
+<form [formGroup]="loginForm" class="login" (ngSubmit)="onSubmit()">
     <div class="form-group">
-        <label for="username">Username</label>
-        <input type="text" formControlName="username" class="form-control" [ngClass]="{ 'is-invalid': submitted && f.username.errors }" />
+        <input type="text" formControlName="username"  placeholder="Username" class="form-control" [ngClass]="{ 'is-invalid': submitted && f.username.errors }" />
         <div *ngIf="submitted && f.username.errors" class="invalid-feedback">
             <div *ngIf="f.username.errors.required">Username is required</div>
         </div>
     </div>
     <div class="form-group">
-        <label for="password">Password</label>
-        <input type="password" formControlName="password" class="form-control" [ngClass]="{ 'is-invalid': submitted && f.password.errors }" />
+        <input type="password" formControlName="password" placeholder="Password"  class="form-control" [ngClass]="{ 'is-invalid': submitted && f.password.errors }" />
         <div *ngIf="submitted && f.password.errors" class="invalid-feedback">
             <div *ngIf="f.password.errors.required">Password is required</div>
         </div>
     </div>
     <div class="form-group">
-        <button [disabled]="loading" class="btn btn-primary">Login</button>
+        <button [disabled]="loading" class="btn btn-primary login-btn">Login</button>
         <img *ngIf="loading" src="data:image/gif;base64,R0lGODlhEAAQAPIAAP///wAAAMLCwkJCQgAAAGJiYoKCgpKSkiH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAEAAQAAADMwi63P4wyklrE2MIOggZnAdOmGYJRbExwroUmcG2LmDEwnHQLVsYOd2mBzkYDAdKa+dIAAAh+QQJCgAAACwAAAAAEAAQAAADNAi63P5OjCEgG4QMu7DmikRxQlFUYDEZIGBMRVsaqHwctXXf7WEYB4Ag1xjihkMZsiUkKhIAIfkECQoAAAAsAAAAABAAEAAAAzYIujIjK8pByJDMlFYvBoVjHA70GU7xSUJhmKtwHPAKzLO9HMaoKwJZ7Rf8AYPDDzKpZBqfvwQAIfkECQoAAAAsAAAAABAAEAAAAzMIumIlK8oyhpHsnFZfhYumCYUhDAQxRIdhHBGqRoKw0R8DYlJd8z0fMDgsGo/IpHI5TAAAIfkECQoAAAAsAAAAABAAEAAAAzIIunInK0rnZBTwGPNMgQwmdsNgXGJUlIWEuR5oWUIpz8pAEAMe6TwfwyYsGo/IpFKSAAAh+QQJCgAAACwAAAAAEAAQAAADMwi6IMKQORfjdOe82p4wGccc4CEuQradylesojEMBgsUc2G7sDX3lQGBMLAJibufbSlKAAAh+QQJCgAAACwAAAAAEAAQAAADMgi63P7wCRHZnFVdmgHu2nFwlWCI3WGc3TSWhUFGxTAUkGCbtgENBMJAEJsxgMLWzpEAACH5BAkKAAAALAAAAAAQABAAAAMyCLrc/jDKSatlQtScKdceCAjDII7HcQ4EMTCpyrCuUBjCYRgHVtqlAiB1YhiCnlsRkAAAOwAAAAAAAAAAAA==" />
-        <a  class="btn btn-link">Register</a>
     </div>
 </form>

+ 1 - 1
app/src/pages/mock-login/mock-login.ts

@@ -38,7 +38,7 @@ export class MockLoginPage implements OnInit {
 
         else{
             console.log('loginform control',this.loginForm);
-            if(this.loginForm.value['username'] == 'test' && this.loginForm.value['password'] == 'test' )
+            if(this.loginForm.value['username'].toLowerCase() == 'test' && this.loginForm.value['password'].toLowerCase() == 'test' )
             this.navCtrl.setRoot(HomePage);
         }
     }

+ 2 - 1
app/src/pages/write-tweet/write-tweet.html

@@ -10,7 +10,8 @@
   <quoted-status *ngIf="retweet" [data]="retweet"></quoted-status>
   <!-- Show tweet to reply to -->
   <ion-label *ngIf="replyTweet" color="primary">Reply to</ion-label>
-  <quoted-status *ngIf="replyTweet" [data]="replyTweet.data"></quoted-status>
+  <!-- <quoted-status *ngIf="replyTweet" [data]="replyTweet.data"></quoted-status> -->
+  <quoted-status *ngIf="replyTweet" [data]="replyTweet"></quoted-status>
   <!-- Form to write a tweet -->
   <form [formGroup]="tweet" (ngSubmit)="submitTweet()">
     <ion-item class="padding-0">

+ 4 - 8
app/src/pages/write-tweet/write-tweet.ts

@@ -93,12 +93,13 @@ export class WriteTweetPage {
         console.log("retweeted tweet", this.retweet);
       } else {
         this.retweet = await this.twitter.fetchTweet(this.retweetId);
-        console.log('this.retweet is:', this.retweet);
       }
     }
     if (this.replyToStatusId) {
-      if (this.storage.get("mockup"))
+      if (this.storage.get("mockup")){
         console.log("replying in mockup");
+        this.replyTweet = await this.mockProv.fetchTweet(this.replyToStatusId);
+      }
       else
         this.replyTweet = await this.twitter.fetchTweet(this.replyToStatusId);
       console.log('this.replyTweet is:', this.replyTweet);
@@ -134,20 +135,15 @@ export class WriteTweetPage {
   }
 
   async submitTweet() {
-    console.log('submitting tweet');
     const loading = this.loadingCtrl.create();
     loading.present();
-    console.log("storage mockup value: ", this.storage.get("mockup"));
     if (await this.storage.get("mockup")) {
       console.log('value of the tweet is:', this.tweet.value);
-      console.log('publishing tweet for mock', this.tweet.value["text"]);
       await this.mockProv.writeTweet(this.tweet.value["text"],
         this.tweet.value.p2p,
         this.retweet,
-        this.replyToStatusId);
-      // loading.dismiss();
+        this.replyTweet);
     } else {
-      console.log('in else ');
       if (this.tweet.value.p2p) {
         loading.setContent("Validate keys...");
         if (

+ 9 - 4
app/src/providers/mock-provider/mock-provider.ts

@@ -61,9 +61,8 @@ export class MockProvider {
   public async replyTweet() {}
 
 
-  public writeTweet(twt: string, isPrivate: boolean, retwt, replyid) {
-    console.log('inside writetweet', retwt, replyid);
-    // console.log('inside writetweet obj is:',this.mockTweets[0].full_text);
+  public writeTweet(twt: string, isPrivate: boolean, retwt, reply) {
+    console.log('inside writetweet', retwt, reply);
     let newTweet = Object.assign({}, this.mockTweets[0]);
     newTweet.full_text = twt;
     newTweet.id = Math.floor(100000 + Math.random() * 900000);
@@ -75,7 +74,13 @@ export class MockProvider {
       newTweet.quoted_status_id = retwt.id;
       newTweet.quoted_status_id_str = retwt.id_str;
     }
-    newTweet.replyToStatusId = replyid;
+    if(reply){
+      newTweet.in_reply_to_screen_name=reply.user.name;
+      newTweet.in_reply_to_status_id = reply.id;
+      newTweet.in_reply_to_status_id_str = reply.id_str;
+      newTweet.in_reply_to_user_id = reply.user.id;
+      newTweet.in_reply_to_user_id_str = reply.user.id_str;
+    }
     if (isPrivate) {
       newTweet.private_tweet = true;
     }