In a blender or mixing cup, whisk or blend ube halaya, coconut milk, condensed milk, and ube extract until completely smooth and uniformly purple.
Fill a tall glass with ice cubes, leaving about an inch of space at the top.
Pour the ube coconut mixture over the ice, filling the glass about three-quarters full.
Slowly pour espresso or cooled strong coffee over the back of a spoon just above the drink to create layers.
Garnish with toasted coconut flakes and serve immediately with a straw. Stir before drinking.