Advice on what to do..

Im 18 weeks and 1 day pregnant now. I'm gonna give you a back story before i jump into the question. Me and my boyfriend have been together on and off for 3 years. He hasn't always been as great as he is now but i see ways he changed for me, he moved in right when he found out im pregnant. Yesterday i was going through his phone and saw old snapchats with some girl calling her cute and shit when we started talking again and at first i'm like okay.. but then i see another date and realize we were dating at the time he called her cute again and it was 2 days before i found out i was pregnant... like i never thought id be in this kind of situation and im honestly so numb. i told him what i saw but didn't show him the proof and he was looking in his phone all night to see what i saw but i was to in shock to really communicate right with him yesterday. this morning he goes to work and he's talking all depressed and now im feeling like i fucked everything up because i know how amazing he is just i need to know is this the only girl? why did this happen and will it ever happen again. Can someone please give me advice on what to do? Also do you think flirting is cheating because in my mind i do but i wanna hear other peoples opinions..