Top Banner
The raise of web developers @loicknuchel
71

Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

Jan 22, 2018

Download

Software

Loïc Knuchel
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

The raise of web developers

@loicknuchel

Page 2: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

?

Page 4: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

L’histoire du smartphone

Page 5: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

Juin 2007

Lancement de l’iPhone 1

Page 6: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

Septembre 2008

Sortie du HTC G1avec Android

Page 7: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

● Nouvelles possibilités○ UX○ Technique○ Business

● Un écosystème à bâtir

Page 8: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

● Nouvelle stack technique

● Peu de personnes formées

● Développer plusieurs fois la même chose

● Environnements très spécifiques (offline, puissance, versions, diversité...)

Page 9: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016
Page 10: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

La WebView

Page 11: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

Idée

Coder des applicationsentièrement dans la WebView

Avantages :

● Technologies et environnements connus● Cross-platform

Page 12: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

PhoneGap / Cordova

Mars 2009 :Lancement de PhoneGap par Nitobi

Octobre 2011 :Rachat de Nitobi par AdobeSéparation de la technologie (Cordova) et des services commerciaux (PhoneGap)

Page 13: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016
Page 14: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

Oups...● UI moche● UI peu réactive● loin du look & feel natif

Mauvais support des standards du web dans la WebView

Peu d’outils / librairies

Téléphones peu puissants

● App de mauvaise qualité● Bugs

Souvent pour des projets à petit budget...

Page 15: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

Aujourd’hui

● Téléphones puissants (et de + en +)

● Très bon support des standards web dans la WebView

● Beaucoup d’outils / librairies

Page 16: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016
Page 17: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

Ionic c’est quoi ?

+ =

Page 18: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

Stack technologique

Natif

Web

Téléphone & APIs natives

Cordova : webview +JavaScript bridges

Angular

Ionic

Application

Page 19: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

Dév web = Dév mobile

Page 20: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

DX“We want to cater to the 99% who just want to build something functional quickly

and not break the bank to do it.” - Max Lynch

Page 21: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

DX#Platform continuity

#CLI

#Backend services

#Push#Deploy

#Package#Auth#Analytics #Ionic View

#Native plugins #Ionic Market

#Ionic Creator

Page 22: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

@ionitron

Page 23: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

Ionic is a complete ecosystem !

Page 24: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

One more thing...

Page 25: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

Hybrid apps have superpowers...

Page 26: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

Hybrid superpowers

Page 27: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

App Store installs are broken !

?http://bit.ly/voxxrin

Page 28: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

App Store installs are broken !

Deep linking Install tracking

Page 29: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

Hybrid superpowers

Web App :

● Cross-platform● Accès instantané● Deep link● Offline

http://bit.ly/voxxrin-bdx-lkn

Page 30: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

Hybrid superpowers

Web App :

● Cross-platform● Accès instantané● Deep link● Offline

Progressive Web App :

● Installation instantanée● Lancement depuis la Home● Push notifications

Page 31: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

Hybrid superpowers

Web App :

● Cross-platform● Accès instantané● Deep link● Offline

Progressive Web App :

● Installation instantanée● Lancement depuis la Home● Push notifications

Native App :

● Accès complet au téléphone

Page 32: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

Hybrid superpowers

Page 33: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

App Store deployment is broken !

Apple : ~ 2 jours

Google : ~ 2 heures

Page 34: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

Hybrid superpowers

Page 35: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016
Page 36: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016
Page 37: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016
Page 38: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016
Page 39: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016
Page 40: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016
Page 41: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016
Page 42: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016
Page 43: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016
Page 44: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016
Page 45: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016
Page 46: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

Nouveautés depuis Ionic 1

● Angular 2 (+ TypeScript)● Navigation push/pop● Nouveaux composants

○ DateTime○ Toast○ Searchbar○ Segment

Page 47: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

Getting started

Install nodejs & npm

$ npm install -g ionic@beta

$ ionic start demoApp --v2 --ts

$ cd demoApp && ionic serve

♬ ♫ ♬ ♫ Your Ionic app is ready to go! ♬ ♫ ♬ ♫

Page 48: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

Getting started

Install mobile sdk (Android ou iOS)

$ sudo npm install -g cordova

$ ionic platform add android

$ ionic run android

Page 49: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

Structure de fichiers

Page 50: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

index.html<!DOCTYPE html><html lang="en" dir="ltr"><head> <meta charset="UTF-8"> <title>Ionic</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"> <meta name="format-detection" content="telephone=no"> <meta name="msapplication-tap-highlight" content="no">

<link ios-href="build/css/app.ios.css" rel="stylesheet"> <link md-href="build/css/app.md.css" rel="stylesheet"> <link wp-href="build/css/app.wp.css" rel="stylesheet"></head><body> <!-- this Ionic's root component and where the app will load --> <ion-app></ion-app>

<!-- cordova.js required for cordova apps --> <script src="cordova.js"></script> <!-- Polyfill needed for platforms without Promise and Collection support --> <script src="build/js/es6-shim.min.js"></script> <!-- Zone.js and Reflect-metadata --> <script src="build/js/Reflect.js"></script> <script src="build/js/zone.js"></script> <!-- the bundle which is built from the app's source code --> <script src="build/js/app.bundle.js"></script></body></html>

Page 51: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

app.tsimport {App, Platform} from 'ionic-angular';import {StatusBar} from 'ionic-native';import {TabsPage} from './pages/tabs/tabs';

@App({ template: '<ion-nav [root]="rootPage"></ion-nav>', config: {} // http://ionicframework.com/docs/v2/api/config/Config/})export class MyApp { rootPage: any = TabsPage;

constructor(platform: Platform) { 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(); }); }}

Page 52: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

page1.tsimport {Page} from 'ionic-angular';

@Page({ templateUrl: 'build/pages/page1/page1.html'})export class Page1 { constructor() {

}}

<ion-navbar *navbar> <ion-title>Tab 1</ion-title></ion-navbar>

<ion-content padding class="page1"> <h2>Welcome to Ionic!</h2> <p> This starter project comes with simple tabs-based layout for apps that are going to primarily use a Tabbed UI. </p> <p> Take a look at the <code>app/</code> directory to add or change tabs, update any existing page or create new pages. </p></ion-content>

Page 53: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

page1.tsimport {Page} from 'ionic-angular';

@Page({ template: `<ion-navbar *navbar> <ion-title>Tab 1</ion-title></ion-navbar>

<ion-content padding class="page1"> <h2>Welcome to Ionic!</h2> <p> This starter project comes with simple tabs-based layout for apps that are going to primarily use a Tabbed UI. </p></ion-content>`})export class Page1 { constructor() {}}

Page 54: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

page1.tsimport {Page} from 'ionic-angular';

@Page({ styles: [`.page1 h2 { color: red;} `], template: `...`})export class Page1 { constructor() {}}

Page 55: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

Angular 1 vs Angular 2

● bootstrap manuel

● Filter => Pipe

● Controllers => Components

● Directives => Components

● $scope => Class properties

● Services => Injectables

Page 56: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

Template

● Bindings :

● Pipes :

● Propriétés / Input :

● Evénements / Output :

● Double binding :

● Templates :

● Local variables :

● Boucles :

Your favorite hero is: {{favoriteHero}}

<span>{{movie.title | uppercase}}</span>

<a [href]="angularDocsUrl">Angular Docs</a>

<button (click)="toggleMovie()"></button>

<input [(ngModel)]="favoriteMovie" />

<div *ngIf="movies.length === 0">No movies</div>

<video-player #player></video-player><button (click)="player.pause()">Pause</button>

<ul *ngFor="let movie of movies"> <li>{{movie.title}}</li></ul>

Page 57: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016
Page 58: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

Créer une nouvelle page

Page 59: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

todo.page.ts todo.html todo.scssimport {Page} from 'ionic-angular';

@Page({ templateUrl: 'build/pages/todo/todo.html'})export class TodoPage { constructor() { }}

<ion-navbar *navbar> <ion-title>Todos</ion-title></ion-navbar>

<ion-content class="todo-page">

</ion-content>

.todo-page { .done { text-decoration: line-through; }}

Page 60: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

import {App, Platform} from 'ionic-angular';import {StatusBar} from 'ionic-native';import {TabsPage} from './pages/tabs/tabs';import {TodoPage} from "./pages/todo/todo.page";

@App({ template: '<ion-nav [root]="rootPage"></ion-nav>', config: {}})export class MyApp { rootPage: any = TodoPage;

constructor(platform: Platform) { platform.ready().then(() => { StatusBar.styleDefault(); }); }}

// http://ionicframework.com/docs/v2/theming/

// App Shared Imports// --------------------------------------------------// These are the imports which make up the design of this app.// By default each design mode includes these shared imports.// App Shared Sass variables belong in app.variables.scss.

@import "../pages/page1/page1";@import "../pages/page2/page2";@import "../pages/page3/page3";@import "../pages/todo/todo";

app.ts theme/app.core.scss

Page 61: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

Ionic2 TODO listimport {Page} from 'ionic-angular';

class Todo { constructor( public name: string, public done: boolean = false ) {}}

@Page({ templateUrl: 'build/pages/todo/todo.html'})export class TodoPage { constructor() { }}

<ion-navbar *navbar> <ion-title>Todos</ion-title></ion-navbar>

<ion-content class="todo-page">

</ion-content>

Page 62: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

Ionic2 TODO listimport {Page} from 'ionic-angular';

class Todo { constructor( public name: string, public done: boolean = false ) {}}

@Page({ templateUrl: 'build/pages/todo/todo.html'})export class TodoPage { todos: Todo[] = [ new Todo('todo 1'), new Todo('todo 2'), new Todo('todo 3') ];

constructor() { }}

<ion-navbar *navbar> <ion-title>Todos</ion-title></ion-navbar>

<ion-content class="todo-page">

</ion-content>

Page 63: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

Ionic2 TODO list<ion-navbar *navbar> <ion-title>Todos</ion-title></ion-navbar>

<ion-content class="todo-page"> <ion-list> <ion-item *ngFor="let todo of todos" [hidden]="todo.done"> <ion-label>{{todo.name}}</ion-label> <ion-checkbox [(ngModel)]="todo.done"></ion-checkbox> </ion-item> <ion-item *ngFor="let todo of todos" [hidden]="!todo.done"> <ion-label class="done">{{todo.name}}</ion-label> <ion-checkbox [(ngModel)]="todo.done" disabled="true"></ion-checkbox> </ion-item> </ion-list></ion-content>

Page 64: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

Ionic2 TODO listimport {Page} from 'ionic-angular';

@Page({ templateUrl: 'build/pages/todo/todo.html'})export class TodoPage { newTodo: string = ''; todos: Todo[] = [ new Todo('todo 1'), new Todo('todo 2'), new Todo('todo 3') ];

constructor() { }

create(text: string): void { this.todos.push(new Todo(text)); this.newTodo = ''; }}

<ion-navbar *navbar> <ion-title>Todos</ion-title></ion-navbar>

<ion-toolbar> <ion-input type="text" [(ngModel)]="newTodo" placeholder="Nouvelle tâche"> </ion-input> <ion-buttons end> <button (click)="create(newTodo)"> <ion-icon name="send"></ion-icon> </button> </ion-buttons></ion-toolbar>

<ion-content class="todo-page"> <ion-list> ... </ion-list></ion-content>

Page 65: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

Ionic2 TODO listimport {Page} from 'ionic-angular';

@Page({ templateUrl: 'build/pages/todo/todo.html'})export class TodoPage { newTodo: string = ''; todos: Todo[] = [...];

constructor() { }

create(text: string): void { ... }

delete(todo: Todo): void { const i = this.todos.indexOf(todo); if(i >= 0) { this.todos.splice(i, 1); } }}

<ion-navbar *navbar> <ion-title>Todos</ion-title></ion-navbar>

<ion-toolbar> ...</ion-toolbar>

<ion-content class="todo-page"> <ion-list> <ion-item *ngFor="let todo of todos" [hidden]="todo.done"> <ion-label>{{todo.name}}</ion-label> <ion-checkbox [(ngModel)]="todo.done"></ion-checkbox> </ion-item> <ion-item *ngFor="..." [hidden]="!todo.done" (click)="delete(todo)"> <ion-label class="done">{{todo.name}}</ion-label> <ion-checkbox [(ngModel)]="todo.done" disabled="true"></ion-checkbox> </ion-item> </ion-list></ion-content>

Page 66: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

Ionic2 TODO listimport {Page} from 'ionic-angular';

@Page({ templateUrl: 'build/pages/todo/todo.html'})export class TodoPage { newTodo: string = ''; todos: Todo[] = [...];

constructor() { }

create(text: string): void { ... }

delete(todo: Todo): void { const i = this.todos.indexOf(todo); if(i >= 0) { this.todos.splice(i, 1); } }}

<ion-navbar *navbar> <ion-title>Todos</ion-title></ion-navbar>

<ion-toolbar> ...</ion-toolbar>

<ion-content class="todo-page"> <ion-list> <ion-item *ngFor="let todo of todos" [hidden]="todo.done"> <ion-label>{{todo.name}}</ion-label> <ion-checkbox [(ngModel)]="todo.done"></ion-checkbox> </ion-item> <ion-item *ngFor="..." [hidden]="!todo.done" (click)="delete(todo)"> <ion-label class="done">{{todo.name}}</ion-label> <ion-checkbox [(ngModel)]="todo.done" disabled="true"></ion-checkbox> </ion-item> </ion-list></ion-content>

Page 67: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016
Page 68: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

Pour tester ce weekend...

Page 70: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016
Page 71: Ionic2 - the raise of web developer, Riviera DEV le 17/06/2016

Questions ?

@loicknuchel