Enable share post button, issue #13

This commit is contained in:
Morgan McMillian 2017-12-19 19:48:38 -08:00
parent 12e7c24a3d
commit 399e5e68f8
3 changed files with 78 additions and 64 deletions

View file

@ -92,4 +92,6 @@
<plugin name="cordova-plugin-statusbar" spec="^2.2.2" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.1" />
<plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
<plugin name="cordova-plugin-share-content" spec="^1.0.0" />
<allow-navigation href="http://169.254.225.150:8100" />
</widget>

View file

@ -28,6 +28,7 @@
"cordova-plugin-console": "^1.0.5",
"cordova-plugin-device": "^1.1.4",
"cordova-plugin-inappbrowser": "^1.7.1",
"cordova-plugin-share-content": "^1.0.0",
"cordova-plugin-splashscreen": "^4.0.3",
"cordova-plugin-statusbar": "^2.2.2",
"cordova-plugin-whitelist": "^1.3.1",
@ -56,7 +57,8 @@
"cordova-plugin-statusbar": {},
"cordova-plugin-whitelist": {},
"ionic-plugin-keyboard": {},
"cordova-plugin-inappbrowser": {}
"cordova-plugin-inappbrowser": {},
"cordova-plugin-share-content": {}
},
"platforms": [
"android"

View file

@ -426,7 +426,7 @@ export class NewPostModal {
@Component({
template: `
<ion-list>
<button ion-item disabled (click)="close()">Share</button>
<button ion-item (click)="share()">Share</button>
<button ion-item *ngIf="showDelBtn" (click)="delete()">Delete</button>
</ion-list>
`
@ -444,6 +444,16 @@ export class PostMenu {
}
}
share() {
(<any>window).shareContentPlugin.share(this.navParams.data.post.content.text, function(e) {
console.log('sharing post:');
console.log(JSON.stringify(e));
}, function(e) {
console.log('sharing failed:');
console.log(JSON.stringify(e));
});
}
delete() {
pnut.deletePost(this.navParams.data.post.id).then(res => {
console.log(res);