diff --git a/package-lock.json b/package-lock.json index 5baa093..d6c3fac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5742,6 +5742,23 @@ "resolved": "https://registry.npmjs.org/ng2-cordova-oauth/-/ng2-cordova-oauth-0.0.8.tgz", "integrity": "sha1-SW+rlufBraHuskNX36wvjP/p80I=" }, + "ngx-clipboard": { + "version": "11.1.9", + "resolved": "https://registry.npmjs.org/ngx-clipboard/-/ngx-clipboard-11.1.9.tgz", + "integrity": "sha512-xF54Ibt/04g2B5SnYylNz7ESP1/thuC7odo+0bKkgbCC873NaqP1VTVx/umh/cnezlXKu8zuWNzzg05tvfgaJg==", + "requires": { + "ngx-window-token": "1.0.2", + "tslib": "1.9.0" + } + }, + "ngx-window-token": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/ngx-window-token/-/ngx-window-token-1.0.2.tgz", + "integrity": "sha512-bFgvi7MYSK1p4b3Mqvn9+biXaO8QDEbpP2sEMSwr0Zgrwh6zCO3F92a6SIIzusqpZBAhxyfVSqj3mO5qIxlM5Q==", + "requires": { + "tslib": "1.9.0" + } + }, "no-case": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/no-case/-/no-case-2.3.2.tgz", diff --git a/package.json b/package.json index 5c57158..60fd933 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "ionicons": "4.2.4", "moment": "^2.18.1", "ng2-cordova-oauth": "0.0.8", + "ngx-clipboard": "^11.1.9", "pnut-butter": "^0.21.0", "run": "^1.4.0", "rxjs": "5.5.8", diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 8645a8f..b5dc8f1 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -23,6 +23,7 @@ import { FilePath } from '@ionic-native/file-path'; import { FileTransfer, FileUploadOptions, FileTransferObject } from '@ionic-native/file-transfer'; import { TimeagoPipe } from '../pipes/timeago/timeago'; import { ParserPipe } from '../pipes/parser/parser'; +import { ClipboardModule } from 'ngx-clipboard'; @NgModule({ declarations: [ @@ -45,6 +46,7 @@ import { ParserPipe } from '../pipes/parser/parser'; BrowserModule, IonicModule.forRoot(MyApp), IonicStorageModule.forRoot(), + ClipboardModule, ], bootstrap: [IonicApp], entryComponents: [ diff --git a/src/pages/stream/post-menu.ts b/src/pages/stream/post-menu.ts index c48bb5f..9f3d161 100644 --- a/src/pages/stream/post-menu.ts +++ b/src/pages/stream/post-menu.ts @@ -1,6 +1,8 @@ import { Component } from '@angular/core'; import { ViewController, NavParams, ToastController } from 'ionic-angular'; import { Events } from 'ionic-angular'; +import { Device } from '@ionic-native/device'; +import { ClipboardService } from 'ngx-clipboard'; import * as pnut from 'pnut-butter'; @@ -8,7 +10,8 @@ import * as pnut from 'pnut-butter'; template: ` - + + ` @@ -16,14 +19,18 @@ import * as pnut from 'pnut-butter'; export class PostMenu { showDelBtn: boolean = false; + showShareBtn: boolean = false; constructor(public navParams: NavParams, public viewCtrl: ViewController, public toastCtrl: ToastController, - public events: Events) { + public events: Events, private clipboardSrv: ClipboardService, private device: Device) { if (navParams.data.me == navParams.data.post.user.username) { this.showDelBtn = true; } else { this.showDelBtn = false; } + if (this.device.platform === "Android" || this.device.platform === "amazon-fireos") { + this.showShareBtn = true; + } } browse() { @@ -42,6 +49,12 @@ export class PostMenu { this.close(); } + copy() { + this.clipboardSrv.copyFromContent(this.navParams.data.post.content.text); + this.presentToast('Post copied'); + this.close(); + } + delete() { pnut.deletePost(this.navParams.data.post.id).then(res => { console.log(res);