ios - MFMailComposeViewController reacting to sent emails based on recipient -
i have button allow user send email support address. there option use email share content other users.
in latter case, fact user has shared via email tracked statistical analysis.
- (void)mailcomposecontroller:(mfmailcomposeviewcontroller *)controller didfinishwithresult:(mfmailcomposeresult)result error:(nserror *)error { if (result == mfmailcomposeresultsent){ [[trackinghelper sharedtracker] trackevent:@"product" action:@"sharedviaemail" label:self.product.name]; } [self dismissviewcontrolleranimated:yes completion:null];
}
since called both when user shares via email , when user sends support email, wondering if there way differentiate between 2 in delegate? mfmailcomposeresult not useful returns wether succeeded or not. hoping make determination retrieving recipients of sent mail , matching support address, far know there no way this.
does know if there way accomplish this?
the way define variable track option activated.
when "support email" selected, set flag issupportemail = yes
else no
.
then, in mailcomposecontroller,
- (void)mailcomposecontroller:(mfmailcomposeviewcontroller *)controller didfinishwithresult:(mfmailcomposeresult)result error:(nserror *)error { if (result == mfmailcomposeresultsent) { if(issupportemail) [[trackinghelper sharedtracker] trackevent:@"support" action:@"supportviaemail" label:self.product.name]; else [[trackinghelper sharedtracker] trackevent:@"product" action:@"sharedviaemail" label:self.product.name]; } [self dismissviewcontrolleranimated:yes completion:null]; }
Comments
Post a Comment