Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 39    Views: 109

Uelsimon
Lost but trying
Profile
Posts: 272
Reg: Mar 25, 2012
NYC
4,470
02/25/13 12:25 AM (12 years ago)

RSS Pluging - getting RSS item Title to appear in Nav bar of bt_screen_webview

Hi... Is there a way to pass the RSS item title to the webview and make it appear sa the title in the Nav bar? Or simply just make it available on BT_screen_webview so i can use it with Socialize? This may be more of a simple Xcode question than a BT question. (sadly I'm a newbie to both). But what I gather is that I want to somehow make 'xmlItemTitleName' from BT_screen_rssReader.m available to BT_screen_webView.m. or pull the info from the JSON the same way it was pulled in rssReader.m file. Any takers? Thanks again
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
02/25/13 04:47 AM (12 years ago)
I haven't found a BT_screen_webview, so I was looking at the HTML doc, which led me to the BT_viewUtilities.m file, which starts getting interesting around line 209 or so... Maybe you can do something with that...? Cheers! -- Smug
 
Uelsimon
Lost but trying
Profile
Posts: 272
Reg: Mar 25, 2012
NYC
4,470
like
02/25/13 04:58 AM (12 years ago)
Hmm interesting indeed. That does control the Navbar...hmm. ok i guess...then i simply just want to get the title info available to the webview..and then override the nav bar default title. BT_screen_webView is found here : BT_Plugins>bt_screen_rssReader>BT_screen_webView.m Thanks SmugWimp for checking into this for me.
 
Red Dog
buzztouch Evangelist
Profile
Posts: 805
Reg: Jun 16, 2011
Southern Califo...
18,800
like
02/25/13 06:07 AM (12 years ago)
@smug BT_screen_webview is a 1.5 BT screen.
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
02/25/13 06:08 AM (12 years ago)
I'll get you the code when i get home, it is the webview one
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
02/25/13 06:11 AM (12 years ago)
@red dog it's also a file in the buzztouchmods version for ios 2.0 selfhosted
 
LA
Aspiring developer
Profile
Posts: 3280
Reg: Aug 16, 2012
Jerseyville, IL
42,900
like
02/25/13 06:12 AM (12 years ago)
Does anyone have codes to the older 1.5 "plugins"? Don't mean to highjack your post @Uelsimon. LA
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
02/25/13 06:15 AM (12 years ago)
@LA what do you mean, code?
 
LA
Aspiring developer
Profile
Posts: 3280
Reg: Aug 16, 2012
Jerseyville, IL
42,900
like
02/25/13 07:03 AM (12 years ago)
@Kittsy, The older 1.5 plugins..like the java and screen in Android. LA
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
02/25/13 07:05 AM (12 years ago)
I'm sure if you ask David he will have a back up somewhere
 
LA
Aspiring developer
Profile
Posts: 3280
Reg: Aug 16, 2012
Jerseyville, IL
42,900
like
02/25/13 07:12 AM (12 years ago)
Thank you @Kittsy. LA
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
02/25/13 08:38 AM (12 years ago)
@Uelsimon In BT_screen_webview add this line under done loading. This code takes the title of the webpage and puts it in the top navbar. self.navigationItem.title=[webView stringByEvaluatingJavaScriptFromString:@"document.title"]; //here I am here it is in the code about line 697 //done loading - (void)webViewDidFinishLoad:(UIWebView *)theWebView{ [BT_debugger showIt:self:@"webViewDidFinishLoad"]; self.navigationItem.title=[webView stringByEvaluatingJavaScriptFromString:@"document.title"]; //hide progress [self hideProgress]; [self setDownloadInProgress:0]; //if we have a back button in a toolbar, we may need to disable it if(self.browserToolBar != nil){ for(UIBarButtonItem *button in [self.browserToolBar items]){ int theTag = [button tag]; //back == 101 (see BT_viewUtilties.m > getWebToolBarForScreen) if(theTag == 101){ if(![self.webView canGoBack]){ [button setEnabled:FALSE]; }else{ [button setEnabled:TRUE]; } } } } } If you don't like seeing the previous title while it loads add self.navigationItem.title=nil; in the view will appear method under the nav bar setup demo code below //setup navigatioBT_itemn bar and background [BT_viewUtilities configureBackgroundAndNavBar:self:[self screenData]]; self.navigationItem.title=nil; // this blanks the name before the webview loads Any questions just ask
 
Uelsimon
Lost but trying
Profile
Posts: 272
Reg: Mar 25, 2012
NYC
4,470
like
02/25/13 10:47 AM (12 years ago)
@Kitsy First of all lemme start with...Thank you for your awesomeness.Were definitely moving closer to what I'm envisioning. So let me lay out exactly what I'm going after. 1. Your code snippet was able to pull in the Site title, but I want the actual 'article title'. I mostly need it to use for Socialize plugin as the 'name' component when a user shares an item. the line I will use it in appears in the -(void)viewWillAppear method self.entity = [SZEntity entityWithKey:dataURL name:(WEBPAGE_TITLE)]; so for example..If I went to the following video http://www.youtube.com/watch?v=Cm4OnFLl5Uw ... the snippet you gracefully provided simply shows 'Youtube' in the nav, but what I want it to show is 'Letter E Song - Youtube'. i.e. the entire title of the page. Thanks for the help
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
02/25/13 11:29 AM (12 years ago)
mmm it must be something youtube does because if you launch any other url it will give it's title. I will continue to dig
 
Uelsimon
Lost but trying
Profile
Posts: 272
Reg: Mar 25, 2012
NYC
4,470
like
02/25/13 11:34 AM (12 years ago)
Confirmed..hmm indeed. most other websites do show up correctly. Twitter somehow does it like Youtube also. Digging here also.
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
02/25/13 11:37 AM (12 years ago)
I'll explain what is happening. the rss feed parses splits up the rss feed into title, url image etc. The image and, title are used in the rss screen. the webview is only sent the url of the website and youtubes body does not respond to .title .subitle does that make sense
 
Uelsimon
Lost but trying
Profile
Posts: 272
Reg: Mar 25, 2012
NYC
4,470
like
02/25/13 11:44 AM (12 years ago)
Confirmed..hmm indeed. most other websites do show up correctly. Twitter somehow does it like Youtube also. Digging here also.
 
Uelsimon
Lost but trying
Profile
Posts: 272
Reg: Mar 25, 2012
NYC
4,470
like
02/25/13 11:47 AM (12 years ago)
yes?? :) .. so is there a way to send over the title from the parser? or are you saying... This IS actually working correct, but Youtube/Twitter is being crafty? so this is prolly as good as it gets.
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
02/25/13 11:53 AM (12 years ago)
yes I'm trying to figure that out, but you tube aint making it easy
 
Uelsimon
Lost but trying
Profile
Posts: 272
Reg: Mar 25, 2012
NYC
4,470
like
02/25/13 11:54 AM (12 years ago)
np.. I'm also trying to explain it to the socialize folks here... so hopefully between the 3 of us, we'll solve this. http://support.getsocialize.com/socialize/topics/current_url_of_uiwebview_in_actionbar?utm_content=reply_link&utm_medium=email&utm_source=reply_notification#reply_11408643 Again, Thank you. €
 
Uelsimon
Lost but trying
Profile
Posts: 272
Reg: Mar 25, 2012
NYC
4,470
like
02/25/13 11:59 AM (12 years ago)
hmm not sure why everything is double posting. (eep)
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
02/25/13 12:46 PM (12 years ago)
an epiphany replace this on around line 450 [BT_strings getJsonPropertyValue:self.screenData.jsonVars:@"navBarTitleText":@""], @"navBarTitleText", with theRssItem.title, @"navBarTitleText",
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
02/25/13 12:54 PM (12 years ago)
then in the web view.m use the string NSString * titleString = self.navigationItem.title; This will then become self.entity = [SZEntity entityWithKey:dataURL name:(WEBPAGE_TITLE)]; self.entity = [SZEntity entityWithKey:dataURL name:titleString]; BOOM!!!!!!!!!
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
02/25/13 12:54 PM (12 years ago)
How simple was that fuming it took so long
 
Uelsimon
Lost but trying
Profile
Posts: 272
Reg: Mar 25, 2012
NYC
4,470
like
02/25/13 12:56 PM (12 years ago)
Bloody Hell! IT worked. I changed the line in BT_screen_rssReader.m, then restored the name:htmlEntity and it worked... oh lemme try your newest add. brb
 
Uelsimon
Lost but trying
Profile
Posts: 272
Reg: Mar 25, 2012
NYC
4,470
like
02/25/13 01:00 PM (12 years ago)
So I remained with the following, as the newest code seemed to bring me back to the 'youtube' only post. i.e. final workgin solution -- NSString *htmlEntity = [NSString stringWithFormat:@"%@", [BT_strings getJsonPropertyValue:screenData.jsonVars:@"navBarTitleText":@""]]; self.entity = [SZEntity entityWithKey:dataURL name:htmlEntity]; --
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
02/25/13 01:02 PM (12 years ago)
What is it you want in there the URL www.google.com or the title google - great search engine
 
Uelsimon
Lost but trying
Profile
Posts: 272
Reg: Mar 25, 2012
NYC
4,470
like
02/25/13 01:06 PM (12 years ago)
The title 'google - great search engine'
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
02/25/13 01:08 PM (12 years ago)
so in the web view swap this NSString *htmlEntity = [NSString stringWithFormat:@"%@", [BT_strings getJsonPropertyValue:screenData.jsonVars:@"navBarTitleText":@""]]; with this NSString *htmlEntity = self.navigationItem.title; then this will work self.entity = [SZEntity entityWithKey:dataURL name:htmlEntity];
 
Uelsimon
Lost but trying
Profile
Posts: 272
Reg: Mar 25, 2012
NYC
4,470
like
02/25/13 01:15 PM (12 years ago)
awesome... it shows up and works great. Now to figure out how to customize the default text socialize creates when sharing an item. Thanks again Kittsy. I'll be around to pick your brain again soon.
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
02/25/13 01:16 PM (12 years ago)
How about that for service hey
 
Uelsimon
Lost but trying
Profile
Posts: 272
Reg: Mar 25, 2012
NYC
4,470
like
02/25/13 01:17 PM (12 years ago)
The very definition! ;)
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
02/25/13 02:31 PM (12 years ago)
Mad Skills, Kittsy :) Cheers! -- Smug
 
Uelsimon
Lost but trying
Profile
Posts: 272
Reg: Mar 25, 2012
NYC
4,470
like
02/25/13 04:11 PM (12 years ago)
I'll start a new thread on this..but since I have you all here already let me ask. RSS Reader plugin. Do you have the option for modifying the RSS rendering? My installation seems to be missing 3 options in particular, but I'm not sure if it is an installation issue, or whether those options were lost with the BT 2.0 update. The three rows I'm looking for in particular are as follows: > RSS List Row Height, Font Size > RSS List Layout, Color > RSS List Icons / Image Size Thanks for confirming.
 
ATRAIN53
Code is Art
Profile
Posts: 1755
Reg: Nov 17, 2011
Chicago
26,450
like
02/26/13 08:46 AM (12 years ago)
Uelsimon - When you find time, please leave Kittsy a review for one of his plug-ins so folks understand what kind of support this guy dishes out in gratis! That's some heavy duty support! Kittsy - I've got one for you regarding Socialize as long as you're on the topic and hopefully have some time....? I added to it an non-BT app for someone and want to use the value of a textLabel as the "entity". The textlabel comes from an NSArray arrayWithObjects I've turned that textlabel into an NSString and then try to use my 'entitywithkey' as that NSString code compiles without error, but crashes when I try to share that entity... I know I'm fighting the controller for that label and it gets nilled out, but if i can just grab it and pass ti to that SZEntity..... code I'm trying: textlabel.text = myszentitytext; self.entity = [SZEntity entityWithMyKey:myszentitytext name:@"Kittsy Rocks"];
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
02/26/13 09:02 AM (12 years ago)
I think you've got it the wrong way around. It should be myszentitytext = textlabel.text;
 
ATRAIN53
Code is Art
Profile
Posts: 1755
Reg: Nov 17, 2011
Chicago
26,450
like
02/26/13 11:52 AM (12 years ago)
Thanks. That does seem to work a little better - but it's just pulling the static value of that label when the screen loads. That label actually populates itself from an NSArray. So I think I really want to capture the current value of that label that is currently on the screen as the "Entity".... It's like I almost need to make a new object out of the NSString of the label when it is displayed, then use that variable?
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
02/27/13 02:37 AM (12 years ago)
you need to find the method that changes the label from the array, then put myszentitytext = textlabel.text; in it so that when the label changes sp does the new variable. If you want to send me the code to the usual address I can take a look, difficult to do when I can't see the flow
 
ATRAIN53
Code is Art
Profile
Posts: 1755
Reg: Nov 17, 2011
Chicago
26,450
like
02/27/13 07:31 AM (12 years ago)
Thanks amigo, I think I was coming to that realization after playing with it more. Let me look at it again with some fresh eyes and see if I can find that. I was hoping to be able to add the SDK without modifying the code too much, but it's never that easy. I like the app idea, sending it your way either way so you can look at it and maybe 'borrow' some code/ideas. That's tain reason I wanted to look at the project myself ;)
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
02/27/13 08:36 AM (12 years ago)
no prob's I wouldn't be changing the code, I'd just need to see how the array was being processed, it would probably be a quick job
 

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.