← Back to team overview

ubuntu-touch-coreapps team mailing list archive

Re: [ubuntu-touch-coreapps][Facebook] First working code...

 

On Sun, 2013-03-17 at 01:22 -0700, Robert Bruce Park wrote:
> (CC'ing Ken on this, because I'm not sure if he's subscribed to this
> list or not)
> 
> On 13-03-16 12:52 PM, Hugo Lima wrote:
> > - I had to discover the column ids by trial and error (eg: message
> > = column_9), is there a better way ? and also the column numbers
> > didn't match up with the example friends code.
> 
> This is something that Ken is currently working on. The columns are
> named nicely within the Python code in the backend, but this
> information gets lost somewhere along the way in the Qml bindings. Ken
> had made an initial attempt at naming them properly, but there was
> some reason it didn't work, and he is still investigating why. I'm
> sure he'll be able to explain better what went wrong.
> 
> For now, I'll refer you to the model schema definition in the Python
> code. Currently that is defined here:
> 
> http://bazaar.launchpad.net/~super-friends/friends/trunk/view/head:/friends/utils/model.py#L44
> 
> Remember to start counting from 0, so 'message_ids' is 0, 'stream' is
> 1, etc.
> 
> Also, be aware that we have actually made a number of big changes to
> this that haven't landed yet, which can be found here:
> 
> http://bazaar.launchpad.net/~super-friends/friends/raring/view/head:/friends/utils/model.py#L44
> 
> Notable changes include list-flattening, which makes it radically
> easier to determine the values of the account_id and the message_id,
> also support for geolocation has been added.
> 
> So be prepared for that to land this week, hopefully. Once Ken figures
> out how to name the columns, you won't have to worry about schema
> changes, because even if the columns shuffle around in order, the name
> will still be correct.
> 
> > - How does friends filter the feed to exclude messages from other
> > providers / accounts ?
> 
> That's something else that Ken is working on, which I don't believe is
> yet available in the code that you are working with, so for right now
> you'll just have to put up with Twitter tweets mixed in to your stuff.
> But the code that filters the model so that you are only looking at
> facebook messages is included with the above big model schema change
> that I mentioned, so hopefully that's all going to come together
> nicely, real soon now ;-)

If you are using the packages from ppa:super-friends/ppa you have this
already.  You can create your model like this:

StreamModel {
    id: streamModel
    service: facebook 
}

That will give you everything for facebook, including multiple facebook
accounts if you have more than one configured.  To get just a model for
a single account, find the account ID from online accounts (you can use
accounts-qml-module) then create it like:

StreamModel {
    id: streamModel
    account: 2
}

Those examples give you everything except comments on posts.  To get
those, you use the messageId in the stream name.  For example:

StreamModel {
    id: commentsStreamModel
    stream: "reply_to/"+messageId
}

For a more complete example, check out the gwibber code.  You can look
at the ListView we used:
http://bazaar.launchpad.net/~gwibber-committers/gwibber/trunk/view/head:/qml/TimeLine.qml

and the thread view for comments at:
http://bazaar.launchpad.net/~gwibber-committers/gwibber/trunk/view/head:/qml/ThreadView.qml#L12

I hope that helps, join us in #gwibber any time if for questions.

Thanks,
--Ken



References