Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 5    Views: 63

Jake Chasan
Veteran developer
Profile
Posts: 1685
Reg: May 13, 2011
location unknow...
29,650
01/12/14 10:05 PM (11 years ago)

Change Homescreen from Plugin

Hi All, Does anyone know of a method which changes the homescreen? Or any ideas on how to change which screen is the homescreen from a plugin? Jake
 
mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
like
01/12/14 10:24 PM (11 years ago)
Let's dig in deeper... in order for a plugin to change what the homescreen becomes, you would need the plugin to change the json data that sets the homescreen. If I remember correctly, the homescreen will be the "first" screen, at the top of the json, where screens are listed. So to change the homescreen, instead of editing the json, we would simply need to add a screen above the current screen for the homescreen to change: So JSON looks like this first: screen 1 - my elephant app! (FIRST SCREEN - HOME SCREEN) screen 2 - contact me screen 3 - search screen Make the plugin add json manually for a screen at the top: screen 1 - user selected screen (NEW FIRST SCREEN - HOME SCREEN) screen 2 - my elephant app! screen 3 - contact me screen 4 - search screen So the real question is.. how do we import json via plugin. I guess you could "edit" the first screen json data, but for some reason I'm thinking it would be easier to add new json then modifying current json. I don't know. I'm trying to think of plugins that may already modify json via plugin, if there are any, that would be the plugin to hack up.. Wish I could be more help, but if you figure this out, it could bring in a whole new idea for plugins: user preferences screens, much like how kittsy's favorites plugin gives the user some power to customize their app by making their own menu screen with favorites. I'm typing more then usual... just excited I guess to see this, sounds like some powerful stuff could come from it :-) David
 
Jake Chasan
Veteran developer
Profile
Posts: 1685
Reg: May 13, 2011
location unknow...
29,650
like
01/12/14 10:34 PM (11 years ago)
@David: I am thinking your idea is right. The view would have to be added to the bottom of the stack. The only problem I see is "corrupting the navigation tree." So the main thing would be: how to change which view is associated with which tab. If this could be figured out, this problem would be easier. Possibly a topic for BuzzDay SD? Jake
 
Stobe
buzztouch Evangelist
Profile
Posts: 1528
Reg: Mar 04, 2011
Fredericksburg,...
24,680
like
01/12/14 10:56 PM (11 years ago)
There's another way to do it... Instead of changing the JSON, you can tell the app which file to use as the config.txt. This way you could have multiple config.txt files, and have a plugin change which one the core is using. This functionality is already built into the core, you'd just have to add some code to your plugin to leverage it. Look around line 92 of the app_delegate file to see how its used. This is exactly how I built the App Transformer plugin, which would probably work pretty well for what you need. I don't have it in the plugin market yet, but PM me if you need some help. -Chris
 
mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
like
01/12/14 11:12 PM (11 years ago)
Here, this is what Smug suggested when we chatted: ----------------------------- line 492 of the BT_application.m file: [theScreen setIsHomeScreen:TRUE]; If you define theScreen in your plugin, that may work. ----------------------------- "If" you were to setup an area in your NSUserDefaults, you could modify the app to look there right after loading the default data, and re-implement your changes... Basically, save your changes in NSUserDefaults, and mod the BT_app.m file to read your defaults right after loading the JSON file, and 're-apply' your changes... ------------------------------ Hope that is a step in the right direction, I didn't think there was another way to do it, I may have over complicated things, I usually do that when I let my mind wander.. hehe. David
 
mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
like
01/12/14 11:25 PM (11 years ago)
Chris, That's an interesting concept for-sure, pre-defined json config files, user chooses which one to load. How would you handle the problem of pushing updates out to several files if needed? Anyways, clever idea. :-) I love how there are so many things that you can do to achieve the same thing. David
 

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.