isuPatches / android-wisefy

Wrapper around WifiManager and ConnectivityManager for Android
Apache License 2.0
312 stars 38 forks source link

Implement asynchronous API #58

Closed jewom closed 7 years ago

jewom commented 7 years ago

Hi,

Just a suggestion, can you implement some methods after the function mWiseFy.addWPA2Network() for example : @override public void onSuccess() {}

@override public void onFail() {} ?

It would be awesome :)

isuPatches commented 7 years ago

Hey there :) The work week caught up with me...let me think on this and see if I can come up with a proposal for callbacks like that. I'm not sure they would make sense for every method, but it could be nice to have that layer.

isuPatches commented 7 years ago

I think I'm going to move forward with this idea...I'm proposing method signatures like this:

public void addOpenNetwork(String ssid, WiseFyAddNetworkCallback addNetworkCallback)

And then it could be implemented like this:

mWiseFy.addOpenNetwork("ssid", new WiseFy.WiseFyAddNetworkCallback() {
            @Override
            public void failure(Integer wifiManagerReturnCode) {

            }

            @Override
            public void success(WifiConfiguration wifiConfiguration) {

            }

            @Override
            public void wisefyFailure(Integer wisefyReturnCode) {

            }
        });

Or something similar...thoughts? This will require some time and the naming of methods and callbacks are subject to change...the tests are also setup pretty linearly now and I would want to document the new updates, but I can get onboard with this architecture...it feels very RxJava-ish.

isuPatches commented 7 years ago

A complete async API will be available in 2.x branch. Each method will have it's own set of callbacks and will be run on a WisefyHandlerThread. This will also cause user's to have to call a method to cleanup the thread at their discretion. This is also related to #60 and #63.

jewom commented 7 years ago

great! When the API will be available ? Good luck and thanks again for this library :)

isuPatches commented 7 years ago

I'm hoping to release a 2.0.0 within the next 2 weeks...I have some tests and documentation to wrap up but the API itself is finalized. I can provide a BETA if you are overly curious :)

jewom commented 7 years ago

Oh yes! I would like to see the beta!

isuPatches commented 7 years ago

https://github.com/isuPatches/WiseFy/releases/tag/v2.0.0-BETA1 :)

It also should now be available through gradle with compile 'com.isupatches:wisefy:2.0.0-BETA1' and the documentation can be found in this directory: https://github.com/isuPatches/WiseFy/tree/2.x/documentation