Skip to content

Instantly share code, notes, and snippets.

@jonz94
Created October 25, 2022 08:07
Show Gist options
  • Save jonz94/57b528a3eb1815e7ac3151795b508686 to your computer and use it in GitHub Desktop.
Save jonz94/57b528a3eb1815e7ac3151795b508686 to your computer and use it in GitHub Desktop.
Check if current device has dynamic island using `@capacitor/device` plugin.
import { Device } from '@capacitor/device';
import { isPlatform } from '@ionic/angular';
const hasDynamicIsland = async () => {
if (!isPlatform('iphone')) {
return false;
}
const { model: identifier } = await Device.getInfo();
// iPhone 14 Pro: 'iPhone15,2'
// iPhone 14 Pro MAX: 'iPhone15,3'
// Credits: https://www.theiphonewiki.com/wiki/Models#iPhone
return ['iPhone15,2', 'iPhone15,3'].includes(identifier);
};
export { hasDynamicIsland };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment