mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
Lot of changes
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { BehaviorSubject, Observable } from 'rxjs'
|
||||
import { Platform } from '@ionic/angular'
|
||||
import { Network } from '@capacitor/network';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -9,20 +10,19 @@ import { Platform } from '@ionic/angular'
|
||||
export class NetworkConnectionService {
|
||||
online: boolean = true;
|
||||
|
||||
constructor(){}
|
||||
|
||||
checkOnline() {
|
||||
window.addEventListener('online', (on) => {
|
||||
this.online === true;
|
||||
console.log('Became online');
|
||||
constructor(){
|
||||
Network.addListener('networkStatusChange', status => {
|
||||
console.log('Network status changed', status);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
checkOffline() {
|
||||
window.addEventListener('offline', (off) => {
|
||||
this.online === false;
|
||||
console.log('Became offline')
|
||||
});
|
||||
}
|
||||
|
||||
logCurrentNetworkStatus = async () => {
|
||||
const status = await Network.getStatus();
|
||||
|
||||
return status;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user