mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 00:52:55 +00:00
refactor: migrate all cordova plugins to capacitor
This commit is contained in:
committed by
Rainer Killinger
parent
cdb6ac4084
commit
75f4644940
@@ -14,7 +14,6 @@
|
||||
*/
|
||||
import {Component} from '@angular/core';
|
||||
import {ActivatedRoute} from '@angular/router';
|
||||
import {Network} from '@ionic-native/network/ngx';
|
||||
import {IonRefresher} from '@ionic/angular';
|
||||
import {LangChangeEvent, TranslateService} from '@ngx-translate/core';
|
||||
import {
|
||||
@@ -26,6 +25,7 @@ import {
|
||||
import {DataProvider, DataScope} from '../data.provider';
|
||||
import {FavoritesService} from '../../favorites/favorites.service';
|
||||
import {take} from 'rxjs/operators';
|
||||
import {Network} from '@capacitor/network';
|
||||
|
||||
/**
|
||||
* A Component to display an SCThing detailed
|
||||
@@ -48,6 +48,11 @@ export class DataDetailComponent {
|
||||
*/
|
||||
language: SCLanguageCode;
|
||||
|
||||
/**
|
||||
* Indicating wether internet connectivity is given or not
|
||||
*/
|
||||
isDisconnected: Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Type guard for SCSavableThing
|
||||
*/
|
||||
@@ -61,14 +66,12 @@ export class DataDetailComponent {
|
||||
*
|
||||
* @param route the route the page was accessed from
|
||||
* @param dataProvider the data provider
|
||||
* @param network the network provider
|
||||
* @param favoritesService the favorites provider
|
||||
* @param translateService he translate provider
|
||||
*/
|
||||
constructor(
|
||||
protected readonly route: ActivatedRoute,
|
||||
private readonly dataProvider: DataProvider,
|
||||
protected readonly network: Network,
|
||||
private readonly favoritesService: FavoritesService,
|
||||
translateService: TranslateService,
|
||||
) {
|
||||
@@ -76,6 +79,11 @@ export class DataDetailComponent {
|
||||
translateService.onLangChange.subscribe((event: LangChangeEvent) => {
|
||||
this.language = event.lang as SCLanguageCode;
|
||||
});
|
||||
|
||||
this.isDisconnected = new Promise(async resolve => {
|
||||
const isConnected = (await Network.getStatus()).connected;
|
||||
resolve(isConnected);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,13 +101,6 @@ export class DataDetailComponent {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if we have internet
|
||||
*/
|
||||
isDisconnected(): boolean {
|
||||
return this.network.type === this.network.Connection.NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize
|
||||
*/
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
</ion-refresher-content>
|
||||
</ion-refresher>
|
||||
<div [ngSwitch]="true">
|
||||
<ng-container *ngSwitchCase="!item && isDisconnected()">
|
||||
<ng-container *ngSwitchCase="!item && (isDisconnected | async)">
|
||||
<div class="centeredMessageContainer">
|
||||
<ion-icon name="no-connection"> </ion-icon>
|
||||
<ion-label>
|
||||
|
||||
Reference in New Issue
Block a user