Closed Bug 914115 Opened 7 years ago Closed 7 years ago
.me][feature] Homescreen will expose an API to rename icons
Collections can be renamed so we need to support it in homescreen part
Assignee: nobody → crdlc
Status: NEW → ASSIGNED
The first version could be something like this https://github.com/crdlc/gaia/commit/ee9537eb30cb56a81b554e050760ba5053b16428#L1L121
Evyatar, notice the API suggested expects Collection origin as an identifier. Do we hold this parameter for Collections?
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
(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.
https://github.com/mozilla-b2g/gaia/pull/12442/files#L0R229 Are you retrieving here the icon? Is the name changed on the grid?
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!
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.