Ver código fonte

merged branches

David Thornley 6 anos atrás
pai
commit
e88f529535

+ 1
- 7
zlg/ionic.config.json Ver arquivo

3
   "integrations": {
3
   "integrations": {
4
     "cordova": {}
4
     "cordova": {}
5
   },
5
   },
6
-<<<<<<< HEAD
7
   "type": "ionic-angular"
6
   "type": "ionic-angular"
8
-}
9
-=======
10
-  "type": "ionic-angular",
11
-  "app_id": ""
12
-}
13
->>>>>>> dave
7
+}

+ 24
- 28
zlg/package-lock.json Ver arquivo

187
         "write-file-atomic": "^2.3.0"
187
         "write-file-atomic": "^2.3.0"
188
       },
188
       },
189
       "dependencies": {
189
       "dependencies": {
190
+        "@types/node": {
191
+          "version": "6.0.116",
192
+          "resolved": "https://registry.npmjs.org/@types/node/-/node-6.0.116.tgz",
193
+          "integrity": "sha512-vToa8YEeulfyYg1gSOeHjvvIRqrokng62VMSj2hoZrwZNcYrp2h3AWo6KeBVuymIklQUaY5zgVJvVsC4KiiLkQ=="
194
+        },
190
         "ansi-escapes": {
195
         "ansi-escapes": {
191
           "version": "3.1.0",
196
           "version": "3.1.0",
192
           "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz",
197
           "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz",
499
       "resolved": "https://registry.npmjs.org/@types/localforage/-/localforage-0.0.30.tgz",
504
       "resolved": "https://registry.npmjs.org/@types/localforage/-/localforage-0.0.30.tgz",
500
       "integrity": "sha1-PWCmv23aOOP4pGlhFZg3nx9klQk="
505
       "integrity": "sha1-PWCmv23aOOP4pGlhFZg3nx9klQk="
501
     },
506
     },
502
-<<<<<<< HEAD
503
     "@types/lodash": {
507
     "@types/lodash": {
504
-      "version": "4.14.113",
505
-      "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.113.tgz",
506
-      "integrity": "sha512-CINMgfKUnif7fWBqPuGUsZrkER8jGU+ufyhD7FuotPqC1rRViHOJVgPuanN2Y8Vv1TqRnHDKlMnyEQLNq9eMjA=="
508
+      "version": "4.14.116",
509
+      "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.116.tgz",
510
+      "integrity": "sha512-lRnAtKnxMXcYYXqOiotTmJd74uawNWuPnsnPrrO7HiFuE3npE2iQhfABatbYDyxTNqZNuXzcKGhw37R7RjBFLg=="
507
     },
511
     },
508
     "@types/make-dir": {
512
     "@types/make-dir": {
509
       "version": "1.0.3",
513
       "version": "1.0.3",
532
       }
536
       }
533
     },
537
     },
534
     "@types/node": {
538
     "@types/node": {
535
-      "version": "6.0.114",
536
-      "resolved": "https://registry.npmjs.org/@types/node/-/node-6.0.114.tgz",
537
-      "integrity": "sha512-5ViC9dwf1VIAtrOFTvOuN04lJgw28eKjuy0Vg2Bd/fSlxKP2feCSkIw04ZgOENL2ywdWrtbkthp1XVLEjJmouw=="
539
+      "version": "10.5.5",
540
+      "resolved": "https://registry.npmjs.org/@types/node/-/node-10.5.5.tgz",
541
+      "integrity": "sha512-6Qnb1gXbp3g1JX9QVJj3A6ORzc9XCyhokxUKaoonHgNXcQhmk8adhotxfkeK8El9TnFeUuH72yI6jQ5nDJKS6w=="
538
     },
542
     },
539
     "@types/rimraf": {
543
     "@types/rimraf": {
540
       "version": "2.0.2",
544
       "version": "2.0.2",
657
       "requires": {
661
       "requires": {
658
         "@types/rx-lite": "*"
662
         "@types/rx-lite": "*"
659
       }
663
       }
660
-=======
661
-    "@types/node": {
662
-      "version": "10.5.5",
663
-      "resolved": "https://registry.npmjs.org/@types/node/-/node-10.5.5.tgz",
664
-      "integrity": "sha512-6Qnb1gXbp3g1JX9QVJj3A6ORzc9XCyhokxUKaoonHgNXcQhmk8adhotxfkeK8El9TnFeUuH72yI6jQ5nDJKS6w=="
665
->>>>>>> dave
666
     },
664
     },
667
     "@types/socket.io-client": {
665
     "@types/socket.io-client": {
668
       "version": "1.4.32",
666
       "version": "1.4.32",
669
       "resolved": "https://registry.npmjs.org/@types/socket.io-client/-/socket.io-client-1.4.32.tgz",
667
       "resolved": "https://registry.npmjs.org/@types/socket.io-client/-/socket.io-client-1.4.32.tgz",
670
       "integrity": "sha512-Vs55Kq8F+OWvy1RLA31rT+cAyemzgm0EWNeax6BWF8H7QiiOYMJIdcwSDdm5LVgfEkoepsWkS+40+WNb7BUMbg=="
668
       "integrity": "sha512-Vs55Kq8F+OWvy1RLA31rT+cAyemzgm0EWNeax6BWF8H7QiiOYMJIdcwSDdm5LVgfEkoepsWkS+40+WNb7BUMbg=="
671
     },
669
     },
672
-<<<<<<< HEAD
670
+    "@types/sockjs-client": {
671
+      "version": "1.1.0",
672
+      "resolved": "https://registry.npmjs.org/@types/sockjs-client/-/sockjs-client-1.1.0.tgz",
673
+      "integrity": "sha512-F3gD7AakaPGzzdTmvN8HYxlNL+vTnMykYSUoukRTRGUntH4lwjxG5wx3ZwdYBTA3sTo4duxHY+rRZMbIEBxhRQ=="
674
+    },
675
+    "@types/stompjs": {
676
+      "version": "2.3.3",
677
+      "resolved": "https://registry.npmjs.org/@types/stompjs/-/stompjs-2.3.3.tgz",
678
+      "integrity": "sha512-p6+AQ+YS9P0bIYgfyDxKBIoDTFnFPpARSyDdHX+bbpNnBsgg3/fKwK6jwROur4CHiyjgAvl5wcIxz2rOvOl7rQ==",
679
+      "requires": {
680
+        "@types/node": "*"
681
+      }
682
+    },
673
     "@types/string-width": {
683
     "@types/string-width": {
674
       "version": "2.0.0",
684
       "version": "2.0.0",
675
       "resolved": "https://registry.npmjs.org/@types/string-width/-/string-width-2.0.0.tgz",
685
       "resolved": "https://registry.npmjs.org/@types/string-width/-/string-width-2.0.0.tgz",
684
       "version": "0.0.29",
694
       "version": "0.0.29",
685
       "resolved": "https://registry.npmjs.org/@types/through/-/through-0.0.29.tgz",
695
       "resolved": "https://registry.npmjs.org/@types/through/-/through-0.0.29.tgz",
686
       "integrity": "sha512-9a7C5VHh+1BKblaYiq+7Tfc+EOmjMdZaD1MYtkQjSoxgB69tBjW98ry6SKsi4zEIWztLOMRuL87A3bdT/Fc/4w==",
696
       "integrity": "sha512-9a7C5VHh+1BKblaYiq+7Tfc+EOmjMdZaD1MYtkQjSoxgB69tBjW98ry6SKsi4zEIWztLOMRuL87A3bdT/Fc/4w==",
687
-=======
688
-    "@types/sockjs-client": {
689
-      "version": "1.1.0",
690
-      "resolved": "https://registry.npmjs.org/@types/sockjs-client/-/sockjs-client-1.1.0.tgz",
691
-      "integrity": "sha512-F3gD7AakaPGzzdTmvN8HYxlNL+vTnMykYSUoukRTRGUntH4lwjxG5wx3ZwdYBTA3sTo4duxHY+rRZMbIEBxhRQ=="
692
-    },
693
-    "@types/stompjs": {
694
-      "version": "2.3.3",
695
-      "resolved": "https://registry.npmjs.org/@types/stompjs/-/stompjs-2.3.3.tgz",
696
-      "integrity": "sha512-p6+AQ+YS9P0bIYgfyDxKBIoDTFnFPpARSyDdHX+bbpNnBsgg3/fKwK6jwROur4CHiyjgAvl5wcIxz2rOvOl7rQ==",
697
->>>>>>> dave
698
       "requires": {
697
       "requires": {
699
         "@types/node": "*"
698
         "@types/node": "*"
700
       }
699
       }
701
     },
700
     },
702
-<<<<<<< HEAD
703
     "@types/untildify": {
701
     "@types/untildify": {
704
       "version": "3.0.0",
702
       "version": "3.0.0",
705
       "resolved": "https://registry.npmjs.org/@types/untildify/-/untildify-3.0.0.tgz",
703
       "resolved": "https://registry.npmjs.org/@types/untildify/-/untildify-3.0.0.tgz",
727
         "through": ">=2.2.7 <3"
725
         "through": ">=2.2.7 <3"
728
       }
726
       }
729
     },
727
     },
730
-=======
731
->>>>>>> dave
732
     "abbrev": {
728
     "abbrev": {
733
       "version": "1.1.1",
729
       "version": "1.1.1",
734
       "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
730
       "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",

+ 3
- 3
zlg/src/app/app.module.ts Ver arquivo

15
 import { Signup } from '../pages/signup/signup'
15
 import { Signup } from '../pages/signup/signup'
16
 import { HomePage } from '../pages/home/home';
16
 import { HomePage } from '../pages/home/home';
17
 import { WebsocketProvider } from '../providers/websocket/websocket';
17
 import { WebsocketProvider } from '../providers/websocket/websocket';
18
-import { UserProvider } from '../providers/user/user';
18
+import { UserProvider} from '../providers/user/UserProvider';
19
 import { PostServiceProvider } from '../providers/post-service/post-service';
19
 import { PostServiceProvider } from '../providers/post-service/post-service';
20
 import { HttpClient } from '@angular/common/http';
20
 import { HttpClient } from '@angular/common/http';
21
 import { HttpClientModule } from '@angular/common/http';
21
 import { HttpClientModule } from '@angular/common/http';
26
     HomePage,
26
     HomePage,
27
     Welcome,
27
     Welcome,
28
     Login,
28
     Login,
29
-    Signup
29
+    Signup,
30
   ],
30
   ],
31
   imports: [
31
   imports: [
32
     BrowserModule,
32
     BrowserModule,
48
     {provide: ErrorHandler, useClass: IonicErrorHandler},
48
     {provide: ErrorHandler, useClass: IonicErrorHandler},
49
     WebsocketProvider,
49
     WebsocketProvider,
50
     UserProvider,
50
     UserProvider,
51
-    PostServiceProvider
51
+    PostServiceProvider,
52
   ]
52
   ]
53
 })
53
 })
54
 export class AppModule {}
54
 export class AppModule {}

+ 35
- 23
zlg/src/pages/home/home.ts Ver arquivo

14
 })
14
 })
15
 export class HomePage implements OnInit{
15
 export class HomePage implements OnInit{
16
 
16
 
17
-<<<<<<< HEAD
18
-  constructor(public navCtrl: NavController, public menu: MenuController) {
19
-    this.menu.enable(true);
20
-=======
17
+  // constructor(public navCtrl: NavController, public menu: MenuController) {
18
+  //   this.menu.enable(true);
21
   constructor(public navCtrl: NavController, private postProvider: PostServiceProvider) {
19
   constructor(public navCtrl: NavController, private postProvider: PostServiceProvider) {
22
     this.getPosts();
20
     this.getPosts();
23
->>>>>>> dave
24
   }
21
   }
25
 
22
 
26
   private stompClient ;
23
   private stompClient ;
39
     this.getPosts();
36
     this.getPosts();
40
     this.connect();  
37
     this.connect();  
41
   }
38
   }
42
-  connect() {
43
-    const socket = new SockJS('https://fast-headland-39537.herokuapp.com/vault-socket');
44
-    this.stompClient = Stomp.over(socket);
45
-
46
-    this.stompClient.connect({}, (frame) => {
47
-      console.log('Connected: ' + frame);
48
-<<<<<<< HEAD
49
-      this.stompClient.subscribe('/topic/posts', (post) => {
50
-        this.posts.unshift(JSON.parse(post.body));
51
-=======
52
-      _this.stompClient.subscribe('/topic/posts', (post) => {
53
-        _this.posts.unshift(JSON.parse(post.body));
54
->>>>>>> dave
55
-     });
56
-    });
57
-  }
39
+
40
+//   connect() {
41
+//     const socket = new SockJS('https://fast-headland-39537.herokuapp.com/vault-socket');
42
+//     this.stompClient = Stomp.over(socket);
43
+
44
+//     this.stompClient.connect({}, (frame) => {
45
+//       console.log('Connected: ' + frame);
46
+//       this.stompClient.subscribe('/topic/posts', (post) => {
47
+//         this.posts.unshift(JSON.parse(post.body)));
48
+//       _this.stompClient.subscribe('/topic/posts', (post) => {
49
+//         _this.posts.unshift(JSON.parse(post.body));
50
+//      });
51
+//     }
52
+//   }
53
+//   );
54
+  
55
+// }
56
+
57
+connect() {
58
+  const socket = new SockJS('https://fast-headland-39537.herokuapp.com/vault-socket');
59
+  this.stompClient = Stomp.over(socket);
60
+
61
+  const _this = this; //i hope i am not expected to understand this
62
+  this.stompClient.connect({}, function (frame) {
63
+    console.log('Connected: ' + frame);
64
+    _this.stompClient.subscribe('/topic/posts', (post) => {
65
+      _this.posts.unshift(JSON.parse(post.body));
66
+   });
67
+  });
68
+}
58
 
69
 
59
   getPosts() {
70
   getPosts() {
60
     this.postProvider.getAllPosts(this.page)
71
     this.postProvider.getAllPosts(this.page)
94
          
105
          
95
 
106
 
96
   goToUsersFeed(post) {
107
   goToUsersFeed(post) {
108
+    console.log(post.id);
97
     let params = {id: post.userId};
109
     let params = {id: post.userId};
98
-    //this.navCtrl.push('UsersFeed', params);
110
+    this.navCtrl.push('UserfeedPage', params);
99
   }
111
   }
100
 
112
 
101
 
113
 
104
     this.postInput = "";
116
     this.postInput = "";
105
   }
117
   }
106
 
118
 
107
-
119
+  
108
 
120
 
109
 }
121
 }

+ 3
- 3
zlg/src/pages/userfeed/userfeed.ts Ver arquivo

1
 import { Component } from '@angular/core';
1
 import { Component } from '@angular/core';
2
 import { IonicPage, NavController, NavParams } from 'ionic-angular';
2
 import { IonicPage, NavController, NavParams } from 'ionic-angular';
3
-import { UserService } from '../../providers/userProvider';
3
+import { UserProvider } from '../../providers/user/UserProvider';
4
 
4
 
5
 /**
5
 /**
6
  * Generated class for the UserfeedPage page.
6
  * Generated class for the UserfeedPage page.
22
   postArr: Array<any>;
22
   postArr: Array<any>;
23
 
23
 
24
   constructor(public navCtrl: NavController, public navParams: NavParams,
24
   constructor(public navCtrl: NavController, public navParams: NavParams,
25
-              public userService: UserService) {
25
+              public UserProvider: UserProvider) {
26
     //this.user.name = this.navParams.get('name');
26
     //this.user.name = this.navParams.get('name');
27
     this.userid = this.navParams.get('id');
27
     this.userid = this.navParams.get('id');
28
   }
28
   }
32
   }
32
   }
33
 
33
 
34
   getAllPostsByUserId(){
34
   getAllPostsByUserId(){
35
-    return this.userService.getAllPostsByUserId(this.userid).subscribe(response => {
35
+    return this.UserProvider.getAllPostsByUserId(this.userid).subscribe(response => {
36
       console.log("response: " + response);
36
       console.log("response: " + response);
37
       this.postArr = response;
37
       this.postArr = response;
38
       console.log("postarr: " + this.postArr);
38
       console.log("postarr: " + this.postArr);

+ 0
- 19
zlg/src/providers/user/user.ts Ver arquivo

1
-import { HttpClient } from '@angular/common/http';
2
-import { Injectable } from '@angular/core';
3
-
4
-/*
5
-  Generated class for the UserProvider provider.
6
-
7
-  See https://angular.io/guide/dependency-injection for more info on providers
8
-  and Angular DI.
9
-*/
10
-@Injectable()
11
-export class UserProvider {
12
-
13
-  constructor(public http: HttpClient) {
14
-    console.log('Hello UserProvider Provider');
15
-  }
16
-
17
-  
18
-
19
-}

zlg/src/providers/userProvider.ts → zlg/src/providers/user/userProvider.ts Ver arquivo

3
 import {Injectable} from "@angular/core";
3
 import {Injectable} from "@angular/core";
4
 
4
 
5
 @Injectable()
5
 @Injectable()
6
-export class UserService{
6
+export class UserProvider{
7
 
7
 
8
 
8
 
9
   public API = "https://fast-headland-39537.herokuapp.com";
9
   public API = "https://fast-headland-39537.herokuapp.com";