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

iOS: Add new method to connect to a SSIDPrefix protected only once, Android: Try to address issue #303 #377

Merged
merged 11 commits into from
Aug 8, 2024

Conversation

notjulian
Copy link
Collaborator

@notjulian notjulian commented Apr 3, 2024

  • iOS: Add new method to connect to a SSIDPrefix protected only once.
  • Android: Add timeout for removeWifiNetwork and disconnect
  • Android: Try to address issue Android 13 issue #303.

For issue #303, I've tested it on a Pixel 7 running Android 14, as well as on other brands.
The fix is taken from WiFiFlutter concurrent-connections
Thanks to: @Martichou, @darhaywa and @daadu

Code example (for a hotspot without Internet), first connect, then forceWifiUsage true, before disconnect forceWiFiUsage to false

//To connect
await WifiManager.connectToProtectedWifiSSID({
                  ssid: WifiNetToUse,
                  password: pwdWifi,
                  isWEP: false,
                  isHidden: false,
                  timeout: 15,
                })
                  .then(async () => {
                    if (!isIOS)
                      await WifiManager.forceWifiUsageWithOptions(true, {
                        noInternet: true,
                      })
                  })
                  .catch(e => {
                    console.log(e.message, e.code)
                    error = e.code
                  })

//To disconnect
 await WifiManager.forceWifiUsageWithOptions(false, {
            noInternet: false,
})
await WifiManager.isRemoveWifiNetwork(currentSSID)

package.json Outdated Show resolved Hide resolved
@JuanSeBestia
Copy link
Owner

I guess it has some conflicts for this MR
#355

@notjulian
Copy link
Collaborator Author

I guess it has some conflicts for this MR #355

sorry where?
thanks

@smartmedev
Copy link

Hi @notjulian why did you add timeout for removeWifiNetwork and disconnect on Android?
What is the purpose?
I've found that you userd DisconnectCallbackHolder.getInstance() on the disconnect() and removeWifiNetwork() timeout blocks and Android Studio tell us that this call requires API Level 29 when the library target is 21.
Screenshot 2024-05-31 alle 14 25 10

Can you please add a check like this if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { } and use the old behavior elsewhere?

@notjulian
Copy link
Collaborator Author

Hi @notjulian why did you add timeout for removeWifiNetwork and disconnect on Android? What is the purpose? I've found that you userd DisconnectCallbackHolder.getInstance() on the disconnect() and removeWifiNetwork() timeout blocks and Android Studio tell us that this call requires API Level 29 when the library target is 21. Screenshot 2024-05-31 alle 14 25 10

Can you please add a check like this if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { } and use the old behavior elsewhere?

Hi,
is to avoid timeout on disconnect, I've updated the code

@smartmedev
Copy link

Hi @notjulian, sorry but what do you mean with "avoid timeout on disconnect"?

In @JuanSeBestia library code on disconnect/removeWifiNetwork is there any timeout... you've added it on your pr, but I can't understand what is the purpose of adding a timeout on disconnect/removeWifiNetwork. Thank you

@notjulian
Copy link
Collaborator Author

Hi @notjulian, sorry but what do you mean with "avoid timeout on disconnect"?

In @JuanSeBestia library code on disconnect/removeWifiNetwork is there any timeout... you've added it on your pr, but I can't understand what is the purpose of adding a timeout on disconnect/removeWifiNetwork. Thank you

If the disconnect take more time to complete, it will cancel and return

@gustavoabel
Copy link
Collaborator

@JuanSeBestia Hey, we already have 2 months of this PR, can we continue with the merge?

@JuanSeBestia
Copy link
Owner

This branch cannot be rebased due to conflicts

I can't.
"This branch cannot be rebased due to conflicts"

Rebase from master and solve conflicts please

@JuanSeBestia
Copy link
Owner

FYI still "This branch cannot be rebased due to conflicts"

@notjulian
Copy link
Collaborator Author

notjulian commented Aug 5, 2024

@JuanSeBestia can you please check I've this:
Able to merge. These branches can be automatically merged.

thanks

PS: can be related to this: 27521 ?

Screenshot 2024-08-05 at 14 24 51

@JuanSeBestia
Copy link
Owner

@notjulian
image

I can squash and merge if you want, but maybe it remove you as a commit owner, you can squash by you own if you want

@JuanSeBestia
Copy link
Owner

JuanSeBestia commented Aug 8, 2024

Mhe I will just merge it, sorry for the delay.

@JuanSeBestia JuanSeBestia merged commit d98ccfc into JuanSeBestia:master Aug 8, 2024
1 check passed
@notjulian
Copy link
Collaborator Author

@notjulian image

I can squash and merge if you want, but maybe it remove you as a commit owner, you can squash by you own if you want

yes can I do it or is too late now?

@JuanSeBestia
Copy link
Owner

🎉 This PR is included in version 4.13.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants