kirillzyusko / react-native-wifi-p2p

Library that provide access for working with wi-fi direct (p2p) module in android.
164 stars 32 forks source link

Why is getConnectionInfo() marked temporary? #16

Closed NoamDev closed 4 years ago

kirillzyusko commented 4 years ago

Hi, @NoamDev Well, it's good question :) If you look at implementation of this method (https://github.com/kirillzyusko/react-native-wifi-p2p/blob/master/android/src/main/java/io/wifi/p2p/WiFiP2PManagerModule.java#L61) you can see this function has side effect (saving new info into local wifiP2pInfo variable). And this method is only used in sendMessage/sendFile flow. And in future I would like to simplify these flows and get rid off the usage of this method. That's why I marked this method as temporary - I don't know whether we need to have this method in future after simplifying flow or not :) Nonetheless if I make breaking change I will publish new version as 2.x.x and prepare some migration documents. So now you can use this method. Did I answer on your question? :)

NoamDev commented 4 years ago

Hi, thanks for quick reply. May I ask what's bad with "saving new info into local wifiP2pInfo variable"? Be aware that I, for example, do not intend to use the sendMessage function. I plan to use basic internet protocols (in that case for webrtc).

kirillzyusko commented 4 years ago

@NoamDev The lifecycle method is not an evil 😅 I was just curios why did I need to use this method in the sending messages/files flow. Why did I need to update a variable? As far as I remember I didn't see anything in official docs - that's why I marked this method as temporary. I think I should remove this label :)

NoamDev commented 4 years ago

Oh, I didn't notice that this is a totally useless line of code😂

Yeah, you should probably get rid of it..

P.s. I'm just curious, what docs are talking about?