Hi Daniel,
I like your approach. It's simple and would work. I do however feel there may cause an issue if a device is released with the same resolution was released for another iOS device (however very unlikely) or perhaps they removed the notch on another model but it had the same resolution.
My approach is to use the Identifiers (from here: http://www.enterpriseios.com/wiki/iOS_Devices) and then get the name of the device with Capabilities.os:
var iOSDeviceInfo:Object = {
//Add all models needed here
'iPhone10,3':{
'name':'iPhone X', //iPhone X (CDMA)
'ram':3072,
'knownRamBudget':null
},
'iPhone10,6':{
'name':'iPhone X', //iPhone X (GSM)
'ram':3072,
'knownRamBudget':null
},
'iPhone11,2':{
'name':'iPhone XS',
'ram':4096,
'knownRamBudget':null
},
'iPhone11,4':{
'name':'iPhone XS Max',
'ram':4096,
'knownRamBudget':null
},
'iPhone11,6':{
'name':'iPhone XS Max',
'ram':4096,
'knownRamBudget':null
},
'iPhone11,8':{
'name':'iPhone XR',
'ram':3072,
'knownRamBudget':null
}
};
var os:String = Capabilities.os.toLowerCase();
var key:String;
var id:String;
var deviceInfo:Object;
for (key in Data.iOSDeviceInfo){
id = key.toLowerCase();
if (os.indexOf(id) >= 0){
deviceInfo = Data.iOSDeviceInfo[key];
deviceInfo['ID'] = key;
break;
}
}
return deviceInfo;
Then, you check deviceInfo for the key/name for all iPhone models with Notches, and apply your changes as needed to allow for the Notch area.
I'll also mention that in my approach, I list the ram and known ram budget to attempt to also check for low ram devices, to disable certain features which may break/crash the app on that device. Probably not all that necessary as technology keeps improving though.