Discussion Forums  >  Buzztouch News and Announcements

Replies: 7    Views: 438

David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
01/31/17 07:52 AM (7 years ago)

Tabs, Button Screen Issues...

Hey folks, Been working out some issues with Tabs, some button funky-ness on the standard button menu and a few other details reported recently such as menu list rows that "show selected state on back press" 4.0.2 will address these and should be available sometime Tuesday. I'm posting this message because I'm hearing lots of repeated questions (which makes sense if nobody knows what's in progress).
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
01/31/17 11:53 AM (7 years ago)
Hello David, good to hear 4.0.2 is on the way. I discovered something that affects a lot of existing plugins, to do with not reading json data from the control panel, so that only default values work. In existing plugins, there seem to be two ways of doing this, one way recently stopped working. The code compiles, runs, but does not return the expected result. The one that stopped working is the more common & uses BT_strings getStyleValueForScreen:self.screenData nameOfProperty The one that still works uses : BT_strings getJsonPropertyValue:self.screenData.jsonVars nameOfProperty I converted to the latter fixing all my plugin problems with setting colours and other values. My question is: do we need to apply this fix to all plugins going forward or will the first method work going forward please? Thanks, Alan
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
01/31/17 08:22 PM (7 years ago)
@AlanMac, this is a great catch / find! I had a look, good timing, trying to get as many of these reports ironed out before pushing 4.0.2. Try to follow along... The BT_strings.getStyleValueForScreen method indeed still exists. Was gonna be shocked to find it gone, as you say, lots of things depend on it. It's close to the same method as the BT_strings.getJsonPropertyValue method, they do in essence the same exact thing. But, one takes a BT_item as the first argument, the other takes BT_item.jsonVars (slight difference). The idea is that either could be used to find a style value from the JSON but using the first one is generally easier when dealing with "screen data." Pass in the current screen data object (an instance of a BT_item), along with the name of the property you want and it returns EITHER the app's theme value for that property, the screen's value (if overridden by that screen) or lastly the default value. You know all this. So why wasn't / didn't it work? I did some testing and found that the method itself is perfectly fine. BUT, it will only work if the appDelegate.rootApp.rootTheme is NOT null. I downloaded a few projects and found some projects where appDelegate.rootApp.rootTheme WAS null and some where appDelegate.rootApp.rootTheme was NOT null. Strange. A bit more snooping around and it became obvious. If you look at the JSON data for an app in the control panel you'll see a key for themeItemId. This was added in 4.0.0. This id matches the id of the theme object lower down in the JSON data. Prior to this update the theme was determined by "finding the first theme in the list", a bit jenky in our opinion, this approach (setting a themeItemId) in the app's JSON is a bit more flexible. You can see some other keys there that use the same sort of logic. Anyway, so why were some of these themeItemId's blank? As it turns out, the control panel sets this value when a theme is "activated." But, for many many existing app's a theme is already activated because it was made awhile ago and therefore the themeItemId never got set. Duh! Amazing how many moving parts in this thing. I've made an adjustment to the control panel to get around this. When you visit an app's control panel it will now check to make sure a themeItemId exists in the apps JSON and set that if needed. Geez. Lastly, this discovery saved me a few hours work! I was digging around in the Buttons menu to figure out why lots of the settings weren't honored on "some apps" and this "null theme" trap was exactly the issue. For app's that had a value in themeItemId, and therefore a non-null theme, it tested fine. Which of course was why I didn't see any issues reported on that other thread. Bingo. Set a theme and buttons magically work. Like I said earlier, great catch! 4.0.2 out in a bit if nothing else goes haywire :-)
 
Kaybee
buzztouch Evangelist
Profile
Posts: 659
Reg: Sep 22, 2012
Perth, Australi...
44,690
like
01/31/17 08:42 PM (7 years ago)
Great work @David, and thank you @Alanmac for your detailed info that uncovered that little gem !! Exactly why Buzztouch is what it is today, the community is tops !!
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
02/01/17 04:01 AM (7 years ago)
I made a fresh test app for BT 4 but never bothered with a theme. David, I was pleased I was able to find something that was not obvious & happy to have saved you a few hours too! Sometimes it's hard to know if an issue is down to the core or not; I reported findings earlier under the thread for BT 4.0.1 plugin bugs.
 
Bonzo
Apple Fan
Profile
Posts: 780
Reg: Jan 30, 2012
Basingstoke
13,500
like
02/01/17 04:26 AM (7 years ago)
@David, Thanks for the update
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
02/11/17 12:40 PM (7 years ago)
Just wanted to say that 4.02 seems pretty solid on iOS. Thanks David.
 
Bonzo
Apple Fan
Profile
Posts: 780
Reg: Jan 30, 2012
Basingstoke
13,500
like
02/11/17 12:59 PM (7 years ago)
Agreed. Great work on the iOS side. Seems bug free so far. Great progress on Android as well but still quite a few things to iron out in that side still.
 

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.