Closed Bug 1113848 Opened 10 years ago Closed 3 years ago

Clean up GeckoAppShell.getOpenURIIntent

Categories

(Firefox for Android Graveyard :: General, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: wesj, Unassigned, Mentored)

Details

getOpenURIIntent does a lot of random work that make its logic hard to follow. If you pass in a SEND intent, it modifies it specially. If no mimetype, then there's a chance it may create a special youtube intent or a sms intent. Or it may just send you back what you asked it for. We should clean it up to make more sense.

An implementation could try to encapsulate our special URL handling better. i.e. for this bug I'd love this method to look something like:

Intent getOpenURIIntent(...) {
  Uri uri = new Uri(targetUri); // may have to normalize the url here

  for (IntentBuilder builder: builders) {
    if (builder.canHandle(action, uri)) {
      return builder.build(context, uri, mimeType, action, title);
    }
  }

  // fill in mimeType if its null
  Intent i = getIntentForActionString(action);
  i.setDataAndType(uri, mimeType);
  return i;
}

interface IntentBuilder {
  boolean canHandle(String action, Uri uri);
  Intent build(...);
}
Mentor: wjohnston2000
We have completed our launch of our new Firefox on Android. The development of the new versions use GitHub for issue tracking. If the bug report still reproduces in a current version of [Firefox on Android nightly](https://play.google.com/store/apps/details?id=org.mozilla.fenix) an issue can be reported at the [Fenix GitHub project](https://github.com/mozilla-mobile/fenix/). If you want to discuss your report please use [Mozilla's chat](https://wiki.mozilla.org/Matrix#Connect_to_Matrix) server https://chat.mozilla.org and join the [#fenix](https://chat.mozilla.org/#/room/#fenix:mozilla.org) channel.
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INCOMPLETE
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.