Closed Bug 914115 Opened 11 years ago Closed 11 years ago

[e.me][feature] Homescreen will expose an API to rename icons

Categories

(Firefox OS Graveyard :: Gaia::Homescreen, defect)

All
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: crdlc, Assigned: crdlc)

References

Details

Attachments

(1 file)

Collections can be renamed so we need to support it in homescreen part
Assignee: nobody → crdlc
Blocks: 910331
Status: NEW → ASSIGNED
Blocks: 911550
No longer blocks: 910331
Attached file Patch v1
Attachment #809884 - Flags: review?(evyatar)
Evyatar, notice the API suggested expects Collection origin as an identifier.
Do we hold this parameter for Collections?
Flags: needinfo?(evyatar)
I'm pretty sure we save this in our index, our ID should be the origin URL.
Amir can give a definitive answer.
Flags: needinfo?(evyatar) → needinfo?(amirn)
It seems we generate an id instead.
I am sure because it is working fine

https://github.com/mozilla-b2g/gaia/pull/12442/files#L1R180
There are two cases:

1. "pre-cooked" collections have an id created by homescreen (which is the origin, if I'm not mistaken)
https://github.com/mozilla-b2g/gaia/blob/master/apps/homescreen/everything.me/js/Core.js#L113

2. any collection later created by the user has a generated id
https://github.com/mozilla-b2g/gaia/blob/master/apps/homescreen/everything.me/modules/Collection/Collection.js#L389
Flags: needinfo?(amirn)
(In reply to Amir Nissim (Everything.me) from comment #7)
> There are two cases:
> 
> 1. "pre-cooked" collections have an id created by homescreen (which is the
> origin, if I'm not mistaken)
> https://github.com/mozilla-b2g/gaia/blob/master/apps/homescreen/everything.
> me/js/Core.js#L113
> 

Right

> 2. any collection later created by the user has a generated id
> https://github.com/mozilla-b2g/gaia/blob/master/apps/homescreen/everything.
> me/modules/Collection/Collection.js#L389

In this case when you create a collection you can pass the id as bookmarkURL as well in the descriptor

https://github.com/mozilla-b2g/gaia/blob/master/apps/homescreen/everything.me/js/etmmanager.js#L14
the 'id' is used to create a new gridItem with identical origin and id
https://github.com/mozilla-b2g/gaia/blob/master/apps/homescreen/everything.me/modules/Collection/Collection.js#L459-L460

the originURL is then passed as the bookmarkURL
https://github.com/mozilla-b2g/gaia/blob/master/apps/homescreen/everything.me/js/etmmanager.js#L17

and finally saved as origin
https://github.com/mozilla-b2g/gaia/blob/master/apps/homescreen/js/grid_components.js#L29-L30

this is all very confusing.. we have started talking about using a single unique 'id' field to reference grid items. maybe it's time..
but, yes, as Cristian said, it will work.
you can fill a bug for that although not for v1.2
Cristian, I'm checking the patch - it seems like if I call setIconName on a collection, and then getIconName (after a few seconds) I still get the old name. Also after re-building the homescreen the name reverts to the old one.
Flags: needinfo?(crdlc)
https://github.com/mozilla-b2g/gaia/pull/12442/files#L0R229

Are you retrieving here the icon? Is the name changed on the grid?
Flags: needinfo?(crdlc)
1. call setIconName
2. The name changes on the grid
3. call getIconName
4. I get the OLD name

1. call setIconName
2. The name changes on the grid
3. Build the homescreen app again
4. The name is now the OLD one
Please take a look to this code https://github.com/mozilla-b2g/gaia/pull/12442/files#L3R456 because I cannot test it on my device and you are working on rename collections bug
Comment on attachment 809884 [details]
Patch v1

Tested, and the issue I had came from OUR code, not this PR. So this is working and can be landed.
Attachment #809884 - Flags: review?(evyatar) → review+
ok thanks, waiting for Travis
All is well from Travis!
https://github.com/mozilla-b2g/gaia/commit/0cca9d9d7d29fba461166e49e5869f90e9141132
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: