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

ANDROID: Timeout parameter on connectToProtectedSSID method #355

Merged
merged 8 commits into from
Mar 26, 2024

Conversation

alexma01
Copy link
Contributor

@alexma01 alexma01 commented Jan 8, 2024

In this PR, a timeout parameter has been added to the connectToProtectedWifiSSID method.
The parameter, as methods are made today, is mandatory. If set to null then by default it will use a 15 second timeout for the connection. The parameter is to be used in seconds and not in milliseconds, the conversion is done in the method.
The timeout was added only for Android, as I didn't encounter any problems on IOS.
This PR was created because, when we try to connect to a network by entering an incorrect password, the ANDROID system takes too long to return a response.

@alexma01
Copy link
Contributor Author

alexma01 commented Jan 8, 2024

@gustavoabel
Copy link
Collaborator

gustavoabel commented Jan 30, 2024

@alexma01 Could you give more details about the change in the description of this PR? (example: added a timeout to connectToProtectedSSID for this or that)

@alexma01
Copy link
Contributor Author

alexma01 commented Feb 4, 2024

Hi @gustavoabel , i added more details!
Thanks!

@JuanSeBestia
Copy link
Owner

Looks a BREAKING CHANGE for previous users, I was thinking that maybe changes props like

onnectToProtectedSSID(
    SSID: string,
    password: string | null,
    options?: {
      isWEP?: boolean,
      isHidden?: boolean,
      timeout?: number | null
    })

Soo to avoid breaking change could you make the parameter optional?

*/
export function connectToProtectedSSID(
SSID: string,
password: string | null,
isWEP: boolean,
isHidden: boolean
isHidden: boolean,
timeout: number | null
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
timeout: number | null
timeout?: number | null

@alexma01
Copy link
Contributor Author

alexma01 commented Feb 5, 2024

Hi @JuanSeBestia,
with the change you suggest we still make BREAKING CHANGES for previous users.
this would require ad hoc work. It would be better to do this in a separate PR.
what do you think?

@JuanSeBestia
Copy link
Owner

JuanSeBestia commented Feb 12, 2024

Yep, but I prefer one breaking change and not many on the future, this days comes now, because #362 is having conflicts with this MR for the same reason.

@gustavoabel
Copy link
Collaborator

Looks a BREAKING CHANGE for previous users, I was thinking that maybe changes props like

onnectToProtectedSSID(
    SSID: string,
    password: string | null,
    options?: {
      isWEP?: boolean,
      isHidden?: boolean,
      timeout?: number | null
    })

Soo to avoid breaking change could you make the parameter optional?

Can we continue this way? @alexma01 @JuanSeBestia

@JuanSeBestia
Copy link
Owner

Yep, but I not have too much time free to implement it :(

@alexma01
Copy link
Contributor Author

alexma01 commented Feb 28, 2024

Hi guys,

so, i added new method "connectToProtectedWifiSSID":

type ConnectToProtectedSSIDParams = {
    ssid: string;
    password: string | null;
    isWEP?: boolean;
    isHidden?: boolean;
    timeout?: number;
};

export function connectToProtectedWifiSSID(
    options: ConnectToProtectedSSIDParams
): Promise<void>;

This is to maintain backwards compatibility and also because method overloading doesn't work with the react-native javascript bridge.
Let me know if this works.

@JuanSeBestia @gustavoabel

@gustavoabel
Copy link
Collaborator

Hi guys,

so, i added new method "connectToProtectedWifiSSID":

type ConnectToProtectedSSIDParams = {
    ssid: string;
    password: string | null;
    isWEP?: boolean;
    isHidden?: boolean;
    timeout?: number;
};

export function connectToProtectedWifiSSID(
    options: ConnectToProtectedSSIDParams
): Promise<void>;

This is to maintain backwards compatibility and also because method overloading doesn't work with the react-native javascript bridge. Let me know if this works.

@JuanSeBestia @gustavoabel

Looks good to me @alexma01

@alexma01
Copy link
Contributor Author

Hi,

can i have a feedback?
If the implemantion isn't ok, i can change that.

Thanks 😁

@JuanSeBestia

@JuanSeBestia
Copy link
Owner

Looks good to me, I don´t know if it works also on android, I didn't see the mapping also on the android part, But I agree with how deal with the issue :)

@gustavoabel
Copy link
Collaborator

Hi @alexma01, has conflicts here.

@alexma01
Copy link
Contributor Author

alexma01 commented Mar 17, 2024

Hi @gustavoabel ,

conflicts resolved.

Thanks

Copy link
Collaborator

@gustavoabel gustavoabel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gustavoabel
Copy link
Collaborator

@JuanSeBestia
Can I merge this PR?

@JuanSeBestia
Copy link
Owner

I think yes

@JuanSeBestia JuanSeBestia merged commit 93d737a into JuanSeBestia:master Mar 26, 2024
1 check passed
@JuanSeBestia
Copy link
Owner

🎉 This PR is included in version 4.12.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.

3 participants