Skip to content
This repository has been archived by the owner on Jul 11, 2018. It is now read-only.

fix(ionic-native): update ionic native to 3.1.0 #84

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions package.json
@@ -1,5 +1,7 @@
{
"dependencies": {
"@ionic-native/camera": "3.1.0",
"@ionic-native/google-maps": "3.1.0",
"ng2-translate": "^5.0.0"
}
}
9 changes: 5 additions & 4 deletions src/app/app.component.ts
@@ -1,6 +1,7 @@
import { Component, ViewChild } from '@angular/core';
import {Platform, Nav, Config} from 'ionic-angular';
import { StatusBar, Splashscreen } from 'ionic-native';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';

import { Settings } from '../providers/providers';

Expand Down Expand Up @@ -59,7 +60,7 @@ export class MyApp {
{ title: 'Search', component: SearchPage }
]

constructor(translate: TranslateService, platform: Platform, settings: Settings, config: Config) {
constructor(statusBar: StatusBar, splashScreen: SplashScreen, translate: TranslateService, platform: Platform, settings: Settings, config: Config) {
// Set the default language for translation strings, and the current language.
translate.setDefaultLang('en');
translate.use('en')
Expand All @@ -71,8 +72,8 @@ export class MyApp {
platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
StatusBar.styleDefault();
Splashscreen.hide();
statusBar.styleDefault();
splashScreen.hide();
});
}

Expand Down
10 changes: 10 additions & 0 deletions src/app/app.module.ts
Expand Up @@ -3,6 +3,11 @@ import { Http } from '@angular/http';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { Storage, IonicStorageModule } from '@ionic/storage';

import { Camera } from '@ionic-native/camera';
import { GoogleMaps } from '@ionic-native/google-maps';
import { SplashScreen } from '@ionic-native/splash-screen';
import { StatusBar } from '@ionic-native/status-bar';

import { MyApp } from './app.component';

import { CardsPage } from '../pages/cards/cards';
Expand Down Expand Up @@ -82,6 +87,11 @@ export function entryComponents() {

export function providers() {
return [
Camera,
GoogleMaps,
StatusBar,
SplashScreen,

User,
Api,
Items,
Expand Down
23 changes: 10 additions & 13 deletions src/pages/item-create/item-create.ts
Expand Up @@ -2,7 +2,7 @@ import { Component, ViewChild } from '@angular/core';
import { Validators, FormBuilder, FormGroup } from '@angular/forms';
import { NavController, ViewController } from 'ionic-angular';

import { Camera } from 'ionic-native';
import { Camera } from '@ionic-native/camera';

/*
Generated class for the ItemCreate page.
Expand All @@ -23,7 +23,7 @@ export class ItemCreatePage {

form: FormGroup;

constructor(public navCtrl: NavController, public viewCtrl: ViewController, formBuilder: FormBuilder) {
constructor(public camera: Camera, public navCtrl: NavController, public viewCtrl: ViewController, formBuilder: FormBuilder) {
this.form = formBuilder.group({
profilePic: [''],
name: ['', Validators.required],
Expand All @@ -41,18 +41,15 @@ export class ItemCreatePage {
}

getPicture() {
if (Camera['installed']()) {
Camera.getPicture({
targetWidth: 96,
targetHeight: 96
}).then((data) => {
this.form.patchValue({ 'profilePic': 'data:image/jpg;base64,' + data });
}, (err) => {
alert('Unable to take photo');
})
} else {
this.camera.getPicture({
destinationType: this.camera.DestinationType.DATA_URL,
targetWidth: 96,
targetHeight: 96
}).then((data) => {
this.form.patchValue({ 'profilePic': 'data:image/jpg;base64,' + data });
}, (err) => {
this.fileInput.nativeElement.click();
}
});
}

processWebImage(event) {
Expand Down
14 changes: 8 additions & 6 deletions src/pages/map/map.ts
@@ -1,7 +1,7 @@
import { Component, ViewChild } from '@angular/core';
import { NavController, Platform } from 'ionic-angular';

import { GoogleMap, GoogleMapsLatLng } from 'ionic-native';
import { GoogleMap, GoogleMaps, LatLng } from '@ionic-native/google-maps';

declare var google: any;

Expand All @@ -12,7 +12,9 @@ declare var google: any;
export class MapPage {
@ViewChild('map') map;

constructor(public navCtrl: NavController, public platform: Platform) {}
googleMap: GoogleMap;

constructor(public googleMaps: GoogleMaps, public navCtrl: NavController, public platform: Platform) {}

initJSMaps(mapEle) {
new google.maps.Map(mapEle, {
Expand All @@ -22,12 +24,12 @@ export class MapPage {
}

initNativeMaps(mapEle) {
this.map = new GoogleMap(mapEle);
this.googleMap = this.googleMaps.create(mapEle);
mapEle.classList.add('show-map');

GoogleMap.isAvailable().then(() => {
const position = new GoogleMapsLatLng(43.074395, -89.381056);
this.map.setPosition(position);
this.googleMaps.isAvailable().then(() => {
const position = new LatLng(43.074395, -89.381056);
this.googleMap.setCenter(position);
});
}

Expand Down