Closed Bug 1016225 Opened 6 years ago Closed 6 years ago

[Collection App] Build time Collection configuration

Categories

(Firefox OS Graveyard :: Gaia, defect)

x86
macOS
defect
Not set

Tracking

(feature-b2g:2.0, tracking-b2g:backlog, b2g-v2.0 fixed, b2g-v2.1 fixed)

RESOLVED FIXED
2.0 S4 (20june)
feature-b2g 2.0
tracking-b2g backlog
Tracking Status
b2g-v2.0 --- fixed
b2g-v2.1 --- fixed

People

(Reporter: amirn, Unassigned)

References

Details

(Whiteboard: [systemsfe])

Allow partners to specify a list of Collections which will be preinstalled on the device.
blocking-b2g: --- → backlog
feature-b2g: --- → 2.0
Whiteboard: [systemsfe]
It should be aligned with bug 1006172, so that configuration files of vertical homescreen can include a number of smart collections
Blocks: 1006172
Cristian, can you take this?
Flags: needinfo?(crdlc)
Maybe it can be done by Carmen or Albert in their tasks about builds
Flags: needinfo?(crdlc)
Flags: needinfo?(cjc)
Flags: needinfo?(acperez)
I already added collections in the patch of bug 1016928
Flags: needinfo?(acperez)
BTW what do we need here?

1. Manifests to represent the collections pre-installed under "shared" like:

https://github.com/mozilla-b2g/gaia/tree/master/apps/homescreen/collections

2. In build time we have to iterate those manifests in order to generate a JSON file with the info

Two scenarios:

* "Homescreen app" loads the JSON to populate the collection datastore with that info

or 

* "FTU app" opens "Collection app" to load the JSON to populate the collection datastore with that info
Flags: needinfo?(kgrandon)
Flags: needinfo?(21)
From my point of view

1) Collection manifests and icons under "Collection" app (like the old homescreen has currently)
2) In build time of "Collection" app we have to create the JSON file with the descriptors
3) When the homescreen is launched, via IAC, we have to send a message to "Collection" app like "configure"
4) When "Collection" app receives this message, it loads the JSON file and populate the datastore (if it was not populated before for sure)
5) "Collection" app sends a message "ready" and "Homescreen app" could read the datastore to recover names and icons for collection pre-installed

Suggestions? ideas?
or the FTE instead of Homescreen could send the message "configure"
Talked about this out of line
Flags: needinfo?(cjc)
I'm not sure if a collection manifest is really all that valuable, but in any case it seems like it should be part of the collections app if necessary. I also feel like we should take the same approach as: https://bugzilla.mozilla.org/show_bug.cgi?id=1017069#c9

We should probably either do this in some startup task after upgrade. Either within the same homescreen origin, or through some cross-app handler after upgrade.
Flags: needinfo?(kgrandon)
Blocks: 1016221, 1016224
Target Milestone: --- → 2.0 S3 (6june)
We have to split in three pieces thought:

--- First bug - Build time ---

* Collection app needs details about each smart collection that could be added to FFOS (name, providerId, icon path, icon resource, ...) In the past, we had stored this info here https://github.com/mozilla-b2g/gaia/tree/master/apps/homescreen/collections. If this info continues being completely needed we have to copy these resources to collection app.

* Obviously, all this info should be translated to a JSON file in built time in order to collection app can consume it

--- Second bug - Collection App starting ---

* Collection app needs to know what smart collections are available with all their info (name, providerId, icon path,...)

* We have to implement a library like CollectionInfo.get(id) and CollectionInfo.getAll() based on indexedDB where we will be able to ask for details.

var tv = CollectionInfo.get(providerId or ...);
tv.name, tv.icon, tv.id.....

* The fist time what collection app is launched, indexedDB will be empty and we have to load the JSON file in order to populate this one

--- Third bug - Pre-installed collections & Datastore ---

* Which collections are pre-installed?

This is configured by OEMs in the homescreens.json

* .. So we have to extract these set of collections from this file in Collection app build time.

* The first time when users are upgrading devices from 1.x to 2.0, behind scene in the FTE, we can send a message via IAC to Collection app saying "configure", "init" or how we want :). In that point, the collection app loads the info of pre-installed collections generated in build time and populates the datastore.

---

Ran, Amir, Kevin, Carmen, Albert:

Any concern, doubt or misunderstanding from my side?, do you miss something?

Ran or Amir, are details of collections the same than 1.5?

https://github.com/mozilla-b2g/gaia/tree/master/apps/homescreen/collections
Flags: needinfo?(ran)
Flags: needinfo?(kgrandon)
Flags: needinfo?(cjc)
Flags: needinfo?(amirn)
Flags: needinfo?(acperez)
- first part - 
I think it is ok to start with copying everything we already have in homescreen1 and later we can clean up what is not needed. Please also include the new icons and backgrounds in:
https://github.com/mozilla-b2g/gaia/pull/16343/files
https://github.com/mozilla-b2g/gaia/pull/18123/files

I had to back these out just now because of the large increase in the homescreen size (bug 1019321) so I am not sure what is the correct way to include these assets.

- second part - 
maybe we can use `CollectionDatabase` for that?
https://github.com/mozilla-b2g/gaia/blob/master/shared/js/collections_database.js#L237

can we skip indexDB? - load the json and save directly to Datastore?

- third part - 
let's start with the same pre-installed collections as in homescreen1 (social, games, music, showbiz)
https://github.com/mozilla-b2g/gaia/blob/master/apps/homescreen/build/default-homescreens.json#L8


Thank you very much Cristian :)
Flags: needinfo?(amirn)
Inline

(In reply to Amir Nissim (Everything.me) from comment #11)
> - first part - 
> I think it is ok to start with copying everything we already have in
> homescreen1 and later we can clean up what is not needed. Please also
> include the new icons and backgrounds in:
> https://github.com/mozilla-b2g/gaia/pull/16343/files
> https://github.com/mozilla-b2g/gaia/pull/18123/files
> 
> I had to back these out just now because of the large increase in the
> homescreen size (bug 1019321) so I am not sure what is the correct way to
> include these assets.
> 
> - second part - 
> maybe we can use `CollectionDatabase` for that?
> https://github.com/mozilla-b2g/gaia/blob/master/shared/js/
> collections_database.js#L237
> 
> can we skip indexDB? - load the json and save directly to Datastore?

The datastore just stores collections already installed in the device (homescreens) and we need to stores in other place the info for all collections that could be added by users, right?

> 
> - third part - 
> let's start with the same pre-installed collections as in homescreen1
> (social, games, music, showbiz)
> https://github.com/mozilla-b2g/gaia/blob/master/apps/homescreen/build/
> default-homescreens.json#L8
> 
> 
> Thank you very much Cristian :)
(In reply to Cristian Rodriguez (:crdlc) from comment #12)
> The datastore just stores collections already installed in the device (homescreens) and we need to stores in other place the info for all collections that could be added by users, right?

right. but we can have the collection app load json > write to datastore.
am I missing something?
I think so or maybe I am wrong :) Let me explain

* indexedDB stores all data for collections which could be added to the homescreen

* datastore stores collections which are already added in homescreens
Depends on: 1019509
or maybe we could save this info in the datastore under another index
(In reply to Cristian Rodriguez (:crdlc) from comment #5)
> BTW what do we need here?
> 
> 1. Manifests to represent the collections pre-installed under "shared" like:
> 
> https://github.com/mozilla-b2g/gaia/tree/master/apps/homescreen/collections
> 
> 2. In build time we have to iterate those manifests in order to generate a
> JSON file with the info
> 
> Two scenarios:
> 
> * "Homescreen app" loads the JSON to populate the collection datastore with
> that info
> 
> or 
> 
> * "FTU app" opens "Collection app" to load the JSON to populate the
> collection datastore with that info

I like the FTU app opens the collection app to load the JSON idea. It may opens more possibility in the future. For example the Collection app can have a UI to let the user choose some of the collection he wants based on some questions. This could be part of the FTU experience has a dedicated screen.
Flags: needinfo?(21)
It sounds like the main concern here is whether or not we need another indexedDB for collections - I'm under the impression that we don't, but maybe I'm mistaken. For pre-installed I think it makes sense that we go directly from JSON -> datastore after some upgrade event. 

I think we will only ever need to do this a single time (after upgrade), so I can't really see a reason to need another indexedDB.
Flags: needinfo?(kgrandon)

(In reply to Kevin Grandon :kgrandon from comment #17)
> It sounds like the main concern here is whether or not we need another
> indexedDB for collections - I'm under the impression that we don't, but
> maybe I'm mistaken. For pre-installed I think it makes sense that we go
> directly from JSON -> datastore after some upgrade event. 

Pre-installed collections -> JSON -> datastore
Already added collections in previous versions -> Upgrade event -> Migrate to datastore 

> 
> I think we will only ever need to do this a single time (after upgrade), so
> I can't really see a reason to need another indexedDB.

Where is the info for all collections that ev.me shows in the combo? I mean tv, social, sports, showbiz, news, music, local, games, funny, etc.. It is defined as manifests in the collection app

All this data -> JSON -> indexedDB or datastore under another index or ...?
(In reply to Cristian Rodriguez (:crdlc) from comment #18)
> Where is the info for all collections that ev.me shows in the combo? I mean
> tv, social, sports, showbiz, news, music, local, games, funny, etc.. It is
> defined as manifests in the collection app
> 
> All this data -> JSON -> indexedDB or datastore under another index or ...?

I believe this data comes back as an Eme API request. I'll let Ran/Amir weigh in more, but the code should be here: https://github.com/mozilla-b2g/gaia/blob/master/apps/collection/js/create_collection.js#L33
ok, that is useful only for pre-installed collections, I mean the local manifests. Perfect for me.
Target Milestone: 2.0 S3 (6june) → 2.0 S4 (20june)
Depends on: 1020134
Depends on: 1020152
Depends on: 1020155
Depends on: 1020158
Flags: needinfo?(ran)
Flags: needinfo?(cjc)
Flags: needinfo?(acperez)
No longer depends on: 1020134
QA Whiteboard: [VH-FL-blocking+][VH-FC-blocking+]
All dependent bugs resolved.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
blocking-b2g: backlog → ---
You need to log in before you can comment on or make changes to this bug.