Closed
Bug 1270102
Opened 9 years ago
Closed 9 years ago
Broadcast messages to announce changes to Places
Categories
(Firefox OS Graveyard :: Gaia::System::Browser Chrome, defect)
Firefox OS Graveyard
Gaia::System::Browser Chrome
ARM
Gonk (Firefox OS)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: benfrancis, Assigned: jovan.gerodetti, NeedInfo)
References
Details
Attachments
(1 file)
The homescreen needs to know when a pinned site or pinned page changes so that it can update itself.
I think we need to send messages using postMessage https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage on a BroadcastChannel https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel
The homescreen needs to know when a site or page is pinned or unpinned. It might also be useful to include the URL of the site or page which changed so that the homescreen can do something smarter than just reloading the whole list.
Reporter | ||
Comment 1•9 years ago
|
||
Jovan, do you think you'd be able to have a go at this?
Let me or Alberto know if you need some help.
Flags: needinfo?(titannanomail)
Flags: needinfo?(apastor)
Assignee | ||
Comment 2•9 years ago
|
||
Yes I think I can give it a try :)
Where should this message be broadcasted?
In the system browser UI I guess, but which files should I check out to get started?
Flags: needinfo?(titannanomail) → needinfo?(bfrancis)
Reporter | ||
Comment 3•9 years ago
|
||
Great!
These actions are triggered from AppChrome:
pinSite https://github.com/mozilla-b2g/gaia/blob/kanikani/apps/system/js/app_chrome.js#L449
unpinSite https://github.com/mozilla-b2g/gaia/blob/kanikani/apps/system/js/app_chrome.js#L497
pinPage https://github.com/mozilla-b2g/gaia/blob/kanikani/apps/system/js/app_chrome.js#L406
unpinPage https://github.com/mozilla-b2g/gaia/blob/kanikani/apps/system/js/app_chrome.js#L428
But the actual database access takes place in Places:
pinSite https://github.com/mozilla-b2g/gaia/blob/kanikani/apps/system/js/places.js#L397
setPinned (for pages) https://github.com/mozilla-b2g/gaia/blob/kanikani/apps/system/js/places.js#L357
We probably want to send the messages once we know the database modification has actually happened, in a callback or when a Promise resolves.
Warning: This code is a bit of a mess at the moment as it's in transition from the old DataStores to the new IndexedDB database.
Flags: needinfo?(bfrancis)
Assignee | ||
Comment 4•9 years ago
|
||
Do Homescreen and System app share the same window object?
Can I broadcast the event on the system app window object?
Flags: needinfo?(bfrancis)
Comment 5•9 years ago
|
||
Nope, they don't, but you can still broadcast messages via BroadcastChannel as both iframes are in the same domain. You can see an example on the Search app
https://github.com/mozilla-b2g/gaia/blob/kanikani/apps/search/js/search.js#L57
Let me know if you have any other question!
Flags: needinfo?(bfrancis)
Flags: needinfo?(apastor)
Assignee | ||
Comment 6•9 years ago
|
||
I finished the broadcasting part. I'd create a pull so one of you can have a look.
Who should I set for review?
Flags: needinfo?(bfrancis)
Flags: needinfo?(apastor)
Assignee | ||
Comment 7•9 years ago
|
||
I finished the broadcasting part. I'd create a pull so one of you can have a look.
Who should I set for review?
Reporter | ||
Comment 8•9 years ago
|
||
Great :) Either of us is fine, I'm happy to review this.
Flags: needinfo?(bfrancis)
Comment 9•9 years ago
|
||
Assignee | ||
Comment 10•9 years ago
|
||
did I messup the review flag? I can't find one on my patch.
Flags: needinfo?(bfrancis)
Updated•9 years ago
|
Assignee: nobody → titannanomail
Flags: needinfo?(apastor)
Updated•9 years ago
|
Attachment #8749162 -
Flags: review?(bfrancis)
Reporter | ||
Comment 11•9 years ago
|
||
Comment on attachment 8749162 [details]
[gaia] TitanNano:fix_1270102 > mozilla-b2g:kanikani
This is great! Thanks Jovan.
We'll want to figure out what to do when a site or page is unpinned, but this is a great start.
Flags: needinfo?(bfrancis)
Attachment #8749162 -
Flags: review?(bfrancis) → review+
Reporter | ||
Comment 12•9 years ago
|
||
Landed on kanikani https://github.com/mozilla-b2g/gaia/commit/3322b12d0f173ebd1bf02e8a7c6685b537c0ef54
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 13•9 years ago
|
||
great! I'm interested to continue working on the homescreen.
So if you have other bugs I can work on, I'll be happy to take a look that them :)
Flags: needinfo?(bfrancis)
You need to log in
before you can comment on or make changes to this bug.
Description
•