This PR resolves https://github.com/emcniece/cordova-plugin-rssi/issues/8 with a caveat: RSSI is no longer available for iPhone X/XR/XS for iOS 11+, and for all other devices for iOS 13+. Instead these devices only return the number of bars visible in the wifi icon.
Prior to the implementation of the code in master branch it was thought that iPhone X devices had a unique element tree. Now it is apparent that iPhone X iOS 11-12 was a transition toward iOS 13, and all iOS 13+ devices use a compatible UIView tree. iPhone X for iOS 11-12 remains an edge case.
The getWifiBars() method is currently split into 2 blocks: the first for handling non-iPhone X/XR/XS (iOS 11-12), and the second for handling iPhone X/XR/XS. Neither block works on both groups. Ideally this can be executed with some logic to detect the UIView elements present and return bars for either device group.
An attempt to implement Mirror/reflection on the UIView objects failed. I hoped that by doing this the method could iterate over available view keys and conditionally handle the different devices. The two object extensions remain commented out at the top of this file in case this ends up being useful.
Todo:
[x] Make it work on all platforms without thrown exceptions
This PR resolves https://github.com/emcniece/cordova-plugin-rssi/issues/8 with a caveat: RSSI is no longer available for iPhone X/XR/XS for iOS 11+, and for all other devices for iOS 13+. Instead these devices only return the number of bars visible in the wifi icon.
Prior to the implementation of the code in master branch it was thought that iPhone X devices had a unique element tree. Now it is apparent that iPhone X iOS 11-12 was a transition toward iOS 13, and all iOS 13+ devices use a compatible UIView tree. iPhone X for iOS 11-12 remains an edge case.
The
getWifiBars()
method is currently split into 2 blocks: the first for handling non-iPhone X/XR/XS (iOS 11-12), and the second for handling iPhone X/XR/XS. Neither block works on both groups. Ideally this can be executed with some logic to detect theUIView
elements present and returnbars
for either device group.An attempt to implement Mirror/reflection on the UIView objects failed. I hoped that by doing this the method could iterate over available view keys and conditionally handle the different devices. The two object extensions remain commented out at the top of this file in case this ends up being useful.
Todo:
isIphoneX
return value