|
@@ -1,5 +1,4 @@
|
|
import { Component } from '@angular/core';
|
|
import { Component } from '@angular/core';
|
|
-
|
|
|
|
import { Platform, Events, AlertController } from '@ionic/angular';
|
|
import { Platform, Events, AlertController } from '@ionic/angular';
|
|
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
|
|
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
|
|
import { StatusBar } from '@ionic-native/status-bar/ngx';
|
|
import { StatusBar } from '@ionic-native/status-bar/ngx';
|
|
@@ -7,11 +6,7 @@ import { Storage } from '@ionic/storage'
|
|
import { UserData } from '../providers/user-data';
|
|
import { UserData } from '../providers/user-data';
|
|
import { Router } from '@angular/router';
|
|
import { Router } from '@angular/router';
|
|
import { LocalNotifications } from '@ionic-native/local-notifications/ngx';
|
|
import { LocalNotifications } from '@ionic-native/local-notifications/ngx';
|
|
-// import { FileOpener } from '@ionic-native/file-opener/ngx';
|
|
|
|
-// import { FileTransfer } from '@ionic-native/file-transfer/ngx';
|
|
|
|
-import { AppVersion } from '@ionic-native/app-version/ngx';
|
|
|
|
-// import { File } from '@ionic-native/file/ngx';
|
|
|
|
-import { WebSocketService } from '../providers/WebSocketService';
|
|
|
|
|
|
+// import { WebSocketService } from '../providers/WebSocketService';
|
|
import { Device } from '@ionic-native/device/ngx';
|
|
import { Device } from '@ionic-native/device/ngx';
|
|
import { Update } from '../providers/update'
|
|
import { Update } from '../providers/update'
|
|
|
|
|
|
@@ -20,13 +15,12 @@ import { Update } from '../providers/update'
|
|
templateUrl: 'app.component.html'
|
|
templateUrl: 'app.component.html'
|
|
})
|
|
})
|
|
export class AppComponent {
|
|
export class AppComponent {
|
|
- private access_token: string
|
|
|
|
private loggedIn: boolean = false;
|
|
private loggedIn: boolean = false;
|
|
|
|
+ private version_number: any
|
|
constructor(
|
|
constructor(
|
|
private device: Device,
|
|
private device: Device,
|
|
private localNotifications: LocalNotifications,
|
|
private localNotifications: LocalNotifications,
|
|
private router: Router,
|
|
private router: Router,
|
|
- private appVersion: AppVersion,
|
|
|
|
private events: Events,
|
|
private events: Events,
|
|
private update: Update,
|
|
private update: Update,
|
|
private userData: UserData,
|
|
private userData: UserData,
|
|
@@ -35,7 +29,7 @@ export class AppComponent {
|
|
private alertController: AlertController,
|
|
private alertController: AlertController,
|
|
private splashScreen: SplashScreen,
|
|
private splashScreen: SplashScreen,
|
|
private statusBar: StatusBar,
|
|
private statusBar: StatusBar,
|
|
- private wsService: WebSocketService
|
|
|
|
|
|
+ // private wsService: WebSocketService
|
|
) {
|
|
) {
|
|
this.initializeApp();
|
|
this.initializeApp();
|
|
// this.update.isUpdate()
|
|
// this.update.isUpdate()
|
|
@@ -43,6 +37,7 @@ export class AppComponent {
|
|
}
|
|
}
|
|
ngOnInit() {
|
|
ngOnInit() {
|
|
this.initWebSocket()
|
|
this.initWebSocket()
|
|
|
|
+ this.getVersionNumber()
|
|
//WS连接的IP和端口提前保存在localStorage里,现在读出来
|
|
//WS连接的IP和端口提前保存在localStorage里,现在读出来
|
|
// this.wsService.createObservableSocket(`ws://192.168.20.32:8804/websocket/403`);
|
|
// this.wsService.createObservableSocket(`ws://192.168.20.32:8804/websocket/403`);
|
|
// this.wsService.sendMessage('testhis.fullScreenImaget')
|
|
// this.wsService.sendMessage('testhis.fullScreenImaget')
|
|
@@ -53,10 +48,15 @@ export class AppComponent {
|
|
|
|
|
|
getUserId(): Promise<string> {
|
|
getUserId(): Promise<string> {
|
|
return this.storage.get('user_id').then((value) => {
|
|
return this.storage.get('user_id').then((value) => {
|
|
|
|
+ // this.update.isUpdate()
|
|
return value;
|
|
return value;
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ async getVersionNumber() {
|
|
|
|
+ this.version_number = await this.update.getVersionNumber()
|
|
|
|
+ }
|
|
|
|
+
|
|
async initWebSocket() {
|
|
async initWebSocket() {
|
|
let _this = this
|
|
let _this = this
|
|
let user_id = await this.getUserId()
|
|
let user_id = await this.getUserId()
|