mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
chore: update tslint rules (#7391)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { getNativeApplication, android as androidApp } from "../application";
|
||||
import { getNativeApplication, android as androidApp } from "../application";
|
||||
|
||||
export enum connectionType {
|
||||
none = 0,
|
||||
@@ -57,8 +57,8 @@ export function startMonitoring(connectionTypeChangedCallback: (newConnectionTyp
|
||||
let onReceiveCallback = function onReceiveCallback(context: android.content.Context, intent: android.content.Intent) {
|
||||
let newConnectionType = getConnectionType();
|
||||
connectionTypeChangedCallback(newConnectionType);
|
||||
}
|
||||
let zoneCallback = <any>zonedCallback(onReceiveCallback);
|
||||
};
|
||||
let zoneCallback = <any>zonedCallback(onReceiveCallback);
|
||||
androidApp.registerBroadcastReceiver(android.net.ConnectivityManager.CONNECTIVITY_ACTION, zoneCallback);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export enum connectionType {
|
||||
export enum connectionType {
|
||||
none = 0,
|
||||
wifi = 1,
|
||||
mobile = 2,
|
||||
@@ -14,6 +14,7 @@ function _createReachability(host?: string): any {
|
||||
sa_len: 16,
|
||||
sa_family: 2
|
||||
});
|
||||
|
||||
return SCNetworkReachabilityCreateWithAddress(null, zeroAddress);
|
||||
}
|
||||
}
|
||||
@@ -25,11 +26,13 @@ function _getReachabilityFlags(host?: string): number {
|
||||
if (!gotFlags) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return flagsRef.value;
|
||||
}
|
||||
|
||||
function _getConnectionType(host?: string): number {
|
||||
const flags = _getReachabilityFlags(host);
|
||||
|
||||
return _getConnectionTypeFromFlags(flags);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user