From my experience they are both needed.
I have had fruits on the same tree ripen at different times. Ones that were fully exposed became brown, sweet and fully ripened.
Those that were covered by leaves seem to take a week or so longer and do not get as sweet and ripened.
But if I had to choose one, it would be heat.