Socket
Socket
Sign inDemoInstall

@josectobar/react-native-iot-wifi

Package Overview
Dependencies
0
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.4 to 1.0.5

3

index.d.ts

@@ -1,2 +0,2 @@

declare module '@josectobar/react-native-iot-wifi' {
declare module "@josectobar/react-native-iot-wifi" {
// tslint:disable:no-namespace

@@ -21,2 +21,3 @@ type ConnectArgs =

function removeSSID(...args: RemoveConnectArgs): void;
function forceWifiUsage(useWifi: boolean): void; //Only available for Android
}

@@ -23,0 +24,0 @@

@@ -1,8 +0,8 @@

'use strict';
"use strict";
import { NativeModules } from 'react-native';
import { NativeModules } from "react-native";
function connect(...args) {
if (args.length < 2 || args.length > 3) {
throw new TypeError('invalid arguments');
throw new TypeError("invalid arguments");
} else if (args.length === 2) {

@@ -17,5 +17,11 @@ NativeModules.IOTWifi.connect(args[0], false, args[1]);

if (args.length < 4 || args.length > 5) {
throw new TypeError('invalid arguments');
throw new TypeError("invalid arguments");
} else if (args.length === 4) {
NativeModules.IOTWifi.connectSecure(args[0], args[1], args[2], false, args[3]);
NativeModules.IOTWifi.connectSecure(
args[0],
args[1],
args[2],
false,
args[3]
);
} else {

@@ -28,3 +34,3 @@ NativeModules.IOTWifi.connectSecure(...args);

if (args.length < 2 || args.length > 3) {
throw new TypeError('invalid arguments');
throw new TypeError("invalid arguments");
} else if (args.length === 2) {

@@ -45,8 +51,13 @@ NativeModules.IOTWifi.removeSSID(args[0], false, args[1]);

function forceWifiUsage(...args) {
NativeModules.IOTWifi.forceWifiUsage(...args);
}
module.exports = {
connect: connect,
connectSecure: connectSecure,
getSSID: getSSID,
isApiAvailable: isApiAvailable,
removeSSID: removeSSID,
connect,
connectSecure,
getSSID,
isApiAvailable,
removeSSID,
forceWifiUsage
};

@@ -53,0 +64,0 @@

{
"name": "@josectobar/react-native-iot-wifi",
"version": "1.0.4",
"version": "1.0.5",
"description": "Connect to WiFi with React Native on Android and iOS.",

@@ -5,0 +5,0 @@ "main": "index.js",

# react-native-iot-wifi
Wifi configuration.
This library was written to config iot devices. With iOS 11 Apple introduced NEHotspotConfiguration class for wifi configuration. Library supports same functionality on ios and android.
## 1.0.5
Android: Added `forceWifiUsage` method. to use this method, do the following steps:
- create a file in `Android/app/src/main/res/xml`
```xml
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">YOUR DEVICE URL(i.e. 10.0.0.1)</domain>
</domain-config>
</network-security-config>
```
- Edit your `AndroidManifest.xml`
```xml
<?xml version="1.0" encoding="utf-8"?>
<manifest ...>
<uses-permission android:name="android.permission.INTERNET" />
<application
...
android:usesCleartextTraffic="true"
android:networkSecurityConfig="@xml/network_security_config"
...>
...
</application>
</manifest>
```
## 1.0.4

@@ -11,44 +43,48 @@

* added missing iOS connection error handling.
* added missing podspec file dependency from package.json.
- added missing iOS connection error handling.
- added missing podspec file dependency from package.json.
## 1.0.3
I tested the library with RN v 0.61.2 for both iOS and Android and was able to fix conflicts related to the dependencies and auto linking with iOS.
I tested the library with RN v 0.61.2 for both iOS and Android and was able to fix conflicts related to the dependencies and auto linking with iOS.
* re-factored podspec and relocated file into root directory.
- re-factored podspec and relocated file into root directory.
## 1.0.2
* Fixed some bugs from the syntax in the podspec
- Fixed some bugs from the syntax in the podspec
## 1.0.1
* Added error handling for iOS wifi connection failure.
- Added error handling for iOS wifi connection failure.
* Added podspec for RN 6.1.2 compatibility.
- Added podspec for RN 6.1.2 compatibility.
## 1.0.0
* Optional Force binding to a Wifi on both iOS and Android platforms
* Android: Better error handling
* Android: Detection for a system added config which cant be reused, removed or updated
* Android: Reliable polling for requested network connection for callbacks
* It does do a lot of other cleanup and re-use of code
- Optional Force binding to a Wifi on both iOS and Android platforms
- Android: Better error handling
- Android: Detection for a system added config which cant be reused, removed or updated
- Android: Reliable polling for requested network connection for callbacks
- It does do a lot of other cleanup and re-use of code
## 0.4.5
Android:
* Makes the connect call asynchronous on Android
* Fails for Android Q as the API is deprecated
- Makes the connect call asynchronous on Android
- Fails for Android Q as the API is deprecated
iOS:
* Fixes APIs on Simulator as it was behind a compile time macro
* Exposed and returns defaults for Simulator targets
- Fixes APIs on Simulator as it was behind a compile time macro
- Exposed and returns defaults for Simulator targets
## 0.3.0
* `connectSecure()` now works
* `getSSID()` should work on android
- `connectSecure()` now works
- `getSSID()` should work on android
## iOS
> Important

@@ -70,17 +106,17 @@ > IOTWifi uses NEHotspotConfigurationManager. To use the NEHotspotConfigurationManager class, you must enable the Hotspot Configuration capability in [Xcode](http://help.apple.com/xcode/mac/current/#/dev88ff319e7).

Wifi.isApiAvailable((available) => {
console.log(available ? 'available' : 'failed');
Wifi.isApiAvailable(available => {
console.log(available ? "available" : "failed");
});
Wifi.getSSID((SSID) => {
Wifi.getSSID(SSID => {
console.log(SSID);
});
Wifi.connect("wifi-name", (error) => {
console.log(error ? 'error: ' + error : 'connected to wifi-name');
Wifi.connect("wifi-name", error => {
console.log(error ? "error: " + error : "connected to wifi-name");
});
Wifi.removeSSID("wifi-name", (error)=>{
console.log(error ? 'error: ' + error : 'removed wifi-name');
Wifi.removeSSID("wifi-name", error => {
console.log(error ? "error: " + error : "removed wifi-name");
});
```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc