Skip to content

Commit bd5e5b6

Browse files
author
Jean-Baptiste Malatrasi
committed
Add cordova-plugin-ionic
1 parent 3c1ddfe commit bd5e5b6

File tree

7 files changed

+98
-5
lines changed

7 files changed

+98
-5
lines changed

config.xml

+9
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,15 @@
8585
<plugin name="cordova-plugin-ionic-webview" spec="3.0.0">
8686
<variable name="ANDROID_SUPPORT_ANNOTATIONS_VERSION" value="27.+" />
8787
</plugin>
88+
<plugin name="cordova-plugin-ionic" spec="5.2.9">
89+
<variable name="APP_ID" value="d0afb8b7" />
90+
<variable name="CHANNEL_NAME" value="Master" />
91+
<variable name="UPDATE_METHOD" value="auto" />
92+
<variable name="MAX_STORE" value="2" />
93+
<variable name="UPDATE_API" value="https://api.ionicjs.com" />
94+
<variable name="MIN_BACKGROUND_DURATION" value="30" />
95+
</plugin>
96+
<plugin name="cordova-plugin-app-version" spec="0.1.9" />
8897
<engine name="android" spec="7.1.4" />
8998
<engine name="ios" spec="4.5.5" />
9099
</widget>

ionic.config.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
"cordova": {},
55
"capacitor": {}
66
},
7-
"type": "angular"
7+
"type": "angular",
8+
"id": "d0afb8b7"
89
}

package-lock.json

+55
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+14-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"@capacitor/cli": "^1.0.0-beta.13",
2626
"@capacitor/core": "^1.0.0-beta.13",
2727
"@capacitor/ios": "^1.0.0-beta.13",
28+
"@ionic-native/app-version": "^5.0.0-beta.21",
2829
"@ionic-native/core": "^5.0.0-beta.21",
2930
"@ionic-native/http": "^5.0.0-beta.21",
3031
"@ionic-native/in-app-browser": "^5.0.0-beta.21",
@@ -36,9 +37,12 @@
3637
"cordova-android": "7.1.4",
3738
"cordova-ios": "4.5.5",
3839
"cordova-plugin-advanced-http": "^2.0.2",
40+
"cordova-plugin-app-version": "0.1.9",
3941
"cordova-plugin-device": "^2.0.2",
4042
"cordova-plugin-file": "^6.0.1",
43+
"cordova-plugin-file-transfer": "1.7.1",
4144
"cordova-plugin-inappbrowser": "^3.0.0",
45+
"cordova-plugin-ionic": "5.2.9",
4246
"cordova-plugin-ionic-keyboard": "^2.1.3",
4347
"cordova-plugin-ionic-webview": "3.0.0",
4448
"cordova-plugin-splashscreen": "5.0.2",
@@ -90,7 +94,16 @@
9094
"cordova-plugin-inappbrowser": {},
9195
"cordova-plugin-ionic-webview": {
9296
"ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
93-
}
97+
},
98+
"cordova-plugin-ionic": {
99+
"APP_ID": "d0afb8b7",
100+
"CHANNEL_NAME": "Master",
101+
"UPDATE_METHOD": "auto",
102+
"MAX_STORE": "2",
103+
"UPDATE_API": "https://api.ionicjs.com",
104+
"MIN_BACKGROUND_DURATION": "30"
105+
},
106+
"cordova-plugin-app-version": {}
94107
},
95108
"platforms": [
96109
"android",

src/app/app.component.html

+6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@
2121
</ion-item>
2222
</ion-menu-toggle>
2323
</ion-list>
24+
25+
<ion-list lines="none">
26+
<ion-item text-center>
27+
<ion-label>v{{ appService.appVersion$ | async }}</ion-label>
28+
</ion-item>
29+
</ion-list>
2430
</ion-content>
2531
</ion-menu>
2632

src/app/app.module.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { AppRoutingModule } from './app-routing.module';
1313
import { SharedModule } from './shared/shared.module';
1414
import { Keyboard } from '@ionic-native/keyboard/ngx';
1515
import { SearchTorrentComponent } from './pages/torrents/search-torrent/search-torrent.component';
16+
import { AppVersion } from '@ionic-native/app-version/ngx';
1617

1718
@NgModule({
1819
declarations: [AppComponent, LoginComponent, SearchTorrentComponent],
@@ -29,7 +30,7 @@ import { SearchTorrentComponent } from './pages/torrents/search-torrent/search-t
2930
}),
3031
SharedModule
3132
],
32-
providers: [SplashScreen, InAppBrowser, HTTP, Keyboard],
33+
providers: [SplashScreen, InAppBrowser, HTTP, Keyboard, AppVersion],
3334
bootstrap: [AppComponent]
3435
})
3536
export class AppModule {}

src/app/shared/services/app/app.service.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Storage } from '@ionic/storage';
22
import { Platform, ToastController } from '@ionic/angular';
33
import { Injectable, NgZone } from '@angular/core';
4-
import { Observable, of, ReplaySubject } from 'rxjs';
4+
import { BehaviorSubject, Observable, of, ReplaySubject } from 'rxjs';
55
import { map, switchMap } from 'rxjs/operators';
66
import { fromPromise } from 'rxjs/internal-compatibility';
77
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
@@ -13,6 +13,7 @@ import { TraktOauthRevokeForm } from '../trakt/forms/oauth/trakt-oauth-revoke.fo
1313
import { HttpService } from '../http/http.service';
1414
import { CacheService } from '../cache.service';
1515
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
16+
import { AppVersion } from '@ionic-native/app-version/ngx';
1617

1718
@Injectable({
1819
providedIn: 'root'
@@ -22,14 +23,17 @@ export class AppService {
2223

2324
isAuthenticated$ = new ReplaySubject<boolean>(1);
2425

26+
appVersion$ = new BehaviorSubject('');
27+
2528
constructor(
2629
private iab: InAppBrowser,
2730
private storage: Storage,
2831
private ngZone: NgZone,
2932
private mobileHttpClient: HTTP,
3033
private platform: Platform,
3134
private splashScreen: SplashScreen,
32-
private toastCtrl: ToastController
35+
private toastCtrl: ToastController,
36+
private appVersion: AppVersion
3337
) {
3438
this.initializeApp();
3539
}
@@ -47,6 +51,10 @@ export class AppService {
4751

4852
if (this.platform.is('cordova')) {
4953
this.splashScreen.hide();
54+
55+
this.appVersion.getVersionNumber().then(version => {
56+
this.appVersion$.next(version);
57+
});
5058
}
5159

5260
setTimeout(() => {

0 commit comments

Comments
 (0)