Home

Awesome

[OUTDATED] CROSS PLATFORM NFC Build Status

Presentation

An NFC Reader application based on ionic2 and TypeScript (ES6)

Screenshots

image image image

IDE

IntelliJ v15.0.3 or later is recommended for a better TypeScript support

Features

Stack

Project Structure

- app: Application files (TypeScript)
    -- app.ts: Ionic2 entry point
    -- classes: Common classes
    -- pages: Ionic views
        --- app.html
        --- login
            ---- login.ts
            ---- login.scss
            ---- login.html
        --- account
        --- nfc
        --- qr
        --- tags
    -- pipes: Angular2 @Pipe components
    -- utils: Utility classes
- www: Assets folder
    -- index.html: Entry point
    -- build (not in git repository): Production folder where sources are minified
    -- css
    -- i18n: 18n files
        --- en.json
        --- fr.json
    -- img: Images of the application
    -- js
    -- res
    -- spec: Unit tests folder
        --- mocks: Cordvoa api mocks
        --- src
- typings: TypeScript interfaces for libraries
    -- cordova
    -- jasmine
    -- lodash
    -- moment
	-- phonegap-nfc
- platforms (not in git repository): Installed platforms (android, ios, etc..) using ```$ionic add platform``` command
- reports (not in git repository): Unit tests reports
    -- junit (used by jenkins)
    -- html
- coverage (not in git repository): Coverage reports
    -- Format text, json ,html and cobertura (xml)
- doc (not in git repository): Generated TypeScript documentation
- node_modules (not in git repository): NPM dependencies
- plugins (not in git repository): Cordova plugins
    -- cordova-plugin-barcodescanner
    -- cordova-plugin-statusbar
    -- cordova-plugin-vibration
    -- phonegap-nfc
    -- cordova-plugin-whitelist
- ionic.config.js: Ionic configuration file
- spec-bundle.js: Used for unit tests only with Karma, webpack and ES6
- karma.conf.js: Karma configuration file for unit tests
- webpack.test.config.js: Build configuration file used for unit tests
- webpack.config.js: Build configuration file
- tsconfig.json: TypeScript configuration file
- tslint.json: TSLint configuration file
- typedoc.json: TypeDoc configuration file
- package.json: For managing npm dependencies
    -- Scripts: ```$ npm test``` for executing unit tests through karma
- config.xml: Phonegap configuration file
- resources: Icons and splash resources for every platforms

Installation

Install the node dependencies:

$ npm install

You need to install the ionic command in version 2:

$ npm install -g ionic@beta

You need to install the karma command:

$ npm install -g karma

You need to install the cordova command

$ npm install -g cordova

Typings

To search for typings :

$ typings search jasmine

To add a typing :

$ typings install jasmine --save --ambient

Files will be added to the typings folder.


# Execution on desktop
For starting the project on desktop:
```bash
$ ionic serve

Install the following cordova plugins

Always use cordova (not phonegap) to add a new plugin

$ cordova plugin add cordova-plugin-barcodescanner
$ cordova plugin add cordova-plugin-statusbar
$ cordova plugin add cordova-plugin-vibration
$ cordova plugin add cordova-plugin-whitelist
$ cordova plugin add phonegap-nfc

Edit the config.xml file and add the following entries:

<gap:plugin name="phonegap-nfc" source="npm" />
<gap:plugin name="cordova-plugin-statusbar" source="npm" />
<gap:plugin name="cordova-plugin-barcodescanner" source="npm" />
<gap:plugin name="cordova-plugin-whitelist" source="npm" />

Allow external links

To allow externals links such as mailto,tel,sms etc: Add allow intents in the config.xml files:

<allow-intent href="mailto:*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />

Execution on real Android device

$ ionic platform add android
$ ionic run android

TypeScript compilation in IntelliJ v older than 15.0.3

TypeScript compilation in IntelliJ v 15.0.3 or later

Unit tests

Unit tests are using:

To run tests:

$ npm run test

Generate reports in junit and HTML.

To run test in browser mode, edit the karma.conf.js file and set 'singleRun' property to false

Quality code

TSLint checks TypeScript code for errors, readability and maintainability. tslint.json is the configuration file for TSLint To run TSLint:

$ npm run quality