Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
0fa1a1e
Update dependencies for ionic-native subpackages
MichaelMarner Oct 9, 2017
8fa501d
Update dependencies section of readme
MichaelMarner Oct 9, 2017
6a46181
Update imports for ionic native services
MichaelMarner Oct 9, 2017
c43302a
Update demo dependencies
MichaelMarner Oct 9, 2017
6fb0e11
Update initialisation of translate module
MichaelMarner Oct 9, 2017
6ff0315
Add @ionic-native/core
MichaelMarner Oct 9, 2017
5338dbf
Fix use of InAppBrowser
MichaelMarner Oct 9, 2017
2d3d7be
Fix tests
MichaelMarner Oct 9, 2017
c060b29
Update manup demo to latest ionic
MichaelMarner Oct 9, 2017
7835b55
Update for new AppVersion
MichaelMarner Oct 9, 2017
12a9584
Fix path to translation files in demo
MichaelMarner Oct 9, 2017
09c6173
Fix Ionic native providers
MichaelMarner Oct 9, 2017
4ead746
Fix use of ManUpService
MichaelMarner Oct 9, 2017
1e0deaf
Update cordova plugins for demo
MichaelMarner Oct 9, 2017
b115431
Code formatting settings for vs code
MichaelMarner Oct 9, 2017
978b5f8
Update cordova config
MichaelMarner Oct 9, 2017
81ea4d5
Update test setup based on Ionic example app
MichaelMarner Oct 9, 2017
1ef3eab
Update cordova resources
MichaelMarner Oct 9, 2017
c8a924c
Update dev deps to angular 4.4.3
MichaelMarner Oct 9, 2017
9608297
Use an InjectionToken to make translations truly optional
MichaelMarner Oct 9, 2017
be60553
Configure demo app with new translation config
MichaelMarner Oct 9, 2017
dbe2ab6
Remove ngx-translate from peer deps
MichaelMarner Oct 9, 2017
68e7450
Update readme
MichaelMarner Oct 9, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"prettier.printWidth": 100,
"prettier.singleQuote": true,
"editor.formatOnSave": true
}
60 changes: 42 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Mandatory Update for Ionic 2
# Mandatory Update for Ionic 2+

[![Build
Status](https://travis-ci.org/NextFaze/ionic-manup.svg?branch=master)](https://travis-ci.org/NextFaze/ionic-manup)
Expand Down Expand Up @@ -34,23 +34,28 @@ Mandatory Update (manup) works like this:

## Requirements

* Ionic 2
* Angular 2.x
* `ionic-native` (needed to get the app version and name)
* Ionic >2
* Angular >2
* `@ionic/storage` (used for caching)
* `cordova-plugin-app-version` to get the installed app name and version
* `@ionic-native/app-version`
* `cordova-plugin-app-version`
* `@ionic-native/in-app-browser`
* `cordova-plugin-inappbrowser` to launch the link to the app/play store


In your ionic project root:

```sh
npm install --save @ionic/storage ionic-native
npm install --save @ionic/storage @ionic-native/app-version @ionic-native/in-app-browser
ionic plugin add cordova-plugin-app-version
ionic plugin add cordova-plugin-inappbrowser
```

Manup assumes you are using Semantic Versioning for your app.

### Optional
* `@ngx-translate/core` Needed to handle translations

## Installation

```sh
Expand Down Expand Up @@ -126,34 +131,53 @@ export class MyApp {

## Internationalisation Support

The service uses [ng2-translate](https://www.npmjs.com/package/ng2-translate) to support languages other than English. This package is the way [recommended](https://ionicframework.com/docs/v2/resources/ng2-translate/) by the Ionic developers.
The service uses [ngx-translate](https://www.npmjs.com/package/ng2-translate) to support languages other than English. This package is the way [recommended](https://ionicframework.com/docs/v2/resources/ng2-translate/) by the Ionic developers.

### With Built in translations

To make life easy for app developers, the service includes its own translation strings. All you need to do is add `ng2-translate` to your Ionic app and set the active language.
To make life easy for app developers, the service includes its own translation strings. All you need to do is add `ngx-translate` to your Ionic app and set the active language. Due to the way AOT works, you also need to provide a `TRANSLATE_SERVICE` for ManUp to use.

Languages supported are currently limited to English and a Google Translated Spanish. We would love pull requests for new languages.

#### Boostrap ng2-translate with your app!
#### Boostrap ngx-translate with your app!

```ts
import { ManUpModule } from 'ionic-manup';
import { TranslateModule } from 'ng2-translate';

// in your module's import array
TranslateModule.forRoot(),
ManUpModule.forRoot({url: 'https://example.com/manup.json'})
import { ManUpModule, ManUpService, TRANSLATE_SERVICE } from 'ionic-manup';
import { TranslateLoader, TranslateModule, TranslateService } from '@ngx-translate/core';


@NgModule({
declarations: [MyApp, HomePage],
imports: [
...
ManUpModule.forRoot({
url: 'https://example.com/manup.json',
externalTranslations: true
}),
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: translateLoader,
deps: [HttpClient]
}
})
],
providers: [
{ provide: TRANSLATE_SERVICE, useClass: TranslateService },
ManUpService,
],
})
```

Note: This is an absolute bare minimum example of loading the module. Follow the instructions linked to above for how to use `ng2-translate` in your app.
Note: This is an absolute bare minimum example of loading the module. Follow the instructions linked to above for how to use `ngx-translate` in your app.

### With your own strings

If you want to further customise the messages, you can provide your own translations for the ManUp strings. _This is the only way we will be supporting customisation of the messages_.

#### Setup your language files

Follow the instructions for setting up `ng2-translate` with your Ionic 2 app, and add the following tree to your language files:
Follow the instructions for setting up `ngx-translate` with your Ionic 2 app, and add the following tree to your language files:


```json
Expand Down Expand Up @@ -194,7 +218,7 @@ You need to tell ManUp to use external translations. Modify your Bootstrap like

## Demonstration App

A demonstration app is in the `manup-demo` folder. This is the default Ionic 2 tabs starter app, with Manup added.
A demonstration app is in the `manup-demo` folder. This is the default Ionic 2 starter app, with ManUp added.

```sh
cd manup-demo
Expand Down
50 changes: 0 additions & 50 deletions angular-cli.json

This file was deleted.

45 changes: 0 additions & 45 deletions karma.conf.js

This file was deleted.

1 change: 1 addition & 0 deletions manup-demo/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ log.txt
npm-debug.log*

.idea/
.sourcemaps/
.sass-cache/
.tmp/
.versions/
Expand Down
26 changes: 26 additions & 0 deletions manup-demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
This is a starter template for [Ionic](http://ionicframework.com/docs/) projects.

## How to use this template

*This template does not work on its own*. The shared files for each starter are found in the [ionic2-app-base repo](https://github.com/ionic-team/ionic2-app-base).

To use this template, either create a new ionic project using the ionic node.js utility, or copy the files from this repository into the [Starter App Base](https://github.com/ionic-team/ionic2-app-base).

### With the Ionic CLI:

Take the name after `ionic2-starter-`, and that is the name of the template to be used when using the `ionic start` command below:

```bash
$ sudo npm install -g ionic cordova
$ ionic start myBlank blank
```

Then, to run it, cd into `myBlank` and run:

```bash
$ ionic cordova platform add ios
$ ionic cordova run ios
```

Substitute ios for android if not on a Mac.

127 changes: 87 additions & 40 deletions manup-demo/config.xml
Original file line number Diff line number Diff line change
@@ -1,40 +1,87 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<widget id="com.ionicframework.manupdemo173035" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Manup Demo</name>
<description>Demonstration of how to use Ionic Manup.</description>
<author email="hi@ionicframework" href="http://ionicframework.com/">Ionic Framework Team</author>
<content src="index.html"/>
<access origin="*"/>
<allow-navigation href="http://ionic.local/*"/>
<allow-navigation href="http://192.168.24.138:8100"/>
<allow-intent href="http://*/*"/>
<allow-intent href="https://*/*"/>
<allow-intent href="tel:*"/>
<allow-intent href="sms:*"/>
<allow-intent href="mailto:*"/>
<allow-intent href="geo:*"/>
<platform name="android">
<allow-intent href="market:*"/>
</platform>
<platform name="ios">
<allow-intent href="itms:*"/>
<allow-intent href="itms-apps:*"/>
</platform>
<preference name="webviewbounce" value="false"/>
<preference name="UIWebViewBounce" value="false"/>
<preference name="DisallowOverscroll" value="true"/>
<preference name="android-minSdkVersion" value="16"/>
<preference name="BackupWebStorage" value="none"/>
<preference name="SplashMaintainAspectRatio" value="true"/>
<preference name="FadeSplashScreenDuration" value="300"/>
<preference name="SplashShowOnlyFirstTime" value="false"/>
<feature name="StatusBar">
<param name="ios-package" onload="true" value="CDVStatusBar"/>
</feature>
<plugin name="ionic-plugin-keyboard" spec="~2.2.1"/>
<plugin name="cordova-plugin-whitelist" spec="1.3.1"/>
<plugin name="cordova-plugin-console" spec="1.0.5"/>
<plugin name="cordova-plugin-statusbar" spec="2.2.1"/>
<plugin name="cordova-plugin-device" spec="1.1.4"/>
<plugin name="cordova-plugin-splashscreen" spec="~4.0.1"/>
</widget>
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.ionic.starter" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>MyApp</name>
<description>An awesome Ionic/Cordova app.</description>
<author email="hi@ionicframework" href="http://ionicframework.com/">Ionic Framework Team</author>
<content original-src="index.html" src="http://192.168.24.118:8101" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<preference name="ScrollEnabled" value="false" />
<preference name="android-minSdkVersion" value="16" />
<preference name="BackupWebStorage" value="none" />
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="FadeSplashScreenDuration" value="300" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="3000" />
<platform name="android">
<allow-intent href="market:*" />
<icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
<icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
<icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
<icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
<icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
<icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
<splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
<splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
<splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
<splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
<splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
<splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
<splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
<splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
<splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
<splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
<splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
<splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
<icon height="57" src="resources/ios/icon/icon.png" width="57" />
<icon height="114" src="resources/ios/icon/icon@2x.png" width="114" />
<icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
<icon height="80" src="resources/ios/icon/icon-40@2x.png" width="80" />
<icon height="120" src="resources/ios/icon/icon-40@3x.png" width="120" />
<icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
<icon height="100" src="resources/ios/icon/icon-50@2x.png" width="100" />
<icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
<icon height="120" src="resources/ios/icon/icon-60@2x.png" width="120" />
<icon height="180" src="resources/ios/icon/icon-60@3x.png" width="180" />
<icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
<icon height="144" src="resources/ios/icon/icon-72@2x.png" width="144" />
<icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
<icon height="152" src="resources/ios/icon/icon-76@2x.png" width="152" />
<icon height="167" src="resources/ios/icon/icon-83.5@2x.png" width="167" />
<icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
<icon height="58" src="resources/ios/icon/icon-small@2x.png" width="58" />
<icon height="87" src="resources/ios/icon/icon-small@3x.png" width="87" />
<splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" />
<splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
<splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
<splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" />
<splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" />
<splash height="2048" src="resources/ios/splash/Default-Landscape@~ipadpro.png" width="2732" />
<splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" />
<splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" />
<splash height="2732" src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" />
<splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
<splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" />
<splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
</platform>
<allow-navigation href="http://192.168.24.118:8101" />
<engine name="ios" spec="^4.5.1" />
<plugin name="cordova-plugin-app-version" spec="^0.1.9" />
<plugin name="cordova-plugin-device" spec="^1.1.4" />
<plugin name="cordova-plugin-inappbrowser" spec="^1.7.1" />
<plugin name="cordova-plugin-ionic-webview" spec="^1.1.14" />
<plugin name="cordova-plugin-splashscreen" spec="^4.0.3" />
<plugin name="cordova-plugin-statusbar" spec="git+https://github.com/apache/cordova-plugin-statusbar.git" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.1" />
<plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
</widget>
6 changes: 4 additions & 2 deletions manup-demo/ionic.config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"name": "manup-demo",
"app_id": "",
"v2": true,
"typescript": true
"type": "ionic-angular",
"integrations": {
"cordova": {}
}
}
Loading