Bladeren bron

merged branches

David Thornley 6 jaren geleden
bovenliggende
commit
e88f529535

+ 1
- 7
zlg/ionic.config.json Bestand weergeven

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

+ 24
- 28
zlg/package-lock.json Bestand weergeven

@@ -187,6 +187,11 @@
187 187
         "write-file-atomic": "^2.3.0"
188 188
       },
189 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 195
         "ansi-escapes": {
191 196
           "version": "3.1.0",
192 197
           "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz",
@@ -499,11 +504,10 @@
499 504
       "resolved": "https://registry.npmjs.org/@types/localforage/-/localforage-0.0.30.tgz",
500 505
       "integrity": "sha1-PWCmv23aOOP4pGlhFZg3nx9klQk="
501 506
     },
502
-<<<<<<< HEAD
503 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 512
     "@types/make-dir": {
509 513
       "version": "1.0.3",
@@ -532,9 +536,9 @@
532 536
       }
533 537
     },
534 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 543
     "@types/rimraf": {
540 544
       "version": "2.0.2",
@@ -657,19 +661,25 @@
657 661
       "requires": {
658 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 665
     "@types/socket.io-client": {
668 666
       "version": "1.4.32",
669 667
       "resolved": "https://registry.npmjs.org/@types/socket.io-client/-/socket.io-client-1.4.32.tgz",
670 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 683
     "@types/string-width": {
674 684
       "version": "2.0.0",
675 685
       "resolved": "https://registry.npmjs.org/@types/string-width/-/string-width-2.0.0.tgz",
@@ -684,22 +694,10 @@
684 694
       "version": "0.0.29",
685 695
       "resolved": "https://registry.npmjs.org/@types/through/-/through-0.0.29.tgz",
686 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 697
       "requires": {
699 698
         "@types/node": "*"
700 699
       }
701 700
     },
702
-<<<<<<< HEAD
703 701
     "@types/untildify": {
704 702
       "version": "3.0.0",
705 703
       "resolved": "https://registry.npmjs.org/@types/untildify/-/untildify-3.0.0.tgz",
@@ -727,8 +725,6 @@
727 725
         "through": ">=2.2.7 <3"
728 726
       }
729 727
     },
730
-=======
731
->>>>>>> dave
732 728
     "abbrev": {
733 729
       "version": "1.1.1",
734 730
       "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",

+ 3
- 3
zlg/src/app/app.module.ts Bestand weergeven

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

+ 35
- 23
zlg/src/pages/home/home.ts Bestand weergeven

@@ -14,13 +14,10 @@ import { PostServiceProvider } from '../../providers/post-service/post-service';
14 14
 })
15 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 19
   constructor(public navCtrl: NavController, private postProvider: PostServiceProvider) {
22 20
     this.getPosts();
23
->>>>>>> dave
24 21
   }
25 22
 
26 23
   private stompClient ;
@@ -39,22 +36,36 @@ export class HomePage implements OnInit{
39 36
     this.getPosts();
40 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 70
   getPosts() {
60 71
     this.postProvider.getAllPosts(this.page)
@@ -94,8 +105,9 @@ export class HomePage implements OnInit{
94 105
          
95 106
 
96 107
   goToUsersFeed(post) {
108
+    console.log(post.id);
97 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,6 +116,6 @@ export class HomePage implements OnInit{
104 116
     this.postInput = "";
105 117
   }
106 118
 
107
-
119
+  
108 120
 
109 121
 }

+ 3
- 3
zlg/src/pages/userfeed/userfeed.ts Bestand weergeven

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

+ 0
- 19
zlg/src/providers/user/user.ts Bestand weergeven

@@ -1,19 +0,0 @@
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 Bestand weergeven

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