Added plugin cordova-plugin-filechooser

Added image button to new post screen
This commit is contained in:
Morgan McMillian 2018-02-17 15:32:24 -08:00
parent e3938a2efe
commit fc089fe12b
24 changed files with 97 additions and 71 deletions

View file

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<widget id="com.monkeystew.goober-m" version="0.5.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> <widget id="com.monkeystew.goober_m" version="0.5.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Goober</name> <name>Goober</name>
<description>Goober, a mobile app for pnut.io</description> <description>Goober, a mobile app for pnut.io</description>
<author email="gilag@monkeystew.com" href="https://monkeystew.org">Morgan McMillian</author> <author email="gilag@monkeystew.com" href="https://monkeystew.org">Morgan McMillian</author>
@ -85,12 +85,13 @@
<icon height="144" src="resources/icon-144.png" width="144" /> <icon height="144" src="resources/icon-144.png" width="144" />
</platform> </platform>
<allow-navigation href="http://10.0.0.212:8100" /> <allow-navigation href="http://10.0.0.212:8100" />
<engine name="android" spec="^6.2.3" /> <engine name="android" spec="^7.0.0" />
<plugin name="cordova-plugin-console" spec="^1.0.5" /> <plugin name="cordova-plugin-console" spec="^1.0.5" />
<plugin name="cordova-plugin-device" spec="^1.1.4" /> <plugin name="cordova-plugin-device" spec="^2.0.1" />
<plugin name="cordova-plugin-inappbrowser" spec="^1.7.1" /> <plugin name="cordova-plugin-filechooser" spec="^1.0.1" />
<plugin name="cordova-plugin-inappbrowser" spec="^2.0.2" />
<plugin name="cordova-plugin-share-content" spec="^1.0.0" /> <plugin name="cordova-plugin-share-content" spec="^1.0.0" />
<plugin name="cordova-plugin-splashscreen" spec="^4.0.3" /> <plugin name="cordova-plugin-splashscreen" spec="^5.0.2" />
<plugin name="cordova-plugin-statusbar" spec="^2.2.2" /> <plugin name="cordova-plugin-statusbar" spec="^2.2.2" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.1" /> <plugin name="cordova-plugin-whitelist" spec="^1.3.1" />
<plugin name="ionic-plugin-keyboard" spec="^2.2.1" /> <plugin name="ionic-plugin-keyboard" spec="^2.2.1" />

View file

@ -1,67 +1,71 @@
{ {
"name": "Goober", "name": "Goober",
"version": "0.0.1", "version": "0.0.1",
"author": "Ionic Framework", "author": "Ionic Framework",
"homepage": "http://ionicframework.com/", "homepage": "http://ionicframework.com/",
"private": true, "private": true,
"scripts": { "scripts": {
"clean": "ionic-app-scripts clean", "clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build", "build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint", "lint": "ionic-app-scripts lint",
"ionic:build": "ionic-app-scripts build", "ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve" "ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"@angular/common": "5.2.5",
"@angular/compiler": "5.2.5",
"@angular/compiler-cli": "5.2.5",
"@angular/core": "5.2.5",
"@angular/forms": "5.2.5",
"@angular/http": "5.2.5",
"@angular/platform-browser": "5.2.5",
"@angular/platform-browser-dynamic": "5.2.5",
"@ionic-native/core": "4.5.3",
"@ionic-native/file-chooser": "^4.5.3",
"@ionic-native/splash-screen": "4.5.3",
"@ionic-native/status-bar": "4.5.3",
"@ionic/storage": "2.1.3",
"cordova-android": "^7.0.0",
"cordova-plugin-console": "^1.0.5",
"cordova-plugin-device": "^2.0.1",
"cordova-plugin-filechooser": "^1.0.1",
"cordova-plugin-inappbrowser": "^2.0.2",
"cordova-plugin-share-content": "^1.0.0",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.2.2",
"cordova-plugin-telerik-imagepicker": "^2.1.8",
"cordova-plugin-whitelist": "^1.3.1",
"ionic-angular": "3.9.2",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
"moment": "^2.18.1",
"ng2-cordova-oauth": "0.0.8",
"pnut-butter": "^0.19.0",
"run": "^1.4.0",
"rxjs": "5.5.6",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.20"
},
"devDependencies": {
"@ionic/app-scripts": "3.1.8",
"ionic": "3.19.1",
"typescript": "2.7.2"
},
"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": {},
"cordova-plugin-share-content": {},
"cordova-plugin-filechooser": {}
}, },
"dependencies": { "platforms": [
"@angular/common": "5.2.5", "android"
"@angular/compiler": "5.2.5", ]
"@angular/compiler-cli": "5.2.5", }
"@angular/core": "5.2.5",
"@angular/forms": "5.2.5",
"@angular/http": "5.2.5",
"@angular/platform-browser": "5.2.5",
"@angular/platform-browser-dynamic": "5.2.5",
"@ionic-native/core": "4.5.3",
"@ionic-native/splash-screen": "4.5.3",
"@ionic-native/status-bar": "4.5.3",
"@ionic/storage": "2.1.3",
"cordova-android": "^7.0.0",
"cordova-plugin-console": "^1.0.5",
"cordova-plugin-device": "^2.0.1",
"cordova-plugin-inappbrowser": "^2.0.2",
"cordova-plugin-share-content": "^1.0.0",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.2.2",
"cordova-plugin-whitelist": "^1.3.1",
"ionic-angular": "3.9.2",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
"moment": "^2.18.1",
"ng2-cordova-oauth": "0.0.8",
"pnut-butter": "^0.19.0",
"run": "^1.4.0",
"rxjs": "5.5.6",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.20"
},
"devDependencies": {
"@ionic/app-scripts": "3.1.8",
"ionic": "3.19.1",
"typescript": "2.7.2"
},
"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": {},
"cordova-plugin-share-content": {}
},
"platforms": [
"android"
]
}
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 99 KiB

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 99 KiB

After

Width:  |  Height:  |  Size: 99 KiB

1
resources/icon.png.md5 Normal file
View file

@ -0,0 +1 @@
b72de713e098078c68cbffd6ab82439b

1
resources/splash.png.md5 Normal file
View file

@ -0,0 +1 @@
7ce07128c050f41eb46a94eaddd55d4a

View file

@ -12,6 +12,7 @@ import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen'; import { SplashScreen } from '@ionic-native/splash-screen';
import { IonicStorageModule } from '@ionic/storage'; import { IonicStorageModule } from '@ionic/storage';
import { Device } from '@ionic-native/device'; import { Device } from '@ionic-native/device';
import { FileChooser } from '@ionic-native/file-chooser';
import { TimeagoPipe } from '../pipes/timeago/timeago'; import { TimeagoPipe } from '../pipes/timeago/timeago';
import { ParserPipe } from '../pipes/parser/parser'; import { ParserPipe } from '../pipes/parser/parser';
@ -46,6 +47,7 @@ import { ParserPipe } from '../pipes/parser/parser';
StatusBar, StatusBar,
SplashScreen, SplashScreen,
Device, Device,
FileChooser,
{provide: ErrorHandler, useClass: IonicErrorHandler} {provide: ErrorHandler, useClass: IonicErrorHandler}
] ]
}) })

View file

@ -2,6 +2,7 @@ import { Component, ViewChild, ChangeDetectorRef } from '@angular/core';
import { ViewController, NavController, NavParams, ModalController, Content, ToastController, PopoverController } from 'ionic-angular'; import { ViewController, NavController, NavParams, ModalController, Content, ToastController, PopoverController } from 'ionic-angular';
import { ThreadPage } from '../thread/thread'; import { ThreadPage } from '../thread/thread';
import { Storage } from '@ionic/storage'; import { Storage } from '@ionic/storage';
import { FileChooser } from '@ionic-native/file-chooser';
import { Events } from 'ionic-angular'; import { Events } from 'ionic-angular';
import * as pnut from 'pnut-butter'; import * as pnut from 'pnut-butter';
@ -335,6 +336,11 @@ export class StreamPage {
</ion-item> </ion-item>
</ion-card-content> </ion-card-content>
<ion-row justify-content-end> <ion-row justify-content-end>
<ion-col offset-0>
<button ion-button (click)="attachImage()">
<ion-icon name="image"></ion-icon>
</button>
</ion-col>
<ion-col col-2><div text-center>{{textCount()}}</div></ion-col> <ion-col col-2><div text-center>{{textCount()}}</div></ion-col>
<ion-col col-2> <ion-col col-2>
<button ion-button (click)="send()"> <button ion-button (click)="send()">
@ -356,7 +362,7 @@ export class NewPostModal {
raw: {type: string, value: Object}[] = []; raw: {type: string, value: Object}[] = [];
constructor(public navParams: NavParams, public viewCtrl: ViewController, public toastCtrl: ToastController, constructor(public navParams: NavParams, public viewCtrl: ViewController, public toastCtrl: ToastController,
public events: Events) { private fileChooser: FileChooser, public events: Events) {
console.log(JSON.stringify(this.navParams)); console.log(JSON.stringify(this.navParams));
this.myUsername = navParams.data.me; this.myUsername = navParams.data.me;
if (navParams.data.type === 'reply') { if (navParams.data.type === 'reply') {
@ -449,6 +455,17 @@ export class NewPostModal {
} }
return counttext return counttext
} }
attachImage() {
console.log('file chooser');
this.fileChooser.open().then(uri => {
console.log('File URI: ' + uri);
}).catch(err => {
console.log(err);
});
}
} }
@Component({ @Component({