Discussion Forums  >  Uncategorized

Replies: 3    Views: 279

GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
07/04/11 06:36 PM (14 years ago)

Can I Populate Screen Name Into Email Subject? v1.5

Hi, One screen of my app loads a web page from an external host. I have a button on the top navigation bar that I would like to have people click to report a dead link. It will open up their email client, and I would like to populate the subject with something like Dead Site Report : <Screen Name>. Is this at all possible? Thanks, Mark
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
07/05/11 01:19 AM (14 years ago)
This is a good question. Yes, you can do it but it will take some hacking ;-) The method that opens the email compose sheet is called: +(void)sendEmailWithScreenData. This is in the BT_viewControllerManager.m file inside the BT_Layout folder. It starts on line 745. You'll see in that method that the subject line is inserted in the email compose sheet. The subject line comes from your control panel (if it's set). You could get a little sneaky and do something like this: a) Create the Email Screen and enter something strategic as the subject. Like: *screen* or something. Then...in the source code, if the subject equaled *screen* you would replace it with the screen title. The screen title is 'remembered' in the sofware as the currentScreenData. So...on about line 772, under where it already sets the subject... try this: //repace *screen* with name of current screen. if([theScreenData.jsonVars objectForKey:@emailSubject]){ if([[theScreenData.jsonVars objectForKey:@emailSubject] isEqualToString:@*screen*]){ [picker setSubject:[appDelegate.rootApp.currentScreenData itemNickname]]; } } The forum replaces double-quotes with single quotes..make sure they are double quotes. Bet it works ;-)
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
07/05/11 10:05 AM (14 years ago)
Ohh...nice! I love to hack! Thanks for showing me how to do this...I'll give it a try today and let you know how it works out. It will be a valuable addition to my app. Thanks, David, for all your hard work on buzztouch! Mark
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
07/05/11 11:34 AM (14 years ago)
Hi David, Here's my lines 742 - 773. I'm not sure exactly what I should be replacing, or if I should be adding. The screen nickname I'm using is *Compose,*, but I don't see that anywhere. The current subject I am using is *Menu Not Available Report!*. I don't see that in my code anywhere. //if we have a subject set... NSString *emailSubject = @; if([theScreenData.jsonVars objectForKey:@emailSubject]){ emailSubject = [theScreenData.jsonVars objectForKey:@emailSubject]; } //empty message body or the imageTitle of an image we are emailing (if it has an imageTitle).. NSString *imageTitle = [BT_strings getPrefString:@emailImageTitle]; if([emailSubject length] < 1){ [picker setSubject:imageTitle]; } //erase emailImageTitle for next time... [BT_strings setPrefString:@emailImageTitle:@]; } //show it [theNavController presentModalViewController:picker animated:YES]; [picker.navigationBar setTintColor:[BT_viewUtilities getNavBarBackgroundColorForScreen:theScreenData]]; }//can send mail }//if mail class } //send email with toAddress (triggered when link with mailto is clicked in a web-view) +(void)sendEmailFromWebLink:(BT_item *)theScreenData:(NSString *)toAddress{ [BT_debugger showIt:self:[NSString stringWithFormat:@sendEmailFromWebView: %@, toAddress]]; //WE SHOULD NOT BE HERE IF THE DEVICE IS NOT CAPABLE OF SENDING EMAILS Thanks! Mark
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.