Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 30    Views: 144

Jlentriken
Aspiring developer
Profile
Posts: 246
Reg: Dec 26, 2012
Palm Beach, Gol...
12,110
03/13/14 07:48 PM (10 years ago)

Plugin Development

Hi all, Im just looking for some pointers here :). I have decided to try my hand at being useful and contributing somehow and i have a plugin in mind. Just chasing some pointers. Firstly, how do i set an option box in the bt control panel, and then how do i output that data into the right spot in the code? Second, is it possible to have some code added to the app delegate in a few places? Thanks all, I hope i can get this done! Jeremy
 
nadthevlad
Code is Art
Profile
Posts: 1025
Reg: Jun 07, 2012
Denver
21,850
like
03/13/14 08:01 PM (10 years ago)
Smugs guide is a good place to start. https://www.buzztouch.com/files/howtos/CP2Project.pdf There isn't much info out there on getting your values into your source code, but its not to hard to do. As far as I know there is no way to add code to the appdelegate.
 
Jlentriken
Aspiring developer
Profile
Posts: 246
Reg: Dec 26, 2012
Palm Beach, Gol...
12,110
like
03/13/14 08:03 PM (10 years ago)
OK, awesome. Thanks for the link. Glad its not too hard, I'm not great or even good yet lol. I didn't think id be able to get anything into the app delegate. Thanks, Jeremy
 
Stobe
buzztouch Evangelist
Profile
Posts: 1528
Reg: Mar 04, 2011
Fredericksburg,...
24,680
like
03/13/14 09:30 PM (10 years ago)
There's no built in way to get anything into the appDelegate. Mainly because of the whole idea that the core project should be kept untouched, and anything needed for the plugin should be coded into the plugin (for maximum portability). That being said, you could always add some instructions for the user to add/modify code in some of the core files. Its been done before. And if you think you have some functionality to add that would be beneficial to other plugin developers, feel free to contact me directly to explain what needed to be added. If its considered a good enough concept, it might be able to make it on our core roadmap. -Chris
 
nadthevlad
Code is Art
Profile
Posts: 1025
Reg: Jun 07, 2012
Denver
21,850
like
03/13/14 11:13 PM (10 years ago)
@stobe Some random thoughts from someone working nightshift: For having global values that can be passed between plugins use a generic and designated mutable array in the app delegate. And use dictionaries as the objects for storing stuff. Key-value pairs. Text only storage. When a plugin has something it wants to make global it adds a dictionary object to the mutable array in the app delegate. If a different plugin needs to access an element from the array it just searches the array for the key and retrieves that value. You could even add helper functions to the app delegate for adding and retrieving strings to the mutable array.
 
Jlentriken
Aspiring developer
Profile
Posts: 246
Reg: Dec 26, 2012
Palm Beach, Gol...
12,110
like
03/13/14 11:19 PM (10 years ago)
Chris - I can understand that completely, I just wondered if the few plugins that require you to put a few lines of code here or there were outdated and not being as automated as they can be. Honestly, my brain is running full revs trying to stay on top of understanding (Barely!) how everything is working. My 'idea' isn't original, but i know for a fact that it is needed by me and a few of my clients, so i thought i bet that others would want this if it was easier to use (sourced the code from github). Even if its not allowed to be sold or put on the plugin store for whyever, ill still be chuffed that i managed to do it. I will message you right now though, just to see what you think anyway. Thanks guys! Jeremy
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
03/14/14 12:47 AM (10 years ago)
Depending on what data you want to create or access in the appdelegate, you might be able to avoid it and use a singleton similar to how the favorites plugin works, originally the bulk of the code was going to be a written tutorial to add code to the appdelegate before I taught myself the singleton method. If you wanna send me a PM I can advise
 
Jlentriken
Aspiring developer
Profile
Posts: 246
Reg: Dec 26, 2012
Palm Beach, Gol...
12,110
like
03/14/14 02:06 AM (10 years ago)
Hi, Thanks Andrew for the offer. Im now wondering if theres anyone that wants to make this with me/teach me by it and then we could either split it and sell it or just keep it to use for ourselves. Im im waaay over my head sadly. Thanks, Jeremy
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
03/14/14 02:13 AM (10 years ago)
Well we are already discussing other things and mods, I'm happy to do some mentoring and training. I'm away from Saturday for a week.
 
Jlentriken
Aspiring developer
Profile
Posts: 246
Reg: Dec 26, 2012
Palm Beach, Gol...
12,110
like
03/14/14 02:29 AM (10 years ago)
Cool :) Andrew, Well, i reckon just wait tip your back and then we can chat about it and work something out. Thanks, Jeremy
 
nadthevlad
Code is Art
Profile
Posts: 1025
Reg: Jun 07, 2012
Denver
21,850
like
03/14/14 02:42 AM (10 years ago)
@kittsy Is there any specific place that you learned about singletons and their proper use?
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
03/14/14 02:52 AM (10 years ago)
@nad The amount of tutorials I do, I would struggle to find a definitive one. Type singleton pattern tutorial in ios into google. It's more about understanding how it gets initiated. @jeremy I'll send you a PM when I'm back
 
Jlentriken
Aspiring developer
Profile
Posts: 246
Reg: Dec 26, 2012
Palm Beach, Gol...
12,110
like
03/14/14 03:10 AM (10 years ago)
Anyone know how to reverse a string of text? More specifically the title in the detail view of the blog pro plugin
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
03/14/14 03:25 AM (10 years ago)
so make kittsy to ysttik Yup I've got a method for that lol You're going to think I'm staliking you lol
 
Jlentriken
Aspiring developer
Profile
Posts: 246
Reg: Dec 26, 2012
Palm Beach, Gol...
12,110
like
03/14/14 06:04 AM (10 years ago)
Haha stalking is sweet as! So long as I'm getting something out if it lol Reckon you could flick your method my way? Thanks, Jeremy
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
03/14/14 06:52 AM (10 years ago)
To reverse a string add this method to whatever plugin you would like - (NSString *)reverseString:(NSString*)string { NSMutableString *result = [[NSMutableString alloc] init]; for (NSInteger i = [string length] - 1; i >= 0; i--) { [result appendString:[NSString stringWithFormat:@"%C", [string characterAtIndex:i]]]; } return result; } To reverse a string you would use [self reverseString:@"Kittsy]; // this will return a string ysttiK to change the navbar title you would put this in the viewWillAppear method. self.navigationItem.title= [self reverseString:self.navigationItem.title]; this set's the a reverse of the nav bar title with the it's original text from the cpanel. No need to do the all the crap someone is probably posting using app delegate to find navbar or bt strings get json Yawn. The text is already there just switch it
 
Jlentriken
Aspiring developer
Profile
Posts: 246
Reg: Dec 26, 2012
Palm Beach, Gol...
12,110
like
03/14/14 06:56 AM (10 years ago)
So I want to reverse the title text in the blog pro detail view. It pulls the data fresh from the Wordpress website, will it work? Thanks
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
03/14/14 06:57 AM (10 years ago)
is that in the menu or when the post is clicked
 
Jlentriken
Aspiring developer
Profile
Posts: 246
Reg: Dec 26, 2012
Palm Beach, Gol...
12,110
like
03/14/14 06:59 AM (10 years ago)
The post when it's clicked
 
Jlentriken
Aspiring developer
Profile
Posts: 246
Reg: Dec 26, 2012
Palm Beach, Gol...
12,110
like
03/14/14 07:00 AM (10 years ago)
The list view title is right, but not the blog post view one.
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
03/14/14 07:02 AM (10 years ago)
To you mean aligned to the left or reverse the string
 
Jlentriken
Aspiring developer
Profile
Posts: 246
Reg: Dec 26, 2012
Palm Beach, Gol...
12,110
like
03/14/14 07:04 AM (10 years ago)
Reverse the string. It displays backwards.
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
03/14/14 07:12 AM (10 years ago)
try this in BTA_screen_blogProWebView.m under this about line 166 NSString* title = [BT_strings getJsonPropertyValue:self.screenData.jsonVars nameOfProperty:@"titleText" defaultValue:@""]; add this title = [self reverseString:title];
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
03/14/14 07:13 AM (10 years ago)
don't forget to add this somewhere in the plugin also - (NSString *)reverseString:(NSString*)string { NSMutableString *result = [[NSMutableString alloc] init]; for (NSInteger i = [string length] - 1; i >= 0; i--) { [result appendString:[NSString stringWithFormat:@"%C", [string characterAtIndex:i]]]; } return result; } if that isn't the right thing find the json value and add that line whatEver = [self reverseString:whatEver];
 
Jlentriken
Aspiring developer
Profile
Posts: 246
Reg: Dec 26, 2012
Palm Beach, Gol...
12,110
like
03/14/14 07:17 AM (10 years ago)
undeclared identifier "reverseString". What do i do with that error?
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
03/14/14 07:19 AM (10 years ago)
Have you added this somewhere outside of curly braces - (NSString *)reverseString:(NSString*)string { NSMutableString *result = [[NSMutableString alloc] init]; for (NSInteger i = [string length] - 1; i >= 0; i--) { [result appendString:[NSString stringWithFormat:@"%C", [string characterAtIndex:i]]]; } return result; }
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
03/14/14 07:20 AM (10 years ago)
I think you have added it in another method that above just add it before @end at then end of the plugin
 
Jlentriken
Aspiring developer
Profile
Posts: 246
Reg: Dec 26, 2012
Palm Beach, Gol...
12,110
like
03/14/14 07:25 AM (10 years ago)
Yeah I put it in the wrong spot. It works. But it's not right. I'm at a loss for ideas. Stupid damn Hebrew has to be written backwards, but the English bits that do not translate to Hebrew are backwards. I don't know what to do. It means that with or without the reverse string code something will be backwards.
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
03/14/14 07:31 AM (10 years ago)
Jeremy I would love to help further, but this would be an explorative way and I haven't got time. I've got 36 hours left in the country, got 2 plugin mods to do, get my holiday whiz together and complete a stupid online uni assignment that I forgot and is due in Wed. If your having this issue many others have, try googling find what ever stuff you can find, try and have a go, whatever you find keep hold of and we'll see what we can do in a week. If you find stuff don't email me it now, it will get last or I will procrastinate either way it's not good for me. Lol
 
Jlentriken
Aspiring developer
Profile
Posts: 246
Reg: Dec 26, 2012
Palm Beach, Gol...
12,110
like
03/14/14 07:32 AM (10 years ago)
No worries, Hey were you able to do the plugin mod before you leave on saturday? Thanks for all your help, Jeremy
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
03/14/14 07:39 AM (10 years ago)
hopefully lol
 

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.