@po-ui/ng-sync 15.1.1 → 15.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/lib/po-sync.module.mjs +3 -6
- package/esm2020/lib/services/po-network/po-network.service.mjs +21 -23
- package/fesm2015/po-ui-ng-sync.mjs +26 -26
- package/fesm2015/po-ui-ng-sync.mjs.map +1 -1
- package/fesm2020/po-ui-ng-sync.mjs +24 -28
- package/fesm2020/po-ui-ng-sync.mjs.map +1 -1
- package/lib/services/po-network/po-network.service.d.ts +2 -3
- package/package.json +8 -8
- package/po-ui-ng-sync-15.2.0.tgz +0 -0
- package/schematics/migrations.json +5 -0
- package/schematics/ng-add/index.js +1 -3
- package/schematics/ng-add/index.js.map +1 -1
- package/schematics/ng-add/index.spec.js +0 -2
- package/schematics/ng-add/index.spec.js.map +1 -1
- package/schematics/ng-update/v14/index.js +1 -1
- package/schematics/ng-update/v15/changes.d.ts +4 -0
- package/schematics/ng-update/v15/changes.js +16 -0
- package/schematics/ng-update/v15/changes.js.map +1 -0
- package/schematics/ng-update/v15/index.d.ts +1 -0
- package/schematics/ng-update/v15/index.js +37 -0
- package/schematics/ng-update/v15/index.js.map +1 -0
- package/schematics/ng-update/v2/index.js +1 -1
- package/schematics/ng-update/v3/index.js +1 -1
- package/schematics/ng-update/v4/index.js +1 -1
- package/schematics/ng-update/v5/index.js +1 -1
- package/schematics/ng-update/v6/index.js +1 -1
- package/po-ui-ng-sync-15.1.1.tgz +0 -0
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Injectable, NgModule } from '@angular/core';
|
|
3
3
|
import { StatusCodes } from 'http-status-codes';
|
|
4
|
-
import { Subject, Observable, of,
|
|
5
|
-
import { map, expand, reduce,
|
|
4
|
+
import { Subject, Observable, of, forkJoin, timer } from 'rxjs';
|
|
5
|
+
import { map, expand, reduce, mergeMap } from 'rxjs/operators';
|
|
6
6
|
import * as i1 from '@po-ui/ng-storage';
|
|
7
7
|
import * as i1$1 from '@angular/common/http';
|
|
8
8
|
import { HttpHeaders } from '@angular/common/http';
|
|
9
|
-
import
|
|
10
|
-
import { Network } from '@awesome-cordova-plugins/network/ngx';
|
|
9
|
+
import { Network } from '@capacitor/network';
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* @description
|
|
@@ -1617,8 +1616,8 @@ class PoNetworkStatus {
|
|
|
1617
1616
|
* O `PoNetworkService` é utilizado para verificar o status e o tipo da conexão de rede do dispositivo.
|
|
1618
1617
|
*/
|
|
1619
1618
|
class PoNetworkService {
|
|
1620
|
-
constructor(
|
|
1621
|
-
this.initNetwork(
|
|
1619
|
+
constructor() {
|
|
1620
|
+
this.initNetwork();
|
|
1622
1621
|
}
|
|
1623
1622
|
/**
|
|
1624
1623
|
* Retorna as propriedades tipo e status da conexão do dispositivo no momento da chamada.
|
|
@@ -1638,30 +1637,29 @@ class PoNetworkService {
|
|
|
1638
1637
|
onChange() {
|
|
1639
1638
|
return this.networkTypeNow.asObservable();
|
|
1640
1639
|
}
|
|
1641
|
-
|
|
1642
|
-
return merge(fromEvent(window, 'offline').pipe(mapTo(false)), fromEvent(window, 'online').pipe(mapTo(true)), Observable.create(sub => {
|
|
1643
|
-
sub.next(navigator.onLine);
|
|
1644
|
-
sub.complete();
|
|
1645
|
-
}));
|
|
1646
|
-
}
|
|
1647
|
-
initNetwork(network) {
|
|
1640
|
+
initNetwork() {
|
|
1648
1641
|
this.networkTypeNow = new Subject();
|
|
1649
|
-
this.initSubscriber(
|
|
1650
|
-
}
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
}
|
|
1642
|
+
this.initSubscriber();
|
|
1643
|
+
}
|
|
1644
|
+
async getStatus() {
|
|
1645
|
+
return await Network.getStatus();
|
|
1646
|
+
}
|
|
1647
|
+
async initSubscriber() {
|
|
1648
|
+
const networkStatus = await this.getStatus();
|
|
1649
|
+
this.networkType = networkStatus.connected ? networkStatus.connectionType : 'none';
|
|
1650
|
+
this.networkTypeNow.next({ status: networkStatus.connected, type: this.networkType });
|
|
1651
|
+
/* istanbul ignore next */
|
|
1652
|
+
Network.addListener('networkStatusChange', status => {
|
|
1653
|
+
this.networkType = status.connected ? status.connectionType : 'none';
|
|
1654
|
+
this.networkTypeNow.next({ status: status.connected, type: this.networkType });
|
|
1655
|
+
});
|
|
1658
1656
|
}
|
|
1659
1657
|
}
|
|
1660
|
-
PoNetworkService.ɵfac = function PoNetworkService_Factory(t) { return new (t || PoNetworkService)(
|
|
1658
|
+
PoNetworkService.ɵfac = function PoNetworkService_Factory(t) { return new (t || PoNetworkService)(); };
|
|
1661
1659
|
PoNetworkService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: PoNetworkService, factory: PoNetworkService.ɵfac });
|
|
1662
1660
|
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PoNetworkService, [{
|
|
1663
1661
|
type: Injectable
|
|
1664
|
-
}], function () { return [
|
|
1662
|
+
}], function () { return []; }, null); })();
|
|
1665
1663
|
|
|
1666
1664
|
/**
|
|
1667
1665
|
* @description
|
|
@@ -1990,8 +1988,7 @@ PoSyncModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ providers: [
|
|
|
1990
1988
|
PoSchemaDefinitionService,
|
|
1991
1989
|
PoSchemaService,
|
|
1992
1990
|
PoSyncService,
|
|
1993
|
-
PoHttpClientService
|
|
1994
|
-
Network
|
|
1991
|
+
PoHttpClientService
|
|
1995
1992
|
] });
|
|
1996
1993
|
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PoSyncModule, [{
|
|
1997
1994
|
type: NgModule,
|
|
@@ -2002,8 +1999,7 @@ PoSyncModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ providers: [
|
|
|
2002
1999
|
PoSchemaDefinitionService,
|
|
2003
2000
|
PoSchemaService,
|
|
2004
2001
|
PoSyncService,
|
|
2005
|
-
PoHttpClientService
|
|
2006
|
-
Network
|
|
2002
|
+
PoHttpClientService
|
|
2007
2003
|
],
|
|
2008
2004
|
imports: []
|
|
2009
2005
|
}]
|