flowkey / UIKit-cross-platform

Cross-platform Swift implementation of UIKit, mostly for Android
MIT License
600 stars 40 forks source link

fix getAndroidDeviceScale #106

Closed michaelknoch closed 6 years ago

michaelknoch commented 6 years ago

DENSITY_DEVICE_STABLE is available for api level >= 24 only

https://developer.android.com/reference/android/util/DisplayMetrics.html#DENSITY_DEVICE_STABLE

anyway it should fallback to 2.0 as implemented. It's a problem with the force unwrap in jni.GetStaticField, i guess.

@cshg @ephemer

ephemer commented 6 years ago

As discussed in private channels, the crash that currently occurs is due to a bug in LLVM that has been fixed in the latest swift releases.

We should fix the DENSITY_DEVICE_STABLE though to fall back to more available APIs on older versions (especially because it's looking more and more likely that we will be able to support API 19 / 4.4.4 by time of release)