diff --git a/package.json b/package.json index 486576a..de45571 100644 --- a/package.json +++ b/package.json @@ -1,69 +1,69 @@ { - "name": "Goober", - "version": "0.0.1", - "author": "Ionic Framework", - "homepage": "http://ionicframework.com/", - "private": true, - "scripts": { - "clean": "ionic-app-scripts clean", - "build": "ionic-app-scripts build", - "lint": "ionic-app-scripts lint", - "ionic:build": "ionic-app-scripts build", - "ionic:serve": "ionic-app-scripts serve" - }, - "dependencies": { - "@angular/common": "4.1.2", - "@angular/compiler": "4.1.2", - "@angular/compiler-cli": "4.1.2", - "@angular/core": "4.1.2", - "@angular/forms": "4.1.2", - "@angular/http": "4.1.2", - "@angular/platform-browser": "4.1.2", - "@angular/platform-browser-dynamic": "4.1.2", - "@ionic-native/core": "3.10.2", - "@ionic-native/splash-screen": "3.10.2", - "@ionic-native/status-bar": "3.10.2", - "@ionic/storage": "2.0.1", - "cordova-android": "^6.2.3", - "cordova-blackberry10": "^3.8.0", - "cordova-plugin-console": "^1.0.5", - "cordova-plugin-device": "^1.1.4", - "cordova-plugin-inappbrowser": "^1.7.1", - "cordova-plugin-splashscreen": "^4.0.3", - "cordova-plugin-statusbar": "^2.2.2", - "cordova-plugin-whitelist": "^1.3.1", - "cordova-windows": "^5.0.0", - "ionic-angular": "3.3.0", - "ionic-plugin-keyboard": "^2.2.1", - "ionicons": "3.0.0", - "moment": "^2.18.1", - "ng2-cordova-oauth": "0.0.8", - "pnut-butter": "^0.8.1", - "rxjs": "5.1.1", - "sw-toolbox": "3.6.0", - "zone.js": "0.8.11" - }, - "devDependencies": { - "@ionic/app-scripts": "1.3.7", - "@ionic/cli-plugin-cordova": "1.3.0", - "@ionic/cli-plugin-ionic-angular": "1.3.0", - "typescript": "2.3.3" - }, - "description": "An Ionic project", - "cordova": { - "plugins": { - "cordova-plugin-console": {}, - "cordova-plugin-device": {}, - "cordova-plugin-splashscreen": {}, - "cordova-plugin-statusbar": {}, - "cordova-plugin-whitelist": {}, - "ionic-plugin-keyboard": {}, - "cordova-plugin-inappbrowser": {} + "name": "Goober", + "version": "0.0.1", + "author": "Ionic Framework", + "homepage": "http://ionicframework.com/", + "private": true, + "scripts": { + "clean": "ionic-app-scripts clean", + "build": "ionic-app-scripts build", + "lint": "ionic-app-scripts lint", + "ionic:build": "ionic-app-scripts build", + "ionic:serve": "ionic-app-scripts serve" }, - "platforms": [ - "android", - "blackberry10", - "windows" - ] - } -} + "dependencies": { + "@angular/common": "4.1.2", + "@angular/compiler": "4.1.2", + "@angular/compiler-cli": "4.1.2", + "@angular/core": "4.1.2", + "@angular/forms": "4.1.2", + "@angular/http": "4.1.2", + "@angular/platform-browser": "4.1.2", + "@angular/platform-browser-dynamic": "4.1.2", + "@ionic-native/core": "3.10.2", + "@ionic-native/splash-screen": "3.10.2", + "@ionic-native/status-bar": "3.10.2", + "@ionic/storage": "2.0.1", + "cordova-android": "^6.2.3", + "cordova-blackberry10": "^3.8.0", + "cordova-plugin-console": "^1.0.5", + "cordova-plugin-device": "^1.1.4", + "cordova-plugin-inappbrowser": "^1.7.1", + "cordova-plugin-splashscreen": "^4.0.3", + "cordova-plugin-statusbar": "^2.2.2", + "cordova-plugin-whitelist": "^1.3.1", + "cordova-windows": "^5.0.0", + "ionic-angular": "3.3.0", + "ionic-plugin-keyboard": "^2.2.1", + "ionicons": "3.0.0", + "moment": "^2.18.1", + "ng2-cordova-oauth": "0.0.8", + "pnut-butter": "^0.8.1", + "rxjs": "5.1.1", + "sw-toolbox": "3.6.0", + "zone.js": "0.8.11" + }, + "devDependencies": { + "@ionic/app-scripts": "1.3.7", + "@ionic/cli-plugin-cordova": "1.3.0", + "@ionic/cli-plugin-ionic-angular": "1.3.0", + "typescript": "2.3.3" + }, + "description": "An Ionic project", + "cordova": { + "plugins": { + "cordova-plugin-console": {}, + "cordova-plugin-device": {}, + "cordova-plugin-splashscreen": {}, + "cordova-plugin-statusbar": {}, + "cordova-plugin-whitelist": {}, + "ionic-plugin-keyboard": {}, + "cordova-plugin-inappbrowser": {} + }, + "platforms": [ + "android", + "blackberry10", + "windows" + ] + } +} \ No newline at end of file diff --git a/src/app/app.component.ts b/src/app/app.component.ts index b85b8a4..0b26f20 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -42,8 +42,6 @@ export class MyApp { } }).catch(err => { console.log('ERROR: ' + err); - pnut.token = 'DOLORSITAmET6E6uaqT70D8R8o-yAG2eqa48wBihEqYhWKN3WQzlIzBd4V18vI-OCjKWCwGUQDPlNO2sS9DgkyYMM0SbJAirYH'; - this.nav.setRoot(StreamPage, {stream: 'global'}); }); this.platform.ready().then(() => { diff --git a/src/pages/stream/stream.html b/src/pages/stream/stream.html index 022352b..a1e24ef 100644 --- a/src/pages/stream/stream.html +++ b/src/pages/stream/stream.html @@ -41,24 +41,45 @@ + + + + + + + + + + 0">{{ post.counts.bookmarks }} - + 0">{{ post.counts.reposts }} - + 0">{{ post.counts.replies }} + + + + + + + + + + + diff --git a/src/pages/stream/stream.ts b/src/pages/stream/stream.ts index a9d8ce6..d192274 100644 --- a/src/pages/stream/stream.ts +++ b/src/pages/stream/stream.ts @@ -58,4 +58,49 @@ export class StreamPage { this.navCtrl.push(PostDetailsPage, {post: postData}); } + bookmark(postid, bookmarked) { + if (bookmarked) { + pnut.deleteBookmark(postid).then(res => { + console.log(res); + this.updatePost(res.data); + }).catch(err => { + console.log(err); + }); + } else { + pnut.bookmark(postid).then(res => { + console.log(res); + this.updatePost(res.data); + }).catch(err => { + console.log(err); + }); + } + } + + repost(postid, reposted) { + if (reposted) { + pnut.deleteRepost(postid).then(res => { + console.log(res); + this.updatePost(res.data); + }).catch(err => { + console.log(err); + }); + } else { + pnut.repost(postid).then(res => { + console.log(res); + this.updatePost(res.data); + }).catch(err => { + console.log(err); + }); + } + } + + updatePost(postData) { + for (var i = 0; i < this.posts.length; i++) { + if (this.posts[i]['id'] === postData.id) { + this.posts[i] = postData; + break; + } + } + } + }