-
Notifications
You must be signed in to change notification settings - Fork 125
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
Add timeout option for connectToProtectedSSID #116
Comments
@eliaslecomte, great idea! However, we don't need add a new method. We could change export function connectToProtectedSSID(
SSID: string,
password: string | null,
isWEP: boolean,
options?: {
timeout: number | undefined,
} | undefined
): Promise<void>; |
Unfortunately the native bridge doesn't support overloaded methods. Having two methods with overloaded parameters on Android will throw a runtime exception 😢 . |
@eliaslecomte, can't we add a public void connectToProtectedSSID(@NonNull final String SSID, @NonNull final String password, final boolean isWep, @Nullable final ReadableMap options, final Promise promise) |
I will try if that works and doesn't mess with the promise. |
@eliaslecomte, if it doesn't work we can add |
any update on this? |
Firstly apologies for wading in, I have just discovered this library, and it's exactly what I need. My own personal view is that using the named parameters approach to function signatures makes adding new features (such as this) trivial in the future. In this case, a short-term breaking change to a sig such as the following would benefit the library in the longer term: export function connectToProtectedSSID(options: {
ssid: string;
password: string | null;
isWEP: boolean;
timeout? number;
}): Promise<void>; With this in place, more options can be easily added to this at a later date, providing they are optional. Of course, there is the downside of inconvenience for existing users, but in most cases a simple refactor should suffice, especially if this is released as a major version bump with clear migration instructions. Thanks for maintaining this library, whatever decision is taken here, it would be great to have a timeout option. |
try react-native-tethering which has this feature see |
Hi, i created this PR #355 |
Thanks for this contribution! @alexma01 |
Closing the issue as the pull request has already been created. #355 |
Feature description
Add configurable timeout option. When the phone couldn't connect to access point in the specified time, cancel the attempt and reject the promise with error
timeoutOccurred
.On iOS this timeout behaviour has to be added completely.
On Android this is already an option in the native dependency used (https://github.com/ThanosFisherman/WifiUtils) but we don't allow setting it yet.
New method signature
If we don't want to break the lib for users that upgrade, we could add a new method:
connectToProtectedSSID(SSID, password, options: Object): Promise
Options:
The text was updated successfully, but these errors were encountered: