Implementing Senchas device profiles guide w/ Architect

Implementing Senchas device profiles guide w/ Architect

Hello,

I'm trying to implement two device profiles (Phone, Tablet) and I've most likely found a guide that matches my needs, but I have trouble following this guide with Architect. The article I talk about is this one:http://docs.sencha.com/touch/2.0.2/#!/guide/profiles

I wonder why some configuration properties like "profiles", which are I guess often used, are not showing up in Architect. Am I missing something?architect1.png

After manually adding that property, setting its type to Array, i get code that looks like in the guide:

Code:

Ext.application({
profiles: [
'Phone',
'Tablet'
],
name: 'MyApp'
});

Not that much of a big deal so far. But my real problem is how to create the
1) "folders"/"packages" where all my profile data should be in. I mean 'app/profile/' and then i.e. 'app/profile/tablet/' for the tablet views). The guide suggests the 'Mail.profile.tablet'. I'm quite stuck on how to get it like that, because I can only add things into Controllers, Views, Models and Resources?

2) profiles (i.e. app/profile/Phone.js). I thought about adding a new class, edit the "extend" property to 'Ext.app.Profile'. Then again manually adding the "config" property and also a function (isActive) inside the class.architect2.png

I'd like to know whether my approach is correct or this guide is already outdated. Or if there are another, better/easier approaches to this common functionality, please let me know. Probably I'm just missing something trivial again...

profile support has not made it into architect yet. i'm looking at profiles as well. latest recommendation from sencha is to do device type/size checks in your code until architect support is ready. l'm not privy to what's on their road map but i'm sure we'll hear something by senchacon.

profile support has not made it into architect yet. i'm looking at profiles as well. latest recommendation from sencha is to do device type/size checks in your code until architect support is ready. l'm not privy to what's on their road map but i'm sure we'll hear something by senchacon.

Oh I see. That's unfortunate. Its a main functionality in my app.
Can you elaborate on that device type checks?
I'm kinda unsure what do you mean/hint to..

something like..... if screenWidth > 500 show menu on left, detail on right else just show menu etc..

pretty much roll your own layout logic. I would encapsulate this logic into a central location so that when profile support is ready, the pain to refactor will be minimized.

John

Thanks for the fast response!
What's the right place to implement that logic? I mean, when will this code be called?
Sorry, this is probably a stupid question but I'm just getting into Architect / Touch...

How you approach this depends on how you want your app laid out for each screen size and orientation. If it were me, I would encapsulate logic within each view (views you want to change based on size/orientation). So on the init of a view I might say if width greater than x show Y or change the layout to hbox ... whatever works for your situation. Again, this code would live inside views you might want to change. I want each of my views to react 'on their own' to the environment they're placed in.

For bigger picture layout changes like the layout of a menu on left, detail on right when on a large screen tablet vs just a menu with itemTaps that take you to the detail, i would perform in my controller.

Hard to explain if you're just getting started but hopefully you get some sense of direction. Start out small, work your way up from there.