Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(wifi_iot): iOS isConnected always true even connection is failed #371

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,24 @@
"contributions": [
"code"
]
},
{
"login": "Bojan227",
"name": "Bojan Blazevski",
"avatar_url": "https://avatars.githubusercontent.com/u/80133862?v=4",
"profile": "https://github.com/Bojan227",
"contributions": [
"bug"
]
},
{
"login": "UnluckyY1",
"name": "Yassine Ben Massaoud",
"avatar_url": "https://avatars.githubusercontent.com/u/48437666?v=4",
"profile": "https://github.com/UnluckyY1",
"contributions": [
"code"
]
}
]
}
2 changes: 2 additions & 0 deletions .github/workflows/all_plugins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: all_plugins

on:
pull_request:
branches:
- master
paths-ignore:
- "docs/**"
- "website/**"
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/wifi_iot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: wifi_iot

on:
pull_request:
branches:
- master
paths:
- "packages/wifi_iot/**"
- ".github/workflows/wifi_iot.yaml"
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/wifi_scan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: wifi_scan

on:
pull_request:
branches:
- master
paths:
- "packages/wifi_scan/**"
- ".github/workflows/wifi_scan.yaml"
Expand Down
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,32 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## 2024-08-27

### Changes

---

Packages with breaking changes:

- There are no breaking changes in this release.

Packages with other changes:

- [`wifi_iot` - `v0.3.19+1`](#wifi_iot---v03191)
- [`wifi_scan` - `v0.4.1+1`](#wifi_scan---v0411)

---

#### `wifi_iot` - `v0.3.19+1`

- **FIX**: Update compileSdkVersion to fix Android release build with flutter 3.24 (#398).

#### `wifi_scan` - `v0.4.1+1`

- **FIX**: Update compileSdkVersion to fix Android release build with flutter 3.24 (#398).


## 2023-09-04

### Changes
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<a href="https://github.com/flutternetwork/WiFiFlutter/actions?query=workflow%3Aall_plugins">
<img src="https://github.com/flutternetwork/WiFiFlutter/workflows/all_plugins/badge.svg" alt="all_plugins GitHub Workflow Status"/>
</a><!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
<a href="https://github.com/flutternetwork/WiFiFlutter/blob/master/CONTRIBUTORS.md#contributors-"><img src="https://img.shields.io/badge/all_contributors-56-orange.svg" alt="All Contributors" /></a>
<a href="https://github.com/flutternetwork/WiFiFlutter/blob/master/CONTRIBUTORS.md#contributors-"><img src="https://img.shields.io/badge/all_contributors-58-orange.svg" alt="All Contributors" /></a>
<!-- ALL-CONTRIBUTORS-BADGE:END -->


Expand Down
4 changes: 3 additions & 1 deletion CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
<a href="https://github.com/flutternetwork/WiFiFlutter/blob/master/CONTRIBUTORS.md#contributors-"><img src="https://img.shields.io/badge/all_contributors-56-orange.svg" alt="All Contributors" /></a>
<a href="https://github.com/flutternetwork/WiFiFlutter/blob/master/CONTRIBUTORS.md#contributors-"><img src="https://img.shields.io/badge/all_contributors-58-orange.svg" alt="All Contributors" /></a>
<!-- ALL-CONTRIBUTORS-BADGE:END -->

## Contributors ✨
Expand Down Expand Up @@ -80,6 +80,8 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<tr>
<td align="center" valign="top" width="11.11%"><a href="https://github.com/weitsai"><img src="https://avatars.githubusercontent.com/u/1283491?v=4?s=100" width="100px;" alt="蔡佳緯"/><br /><sub><b>蔡佳緯</b></sub></a><br /><a href="https://github.com/flutternetwork/WiFiFlutter/commits?author=weitsai" title="Code">💻</a></td>
<td align="center" valign="top" width="11.11%"><a href="https://github.com/thearaks"><img src="https://avatars.githubusercontent.com/u/5188791?v=4?s=100" width="100px;" alt="Mattia Aracne"/><br /><sub><b>Mattia Aracne</b></sub></a><br /><a href="https://github.com/flutternetwork/WiFiFlutter/commits?author=thearaks" title="Code">💻</a></td>
<td align="center" valign="top" width="11.11%"><a href="https://github.com/Bojan227"><img src="https://avatars.githubusercontent.com/u/80133862?v=4?s=100" width="100px;" alt="Bojan Blazevski"/><br /><sub><b>Bojan Blazevski</b></sub></a><br /><a href="https://github.com/flutternetwork/WiFiFlutter/issues?q=author%3ABojan227" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="11.11%"><a href="https://github.com/UnluckyY1"><img src="https://avatars.githubusercontent.com/u/48437666?v=4?s=100" width="100px;" alt="Yassine Ben Massaoud"/><br /><sub><b>Yassine Ben Massaoud</b></sub></a><br /><a href="https://github.com/flutternetwork/WiFiFlutter/commits?author=UnluckyY1" title="Code">💻</a></td>
</tr>
</tbody>
</table>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<a href="https://codecov.io/gh/flutternetwork/WiFiFlutter/">
<img src="https://codecov.io/gh/flutternetwork/WiFiFlutter/graph/badge.svg" alt="all_plugins Coverage"/>
</a><!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
<a href="https://github.com/flutternetwork/WiFiFlutter/blob/master/CONTRIBUTORS.md#contributors-"><img src="https://img.shields.io/badge/all_contributors-56-orange.svg" alt="All Contributors" /></a>
<a href="https://github.com/flutternetwork/WiFiFlutter/blob/master/CONTRIBUTORS.md#contributors-"><img src="https://img.shields.io/badge/all_contributors-58-orange.svg" alt="All Contributors" /></a>
<!-- ALL-CONTRIBUTORS-BADGE:END -->
<a href="https://gitter.im/flutternetwork/WiFiFlutter?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge">
<img src="https://badges.gitter.im/flutternetwork/WiFiFlutter.svg" alt="Join the chat at https://gitter.im/flutternetwork/WiFiFlutter]">
Expand Down
4 changes: 4 additions & 0 deletions packages/wifi_iot/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.3.19+1

- **FIX**: Update compileSdkVersion to fix Android release build with flutter 3.24 (#398).

## 0.3.19

- **CHORE**: Update Gradle to 8.2 and AGP to 8.2.0 (#360)
Expand Down
2 changes: 1 addition & 1 deletion packages/wifi_iot/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ apply plugin: 'com.android.library'
android {
namespace 'com.alternadom.wifiiot'

compileSdkVersion 30
compileSdkVersion 34

defaultConfig {
minSdkVersion 16
Expand Down
21 changes: 7 additions & 14 deletions packages/wifi_iot/ios/Classes/SwiftWifiIotPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,7 @@ public class SwiftWifiIotPlugin: NSObject, FlutterPlugin {
let sPassword = (call.arguments as? [String : AnyObject])?["password"] as? String? ?? nil
let bJoinOnce = (call.arguments as? [String : AnyObject])?["join_once"] as! Bool?
let sSecurity = (call.arguments as? [String : AnyObject])?["security"] as! String?

// print("SSID : '\(sSSID)'")
// print("PASSWORD : '\(sPassword)'")
// print("JOIN_ONCE : '\(bJoinOnce)'")
// if (bJoinOnce) {
// print("The network will be forgotten!")
// }
// print("SECURITY : '\(sSecurity)'")

if #available(iOS 11.0, *) {
let configuration = initHotspotConfiguration(ssid: sSSID, passphrase: sPassword, security: sSecurity)
configuration.joinOnce = bJoinOnce ?? false
Expand All @@ -142,19 +135,19 @@ public class SwiftWifiIotPlugin: NSObject, FlutterPlugin {
result(false)
return
}
this.getSSID { (sSSID) -> () in
this.getSSID { (connectedSSID) -> () in
if (error != nil) {
if (error?.localizedDescription == "already associated.") {
print("Connected to '\(sSSID ?? "<Unknown Network>")'")
print("Connected to '\(connectedSSID ?? "<Unknown Network>")'")
result(true)
} else {
print("Not Connected")
result(false)
}
} else if let ssid = sSSID {
print("Connected to " + ssid)
// ssid check is required because if wifi not found (could not connect) there seems to be no error given
result(ssid == sSSID)
} else if let connectedSSID = connectedSSID {
print("Connected to " + connectedSSID)
// Emit result of [isConnected] by checking if targetSSID is the same as connectedSSID.
result(sSSID == connectedSSID)
} else {
print("WiFi network not found")
result(false)
Expand Down
2 changes: 1 addition & 1 deletion packages/wifi_iot/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: wifi_iot
description: Flutter plugin which can handle WiFi connections and hotspot (AP, STA)
version: 0.3.19
version: 0.3.19+1
homepage: https://github.com/flutternetwork/WiFiFlutter/tree/master/packages/wifi_iot

flutter:
Expand Down
4 changes: 4 additions & 0 deletions packages/wifi_scan/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.4.1+1

- **FIX**: Update compileSdkVersion to fix Android release build with flutter 3.24 (#398).

## 0.4.1
-
- **CHORE**: Update Gradle to 8.2 and AGP to 8.2.0 (#360)
Expand Down
2 changes: 1 addition & 1 deletion packages/wifi_scan/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ apply plugin: 'kotlin-android'
android {
namespace 'dev.flutternetwork.wifi.wifi_scan'

compileSdkVersion 30
compileSdkVersion 34

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand Down
8 changes: 5 additions & 3 deletions packages/wifi_scan/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ class _MyAppState extends State<MyApp> {
final can = await WiFiScan.instance.canStartScan();
// if can-not, then show error
if (can != CanStartScan.yes) {
if (mounted) kShowSnackBar(context, "Cannot start scan: $can");
if (context.mounted) kShowSnackBar(context, "Cannot start scan: $can");
return;
}
}

// call startScan API
final result = await WiFiScan.instance.startScan();
if (mounted) kShowSnackBar(context, "startScan: $result");
if (context.mounted) kShowSnackBar(context, "startScan: $result");
// reset access points.
setState(() => accessPoints = <WiFiAccessPoint>[]);
}
Expand All @@ -49,7 +49,9 @@ class _MyAppState extends State<MyApp> {
final can = await WiFiScan.instance.canGetScannedResults();
// if can-not, then show error
if (can != CanGetScannedResults.yes) {
if (mounted) kShowSnackBar(context, "Cannot get scanned results: $can");
if (context.mounted) {
kShowSnackBar(context, "Cannot get scanned results: $can");
}
accessPoints = <WiFiAccessPoint>[];
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/wifi_scan/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: wifi_scan
description: Flutter plugin to scan for nearby visible WiFi access points.
version: 0.4.1
version: 0.4.1+1
homepage: https://github.com/flutternetwork/WiFiFlutter/tree/master/packages/wifi_scan

environment:
Expand Down
Loading
Loading