Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { Component,ViewChild } from '@angular/core';
import { Platform,AlertController,Content } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
// import { TabsPage } from '../pages/tabs/tabs';
import { LoginPage } from '../pages/login/login';
import { AppVersion } from '@ionic-native/app-version';
import { AppUpdateService } from '../service/appUpdateService';
import { Keyboard } from '@ionic-native/keyboard';
import { Badge } from '@ionic-native/badge';
@Component({
templateUrl: 'app.html'
})
export class MyApp {
@ViewChild(Content) content: Content;
rootPage:any = LoginPage;
constructor(platform: Platform,
statusBar: StatusBar,
splashScreen: SplashScreen,
alertCtrl: AlertController,
keyboard:Keyboard,
appUpdateService: AppUpdateService,
appVersion: AppVersion,
badge:Badge
) {
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();
//检测是否需要更新
appVersion.getVersionNumber().then((version: string) => {
appUpdateService.compariVersion().subscribe(data => {
if (data.code == 200) {
if (data.latestVersion != null && data.latestVersion != version) {
appUpdateService.detectionUpgrade(data.androidDownload, true); //提示升级
}
}
});
}).catch(err => {
console.log('getVersionNumber:' + err);
});
//log角标数目显示
badge.set(10);