Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 10    Views: 110

mtcoleman9
Aspiring developer
Profile
Posts: 29
Reg: Apr 11, 2013
San Diego
2,290
08/16/13 03:11 PM (12 years ago)

Do I need to build a plugin?

I'm trying to add functionality to an otherwise complete BT app. It required me to create a new objective c class in xcode...wondering if I can somehow get my BT plugins to interact with my new class easily, or do I need to turn my new class into a plugin? Thanks!
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
08/16/13 03:17 PM (12 years ago)
If the code creates a new screen, you're talking custom plugin. If the code enhances an already existing feature, you're probably just going to alter the core. Without specifics, we're just generalizing. Cheers! -- Smug
 
mtcoleman9
Aspiring developer
Profile
Posts: 29
Reg: Apr 11, 2013
San Diego
2,290
like
08/16/13 03:32 PM (12 years ago)
New plugin it is then. Answered my question, thanks!
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
08/16/13 05:15 PM (12 years ago)
Really a plugin is just a class file. Simply add an item in your BT_config.txt with itemType equal to the name of your class and you're all set. Use the JSON Snipet Keeper to keep it dynamic. And be sure to ask for help when you need it!
 
mtcoleman9
Aspiring developer
Profile
Posts: 29
Reg: Apr 11, 2013
San Diego
2,290
like
08/16/13 06:07 PM (12 years ago)
Oh nice, thanks Chris...that will make the process much easier
 
CrazyLina
Aspiring developer
Profile
Posts: 8
Reg: Aug 04, 2013
London
4,680
like
08/16/13 09:10 PM (12 years ago)
Hi Chris, I keep seeing people taking about the JSON snipet keeper. I can't find any more info on this - can you point me in the right direction please? I created some screens through the control panel, downloaded and ran in xcode, and am now adding my own .h & .m UITableViewController files. I am now struggling to figure out where else I need to add code to call these. Thinking it's JSON in config file?
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
08/16/13 09:33 PM (12 years ago)
Yep - sounds like you're really close to getting your screens up and running. Basically here's how Buzztouch apps work: 1) The app starts up and runs some code (starting with the appDelegate file) that looks at the BT_config.txt file to see what screens have been added to the app. 2) The app determines what screen (or view controller) to show first based on the BT_config.txt file, then loads that screen. It does this by looking at the "itemType" property. 3) Links to various screens from the homescreen are controlled through the BT_config.txt file. This happens using the "itemId" property and the "itemType" property. So, for instance, let's say you have two screens in your app - a menu screen and an HTML screen. Your BT_config.txt file might look like this: BT_config.txt: ... "BT_screens":[ {"itemId":"123abc", "itemType":"BT_menuListSimple", "childItems":[ {"itemId":"menuRow1", "itemType":"BT_menuItem", "loadScreenWithItemId":"456def", "titleText":"a cool screen"} ]}, {"itemId":"456def", "itemType":"BT_screen_htmlDoc", "localFileName":"index.html"} ] ... Here, you can see there are two entries in the BT_config.txt file. The first has a itemId of "123abc" and has a childItem (menu row) that points to the second screen, with itemId of "456def". So, in your case, you need to first have an entry in your BT_config.txt file for your custom screen. The "itemType" is the name of the class file. (In the above example, the class files are "BT_screen_htmlDoc.m" and "BT_screen_htmlDoc.h". The code will look at the name before the ".h" or ".m" and match it up with the itemType. Getting this information in the BT_config.txt file is where the rub is. If your app is 'offline', it's as easy as editing the BT_config.txt file in XCode. But if your app is connected to the control panel (the default setting), then the app will overwrite any changes you make in XCode the next time it downloads the file from Buzztouch.com. To get around this, you can use the JSON Snippet Keeper plugin. This plugin allows you to manually add JSON data to your online BT_config.txt file. It will show up as a screen on your control panel, so you can easily accomplish the second part - linking one of your menu items to the new screen. All you need to do is create the JSON Snippet Keeper screen, open it up on the control panel, and add in the "itemType" property to the JSON. Hopefully that helps. I know I just threw a ton of information at you, so be sure to ask questions for whatever might have just gone over your head!
 
CrazyLina
Aspiring developer
Profile
Posts: 8
Reg: Aug 04, 2013
London
4,680
like
08/16/13 10:40 PM (12 years ago)
Thanks Chris for the great info! Yes figured that its referring to the online config file instead of local version. Don't really want to take the whole thing offline as could cause issues for me in the future, so will either try adding the JSON Snippet Keeper plugin. My other thought was maybe using Dropbox for the config file, but then I'd need to be on top of any JSON code changes myself. Depends how organised I think i'll be!
 
CrazyLina
Aspiring developer
Profile
Posts: 8
Reg: Aug 04, 2013
London
4,680
like
08/16/13 11:33 PM (12 years ago)
Thanks Chris for the great info! Yes figured that its referring to the online config file instead of local version. Don't really want to take the whole thing offline as could cause issues for me in the future, so will either try adding the JSON Snippet Keeper plugin. My other thought was maybe using Dropbox for the config file, but then I'd need to be on top of any JSON code changes myself. Depends how organised I think i'll be!
 
CrazyLina
Aspiring developer
Profile
Posts: 8
Reg: Aug 04, 2013
London
4,680
like
08/17/13 02:24 AM (12 years ago)
Thanks Chris for the great info! Yes figured that its referring to the online config file instead of local version. Don't really want to take the whole thing offline as could cause issues for me in the future, so will either try adding the JSON Snippet Keeper plugin. My other thought was maybe using Dropbox for the config file, but then I'd need to be on top of any JSON code changes myself. Depends how organised I think i'll be!
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
08/17/13 09:19 PM (12 years ago)
Yep - hosting the config file outside of Buzztouch is certainly one way to go. It's certainly more work that way, but it can provide some nice flexibility if you understand JSON well. But for most uses, I'd stick with the JSON Snipper Keeper.
 

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.