Closed
Bug 1016554
Opened 11 years ago
Closed 8 years ago
Unify how apps handle URI/URL activities
Categories
(Firefox OS Graveyard :: Gaia, defect)
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: kamituel, Assigned: ehsan.akhgari)
References
()
Details
Attachments
(2 files)
Currently, there is no one coherent way in which apps accross Gaia handle URI/URL's.
URI's can come in many forms, such as:
- URL's (web addresses, http://... or https://...)
- mailto:...
- tel:...
- etc.
There seem to be a preference that apps register something similar in their manifests:
(browser)
> "view": {
> "filters": {
> "type": "url",
> "url": {
> "required":true, "pattern":"https?:.{1,16384}", "patternFlags":"i"
> }
> }
> },
But at the same time the very same action (users' intention is to open a web apge) when user shares website via NFC (by pressing one device against back of another) is handled by completely different handler:
(browser)
> "nfc-ndef-discovered": {
> "filters": {
> "type": "url",
> "url": {
> "required":true, "pattern":"https?:.{1,16384}", "patternFlags":"i"
> }
> }
> }
When we look at another apps, it gets more complicated. For instance, for "tel:" URI's:
(dialer)
> "dial": {
> "filters": {
> "type": "webtelephony/number",
> "number": { "pattern":"[\\d\\s+#*().-]{0,50}" }
> },
> "href": "/dialer/index.html#keyboard-view",
> "disposition": "window"
> }
This time, even altough again we want to share URI (same thing as above, only URI is different), we are required to name it "dial" instead of "view", and provide not "data.url", but "data.number" (and some other params).
Same goes for email app ("mailto:" URI) etc.
It'd be pretty hard to explain to developers how they should call MozActivity to handle each URI. For now, the striking example of the unnecessary code to which it leads can be seen in NfcManager.formatURIRecord() [1].
In my opinion, it could be fixed in a similar way Android handles this - make an assumption that for all URI's:
- name would be "view"
- data.uri would be set to URI
So, we would have:
(dialer)
> "view": {
> "filters": {
> "uri": { "pattern":"tel:[\\d\\s+#*().-]{0,50}" }
> },
> ...
> }
(browser)
> "view": {
> "filters": {
> "uri": { "pattern":"http.?:\/\/.*" }
> },
> ...
> }
(email)
> "view": {
> "filters": {
> "uri": { "pattern":"mailto:.*" }
> },
> ...
> }
etc.
I discussed it briefly with Alive, and he has no strong opinion on that.
I wonder what do you think? (asking for info owners of those apps).
[1] https://github.com/mozilla-b2g/gaia/blob/4d8d14477a81330aa2fb6885e808451371a422fb/apps/system/js/nfc_manager.js#L479
| Reporter | ||
Comment 1•11 years ago
|
||
First, I'm asking you @Ben, for your input.
If you guys decide it's not worth the change, we'll just close this bug as nofix.
Flags: needinfo?(bfrancis)
| Assignee | ||
Updated•11 years ago
|
Assignee: nobody → ehsan
Comment 3•11 years ago
|
||
Agree with the change, Eshan mentioned working on something similiar hence assigning himself, but would be happy to take a patch for it, I think this is something that would need to be fixed everywhere at once.
Flags: needinfo?(dale)
| Reporter | ||
Comment 4•11 years ago
|
||
Great, happy to hear that Dale!
What is your opinion on that Etienne (owner of Dialer)?
Flags: needinfo?(etienne)
Comment 5•11 years ago
|
||
(In reply to Kamil Leszczuk [:kamituel] from comment #4)
> Great, happy to hear that Dale!
> What is your opinion on that Etienne (owner of Dialer)?
Sure, we can surely find something that scales better than the current shell.js hack [1] :)
[1] https://mxr.mozilla.org/mozilla-central/source/b2g/chrome/content/shell.js#591
Flags: needinfo?(etienne)
| Reporter | ||
Comment 6•11 years ago
|
||
@Ehsan, are you working on that?
I've proposed it, and I thing it'd be great to see it happen, but I'm not sure I should still push it forward? Or would take care from now on? It's okay with me!
| Assignee | ||
Comment 7•11 years ago
|
||
What I'm going to do in this bug is to audit and document how existing gaia code uses activities, and then come up with ways to clean up any existing inconsistencies. If you mean comment 5, my work here may lead to that code being cleaned up, but I'm mostly going to focus on the API side of things.
| Reporter | ||
Comment 8•11 years ago
|
||
Great, thanks!
(also Dale has aleady answered my question, so clearing needinfo?)
Flags: needinfo?(bfrancis)
| Assignee | ||
Comment 9•11 years ago
|
||
| Assignee | ||
Comment 10•11 years ago
|
||
| Assignee | ||
Comment 11•11 years ago
|
||
Here is a list of gaia activities that we're currently using: <https://docs.google.com/spreadsheets/d/1yqjeNcikmXIFOTqwvroOcvaYjRA6SoCwBweL2xzlE-I/edit?usp=sharing>
Comment 12•8 years ago
|
||
Firefox OS is not being worked on
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•