Skip to content

Commit

Permalink
Add isHidden to secureConnect
Browse files Browse the repository at this point in the history
  • Loading branch information
sgrodzicki committed May 8, 2023
1 parent 87b9ef3 commit 6a3b2f1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ class PluginWifiConnectPlugin() : FlutterPlugin, MethodCallHandler {
val password = call.argument<String>("password")
val isWep = call.argument<Boolean>("isWep")
val isWpa3 = call.argument<Boolean>("isWpa3")
val isHidden = call.argument<Boolean>("isHidden")

if (ssid == null || password == null || isWep == null) {
return
Expand All @@ -141,6 +142,9 @@ class PluginWifiConnectPlugin() : FlutterPlugin, MethodCallHandler {
} else {
setWpa2Passphrase(password)
}
if (isHidden) {
setIsHiddenSsid(true)
}
}
.build()
connect(specifier, result)
Expand Down
1 change: 1 addition & 0 deletions ios/Classes/SwiftPluginWifiConnectPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class SwiftPluginWifiConnectPlugin: NSObject, FlutterPlugin {
let args = try GetArgs(arguments: call.arguments)
let hotspotConfig = NEHotspotConfiguration.init(ssid: args["ssid"] as! String, passphrase: args["password"] as! String, isWEP: args["isWep"] as! Bool)
hotspotConfig.joinOnce = !(args["saveNetwork"] as! Bool);
hotspotConfig.isHidden = args["isHidden"] as! Bool;
connect(hotspotConfig: hotspotConfig, result: result)
return

Expand Down
4 changes: 3 additions & 1 deletion lib/plugin_wifi_connect.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ class PluginWifiConnect {
static Future<bool?> connectToSecureNetwork(String ssid, String password,
{bool isWep = false,
bool isWpa3 = false,
bool saveNetwork = false}) async {
bool saveNetwork = false,
bool isHidden = false}) async {
final bool? connected = await _channel.invokeMethod<bool>(
'secureConnect',
<String, dynamic>{
Expand All @@ -68,6 +69,7 @@ class PluginWifiConnect {
'saveNetwork': saveNetwork,
'isWep': isWep,
'isWpa3': isWpa3,
'isHidden': isHidden,
},
);
return connected;
Expand Down

0 comments on commit 6a3b2f1

Please sign in to comment.