Created
October 25, 2022 08:07
-
-
Save jonz94/57b528a3eb1815e7ac3151795b508686 to your computer and use it in GitHub Desktop.
Check if current device has dynamic island using `@capacitor/device` plugin.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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