Closed Bug 741608 Opened 9 years ago Closed 9 years ago

Create homescreen shortcut for installed app

Categories

(Firefox for Android Graveyard :: Web Apps (PWAs), defect)

ARM
Android
defect
Not set
major

Tracking

(blocking-kilimanjaro:+, firefox15 verified)

VERIFIED FIXED
Firefox 15
blocking-kilimanjaro +
Tracking Status
firefox15 --- verified

People

(Reporter: Harald, Assigned: mfinkle)

References

Details

(Whiteboard: [Phase1])

Attachments

(1 file, 1 obsolete file)

On app install, create a launch shortcut on the homescreen.

It should not create duplicates, use the correct device-specific icon size.

When added, the shortcut should use the WEBAPP intent.
Blocks: 738546
Whiteboard: [WebRT:Phase1]
Depends on: 741435
Whiteboard: [WebRT:Phase1] → [Phase1]
Whiteboard: [Phase1]
Whiteboard: [Phase1]
Yeah. bug 741431 already encompasses the task for this bug.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 741431
I'd disagree, bug 741431 is about additional install options because Soup had them, but is a UX bug, which is to be solved by UX at this point. As those options did not pop up during the UX flows so far, I'd rather go with no options and create a shortcut by default; at least until we have a flow defined.

Though this bug is a basic implementation bug, and just describes the behavior we have defined for now.
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
Status: REOPENED → NEW
Whiteboard: [Phase1] → [Phase1] [marketplace-beta?]
(In reply to Harald Kirschner from comment #0)
> On app install, create a launch shortcut on the homescreen.
> 
> It should not create duplicates, use the correct device-specific icon size.

We don't have a way to tell if a shortcut exists
Whiteboard: [Phase1] [marketplace-beta?] → [Phase1]
(In reply to Mark Finkle (:mfinkle) from comment #4)
> (In reply to Harald Kirschner from comment #0)
> > On app install, create a launch shortcut on the homescreen.
> > 
> > It should not create duplicates, use the correct device-specific icon size.
> 
> We don't have a way to tell if a shortcut exists

There is a hidden flag for shortcut creation that prevents dups: https://github.com/mozilla/soup/blob/master/src/org/mozilla/labs/Soup/plugins/MozAppsPlugin.java#L323 . It is not silent; when the shortcut already exists, the user will get a toast.
Attached patch patch (obsolete) — Splinter Review
Throwing Wes onto the WebApp scene. This patch will create a homescreen shortcut for an app when installed.

It uses the same code I was using for the about:apps page. In fact, I moved the code into WebappsUI so it could be used by both features.

If no shortcut exists, Android will make one, potentially on a different homescreen if it is full. If a shortcut for the app already exists, Android will display a message stating that it exists and won't make a dupe.
Assignee: nobody → mark.finkle
Attachment #621356 - Flags: review?(wjohnston)
Nominating for k9o, as this relates to basic functionality for the android web runtime for web apps on app install.
blocking-kilimanjaro: --- → ?
Comment on attachment 621356 [details] [diff] [review]
patch

Review of attachment 621356 [details] [diff] [review]:
-----------------------------------------------------------------

::: mobile/android/chrome/content/browser.js
@@ +4770,5 @@
>    }
>  };
>  
>  var WebappsUI = {
> +  init: function init() {

Happy to have names! We should probably prefix them?

@@ +4807,2 @@
>        DOMApplicationRegistry.confirmInstall(aData);
> +      this.createShortcut(manifest.name, manifest.fullLaunchPath(), manifest.iconURLForSize("64"), "webapp");

Hmm... Still looking through this code. Is it possible for things to fail? Maybe we should just have an observer listening for the webapps-sync-install notification and when that happens we create a shortcut.
blocking-kilimanjaro: ? → +
Comment on attachment 621356 [details] [diff] [review]
patch

Review of attachment 621356 [details] [diff] [review]:
-----------------------------------------------------------------

I'd like to know if there is some event sent when the install is complete. It looks like from:

http://mxr.mozilla.org/mozilla-central/source/dom/base/Webapps.jsm#195

that confirmInstall does some async file writing. I think we need better messages/callbacks/promises/etc sent if that succeeds or fails? Can the webapps guys comment?
Attachment #621356 - Flags: review?(wjohnston) → review-
(In reply to Wesley Johnston (:wesj) from comment #9)
> Comment on attachment 621356 [details] [diff] [review]
> patch
> 
> Review of attachment 621356 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> I'd like to know if there is some event sent when the install is complete.
> It looks like from:

There is no event sent to chrome after install.


> http://mxr.mozilla.org/mozilla-central/source/dom/base/Webapps.jsm#195
> 
> that confirmInstall does some async file writing. I think we need better
> messages/callbacks/promises/etc sent if that succeeds or fails? Can the
> webapps guys comment?

The appObject is cached in memory here:
http://mxr.mozilla.org/mozilla-central/source/dom/base/Webapps.jsm#192

That is what's used to access the app data after install, so we should be good to go.
Attached patch patch 2Splinter Review
This patch uses "webapps-sync-install" to wait for a successful install before adding the homescreen shortcut. Seems to work OK.
Attachment #621356 - Attachment is obsolete: true
Attachment #625148 - Flags: review?(wjohnston)
Comment on attachment 625148 [details] [diff] [review]
patch 2

Review of attachment 625148 [details] [diff] [review]:
-----------------------------------------------------------------

::: mobile/android/chrome/content/browser.js
@@ +5004,5 @@
> +        // Wait until we know the app install worked, then make a homescreen shortcut
> +        DOMApplicationRegistry.getManifestFor(data.origin, (function(aManifest) {
> +	   if (!aManifest)
> +	     return;
> +          dump("XXXX make a homescreen shortcut")

Remove this
Attachment #625148 - Flags: review?(wjohnston) → review+
Flags: in-moztrap?(aaron.train)
MozTrap: https://moztrap.mozilla.org/manage/case/257/
Flags: in-moztrap?(aaron.train) → in-moztrap+
https://hg.mozilla.org/mozilla-central/rev/80f607fa91eb
Status: NEW → RESOLVED
Closed: 9 years ago9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 15
Whiteboard: [Phase1] → [Phase1], [qa+]
Whiteboard: [Phase1], [qa+] → [Phase1], [qa+:AaronMT]
Verified Fixed

Via:

--
Nightly (06/02)
Samsung Galaxy Nexus (Android 4.0.4)
Status: RESOLVED → VERIFIED
Whiteboard: [Phase1], [qa+:AaronMT] → [Phase1]
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.