Project: titanium
Issue TIMOB-20064: Windows: Convert platform-specific (store or phone only) code to using macros to guard
We currently use macros that will effectively compile one block or another depending on whether the code works/is available on phone or desktop. i.e. {code:cpp} #if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP {code} This is the right approach for Windows 8, but in Windows 10 a universal app is generated and the check must be done at runtime. We need to convert these checks into a macro and have the macro defined to do different things for 8.1 versus 10. See https://msdn.microsoft.com/en-us/library/windows/apps/mt188202.aspx and https://msdn.microsoft.com/en-us/library/windows/apps/mt188203.aspx#reviewing_conditional_compilation I think we can extract a simple macro like: {code:cpp} // Only on Win 8.1 #define PHONE_ONLY_START \ #if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP #define PHONE_ONLY_END \ #endif // Only on Win 10 #define PHONE_ONLY_START \ if (Windows::System::Profile::AnalyticsInfo::VersionInfo::DeviceFamily == "Windows.Mobile") { #define PHONE_ONLY_END \ } {code} We may of course need more variants for things where the API is now available in Win10, but was only available for phone or store on 8.1, etc. (i.e. Clipboard was only for store.desktop in 8.1, but is universal in 10)
Story points: 13