Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id BF535200D5A for ; Thu, 14 Dec 2017 08:19:39 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id BDC36160C01; Thu, 14 Dec 2017 07:19:39 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 8B582160C04 for ; Thu, 14 Dec 2017 08:19:38 +0100 (CET) Received: (qmail 46733 invoked by uid 500); 14 Dec 2017 07:19:37 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 46723 invoked by uid 99); 14 Dec 2017 07:19:37 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Dec 2017 07:19:37 +0000 From: GitBox To: commits@cordova.apache.org Subject: [GitHub] maverickmishra closed pull request #59: CB-13663 : Removed deprecated platforms Message-ID: <151323597696.17416.7665449082197645104.gitbox@gitbox.apache.org> archived-at: Thu, 14 Dec 2017 07:19:39 -0000 maverickmishra closed pull request #59: CB-13663 : Removed deprecated platforms URL: https://github.com/apache/cordova-plugin-network-information/pull/59 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/README.md b/README.md index 4ee2bb0..1bcb8f3 100644 --- a/README.md +++ b/README.md @@ -45,15 +45,10 @@ Report issues with this plugin on the [Apache Cordova issue tracker][Apache Cord ## Supported Platforms -- Amazon Fire OS - Android -- BlackBerry 10 - Browser - iOS -- Windows Phone 7 and 8 -- Tizen - Windows -- Firefox OS # Connection @@ -114,27 +109,10 @@ eventually be removed. - The code examples in this section show examples of changing app behavior using the online and offline events and your network connection status. diff --git a/package.json b/package.json index 73b253d..74998a1 100644 --- a/package.json +++ b/package.json @@ -1,22 +1,14 @@ { "name": "cordova-plugin-network-information", - "version": "1.3.5-dev", + "version": "2.0.0-dev", "description": "Cordova Network Information Plugin", "types": "./types/index.d.ts", "cordova": { "id": "cordova-plugin-network-information", "platforms": [ - "firefoxos", "android", - "amazon-fireos", - "ubuntu", "ios", - "blackberry10", - "wp7", - "wp8", - "windows8", "windows", - "tizen", "browser" ] }, @@ -32,17 +24,9 @@ "network", "information", "ecosystem:cordova", - "cordova-firefoxos", "cordova-android", - "cordova-amazon-fireos", - "cordova-ubuntu", "cordova-ios", - "cordova-blackberry10", - "cordova-wp7", - "cordova-wp8", - "cordova-windows8", "cordova-windows", - "cordova-tizen", "cordova-browser" ], "scripts": { diff --git a/plugin.xml b/plugin.xml index 95f3f31..ce2cea0 100644 --- a/plugin.xml +++ b/plugin.xml @@ -21,7 +21,7 @@ + version="2.0.0-dev"> Network Information Cordova Network Information Plugin @@ -39,12 +39,6 @@ xmlns:android="http://schemas.android.com/apk/res/android" - - - - - - @@ -62,34 +56,6 @@ xmlns:android="http://schemas.android.com/apk/res/android" - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -106,51 +72,6 @@ xmlns:android="http://schemas.android.com/apk/res/android" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -158,13 +79,6 @@ xmlns:android="http://schemas.android.com/apk/res/android" - - - - - - - diff --git a/src/blackberry10/index.js b/src/blackberry10/index.js deleted file mode 100644 index 1c8588b..0000000 --- a/src/blackberry10/index.js +++ /dev/null @@ -1,65 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * -*/ - -/* global PluginResult */ - -// map from BB10 to cordova connection types: -// https://github.com/apache/cordova-js/blob/master/lib/common/plugin/Connection.js -function mapConnectionType (con) { - switch (con.type) { - case 'wired': - return 'ethernet'; - case 'wifi': - return 'wifi'; - case 'none': - return 'none'; - case 'cellular': - switch (con.technology) { - case 'edge': - case 'gsm': - return '2g'; - case 'evdo': - return '3g'; - case 'umts': - return '3g'; - case 'lte': - return '4g'; - } - return 'cellular'; - } - return 'unknown'; -} - -function currentConnectionType () { - try { - // possible for webplatform to throw pps exception - return mapConnectionType(window.qnx.webplatform.device.activeConnection || { type: 'none' }); - } catch (e) { - return 'unknown'; - } -} - -module.exports = { - getConnectionInfo: function (success, fail, args, env) { - var result = new PluginResult(args, env); - result.ok(currentConnectionType()); - } -}; diff --git a/src/firefoxos/NetworkProxy.js b/src/firefoxos/NetworkProxy.js deleted file mode 100644 index 7d49b96..0000000 --- a/src/firefoxos/NetworkProxy.js +++ /dev/null @@ -1,96 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -/* - Network API overview: http://www.w3.org/TR/netinfo-api/ - and http://w3c.github.io/netinfo/ -*/ - -var Connection = require('./Connection'); -var modulemapper = require('cordova/modulemapper'); - -var origConnection = modulemapper.getOriginalSymbol(window, 'navigator.connection'); - -module.exports = { - - getConnectionInfo: function (successCallback, errorCallback) { - var connection = origConnection || navigator.mozConnection; - var connectionType = Connection.UNKNOWN; - - if (!connection) { - setTimeout(function () { - successCallback(connectionType); - }, 0); - return; - } - - var bandwidth = connection.bandwidth; - var metered = connection.metered; - var type = connection.type; - - if (type !== undefined) { - // For more information see: - // https://developer.mozilla.org/en-US/docs/Web/API/Network_Information_API - - switch (type) { - case 'cellular': - connectionType = Connection.CELL; - break; - case 'ethernet': - connectionType = Connection.ETHERNET; - break; - case 'wifi': - connectionType = Connection.WIFI; - break; - case 'none': - connectionType = Connection.NONE; - break; - } - } else if (bandwidth !== undefined && metered !== undefined) { - /* - bandwidth of type double, readonly - The user agent must set the value of the bandwidth attribute to: - 0 if the user is currently offline; - Infinity if the bandwidth is unknown; - an estimation of the current bandwidth in MB/s (Megabytes per seconds) - available for communication with the browsing context active document's - domain. - - For more information see: - https://developer.mozilla.org/en-US/docs/Web/API/Connection - */ - - if (bandwidth === 0) { - connectionType = Connection.NONE; - } else if (metered && isFinite(bandwidth)) { - connectionType = Connection.CELL; - } else if (!metered && isFinite(bandwidth)) { - connectionType = Connection.WIFI; - } - } - - setTimeout(function () { - successCallback(connectionType); - }, 0); - } -}; - -require('cordova/exec/proxy').add('NetworkStatus', module.exports); diff --git a/src/tizen/NetworkProxy.js b/src/tizen/NetworkProxy.js deleted file mode 100644 index 63684d1..0000000 --- a/src/tizen/NetworkProxy.js +++ /dev/null @@ -1,89 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * -*/ - -/* global tizen */ - -var Connection = require('./Connection'); - -module.exports = { - getConnectionInfo: function (successCallback, errorCallback) { - var cncType = Connection.NONE; - var infoCount = 0; - var deviceCapabilities = null; - var timerId = 0; - var timeout = 300; - - function connectionCB () { - if (timerId !== null) { - clearTimeout(timerId); - timerId = null; - } - - infoCount++; - - if (infoCount > 1) { - if (successCallback) { - successCallback(cncType); - } - } - } - - function errorCB (error) { - console.log('Error: ' + error.code + ',' + error.name + ',' + error.message); - - if (errorCallback) { - errorCallback(); - } - } - - function wifiSuccessCB (wifi) { - if ((wifi.status === 'ON') && (wifi.ipAddress.length !== 0)) { - cncType = Connection.WIFI; - } - connectionCB(); - } - - function cellularSuccessCB (cell) { - if ((cncType === Connection.NONE) && (cell.status === 'ON') && (cell.ipAddress.length !== 0)) { - cncType = Connection.CELL_2G; - } - connectionCB(); - } - - deviceCapabilities = tizen.systeminfo.getCapabilities(); - - timerId = setTimeout(function () { - timerId = null; - infoCount = 1; - connectionCB(); - }, timeout); - - if (deviceCapabilities.wifi) { - tizen.systeminfo.getPropertyValue('WIFI_NETWORK', wifiSuccessCB, errorCB); - } - - if (deviceCapabilities.telephony) { - tizen.systeminfo.getPropertyValue('CELLULAR_NETWORK', cellularSuccessCB, errorCB); - } - } -}; - -require('cordova/tizen/commandProxy').add('NetworkStatus', module.exports); diff --git a/src/ubuntu/network_information.cpp b/src/ubuntu/network_information.cpp deleted file mode 100644 index 8fdb494..0000000 --- a/src/ubuntu/network_information.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "network_information.h" - -void NetworkInformation::getConnectionInfo(int scId, int ecId) { - Q_UNUSED(ecId); - - QString result; - QNetworkInfo::NetworkMode networkMode = m_systemNetworkInfo.currentNetworkMode(); - QNetworkInfo::NetworkStatus networkStatus = m_systemNetworkInfo.networkStatus(networkMode, 0); - QNetworkInfo::CellDataTechnology cellDataTechnology = m_systemNetworkInfo.currentCellDataTechnology(0); - - if (networkStatus == QNetworkInfo::NoNetworkAvailable) - result = "Connection.NONE"; - - switch (networkMode) { - case QNetworkInfo::WimaxMode: - case QNetworkInfo::WlanMode: - result = "Connection.WIFI"; - break; - case QNetworkInfo::EthernetMode: - result = "Connection.ETHERNET"; - break; - case QNetworkInfo::LteMode: - result = "Connection.CELL_4G"; - break; - case QNetworkInfo::GsmMode: - case QNetworkInfo::CdmaMode: - case QNetworkInfo::TdscdmaMode: - case QNetworkInfo::WcdmaMode: - switch (cellDataTechnology) { - case QNetworkInfo::UmtsDataTechnology: - case QNetworkInfo::HspaDataTechnology: - result = "Connection.CELL_3G"; - break; - case QNetworkInfo::EdgeDataTechnology: - case QNetworkInfo::GprsDataTechnology: - result = "Connection.CELL_2G"; - break; - case QNetworkInfo::UnknownDataTechnology: - result = "Connection.UNKNOWN"; - break; - } - case QNetworkInfo::BluetoothMode: - case QNetworkInfo::UnknownMode: - result = "Connection.UNKNOWN"; - break; - } - - this->callback(scId, result); -} diff --git a/src/ubuntu/network_information.h b/src/ubuntu/network_information.h deleted file mode 100644 index aca20e7..0000000 --- a/src/ubuntu/network_information.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef NETWORK_INFORMATION_H -#define NETWORK_INFORMATION_H - -#include - -#include -#include - -class NetworkInformation: public CPlugin { - Q_OBJECT -public: - explicit NetworkInformation(Cordova *cordova): CPlugin(cordova) {} - - virtual const QString fullName() override { - return NetworkInformation::fullID(); - } - - virtual const QString shortName() override { - return "Connection"; - } - - static const QString fullID() { - return "NetworkStatus"; - } - -public slots: - void getConnectionInfo(int scId, int ecId); - -private: - QNetworkInfo m_systemNetworkInfo; -}; - -#endif diff --git a/src/wp/NetworkStatus.cs b/src/wp/NetworkStatus.cs deleted file mode 100644 index 12eb061..0000000 --- a/src/wp/NetworkStatus.cs +++ /dev/null @@ -1,129 +0,0 @@ -?/* - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -using System; -using System.Diagnostics; -using System.Net; -using System.Net.NetworkInformation; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Documents; -using System.Windows.Ink; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Animation; -using System.Windows.Shapes; -using Microsoft.Phone.Net.NetworkInformation; - -namespace WPCordovaClassLib.Cordova.Commands -{ - - // http://msdn.microsoft.com/en-us/library/microsoft.phone.net.networkinformation(v=VS.92).aspx - // http://msdn.microsoft.com/en-us/library/microsoft.phone.net.networkinformation.devicenetworkinformation(v=VS.92).aspx - - public class NetworkStatus : BaseCommand - { - const string UNKNOWN = "unknown"; - const string ETHERNET = "ethernet"; - const string WIFI = "wifi"; - const string CELL_2G = "2g"; - const string CELL_3G = "3g"; - const string CELL_4G = "4g"; - const string NONE = "none"; - const string CELL = "cellular"; - - private bool HasCallback = false; - - public NetworkStatus() - { - DeviceNetworkInformation.NetworkAvailabilityChanged += new EventHandler(ChangeDetected); - } - - public override void OnResume(object sender, Microsoft.Phone.Shell.ActivatedEventArgs e) - { - this.getConnectionInfo(""); - } - - public void getConnectionInfo(string empty) - { - HasCallback = true; - updateConnectionType(checkConnectionType()); - } - - private string checkConnectionType() - { - if (DeviceNetworkInformation.IsNetworkAvailable) - { - if (DeviceNetworkInformation.IsWiFiEnabled) - { - return WIFI; - } - else - { - return DeviceNetworkInformation.IsCellularDataEnabled ? CELL : UNKNOWN; - } - } - return NONE; - } - - private string checkConnectionType(NetworkInterfaceSubType type) - { - switch (type) - { - case NetworkInterfaceSubType.Cellular_1XRTT: //cell - case NetworkInterfaceSubType.Cellular_GPRS: //cell - return CELL; - case NetworkInterfaceSubType.Cellular_EDGE: //2 - return CELL_2G; - case NetworkInterfaceSubType.Cellular_3G: - case NetworkInterfaceSubType.Cellular_EVDO: //3 - case NetworkInterfaceSubType.Cellular_EVDV: //3 - case NetworkInterfaceSubType.Cellular_HSPA: //3 - return CELL_3G; - case NetworkInterfaceSubType.WiFi: - return WIFI; - case NetworkInterfaceSubType.Unknown: - case NetworkInterfaceSubType.Desktop_PassThru: - default: - return UNKNOWN; - } - } - - void ChangeDetected(object sender, NetworkNotificationEventArgs e) - { - switch (e.NotificationType) - { - case NetworkNotificationType.InterfaceConnected: - updateConnectionType(checkConnectionType(e.NetworkInterface.InterfaceSubtype)); - break; - case NetworkNotificationType.InterfaceDisconnected: - updateConnectionType(NONE); - break; - default: - break; - } - } - - private void updateConnectionType(string type) - { - // This should also implicitly fire offline/online events as that is handled on the JS side - if (this.HasCallback) - { - PluginResult result = new PluginResult(PluginResult.Status.OK, type); - result.KeepCallback = true; - DispatchCommandResult(result); - } - } - } -} ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org For additional commands, e-mail: commits-help@cordova.apache.org